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

Method knobChanged

Engine/ReadNode.cpp:1205–1320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205bool
1206ReadNode::knobChanged(KnobI* k,
1207 ValueChangedReasonEnum reason,
1208 ViewSpec view,
1209 double time,
1210 bool originatedFromMainThread)
1211{
1212 bool ret = true;
1213
1214 if ( ( k == _imp->inputFileKnob.lock().get() ) && (reason != eValueChangedReasonTimeChanged) ) {
1215
1216 NodePtr hasMaster = getNode()->getMasterNode();
1217 if (hasMaster) {
1218 // Unslave all knobs since we are going to remove some and recreate others
1219 unslaveAllKnobs();
1220 }
1221 if (_imp->creatingReadNode) {
1222 NodePtr p = getEmbeddedReader();
1223 if (p) {
1224 p->getEffectInstance()->knobChanged(k, reason, view, time, originatedFromMainThread);
1225 }
1226
1227 return false;
1228 }
1229 try {
1230 _imp->refreshPluginSelectorKnob();
1231 } catch (const std::exception& e) {
1232 setPersistentMessage( eMessageTypeError, e.what() );
1233 }
1234
1235 KnobFilePtr fileKnob = _imp->inputFileKnob.lock();
1236 assert(fileKnob);
1237 std::string filename = fileKnob->getValue();
1238 try {
1239 _imp->createReadNode( false, filename, NodeSerializationPtr() );
1240 } catch (const std::exception& e) {
1241 setPersistentMessage( eMessageTypeError, e.what() );
1242 }
1243 if (hasMaster) {
1244 slaveAllKnobs(hasMaster->getEffectInstance().get(), false);
1245 }
1246 } else if ( k == _imp->pluginSelectorKnob.lock().get() ) {
1247 KnobStringPtr pluginIDKnob = _imp->pluginIDStringKnob.lock();
1248 std::string entry = _imp->pluginSelectorKnob.lock()->getActiveEntry().id;
1249 if ( entry == pluginIDKnob->getValue() ) {
1250 return false;
1251 }
1252
1253 if (entry == "Default") {
1254 entry.clear();
1255 }
1256
1257 pluginIDKnob->setValue(entry);
1258
1259 KnobFilePtr fileKnob = _imp->inputFileKnob.lock();
1260 assert(fileKnob);
1261 std::string filename = fileKnob->getValue();
1262

Callers

nothing calls this directly

Calls 15

getCurrentTimeFunction · 0.85
ViewSpecFunction · 0.85
isVideoReaderFunction · 0.85
getAppFunction · 0.85
getMasterNodeMethod · 0.80
getEffectInstanceMethod · 0.80
getActiveEntryMethod · 0.80
toStdStringMethod · 0.80
canonicalizePathMethod · 0.80
getProjectMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected