MCPcopy Create free account
hub / github.com/MrKepzie/Natron / knobChanged

Method knobChanged

Engine/WriteNode.cpp:1150–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1148}
1149
1150bool
1151WriteNode::knobChanged(KnobI* k,
1152 ValueChangedReasonEnum reason,
1153 ViewSpec view,
1154 double time,
1155 bool originatedFromMainThread)
1156{
1157 bool ret = true;
1158 NodePtr writer = _imp->embeddedPlugin.lock();
1159
1160 if ( ( k == _imp->outputFileKnob.lock().get() ) && (reason != eValueChangedReasonTimeChanged) ) {
1161 if (_imp->creatingWriteNode) {
1162 if (writer) {
1163 writer->getEffectInstance()->knobChanged(k, reason, view, time, originatedFromMainThread);
1164 }
1165
1166 return false;
1167 }
1168
1169 NodePtr hasMaster = getNode()->getMasterNode();
1170 if (hasMaster) {
1171 unslaveAllKnobs();
1172 }
1173 try {
1174 _imp->refreshPluginSelectorKnob();
1175 } catch (const std::exception& e) {
1176 setPersistentMessage( eMessageTypeError, e.what() );
1177 }
1178
1179 boost::shared_ptr<KnobOutputFile> fileKnob = _imp->outputFileKnob.lock();
1180 assert(fileKnob);
1181 std::string filename = fileKnob->getValue();
1182
1183 try {
1184 _imp->createWriteNode( false, filename, boost::shared_ptr<NodeSerialization>() );
1185 } catch (const std::exception& e) {
1186 setPersistentMessage( eMessageTypeError, e.what() );
1187 }
1188 if (hasMaster) {
1189 slaveAllKnobs(hasMaster->getEffectInstance().get(), false);
1190 }
1191 } else if ( k == _imp->pluginSelectorKnob.lock().get() ) {
1192 boost::shared_ptr<KnobString> pluginIDKnob = _imp->pluginIDStringKnob.lock();
1193 std::string entry = _imp->pluginSelectorKnob.lock()->getActiveEntry().id;
1194 if ( entry == pluginIDKnob->getValue() ) {
1195 return false;
1196 }
1197
1198 if (entry == "Default") {
1199 entry.clear();
1200 }
1201
1202 pluginIDKnob->setValue(entry);
1203
1204 boost::shared_ptr<KnobOutputFile> fileKnob = _imp->outputFileKnob.lock();
1205 assert(fileKnob);
1206 std::string filename = fileKnob->getValue();
1207

Callers

nothing calls this directly

Calls 15

getEffectInstanceMethod · 0.80
getMasterNodeMethod · 0.80
createWriteNodeMethod · 0.80
getActiveEntryMethod · 0.80
replaceInputMethod · 0.80
getNameMethod · 0.80
getNodeFunction · 0.70
lockMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected