MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / cloneSelection

Method cloneSelection

Engine/source/gui/editor/guiEditCtrl.cpp:1253–1286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1251//-----------------------------------------------------------------------------
1252
1253void GuiEditCtrl::cloneSelection()
1254{
1255 Vector< GuiControl* > newSelection;
1256
1257 // Clone the controls in the current selection.
1258
1259 const U32 numOldControls = mSelectedControls.size();
1260 for( U32 i = 0; i < numOldControls; ++ i )
1261 {
1262 GuiControl* ctrl = mSelectedControls[ i ];
1263
1264 // If parent is in selection, too, skip to prevent multiple clones.
1265
1266 if( ctrl->getParent() && selectionContains( ctrl->getParent() ) )
1267 continue;
1268
1269 // Clone and add to set.
1270
1271 GuiControl* clone = dynamic_cast< GuiControl* >( ctrl->deepClone() );
1272 if( clone )
1273 newSelection.push_back( clone );
1274 }
1275
1276 // Exchange the selection set.
1277
1278 clearSelection();
1279 const U32 numNewControls = newSelection.size();
1280 for( U32 i = 0; i < numNewControls; ++ i )
1281 addSelection( newSelection[ i ] );
1282
1283 // Callback for undo.
1284
1285 onSelectionCloned_callback( getSelectedSet() );
1286}
1287
1288//-----------------------------------------------------------------------------
1289

Callers

nothing calls this directly

Calls 5

getSelectedSetFunction · 0.85
sizeMethod · 0.45
getParentMethod · 0.45
deepCloneMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected