MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / drawSelectSubtreeButton

Method drawSelectSubtreeButton

source/MRViewer/MRRibbonMenu.cpp:1192–1229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1190}
1191
1192bool RibbonMenu::drawSelectSubtreeButton( const std::vector<std::shared_ptr<Object>>& selected )
1193{
1194 bool someChanges = false;
1195 const bool subtreeExists = std::any_of( selected.begin(), selected.end(), [] ( std::shared_ptr<Object> obj )
1196 {
1197 return obj && !obj->isAncillary() && objectHasSelectableChildren( *obj );
1198 } );
1199
1200 if ( selected.empty() || !subtreeExists )
1201 return someChanges;
1202
1203 if ( UI::button( _tr( "Select Subtree" ), { -1, 0 } ) )
1204 {
1205 for ( auto selectedObject : selected )
1206 {
1207 std::stack<std::shared_ptr<Object>> objects;
1208 objects.push( selectedObject );
1209 while ( !objects.empty() )
1210 {
1211 auto object = objects.top();
1212 objects.pop();
1213
1214 if ( !object )
1215 continue;
1216
1217 object->select( true );
1218 if ( sceneObjectsList_->getShowNewSelectedObjects() )
1219 object->setGlobalVisibility( true );
1220
1221 for ( auto child : object->children() )
1222 objects.push( child );
1223 }
1224 }
1225 someChanges = true;
1226 }
1227
1228 return someChanges;
1229}
1230
1231bool RibbonMenu::drawCloneSelectionButton( const std::vector<std::shared_ptr<Object>>& selected )
1232{

Callers 1

drawSceneContextMenu_Method · 0.80

Calls 9

setGlobalVisibilityMethod · 0.80
buttonFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
pushMethod · 0.45
popMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected