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

Method placeWriteNodeKnobsInPage

Engine/WriteNode.cpp:299–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void
300WriteNodePrivate::placeWriteNodeKnobsInPage()
301{
302 KnobIPtr pageKnob = _publicInterface->getKnobByName("Controls");
303 KnobPage* isPage = dynamic_cast<KnobPage*>( pageKnob.get() );
304
305 if (!isPage) {
306 return;
307 }
308 for (std::list<KnobIWPtr>::iterator it = writeNodeKnobs.begin(); it != writeNodeKnobs.end(); ++it) {
309 KnobIPtr knob = it->lock();
310 knob->setParentKnob( KnobIPtr() );
311 isPage->removeKnob( knob.get() );
312 }
313 KnobsVec children = isPage->getChildren();
314 int index = -1;
315 for (std::size_t i = 0; i < children.size(); ++i) {
316 if (children[i]->getName() == kParamLastFrame) {
317 index = i;
318 break;
319 }
320 }
321 if (index != -1) {
322 ++index;
323 for (std::list<KnobIWPtr>::iterator it = writeNodeKnobs.begin(); it != writeNodeKnobs.end(); ++it) {
324 KnobIPtr knob = it->lock();
325 isPage->insertKnob(index, knob);
326 ++index;
327 }
328 }
329
330 // Find the separatorKnob in the page and if the next parameter is also a separator, hide it
331 int foundSep = -1;
332 for (std::size_t i = 0; i < children.size(); ++i) {
333 if (children[i]== separatorKnob.lock()) {
334 foundSep = i;
335 break;
336 }
337 }
338 if (foundSep != -1) {
339 ++foundSep;
340 if (foundSep < (int)children.size()) {
341 bool isSecret = children[foundSep]->getIsSecret();
342 while (isSecret && foundSep < (int)children.size()) {
343 ++foundSep;
344 isSecret = children[foundSep]->getIsSecret();
345 }
346 if (foundSep < (int)children.size()) {
347 separatorKnob.lock()->setSecret(dynamic_cast<KnobSeparator*>(children[foundSep].get()));
348 } else {
349 separatorKnob.lock()->setSecret(true);
350 }
351
352 } else {
353 separatorKnob.lock()->setSecret(true);
354 }
355 }
356

Callers

nothing calls this directly

Calls 14

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