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

Method onEffectCreated

Engine/WriteNode.cpp:1083–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1081} // WriteNode::initializeKnobs
1082
1083void
1084WriteNode::onEffectCreated(bool mayCreateFileDialog,
1085 const CreateNodeArgs& args)
1086{
1087
1088 RenderEnginePtr engine = getRenderEngine();
1089 assert(engine);
1090 QObject::connect(engine.get(), SIGNAL(renderFinished(int)), this, SLOT(onSequenceRenderFinished()));
1091
1092 if ( !_imp->renderButtonKnob.lock() ) {
1093 _imp->renderButtonKnob = std::dynamic_pointer_cast<KnobButton>( getKnobByName(kNatronWriteParamStartRender) );
1094 assert( _imp->renderButtonKnob.lock() );
1095 }
1096
1097
1098 //If we already loaded the Writer, do not do anything
1099 if ( _imp->embeddedPlugin.lock() ) {
1100 // Ensure the plug-in ID knob has the same value as the created reader:
1101 // The reader might have been created in onKnobsAboutToBeLoaded() however the knobs
1102 // get loaded afterwards and the plug-in ID could not reflect the underlying plugin
1103 KnobStringPtr pluginIDKnob = _imp->pluginIDStringKnob.lock();
1104 if (pluginIDKnob) {
1105 pluginIDKnob->setValue(_imp->embeddedPlugin.lock()->getPluginID());
1106 }
1107 return;
1108 }
1109 bool throwErrors = false;
1110 KnobStringPtr pluginIdParam = _imp->pluginIDStringKnob.lock();
1111 std::string pattern;
1112
1113 if (mayCreateFileDialog) {
1114 bool useDialogForWriters = appPTR->getCurrentSettings()->isFileDialogEnabledForNewWriters();
1115 if (useDialogForWriters) {
1116 pattern = getApp()->saveImageFileDialog();
1117 }
1118
1119 //The user selected a file, if it fails to read do not create the node
1120 throwErrors = true;
1121 } else {
1122
1123 std::vector<std::string> defaultParamValues = args.getPropertyN<std::string>(kCreateNodeArgsPropNodeInitialParamValues);
1124 std::vector<std::string>::iterator foundFileName = std::find(defaultParamValues.begin(), defaultParamValues.end(), std::string(kOfxImageEffectFileParamName));
1125 if (foundFileName != defaultParamValues.end()) {
1126 std::string propName(kCreateNodeArgsPropParamValue);
1127 propName += "_";
1128 propName += kOfxImageEffectFileParamName;
1129 pattern = args.getProperty<std::string>(propName);
1130 }
1131 }
1132
1133 _imp->createWriteNode( throwErrors, pattern, NodeSerializationPtr() );
1134 _imp->refreshPluginSelectorKnob();
1135}
1136
1137void
1138WriteNode::onKnobsAboutToBeLoaded(const NodeSerializationPtr& serialization)

Callers

nothing calls this directly

Calls 13

getRenderEngineFunction · 0.85
getAppFunction · 0.85
getCurrentSettingsMethod · 0.80
createWriteNodeMethod · 0.80
getMethod · 0.45
lockMethod · 0.45
setValueMethod · 0.45
getPluginIDMethod · 0.45
saveImageFileDialogMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected