Script button for IsolateSelected and IsolateAll

General questions and troubleshooting SOFTIMAGE©
Val_west
Posts: 2
Joined: 26 Jul 2013, 14:23

Script button for IsolateSelected and IsolateAll

Post by Val_west » 26 Jul 2013, 15:30

Hello i'm looking for an instruction to do a button which swap between IsolateSelected(null, 1); and IsolateAll(null, 1);

i think i have to use a script similar to this :

var pref = GetValue("preferences.Polygon.planarity" );
SetValue("preferences.Polygon.planarity", !pref, null);

if someone have got something this would be very useful. Thanks

User avatar
kcsaba
Posts: 26
Joined: 01 Jun 2011, 09:42
Skype: csabakanal
Location: Budapest/Hungary

Re: Script button for IsolateSelected and IsolateAll

Post by kcsaba » 26 Jul 2013, 16:26

Wouldn't be easier to simply map the commands in the hotkey editor? I have alt f1/f2 works perfect for me.
csk

User avatar
myara
Posts: 406
Joined: 28 Sep 2011, 08:33

Re: Script button for IsolateSelected and IsolateAll

Post by myara » 31 Jul 2013, 05:36

I haven't found any way to know if an object has been isolated or a view is isolating something. So you would need to create something to get this info, like a custom property to know when to change from Isolate to Unisolate (IsolateAll).

Now, IsolateSelected works with only one view, so you would need to check what view are you using now, and what view did you use to isolate.

The code wouldn't be 2 lines, but about 30~40 maybe.

A basic code working with only 1 view:

Code: Select all

var r = ActiveSceneRoot

if (!r.properties("iso") && selection.count >0){
	IsolateSelected();
	oPSet = r.AddProperty("CustomProperty", 0,"iso");
}
else{
	IsolateAll();
	if (r.properties("iso")) DeleteObj(r.properties("iso"));
}
BTW you could use ToggleValue for your planarity code. Apart from being a one line command it doesn't have any advantages though.

Code: Select all

ToggleValue("planarity", "preferences.polygon")
M.Yara
Character Modeler | Softimage Generalist (sort of)

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 13:31
Skype: csaezmargotta
Location: Sydney, Australia

Re: Script button for IsolateSelected and IsolateAll

Post by csaez » 31 Jul 2013, 05:50

IsolateSelected without anything selected does the same than IsolateAll :)

User avatar
myara
Posts: 406
Joined: 28 Sep 2011, 08:33

Re: Script button for IsolateSelected and IsolateAll

Post by myara » 31 Jul 2013, 07:18

csaez wrote:IsolateSelected without anything selected does the same than IsolateAll :)
OMG! thanks!
All this time I've been clicking the [X] button.
M.Yara
Character Modeler | Softimage Generalist (sort of)

Val_west
Posts: 2
Joined: 26 Jul 2013, 14:23

Re: Script button for IsolateSelected and IsolateAll

Post by Val_west » 05 Aug 2013, 07:19

Thank you. it's working too good.