[SOLVED] Select multiple nodes with Jscript - How?

Smart people ~ Great Scripts
Post Reply
User avatar
Draise
Captain
Posts: 2811
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

[SOLVED] Select multiple nodes with Jscript - How?

Post by Draise » 08 Jul 2014, 05:16

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?
Last edited by Draise on 09 Jul 2014, 17:00, edited 1 time in total.

User avatar
Draise
Captain
Posts: 2811
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Select multiple nodes with Jscript - How?

Post by Draise » 08 Jul 2014, 06:22

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??

User avatar
Draise
Captain
Posts: 2811
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Select multiple nodes with Jscript - How?

Post by Draise » 08 Jul 2014, 06:57

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. =/

stan
Master Chief Petty Officer
Posts: 430
Joined: 21 May 2009, 17:20

Re: Select multiple nodes with Jscript - How?

Post by stan » 08 Jul 2014, 13:01

This works selecting multiple objects in one click.
Space.Select( Space.CurrentScene() + "/Cylinder;/Project/Space 3D, 7/Torus;/Project/Space 3D, 7/Torus, 1")

clintonman
Captain
Posts: 1544
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Select multiple nodes with Jscript - How?

Post by clintonman » 08 Jul 2014, 15:39

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.
Clinton Reese

http://clintons3d.com

User avatar
Draise
Captain
Posts: 2811
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Select multiple nodes with Jscript - How?

Post by Draise » 09 Jul 2014, 14:25

That worked, thanks! Handy. May come in handy later.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest