| 476 | } // findAndTryLoadAutoSave |
| 477 | |
| 478 | void |
| 479 | GuiAppInstance::createNodeGui(const NodePtr &node, |
| 480 | const NodePtr& parentMultiInstance, |
| 481 | const CreateNodeArgs& args) |
| 482 | { |
| 483 | NodeCollectionPtr group = node->getGroup(); |
| 484 | NodeGraph* graph; |
| 485 | |
| 486 | if (group) { |
| 487 | NodeGraphI* graph_i = group->getNodeGraph(); |
| 488 | assert(graph_i); |
| 489 | graph = dynamic_cast<NodeGraph*>(graph_i); |
| 490 | assert(graph); |
| 491 | } else { |
| 492 | graph = _imp->_gui->getNodeGraph(); |
| 493 | } |
| 494 | if (!graph) { |
| 495 | throw std::logic_error(""); |
| 496 | } |
| 497 | |
| 498 | NodesGuiList selectedNodes = graph->getSelectedNodes(); |
| 499 | NodeGuiPtr nodegui = _imp->_gui->createNodeGUI(node, args); |
| 500 | assert(nodegui); |
| 501 | |
| 502 | if (parentMultiInstance && nodegui) { |
| 503 | nodegui->hideGui(); |
| 504 | |
| 505 | |
| 506 | NodeGuiIPtr parentNodeGui_i = parentMultiInstance->getNodeGui(); |
| 507 | assert(parentNodeGui_i); |
| 508 | nodegui->setParentMultiInstance( std::dynamic_pointer_cast<NodeGui>(parentNodeGui_i) ); |
| 509 | } |
| 510 | |
| 511 | bool isViewer = node->isEffectViewer() != 0; |
| 512 | if (isViewer) { |
| 513 | _imp->_gui->createViewerGui(node); |
| 514 | } |
| 515 | |
| 516 | // Must be done after the viewer gui has been created |
| 517 | _imp->_gui->createNodeViewerInterface(nodegui); |
| 518 | |
| 519 | |
| 520 | NodeGroup* isGroup = node->isEffectGroup(); |
| 521 | if ( isGroup && isGroup->isSubGraphUserVisible() ) { |
| 522 | _imp->_gui->createGroupGui(node, args); |
| 523 | } |
| 524 | |
| 525 | ///Don't initialize inputs if it is a multi-instance child since it is not part of the graph |
| 526 | if (!parentMultiInstance) { |
| 527 | nodegui->initializeInputs(); |
| 528 | } |
| 529 | |
| 530 | NodeSerializationPtr serialization = args.getProperty<NodeSerializationPtr>(kCreateNodeArgsPropNodeSerialization); |
| 531 | if ( !serialization && !isViewer ) { |
| 532 | ///we make sure we can have a clean preview. |
| 533 | node->computePreviewImage( getTimeLine()->currentFrame() ); |
| 534 | triggerAutoSave(); |
| 535 | } |
nothing calls this directly
no test coverage detected