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

Method createNodeInternal

Engine/AppInstance.cpp:1111–1397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111NodePtr
1112AppInstance::createNodeInternal(CreateNodeArgs& args)
1113{
1114 NodePtr node;
1115 Plugin* plugin = 0;
1116 QString findId;
1117
1118 NodeSerializationPtr serialization = args.getProperty<NodeSerializationPtr>(kCreateNodeArgsPropNodeSerialization);
1119 bool trustPluginID = args.getProperty<bool>(kCreateNodeArgsPropTrustPluginID);
1120 QString argsPluginID = QString::fromUtf8(args.getProperty<std::string>(kCreateNodeArgsPropPluginID).c_str());
1121 int versionMajor = args.getProperty<int>(kCreateNodeArgsPropPluginVersion, 0);
1122 int versionMinor = args.getProperty<int>(kCreateNodeArgsPropPluginVersion, 1);
1123
1124 //Roto has moved to a built-in plugin
1125 if ( (!trustPluginID || serialization) &&
1126 ( ( !_imp->_projectCreatedWithLowerCaseIDs && ( argsPluginID == QString::fromUtf8(PLUGINID_OFX_ROTO) ) ) || ( _imp->_projectCreatedWithLowerCaseIDs && ( argsPluginID == QString::fromUtf8(PLUGINID_OFX_ROTO).toLower() ) ) ) ) {
1127 findId = QString::fromUtf8(PLUGINID_NATRON_ROTO);
1128 } else {
1129 findId = argsPluginID;
1130 }
1131
1132 bool isSilentCreation = args.getProperty<bool>(kCreateNodeArgsPropSilent);
1133
1134
1135#ifdef NATRON_ENABLE_IO_META_NODES
1136 NodePtr argsIOContainer = args.getProperty<NodePtr>(kCreateNodeArgsPropMetaNodeContainer);
1137 //If it is a reader or writer, create a ReadNode or WriteNode
1138 if (!argsIOContainer) {
1139 if ( ReadNode::isBundledReader( argsPluginID.toStdString(), wasProjectCreatedWithLowerCaseIDs() ) ) {
1140 args.addParamDefaultValue(kNatronReadNodeParamDecodingPluginID, argsPluginID.toStdString());
1141 findId = QString::fromUtf8(PLUGINID_NATRON_READ);
1142 } else if ( WriteNode::isBundledWriter( argsPluginID.toStdString(), wasProjectCreatedWithLowerCaseIDs() ) ) {
1143 args.addParamDefaultValue(kNatronWriteNodeParamEncodingPluginID, argsPluginID.toStdString());
1144 findId = QString::fromUtf8(PLUGINID_NATRON_WRITE);
1145 }
1146 }
1147#endif
1148
1149 try {
1150 plugin = appPTR->getPluginBinary(findId, versionMajor, versionMinor, _imp->_projectCreatedWithLowerCaseIDs && serialization);
1151 } catch (const std::exception & e1) {
1152 ///Ok try with the old Ids we had in Natron prior to 1.0
1153 try {
1154 plugin = appPTR->getPluginBinaryFromOldID(argsPluginID, versionMajor, versionMinor);
1155 } catch (const std::exception& e2) {
1156 if (!isSilentCreation) {
1157 Dialogs::errorDialog(tr("Plugin error").toStdString(),
1158 tr("Cannot load plug-in executable.").toStdString() + ": " + e2.what(), false );
1159 } else {
1160 std::cerr << tr("Cannot load plug-in executable.").toStdString() + ": " + e2.what() << std::endl;
1161 }
1162 return node;
1163 }
1164 }
1165
1166 if (!plugin) {
1167 return node;
1168 }

Callers

nothing calls this directly

Calls 15

isEntitledForInspectorFunction · 0.85
removeFileExtensionFunction · 0.85
toStdStringMethod · 0.80
addParamDefaultValueMethod · 0.80
getPluginBinaryMethod · 0.80
getIsUserCreatableMethod · 0.80
getOfxDescMethod · 0.80
getOfxPluginMethod · 0.80
setOfxDescMethod · 0.80
getCurrentSettingsMethod · 0.80
useGlobalThreadPoolMethod · 0.80

Tested by

no test coverage detected