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

Method destroyWriteNode

Engine/WriteNode.cpp:411–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409}
410
411void
412WriteNodePrivate::destroyWriteNode()
413{
414 assert( QThread::currentThread() == qApp->thread() );
415 NodePtr embeddedNode = embeddedPlugin.lock();
416 if (!embeddedNode) {
417 return;
418 }
419
420 KnobsVec knobs = _publicInterface->getKnobs();
421
422 genericKnobsSerialization.clear();
423
424 std::string serializationString;
425 try {
426 std::ostringstream ss;
427 boost::archive::xml_oarchive oArchive(ss);
428 std::list<boost::shared_ptr<KnobSerialization> > serialized;
429 for (KnobsVec::iterator it = knobs.begin(); it != knobs.end(); ++it) {
430
431 // The internal node still holds a shared ptr to the knob.
432 // Since we want to keep some knobs around, ensure they do not get deleted in the desctructor of the embedded node
433 embeddedNode->getEffectInstance()->removeKnobFromList(it->get());
434
435 if ( !(*it)->isDeclaredByPlugin() ) {
436 continue;
437 }
438
439 //If it is a knob of this WriteNode, do not destroy it
440 bool isWriteNodeKnob = false;
441 for (std::list<boost::weak_ptr<KnobI> >::iterator it2 = writeNodeKnobs.begin(); it2 != writeNodeKnobs.end(); ++it2) {
442 if (it2->lock() == *it) {
443 isWriteNodeKnob = true;
444 break;
445 }
446 }
447 if (isWriteNodeKnob) {
448 continue;
449 }
450
451 //Keep pages around they will be re-used
452 KnobPage* isPage = dynamic_cast<KnobPage*>( it->get() );
453 if (isPage) {
454 continue;
455 }
456
457 //This is a knob of the Writer plug-in
458
459 //Serialize generic knobs and keep them around until we create a new Writer plug-in
460 bool mustSerializeKnob;
461 bool isGeneric = isGenericKnob( (*it)->getName(), &mustSerializeKnob );
462 if (!isGeneric || mustSerializeKnob) {
463
464 /*if (!isGeneric && !(*it)->getDefaultIsSecret()) {
465 // Don't save the secret state otherwise some knobs could be invisible when cloning the serialization even if we change format
466 (*it)->setSecret(false);
467 }*/
468 boost::shared_ptr<KnobSerialization> s( new KnobSerialization(*it) );

Callers

nothing calls this directly

Calls 15

removeKnobFromListMethod · 0.80
getEffectInstanceMethod · 0.80
isDeclaredByPluginMethod · 0.80
getNameMethod · 0.80
deleteKnobMethod · 0.80
recreateKnobsMethod · 0.80
destroyNodeMethod · 0.80
isGenericKnobFunction · 0.70
lockMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected