Hi shayne, for v5 there was more stuff added for scripting the scene browser that makes it more convenient to write this script.
For v4 it's still possible just not as convenient, try this one for v4:
script: /* Toggle visibility on given style */ var style_name = 'Blue'; var item = moi.ui.sceneBrowser.styles.find( style_name ); var style = moi.geometryDatabase.findStyle( style_name ); if ( style ) { var style_index = style.index; var any_hidden = false; var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length && !any_hidden; ++i ) { var obj = objs.item( i ); if ( obj.styleIndex == style_index && obj.hidden ) { any_hidden = true; } var subobjs = obj.getSubObjects(); for ( var j = 0; j < subobjs.length && !any_hidden; ++j ) { var subobj = subobjs.item(j); if ( subobj.styleIndex == style_index && subobj.hidden ) { any_hidden = true; } } } } if ( any_hidden ) { item.alterStatus( 'show' ); } else { item.alterStatus( 'hide' ); }
- Michael
|