Node Delete Selection Bug

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:

Node Delete Selection Bug

Post by clintonman »

When selected items are deleted, the Node commands still behave as if the selection exists. Code below shows how to check for a valid selection before using it.
1. delete some nodes
2. run the script to see the ghost selection
3. note "selection is good" does not print

Code: Select all

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

	if(!Node.Selection()) return;
	System.Trace(Node.Selection());

	var selCount = Node.SelectedCount();

	if(selCount == 0) return;
	System.Trace(selCount);

	System.Trace(Node.FirstSelected());

	if(!IsValidSelection(Node.Selection())) return;
	
	System.Trace("selection is good");

}

function IsValidSelection(selection)
{
	if(!selection) return false;
	
	var reWhiteSpace = /^\s/; // whitespace in first character position for cleaning selection text

	var selectionArray = selection.split(";");

	for(var i = 0; i < selectionArray.length; i++) {
		var selClean = selectionArray[i].replace(reWhiteSpace, "");
		if(!Node.Exists(selClean)) return false;
	}
	return true;
}
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: Node Delete Selection Bug

Post by trueBlue »

I have been trying to come up with a solution for this for several weeks now.
Using your posted script and steps, try using this command when you see the ghost selection in the Log view
RsTool.Arrow();var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0);Space.Unselect()
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Node Delete Selection Bug

Post by clintonman »

trueBlue wrote: 07 Jan 2021, 22:48 I have been trying to come up with a solution for this for several weeks now.
Using your posted script and steps, try using this command when you see the ghost selection in the Log view
RsTool.Arrow();var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0);Space.Unselect()
My test shows that the Space.Unselect clears out the ghost selection. What are all the other commands doing?
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: Node Delete Selection Bug

Post by trueBlue »

clintonman wrote: 07 Jan 2021, 23:06
trueBlue wrote: 07 Jan 2021, 22:48 I have been trying to come up with a solution for this for several weeks now.
Using your posted script and steps, try using this command when you see the ghost selection in the Log view
RsTool.Arrow();var PVT_LOCKED = 2;RsStackView.RemovePanelsFromCurrSelection(PVT_LOCKED, 0);Space.Unselect()
My test shows that the Space.Unselect clears out the ghost selection. What are all the other commands doing?
Removes the last selected object from the Stack/Panel
This is the command for the Object tool in the UU(s)
Post Reply