Multiple Isolation levels

Next
 From:  Kash (ZELDAER)
10598.1 
Hi, I was wondering if someone could help me with writing a script. what I want is to create multiple layers of isolation. This is directly inspired from the works of Machin3 the developer of decal machin3, machin3 tools etc.

scenario example:
a scene with 50 objects. I select 30 objects run the isolation command and the 20 objects are hidden [ this would be focus level: 1 ].
from the 30 objects visible I select 15 objects and run the isolation command again [ this would be focus level: 2 ].
now if I run the unisolate command it steps out of the level 2 and return into level one.

it would be ideal if I could go up to at least 5 levels.

I have little scripting experience in python, but I don't have enough know how to accomplish this on my own. any help would be greatly appreciated.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10598.2 In reply to 10598.1 
Hi Kash, try these - go to Options > Shortcut keys and for the isolate shortcut key put this in to the Command section of the shortcut key:

script: /* Multi-level isolate */ var states = []; var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); states[obj.id] = obj.hidden; if ( !obj.selected ) { obj.hidden = true; } } var levels = []; try { levels = moi.command.getOption( 'multi-level isolate' ); } catch(e) {}; levels.push( states ); moi.command.setOption( 'multi-level isolate', levels );

And for your unisolate shortcut key put in this:

script: /* Multi-level unisolate */ var levels = []; try { levels = moi.command.getOption( 'multi-level isolate' ); } catch(e) {} if ( levels.length > 0 ) { var states = levels.pop(); moi.command.setOption( 'multi-level isolate', levels ); var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); var state = states[obj.id]; if ( state != undefined ) { obj.hidden = state; } } }

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Kash (ZELDAER)
10598.3 In reply to 10598.2 
this is perfect, thank you very much. will be using this script alot! simple but very powerful
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  pixelhouse
10598.4 
Hi Michael,

this is a fantastic script! I love the functionality to hide and unhide objects in this way!
Das Leben ist ein Spaziergang. Manchmal bei beschissenem Wetter ;)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Phiro
10598.5 
Hi Michael,

Very cool and usefull scripts.

Thanks !
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  mk (MARKY)
10598.6 In reply to 10598.2 
Wow, what a useful function!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All