Collapse Group

I have developed a script that will loop through a large number of objects and apply a material.

That part works fine.

The problem is that after the script has executed, the scene shows all my groups that I created objects in expanded and selected.

I made a loop that deselects.

Now I am looking for code that will allow my parent object to collapse in the Scene tab.

The following calls don't seem to work:

MyObject.select(); // Iselect the object first

MyObject.setCollapsed(); // In documentation but does throws an error 

MyObject.closeSelected(); // Does not seem to do anything

 

Also is there a nice easy way of unselecting all objects in a scene programatically and collapsing the open structures to root nodes?

Post edited by FasterScene on

Comments

  • OmnifluxOmniflux Posts: 377
    Scene.selectAllNodes (false);

    Then, select only your root object(s) to collapse and call

    MainWindow.getPaneMgr().findPane ('DzHierarchyPane').closeSelected();

     or, to collapse everything

    MainWindow.getPaneMgr().findPane ('DzHierarchyPane').closeAll();

     

  • FasterSceneFasterScene Posts: 8
    edited April 2022

    Oh yeh Omniflux!

    MainWindow.getPaneMgr().findPane ('DzHierarchyPane').closeAll();

     

    That's much neater!!

    Thank you

     

    Post edited by FasterScene on
  • Richard HaseltineRichard Haseltine Posts: 101,507

    Omniflux said:

    Scene.selectAllNodes (false);

    Then, select only your root object(s) to collapse and call

    MainWindow.getPaneMgr().findPane ('DzHierarchyPane').closeSelected();

     or, to collapse everything

    MainWindow.getPaneMgr().findPane ('DzHierarchyPane').closeAll();

    Just bear in mind that these are not official, documented methods so they may be changed or removed without notice.

Sign In or Register to comment.