Page 1 of 1

[SOLVED] Select multiple nodes with Jscript - How?

Posted: 08 Jul 2014, 05:16
by Draise
I have been studying some selection things and with the help of Stan, managed to use and implement a recursive selection system.

But then I had another brilliant idea to record a selection of joints or objects with a click of a button, creating a "keyset" which trueSpace is deficient in. It is difficult to select or attribute what one wants to record and for many objects/controllers, it's imperative to try create branches of animation so it's easier to blend and create animation libraries.

So.. in theory I ran the macro recorder, but it doesn't reproduce the multiple object selection that I do manually...

Code: Select all

function Execute(params)
{

	// creating script form for 'Widget:Sequence '
	Node.Select(Space.CurrentScene() + "/Cube")
	// creating script form for 'Widget:Sequence '
	//Widgets.ActivateDefaultWidget("/Widgets/Select", Space.CurrentScene() + "/Cube;/Project/Space 3D, 45/Cube, 1")
	// creating script form for 'Widget:Sequence '
	//Widgets.ActivateDefaultWidget("/Widgets/Select", Space.CurrentScene() + "/Cube;/Project/Space 3D, 45/Cube, 1;/Project/Space 3D, 45/Cube, 2")

}
I assume one uses the following to select singular nodes but how would you make it select another and another? A series of nodes I would like to define (absolute paths are valid this time around)

Code: Select all

Node.Select()
This node works with one object, how do I add another?

Re: Select multiple nodes with Jscript - How?

Posted: 08 Jul 2014, 06:22
by Draise
clintonman wrote: To work with a selection of nodes you use Node.Selection then Node.Selected with an index to loop through the selection.
You do need a full path to get to a node.

I think I have the answer here. But.. not sure how to implement it.

Ok, so...

Code: Select all


Node.Selection(Node.Selected() + "/Project/Space 3D/Cube")


!
I know it doesn't work.
I just don't know how to apply it. Man I'm feeling like a major newb.

Care to expand and/or share an example??

Re: Select multiple nodes with Jscript - How?

Posted: 08 Jul 2014, 06:57
by Draise
VARIANT * IRiNodeItem::Selection [get]

Gets entire objects selection in one string:

Semicolon separated object names.
Useful when you need to remember original selection.

@return pVal [out, retval] Returns entire objects selection string
So.. it would look something like the following:

Code: Select all


Node.Selection ("/Projects/Space 3D/Cube"; "/Projects/Space 3D/Sphere")


??

I will try it.. coding is certainly not as fun as pushing and pulling and pressing buttons with a UI. =/

Re: Select multiple nodes with Jscript - How?

Posted: 08 Jul 2014, 13:01
by stan
This works selecting multiple objects in one click.
Space.Select( Space.CurrentScene() + "/Cylinder;/Project/Space 3D, 7/Torus;/Project/Space 3D, 7/Torus, 1")

Re: Select multiple nodes with Jscript - How?

Posted: 08 Jul 2014, 15:39
by clintonman
stan wrote:This works selecting multiple objects in one click.
Space.Select( Space.CurrentScene() + "/Cylinder;/Project/Space 3D, 7/Torus;/Project/Space 3D, 7/Torus, 1")
It's important to note that the ; don't have any spaces next to them.

Re: Select multiple nodes with Jscript - How?

Posted: 09 Jul 2014, 14:25
by Draise
That worked, thanks! Handy. May come in handy later.