| 40 | |
| 41 | |
| 42 | NATRON_NAMESPACE_ENTER |
| 43 | |
| 44 | void |
| 45 | Node::load(const CreateNodeArgs& args) |
| 46 | { |
| 47 | ///Called from the main thread. MT-safe |
| 48 | assert( QThread::currentThread() == qApp->thread() ); |
| 49 | |
| 50 | ///cannot load twice |
| 51 | assert(!_imp->effect); |
| 52 | _imp->isPartOfProject = !args.getProperty<bool>(kCreateNodeArgsPropOutOfProject); |
| 53 | |
| 54 | #ifdef NATRON_ENABLE_IO_META_NODES |
| 55 | _imp->ioContainer = args.getProperty<NodePtr>(kCreateNodeArgsPropMetaNodeContainer); |
| 56 | #endif |
| 57 | |
| 58 | NodeCollectionPtr group = getGroup(); |
| 59 | std::string multiInstanceParentName = args.getProperty<std::string>(kCreateNodeArgsPropMultiInstanceParentName); |
| 60 | if ( !multiInstanceParentName.empty() ) { |
| 61 | _imp->multiInstanceParentName = multiInstanceParentName; |
| 62 | _imp->isMultiInstance = false; |
| 63 | fetchParentMultiInstancePointer(); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | _imp->wasCreatedSilently = args.getProperty<bool>(kCreateNodeArgsPropSilent); |
| 68 | |
| 69 | NodePtr thisShared = shared_from_this(); |
| 70 | LibraryBinary* binary = _imp->plugin->getLibraryBinary(); |
| 71 | std::pair<bool, EffectBuilder> func; |
| 72 | if (binary) { |
| 73 | func = binary->findFunction<EffectBuilder>("BuildEffect"); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | NodeSerializationPtr serialization = args.getProperty<NodeSerializationPtr>(kCreateNodeArgsPropNodeSerialization); |
| 78 | |
| 79 | bool isSilentCreation = args.getProperty<bool>(kCreateNodeArgsPropSilent); |
| 80 | #ifndef NATRON_ENABLE_IO_META_NODES |
| 81 | bool hasUsedFileDialog = false; |
| 82 | #endif |
| 83 | |
| 84 | bool hasDefaultFilename = false; |
| 85 | { |
| 86 | std::vector<std::string> defaultParamValues = args.getPropertyN<std::string>(kCreateNodeArgsPropNodeInitialParamValues); |
| 87 | std::vector<std::string>::iterator foundFileName = std::find(defaultParamValues.begin(), defaultParamValues.end(), std::string(kOfxImageEffectFileParamName)); |
| 88 | if (foundFileName != defaultParamValues.end()) { |
| 89 | std::string propName(kCreateNodeArgsPropParamValue); |
| 90 | propName += "_"; |
| 91 | propName += kOfxImageEffectFileParamName; |
| 92 | hasDefaultFilename = !args.getProperty<std::string>(propName).empty(); |
| 93 | } |
| 94 | } |
| 95 | bool canOpenFileDialog = !isSilentCreation && !serialization && _imp->isPartOfProject && !hasDefaultFilename && getGroup(); |
| 96 | |
| 97 | std::string argFixedName = args.getProperty<std::string>(kCreateNodeArgsPropNodeInitialName); |
| 98 | |
| 99 |
nothing calls this directly
no test coverage detected