| 1190 | } |
| 1191 | |
| 1192 | bool 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 | |
| 1231 | bool RibbonMenu::drawCloneSelectionButton( const std::vector<std::shared_ptr<Object>>& selected ) |
| 1232 | { |
no test coverage detected