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

Method createWriteNode

Engine/WriteNode.cpp:709–887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707} // WriteNodePrivate::createReadNodeAndConnectGraph
708
709void
710WriteNodePrivate::createWriteNode(bool throwErrors,
711 const std::string& filename,
712 const NodeSerializationPtr& serialization)
713{
714 if (creatingWriteNode) {
715 return;
716 }
717
718 NodeGroupPtr isNodeGroup = std::dynamic_pointer_cast<NodeGroup>( _publicInterface->shared_from_this() );
719 NodePtr input = inputNode.lock(), output = outputNode.lock();
720 //NodePtr maskInput;
721 assert( (input && output) || (!input && !output) );
722 if (!output) {
723 CreateNodeArgs args(PLUGINID_NATRON_OUTPUT, isNodeGroup);
724 args.setProperty(kCreateNodeArgsPropNoNodeGUI, true);
725 args.setProperty(kCreateNodeArgsPropOutOfProject, true);
726 args.setProperty<bool>(kCreateNodeArgsPropAllowNonUserCreatablePlugins, true);
727 output = _publicInterface->getApp()->createNode(args);
728 try {
729 output->setScriptName("Output");
730 } catch (...) {
731 }
732
733 assert(output);
734 outputNode = output;
735 }
736 if (!input) {
737 CreateNodeArgs args(PLUGINID_NATRON_INPUT, isNodeGroup);
738 args.setProperty(kCreateNodeArgsPropNoNodeGUI, true);
739 args.setProperty(kCreateNodeArgsPropOutOfProject, true);
740 args.setProperty<std::string>(kCreateNodeArgsPropNodeInitialName, "Source");
741 args.setProperty<bool>(kCreateNodeArgsPropAllowNonUserCreatablePlugins, true);
742 input = _publicInterface->getApp()->createNode(args);
743 assert(input);
744 inputNode = input;
745 }
746
747 SetCreatingWriterRAIIFlag creatingNode__(this);
748 QString qpattern = QString::fromUtf8( filename.c_str() );
749 std::string ext = QtCompat::removeFileExtension(qpattern).toLower().toStdString();
750 KnobStringPtr pluginIDKnob = pluginIDStringKnob.lock();
751 std::string writerPluginID = pluginIDKnob->getValue();
752
753 if ( writerPluginID.empty() ) {
754 KnobChoicePtr pluginChoiceKnob = pluginSelectorKnob.lock();
755 int pluginChoice_i = pluginChoiceKnob->getValue();
756 if (pluginChoice_i == 0) {
757 //Use default
758 writerPluginID = appPTR->getWriterPluginIDForFileType(ext);
759 } else {
760 std::vector<ChoiceOption> entries = pluginChoiceKnob->getEntries_mt_safe();
761 if ( (pluginChoice_i >= 0) && ( pluginChoice_i < (int)entries.size() ) ) {
762 writerPluginID = entries[pluginChoice_i].id;
763 }
764 }
765 }
766

Callers 3

onEffectCreatedMethod · 0.80
knobChangedMethod · 0.80

Calls 15

removeFileExtensionFunction · 0.85
ViewSpecFunction · 0.85
setPropertyMethod · 0.80
toStdStringMethod · 0.80
emptyMethod · 0.80
getEntries_mt_safeMethod · 0.80
getEffectInstanceMethod · 0.80
replaceInputMethod · 0.80
findPluginFormatKnobsMethod · 0.80
recreateKnobsMethod · 0.80

Tested by

no test coverage detected