script: make everything visible script: make everything invisible except selected

mCasualmCasual Posts: 4,604

//===========================================================

//hide everything except what is selected

nodes=Scene.getNodeList();

for(i=0;i<nodes.length;i++) if( !nodes[i].isSelected() ) nodes[i].setVisible(false);

 

//===========================================================

//make everything (else)  visible (again )

nodes=Scene.getNodeList();

for(i=0;i<nodes.length;i++) nodes[i].setVisible(true);

Comments

  • mCasualmCasual Posts: 4,604
    edited June 2023

    and there's always and still The PoWARful mcjHideAllBut script found here :

    https://sites.google.com/site/mcasualsdazscripts4/mcjhideallbut

     

    EmbeddedImage.jpg
    512 x 512 - 89K
    demoz.jpg
    1029 x 812 - 79K
    Post edited by mCasual on
  • richardandtracyrichardandtracy Posts: 5,092
    edited June 2023

    I always find it useful to have an invert visibility script, so based on the above @mCasual code, the following should work (I haven't tried it):

    nodes=Scene.getNodeList();

    for(i=0;i<nodes.length;i++) 

    {

    nodes[i].setVisible(!nodes[i].isVisible());

    }

    I know there's a redundant set of curly braces, but I learnt to do my C++ coding that way, and it's a habit I can't (and don't want to) break. Shame the code box formatting is broken.

    Regards,

    Richard

    Post edited by richardandtracy on
Sign In or Register to comment.