MCPcopy Create free account
hub / github.com/begla/Intrinsic / onCreateComponent

Method onCreateComponent

IntrinsicEd/src/IntrinsicEdNodeViewTreeWidget.cpp:248–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void IntrinsicEdNodeViewTreeWidget::onCreateComponent()
249{
250 QTreeWidgetItem* currIt = currentItem();
251 Components::NodeRef currentNode = _itemToNodeMap[currIt];
252 Entity::EntityRef entity = Components::NodeManager::_entity(currentNode);
253
254 QAction* action = (QAction*)QObject::sender();
255 _INTR_STRING compName = action->text().toStdString().c_str();
256 Dod::Components::ComponentManagerEntry& entry =
257 Application::_componentManagerMapping[compName];
258
259 _INTR_ASSERT(entry.createFunction);
260 Dod::Ref compRef = entry.createFunction(entity);
261
262 if (entry.resetToDefaultFunction)
263 {
264 entry.resetToDefaultFunction(compRef);
265 }
266
267 if (entry.createResourcesFunction)
268 {
269 Dod::RefArray components = {compRef};
270 entry.createResourcesFunction(components);
271 }
272
273 if (entry.onInsertionDeletionFinishedAction)
274 {
275 entry.onInsertionDeletionFinishedAction();
276 }
277
278 onItemSelected(currIt, nullptr);
279 onPopulateNodeTree();
280}
281
282void IntrinsicEdNodeViewTreeWidget::onDestroyComponent()
283{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected