View Full Version : ParentItemID???

08-19-2003, 02:22 AM
It's the second day I'm trying to understand what is LScripting.
I use LS Comander.
Here is my question.
I want to clone a null(number of clones eg 10 ) and to clone 10 cameras.Then I want null object(1) to be parent for camera (1), null object(2) to be parent for camera (2),etc. I can do this easily in new scen.

AddNull Null
Clone 9
Clone 9
SelectItem 10000000
SelectItem 30000000
ParentItem 10000000
SelectItem 30000001
ParentItem 10000001
SelectItem 30000002
ParentItem 10000002
SelectItem 30000003
ParentItem 10000003
SelectItem 30000004
ParentItem 10000004

But the problem is that if I alredy have objects in my scene Item 10000000 is not my 1-st null object.
I tryed to use select by name command and I can select exactly the camera I want, but I can't set the proper parent item There is command ParentItemID but I need something like ParentItem by name.

Hope you can help me.

08-19-2003, 08:40 AM
to answer you directly:

// get a parentid using name

curSelection = Scene().getSelect(); // memorizes current selection
parentName = "This_Is_The_Parent"; // assuming your parent has this name
SelectByName(parentName); // selects parent using name
parentID = Scene().firstSelect(); // gets currently selected item's id, which is the parent
for(i=curSelection.size() - 1;i<=1;i--)
AddToSelection(curSelection[i].id); // restores your original selection

did not check the code, but it should be something like that... NOTE: convert to lscript.. dont use the CS mode in lscript commander. lscommander has a lot of weird problems.