Selection Scripts

Post Reply
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Selection Scripts

Post by clintonman »

selectionscripts.jpg
Some random selection scripts. Not sure what I want to add and do with them.
Works on top level scene items.
Buttons to select all items, invert the selection, select lights, cameras and by search name.

forgot to mention, I found that if you have a multiple selection in workspace, modelspace won't see the selection. if one thing is selected then it sees it.
Attachments
SelectionScripts.RsObj
(25.46 KiB) Downloaded 188 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Selection Scripts

Post by trueBlue »

clintonman wrote: 08 Aug 2020, 01:58 selectionscripts.jpg

Not sure what I want to add and do with them.
Nice!
Link Editor Preferences panel would be handy
LEpreferences button.png
LEpreferences button.png (8.05 KiB) Viewed 2576 times
Along with you Alphabetize scripts
Select and Sort.png
Select and Sort.png (10.94 KiB) Viewed 2576 times
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Selection Scripts

Post by trueBlue »

Is there a way to select 3D Objects Only, excluding Lights and Cameras?

Adding if(Node.IsRenderable(subobj)) is helpful too.
As an example, selecting renderable objects, selects Lights, Cameras, and 3D Objects, and selecting Inverse, selects Non renderable objects.

Also is it possible to add selected objects to your Alphabetize scripts?
IE: Instead of Alphabetizing the whole scene, only selected items in the scene.
I envision a tool that you could reorganize you scene by Lights, Cameras, 3D Objects, and 2D Objects
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Selection Scripts

Post by clintonman »

trueBlue wrote: 23 Aug 2020, 17:19 Is there a way to select 3D Objects Only, excluding Lights and Cameras?

Adding if(Node.IsRenderable(subobj)) is helpful too.
As an example, selecting renderable objects, selects Lights, Cameras, and 3D Objects, and selecting Inverse, selects Non renderable objects.

Also is it possible to add selected objects to your Alphabetize scripts?
IE: Instead of Alphabetizing the whole scene, only selected items in the scene.
I envision a tool that you could reorganize you scene by Lights, Cameras, 3D Objects, and 2D Objects
3D Objects Only, excluding Lights and Cameras not including group objects

Code: Select all

// Execute 
// Called to execute the command 
function Execute(params)
{

	var scene = Space.CurrentScene();

	var newSelection = "";

	for(var i=0;i<Node.SubObjectCount(scene);i++) {
		var subobj = scene + "/" + Node.SubObject(scene, i);
		if(!Node.IsLight(subobj) && !Node.IsCamera(subobj) && Node.IsRenderable(subobj))
			newSelection += subobj + ";";
	}

	Space.Select(newSelection);

}
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Selection Scripts

Post by trueBlue »

clintonman wrote: 23 Aug 2020, 18:33 3D Objects Only, excluding Lights and Cameras not including group objects
Thanks!
3D Objects Only, excluding Lights and Cameras including group objects

Code: Select all

if(!Node.IsLight(subobj) && !Node.IsCamera(subobj) && Node.ConExists(subobj, "ObjMatrix"))
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Selection Scripts

Post by trueBlue »

How would you eliminate the Vray and PhotoRender nodes from this selection?

Code: Select all

function Execute(params)
{
	var scene = Space.CurrentScene();

	var newSelection = "";

	for(var i=0;i<Node.SubObjectCount(scene);i++) {
		var subobj = scene + "/" + Node.SubObject(scene, i);
		if(!Node.ConExists(subobj, "ObjMatrix"))
			newSelection += subobj + ";";
	}

	Space.Select(newSelection);
}
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Selection Scripts

Post by clintonman »

trueBlue wrote: 24 Aug 2020, 16:11 How would you eliminate the Vray and PhotoRender nodes from this selection?

Code: Select all

function Execute(params)
{
	var scene = Space.CurrentScene();

	var newSelection = "";

	for(var i=0;i<Node.SubObjectCount(scene);i++) {
		var subobj = scene + "/" + Node.SubObject(scene, i);
		if(!Node.ConExists(subobj, "ObjMatrix"))
			newSelection += subobj + ";";
	}

	Space.Select(newSelection);
}
Something like

Code: Select all

if(!Node.ConExists(subobj, "ObjMatrix") && Node.SubObject(scene, i) != "Vray" && Node.SubObject(scene, i) != "PhotoRender")
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5208
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Selection Scripts

Post by trueBlue »

Purrrfecto!
Thank you!!! :D
Post Reply