| 397 | void IntrinsicEdNodeViewTreeWidget::onCreateRootNode() { createNode(nullptr); } |
| 398 | |
| 399 | void IntrinsicEdNodeViewTreeWidget::createNode(QTreeWidgetItem* p_Parent) |
| 400 | { |
| 401 | { |
| 402 | Entity::EntityRef entityRef = Entity::EntityManager::createEntity("Node"); |
| 403 | Components::NodeRef nodeRef = |
| 404 | Components::NodeManager::createNode(entityRef); |
| 405 | |
| 406 | QTreeWidgetItem* item; |
| 407 | if (p_Parent) |
| 408 | { |
| 409 | Components::NodeRef parentNode = _itemToNodeMap[p_Parent]; |
| 410 | Components::NodeManager::attachChild(parentNode, nodeRef); |
| 411 | |
| 412 | item = new QTreeWidgetItem(p_Parent); |
| 413 | _nodeToItemMap[nodeRef] = item; |
| 414 | _itemToNodeMap[item] = nodeRef; |
| 415 | |
| 416 | item->setText(0, Entity::EntityManager::_name( |
| 417 | Components::NodeManager::_entity(nodeRef)) |
| 418 | .getString() |
| 419 | .c_str()); |
| 420 | item->setIcon(0, QIcon(":/Icons/target")); |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | item = new QTreeWidgetItem(this); |
| 425 | _nodeToItemMap[nodeRef] = item; |
| 426 | _itemToNodeMap[item] = nodeRef; |
| 427 | |
| 428 | item->setText(0, Entity::EntityManager::_name( |
| 429 | Components::NodeManager::_entity(nodeRef)) |
| 430 | .getString() |
| 431 | .c_str()); |
| 432 | item->setIcon(0, QIcon(":/Icons/globe")); |
| 433 | } |
| 434 | |
| 435 | _INTR_ASSERT(item); |
| 436 | |
| 437 | item->setFlags(item->flags() | Qt::ItemIsEditable); |
| 438 | } |
| 439 | Components::NodeManager::rebuildTreeAndUpdateTransforms(); |
| 440 | } |
| 441 | |
| 442 | void IntrinsicEdNodeViewTreeWidget::cloneNode(QTreeWidgetItem* p_Node) |
| 443 | { |