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

Method onEffectCreated

Engine/ReadNode.cpp:1142–1188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1140}
1141
1142void
1143ReadNode::onEffectCreated(bool mayCreateFileDialog,
1144 const CreateNodeArgs& args)
1145{
1146 //If we already loaded the Reader, do not do anything
1147 NodePtr p = getEmbeddedReader();
1148 if (p) {
1149 // Ensure the plug-in ID knob has the same value as the created reader:
1150 // The reader might have been created in onKnobsAboutToBeLoaded() however the knobs
1151 // get loaded afterwards and the plug-in ID could not reflect the underlying plugin
1152 KnobStringPtr pluginIDKnob = _imp->pluginIDStringKnob.lock();
1153 if (pluginIDKnob) {
1154 pluginIDKnob->setValue(p->getPluginID());
1155 }
1156 return;
1157 }
1158
1159 _imp->wasCreatedAsHiddenNode = args.getProperty<bool>(kCreateNodeArgsPropNoNodeGUI);
1160
1161 bool throwErrors = false;
1162 std::string pattern;
1163
1164 if (mayCreateFileDialog) {
1165 if ( !getApp()->isBackground() ) {
1166 pattern = getApp()->openImageFileDialog();
1167
1168 // File dialog was closed, ignore
1169 if ( pattern.empty() ) {
1170 throw std::runtime_error("");
1171 }
1172 }
1173
1174 //The user selected a file, if it fails to read do not create the node
1175 throwErrors = true;
1176 } else {
1177 std::vector<std::string> defaultParamValues = args.getPropertyN<std::string>(kCreateNodeArgsPropNodeInitialParamValues);
1178 std::vector<std::string>::iterator foundFileName = std::find(defaultParamValues.begin(), defaultParamValues.end(), std::string(kOfxImageEffectFileParamName));
1179 if (foundFileName != defaultParamValues.end()) {
1180 std::string propName(kCreateNodeArgsPropParamValue);
1181 propName += "_";
1182 propName += kOfxImageEffectFileParamName;
1183 pattern = args.getProperty<std::string>(propName);
1184 }
1185 }
1186 _imp->createReadNode( throwErrors, pattern, NodeSerializationPtr() );
1187 _imp->refreshPluginSelectorKnob();
1188}
1189
1190void
1191ReadNode::onKnobsAboutToBeLoaded(const NodeSerializationPtr& serialization)

Callers 1

loadMethod · 0.45

Calls 11

getAppFunction · 0.85
emptyMethod · 0.80
lockMethod · 0.45
setValueMethod · 0.45
getPluginIDMethod · 0.45
isBackgroundMethod · 0.45
openImageFileDialogMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
createReadNodeMethod · 0.45

Tested by

no test coverage detected