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

Method placeReadNodeKnobsInPage

Engine/ReadNode.cpp:342–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342void
343ReadNodePrivate::placeReadNodeKnobsInPage()
344{
345 KnobIPtr pageKnob = _publicInterface->getKnobByName("Controls");
346 KnobPage* isPage = dynamic_cast<KnobPage*>( pageKnob.get() );
347
348 if (!isPage) {
349 return;
350 }
351 for (std::list<KnobIWPtr>::iterator it = readNodeKnobs.begin(); it != readNodeKnobs.end(); ++it) {
352 KnobIPtr knob = it->lock();
353 knob->setParentKnob( KnobIPtr() );
354 isPage->removeKnob( knob.get() );
355 }
356
357 KnobsVec children = isPage->getChildren();
358 int index = -1;
359 for (std::size_t i = 0; i < children.size(); ++i) {
360 if (children[i]->getName() == kParamCustomFps) {
361 index = i;
362 break;
363 }
364 }
365 if (index != -1) {
366 ++index;
367 for (std::list<KnobIWPtr>::iterator it = readNodeKnobs.begin(); it != readNodeKnobs.end(); ++it) {
368 KnobIPtr knob = it->lock();
369 isPage->insertKnob(index, knob);
370 ++index;
371 }
372 }
373
374 children = isPage->getChildren();
375 // Find the separatorKnob in the page and if the next parameter is also a separator, hide it
376 int foundSep = -1;
377 for (std::size_t i = 0; i < children.size(); ++i) {
378 if (children[i]== separatorKnob.lock()) {
379 foundSep = i;
380 break;
381 }
382 }
383 if (foundSep != -1) {
384 ++foundSep;
385 if (foundSep < (int)children.size()) {
386 bool isSecret = children[foundSep]->getIsSecret();
387 while (isSecret && foundSep < (int)children.size()) {
388 ++foundSep;
389 isSecret = children[foundSep]->getIsSecret();
390 }
391 if (foundSep < (int)children.size()) {
392 separatorKnob.lock()->setSecret(dynamic_cast<KnobSeparator*>(children[foundSep].get()));
393 } else {
394 separatorKnob.lock()->setSecret(true);
395 }
396
397 } else {
398 separatorKnob.lock()->setSecret(true);
399 }

Callers

nothing calls this directly

Calls 13

setParentKnobMethod · 0.80
removeKnobMethod · 0.80
getNameMethod · 0.80
getIsSecretMethod · 0.80
getKnobByNameMethod · 0.45
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
getChildrenMethod · 0.45
sizeMethod · 0.45
insertKnobMethod · 0.45

Tested by

no test coverage detected