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

Method destroyWriteNode

Engine/WriteNode.cpp:408–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408void
409WriteNodePrivate::destroyWriteNode()
410{
411 assert( QThread::currentThread() == qApp->thread() );
412 NodePtr embeddedNode = embeddedPlugin.lock();
413 if (!embeddedNode) {
414 return;
415 }
416
417 KnobsVec knobs = _publicInterface->getKnobs();
418
419 genericKnobsSerialization.clear();
420
421 std::string serializationString;
422 try {
423 std::ostringstream ss;
424 { // see http://boost.2283326.n4.nabble.com/the-boost-xml-serialization-to-a-stringstream-does-not-have-an-end-tag-td2580772.html
425 // xml_oarchive must be destroyed before obtaining ss.str(), or the </boost_serialization> tag is missing,
426 // which throws an exception in boost 1.66.0, due to the following change:
427 // https://fossies.org/diffs/boost/1_65_1_vs_1_66_0/libs/serialization/src/basic_xml_grammar.ipp-diff.html
428 // see also https://svn.boost.org/trac10/ticket/13400
429 // see also https://svn.boost.org/trac10/ticket/13354
430
431 boost::archive::xml_oarchive oArchive(ss);
432 std::list<KnobSerializationPtr> serialized;
433 for (KnobsVec::iterator it = knobs.begin(); it != knobs.end(); ++it) {
434
435 // The internal node still holds a shared ptr to the knob.
436 // Since we want to keep some knobs around, ensure they do not get deleted in the destructor of the embedded node
437 embeddedNode->getEffectInstance()->removeKnobFromList(it->get());
438
439 if ( !(*it)->isDeclaredByPlugin() ) {
440 continue;
441 }
442
443 //If it is a knob of this WriteNode, do not destroy it
444 bool isWriteNodeKnob = false;
445 for (std::list<KnobIWPtr>::iterator it2 = writeNodeKnobs.begin(); it2 != writeNodeKnobs.end(); ++it2) {
446 if (it2->lock() == *it) {
447 isWriteNodeKnob = true;
448 break;
449 }
450 }
451 if (isWriteNodeKnob) {
452 continue;
453 }
454
455 //Keep pages around they will be re-used
456 KnobPage* isPage = dynamic_cast<KnobPage*>( it->get() );
457 if (isPage) {
458 continue;
459 }
460
461 //This is a knob of the Writer plug-in
462
463 //Serialize generic knobs and keep them around until we create a new Writer plug-in
464 bool mustSerializeKnob;
465 bool isGeneric = isGenericKnob( (*it)->getName(), &mustSerializeKnob );

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