Script sample for getting the selected object in scene
Script sample for getting the selected object in scene
Hi. This is my first post and my experience with trueSpace is somehow limited. I try to make an exporter plugin and so far I managed to compile and load a plugin in trueSpace. While Roman philosophy for the workspace is very intriguing and powerful but the SDK is a real pain. It's very nice structured from a design point of view and not that hard to work with. But not all COM return types are considered in trueSpace and sometime trueSpace code dose not correctly check for function return codes. Also the logging support is very rudimentary. This and the fact that SDK documentation is just a Doxygen documentation leaves alot of questions unanswered. A lot of trueSpace functionality is provided to be used in scripting. So even if you use the SDK to make plugins you could still benefit from having good scripting experience. My exporter provides through a script interface the function Export. This function receives 2 string parameters. First is the name of the object and second is the path for file. I want that if the first parameter is void to be able to get the list of selected objects. So please tell me what kind of functions you use to determine the list of current selected objects or for example to get an object using its path like ‘Project/Space 3D/Sphere’.
- Prodigy
- Site Admin
- Posts: 957
- Joined: 21 May 2009, 14:46
- Type the number ten into the box: 0
- Location: Uruguay
Re: Script sample for getting the selected object in scene
Sorry, im not expert on Script or sdk but this is what you are searching?
Code: Select all
System.Alert(Node.Selected(0));
๑۩۞۩๑ prodigy ๑۩۞۩๑
Re: Script sample for getting the selected object in scene
Thank a lot. Yes this works
will select the idx object in a selection or if no object is in selection at that index will fail nicely. And also in Node script interface seams to be witch will select an object with it's name. Thank so much this is realy the solution in looking for.
Code: Select all
Node.Selected(idx)
Code: Select all
Node.Select('Project/Space 3D/Cube')
- Prodigy
- Site Admin
- Posts: 957
- Joined: 21 May 2009, 14:46
- Type the number ten into the box: 0
- Location: Uruguay
Re: Script sample for getting the selected object in scene
haaa good
Please, call me Mr. Scriptor
Please, call me Mr. Scriptor
๑۩۞۩๑ prodigy ๑۩۞۩๑
Re: Script sample for getting the selected object in scene
CHMar Just to let you know it is there, there is a developer site starting up at http://www.truespaceplugins.com. You will find a few people there that are experienced in both cpp and javascript and who are quite willing to help.
Re: Script sample for getting the selected object in scene
Thanks. I didn't know about trueSpacePlugins. I'lll keep an eye on it. Anyway the ideea of using Node to do the selection parsing didn't work in C++ . So time to try something else
Re: Script sample for getting the selected object in scene
for c++ use RsSelectionHelper.h
your plugin class in the < >.
#include "RsSelectionHelper.h" //selections support
CComBSTR bszObjectName;
if (bszObjectName.Length() < 1)
{ // Default selection:
RsSelectionHelper::GetFirstSelectedNodeName<CRpPlugin>(&bszObjectName);
}
your plugin class in the < >.
#include "RsSelectionHelper.h" //selections support
CComBSTR bszObjectName;
if (bszObjectName.Length() < 1)
{ // Default selection:
RsSelectionHelper::GetFirstSelectedNodeName<CRpPlugin>(&bszObjectName);
}
Re: Script sample for getting the selected object in scene
Stan thanks a lot. I didn't manage to create the Node aka IRiNodeItem to access the sellected node. Your method is very friendly. Documentation says nothing about the streams in a mesh object. I managed to get the IRdMesh and got the TriangleStreamGroup. Can I assume that all streams in the TriangleStreamGroup will have the same number of entries? ANd if the number of entries differs then should I ignore other streams like IRdUVTriangleStream and use just the IRdTriangleStream?
Thanks
Thanks