Selection Thoughts

 From:  Michael Gibson
1073.5 In reply to 1073.4 
Hi Marc,

> I there a simple way to tweak the script to behave like this?;
> -Command would trigger "show points"
> -Selection set would be locked (as in script).
> -Escape two times would exit the script. (Like current show
> points behavior) and therefore unlock the selection.

There is for the first 2 things, that would be this:
code:
script:moi.geometryDatabase.showPoints(); var objs = moi.geometryDatabase.getObjects(), locked = moi.geometryDatabase.createObjectList(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( !obj.showPoints ) locked.addObject( obj ); } locked.lockSelection();

So that turns on the special "locked points" mode with one key.

But for the moment Escape won't work to exit this mode, you will need to use this on a different key instead:
code:
script:moi.geometryDatabase.getObjects().unlockSelection();

However, I have tuned up Escape for the next release to handle this - if nothing is selected when you push Escape (which will be the case on the second time that you push it), it will look to see if there is any locked selection and if there is it will clear the locked selection.


> For the lock selection set feature, I was initially thinking of a toggle
> On-Off lock that would lock selection and prevent adding other object,
> similar to the "show points lock" script you have made.

Then I guess that means locking all the objects that are _not_ currently selected... That would be this:
code:
script:var objs = moi.geometryDatabase.getObjects(), locked = moi.geometryDatabase.createObjectList(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( !obj.selected ) locked.addObject( obj ); } locked.lockSelection();

I'm not quite sure if that is what you wanted?

- Michael