| 847 | }; |
| 848 | |
| 849 | NodePtr |
| 850 | AppInstance::createNodeFromPythonModule(Plugin* plugin, |
| 851 | const CreateNodeArgs& args) |
| 852 | |
| 853 | { |
| 854 | /*If the plug-in is a toolset, execute the toolset script and don't actually create a node*/ |
| 855 | bool istoolsetScript = plugin->getToolsetScript(); |
| 856 | NodePtr node; |
| 857 | |
| 858 | NodeSerializationPtr serialization = args.getProperty<NodeSerializationPtr>(kCreateNodeArgsPropNodeSerialization); |
| 859 | NodeCollectionPtr group = args.getProperty<NodeCollectionPtr>(kCreateNodeArgsPropGroupContainer); |
| 860 | { |
| 861 | FlagIncrementer fs(&_imp->_creatingGroup, &_imp->creatingGroupMutex); |
| 862 | if (_imp->_creatingGroup == 1) { |
| 863 | bool createGui = !args.getProperty<bool>(kCreateNodeArgsPropNoNodeGUI) && !args.getProperty<bool>(kCreateNodeArgsPropOutOfProject); |
| 864 | _imp->_creatingInternalNode = !createGui; |
| 865 | } |
| 866 | CreatingNodeTreeFlag_RAII createNodeTree( shared_from_this() ); |
| 867 | NodePtr containerNode; |
| 868 | if (!istoolsetScript) { |
| 869 | CreateNodeArgs groupArgs = args; |
| 870 | groupArgs.setProperty<std::string>(kCreateNodeArgsPropPluginID,PLUGINID_NATRON_GROUP); |
| 871 | groupArgs.setProperty<bool>(kCreateNodeArgsPropNodeGroupDisableCreateInitialNodes, true); |
| 872 | containerNode = createNode(groupArgs); |
| 873 | if (!containerNode) { |
| 874 | return containerNode; |
| 875 | } |
| 876 | |
| 877 | if (!serialization && args.getProperty<std::string>(kCreateNodeArgsPropNodeInitialName).empty()) { |
| 878 | std::string containerName; |
| 879 | try { |
| 880 | if (group) { |
| 881 | group->initNodeName(plugin->getLabelWithoutSuffix().toStdString(), &containerName); |
| 882 | } |
| 883 | containerNode->setScriptName(containerName); |
| 884 | containerNode->setLabel(containerName); |
| 885 | } catch (...) { |
| 886 | } |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | AddCreateNode_RAII creatingNode_raii(_imp.get(), containerNode); |
| 891 | std::string containerFullySpecifiedName; |
| 892 | if (containerNode) { |
| 893 | containerFullySpecifiedName = containerNode->getFullyQualifiedName(); |
| 894 | } |
| 895 | |
| 896 | |
| 897 | QString moduleName; |
| 898 | QString modulePath; |
| 899 | plugin->getPythonModuleNameAndPath(&moduleName, &modulePath); |
| 900 | |
| 901 | if ( containerNode && !moduleName.isEmpty() ) { |
| 902 | setGroupLabelIDAndVersion(containerNode, modulePath, moduleName); |
| 903 | } |
| 904 | |
| 905 | int appID = getAppID() + 1; |
| 906 | std::stringstream ss; |
nothing calls this directly
no test coverage detected