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