Unselectable script

free scripts, plugins, models, textures
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:

Unselectable script

Post by clintonman »

Update to the "unselectable" script used to lock object selections. The new version uses the web ui plugin to deselected locked items when they are selected. The big change is that it locks link editor selections where the old version only locked 3d view selections and it requires the web ui plugin/script to be installed. Still not ideal since it deselects instead of preventing selection in the first place. It's the best that can be done without source code access.

http://clintons3d.com/plugins/truespace ... selectable

Related and required is an update to the web scene view, which processes the selection change events. Locking has been added the the browser based scene view.

http://clintons3d.com/plugins/truespace ... webui.html

Related as well is the workspace layers. Changed to use the new locking and some fixes like camera and spotlights could not be hidden. It also allows items to be hidden and locked at the same time. This requires the web ui plugins/scripts for locking items.

http://clintons3d.com/plugins/truespace ... ayers.html
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Unselectable script

Post by Draise »

I still haven't managed to get the Webui system going yet. I'll have to give it another try once I'm done delivering and going into a lull for the end of the year.
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Unselectable script

Post by clintonman »

Update June 2020

when unlocking the lock data node is removed
installer clears the recent files list before saving tS state
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Unselectable script

Post by clintonman »

Update July 2020

reintroduced script based locking based on trueBlue "undo" technique

script based locking works by undo if it finds a locked node in the selection. if you select a several items at once and one is locked the entire selection will revert to it's previous state via undo action. plugin based locking will keep the selection for items that are not locked

if the web server panel is open the internal script based locking will be disabled.
Clinton Reese

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

Re: Unselectable script

Post by trueBlue »

Have you noticed that if you select an object that has the UnSelectable attribute twice or more, there can be two Object Navigation Widgets?
Even if the other object that has the additional Object Navigation Widget has an UnSelectable attribute!
In the UnDo script, I added:

Code: Select all

RsApp.Undo();
MeshModifiers.ActivateSelectionTool() //<----
break;
This also fixes an issue with the Active attribute unchecking.
IE: If an object that has the UnSelectable attribute is selected before Activating the Undo script

Also with the unlockAll script, I added:

Code: Select all

function Execute(params)
{
	scene = Space.CurrentScene();
Node.Value(System.ThisOwner(), "Active") = 0 //<----
	//recursively search scene and set unlock selection
	ExploreNode(scene);
}
You may also want to reconsider having the scripts located in CustomCommands, where a user could leave it Active!
IMO... It would be safer if it was loaded into a scene!
With an option to have the panel auto load when the scene loads.
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Unselectable script

Post by clintonman »

trueBlue wrote: 18 Jul 2020, 13:30 Have you noticed that if you select an object that has the UnSelectable attribute twice or more, there can be two Object Navigation Widgets?
Even if the other object that has the additional Object Navigation Widget has an UnSelectable attribute!
In the UnDo script, I added:

Code: Select all

RsApp.Undo();
MeshModifiers.ActivateSelectionTool() //<----
break;
Also with the unlockAll script, I added:

Code: Select all

function Execute(params)
{
	scene = Space.CurrentScene();
Node.Value(System.ThisOwner(), "Active") = 0 //<----
	//recursively search scene and set unlock selection
	ExploreNode(scene);
}
Added inactive to unlock all.

No idea what you're talking about with the 2 object nav widgets. How do you make it happen?
tried it with lockig active and inactive
1. add unselectable attribute
2. select the object twice or more
nothing
1. add multiple unselectable attributes
2. select the object twice or more
nothing
Clinton Reese

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

Re: Unselectable script

Post by trueBlue »

Yeah I can not seem to replicate that issue that I saw this morning.
But it did happen.
Did you notice the other issue:
This also fixes an issue with the Active attribute unchecking.
IE: If an object that has the UnSelectable attribute is selected before Activating the Undo script
User avatar
trueBlue
Captain
Posts: 5206
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Unselectable script

Post by trueBlue »

Okay try this:
Select an object that has an UnSelectable attribute
Activate the UnDo script
Rectangle select multiple objects in the LE
Results:
The Undo Active checkbox unchecks.
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Unselectable script

Post by clintonman »

Mis-posted before.
Meant to say Added inactive to unlock, not "Added inactive to unlock all."

Why is it needed for unlock all?

"You may also want to reconsider having the scripts located in CustomCommands, where a user could leave it Active!"
Not gonna recode the rsx plugin for the web server to look in the scene. It takes much more work to make rsx changes and I'm just not willing to put in the time.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Unselectable script

Post by clintonman »

Ok, I'm confusing myself. Here are the untested changes I've made.

Unlock All

Code: Select all

Node.Value(System.ThisOwner(), "Active") = false;

Undo

Code: Select all

			if (Node.ConExists(sel, "UnSelectable") && Node.Value(sel, "UnSelectable")) {

				RsApp.Undo();

				//below needed for case:
				// 1. selected object is locked and unselectable is inactive then
				// 2. unselectable is activated and the same object is selected - no real selection change so will undo the activation
				Node.Value(System.ThisOwner(), "Active") = true;

				break;
			}
LockIt

Code: Select all

var validSelection = false;

	if(num < 1) return;

	for(i=0;i<num;i++)
	{
		cursel = Node.SelectionGetAt(sel,i);
		System.Trace(cursel);
		//valid scene object
		if(Node.ConExists(cursel,"WldMatrix"))
		{
			//copy selection locking node if does not exist
			if(!Node.ConExists(cursel,"UnSelectable"))
			{
				newnode = Node.Copy(owner + "/selectionLocking",cursel);
				Node.ExportConnector(newnode, "UnSelectable", "", 1, 1);			
			}

			Node.Value(cursel,"UnSelectable") = true;
			validSelection = true;
		}
	}
	
	if(validSelection)
		Space.Unselect();
Clinton Reese

http://clintons3d.com
Post Reply