MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / createNodeGUI

Method createNodeGUI

Gui/NodeGraph.cpp:368–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368NodeGuiPtr
369NodeGraph::createNodeGUI(const NodePtr & node,
370 const CreateNodeArgs& args)
371{
372 NodeGuiPtr node_ui;
373 Dot* isDot = dynamic_cast<Dot*>( node->getEffectInstance().get() );
374 Backdrop* isBd = dynamic_cast<Backdrop*>( node->getEffectInstance().get() );
375 NodeGroup* isGrp = dynamic_cast<NodeGroup*>( node->getEffectInstance().get() );
376
377
378 if (isDot) {
379 node_ui.reset( new DotGui(_imp->_nodeRoot) );
380 } else if (isBd) {
381 node_ui.reset( new BackdropGui(_imp->_nodeRoot) );
382 } else {
383 node_ui.reset( new NodeGui(_imp->_nodeRoot) );
384 }
385 assert(node_ui);
386 node_ui->initialize(this, node);
387
388 if (isBd) {
389 BackdropGui* bd = dynamic_cast<BackdropGui*>( node_ui.get() );
390 assert(bd);
391 NodesGuiList selectedNodes = _imp->_selection;
392 if ( bd && !selectedNodes.empty() ) {
393 ///make the backdrop large enough to contain the selected nodes and position it correctly
394 QRectF bbox;
395 for (NodesGuiList::iterator it = selectedNodes.begin(); it != selectedNodes.end(); ++it) {
396 QRectF nodeBbox = (*it)->mapToScene( (*it)->boundingRect() ).boundingRect();
397 bbox = bbox.united(nodeBbox);
398 }
399
400 double border50 = mapToScene( QPoint(50, 0) ).x();
401 double border0 = mapToScene( QPoint(0, 0) ).x();
402 double border = border50 - border0;
403 double headerHeight = bd->getFrameNameHeight();
404 QPointF scenePos(bbox.x() - border, bbox.y() - border);
405
406 bd->setPos( bd->mapToParent( bd->mapFromScene(scenePos) ) );
407 bd->resize(bbox.width() + 2 * border, bbox.height() + 2 * border - headerHeight);
408 }
409 }
410
411
412 {
413 QMutexLocker l(&_imp->_nodesMutex);
414 _imp->_nodes.push_back(node_ui);
415 }
416
417 //NodeGroup* parentIsGroup = dynamic_cast<NodeGroup*>(node->getGroup().get());;
418 const std::list<NodePtr>& nodesBeingCreated = getGui()->getApp()->getNodesBeingCreated();
419 bool isTopLevelNodeBeingCreated = false;
420 if ( !nodesBeingCreated.empty() && (nodesBeingCreated.front() == node) ) {
421 isTopLevelNodeBeingCreated = true;
422 }
423
424 NodeSerializationPtr serialization = args.getProperty<NodeSerializationPtr>(kCreateNodeArgsPropNodeSerialization);
425

Callers

nothing calls this directly

Calls 15

QPointClass · 0.85
getGuiFunction · 0.85
pushUndoCommandFunction · 0.85
getEffectInstanceMethod · 0.80
emptyMethod · 0.80
getFrameNameHeightMethod · 0.80
ensurePanelCreatedMethod · 0.80
registerNewUndoStackMethod · 0.80
getMethod · 0.45
resetMethod · 0.45
initializeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected