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

Method resetInstances

Gui/MultiInstancePanel.cpp:1610–1653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1608}
1609
1610void
1611MultiInstancePanel::resetInstances(const std::list<Node*> & instances)
1612{
1613 if ( instances.empty() ) {
1614 return;
1615 }
1616
1617 std::list<Node*>::const_iterator next = instances.begin();
1618 if ( next != instances.end() ) {
1619 ++next;
1620 }
1621 for (std::list<Node*>::const_iterator it = instances.begin();
1622 it != instances.end();
1623 ++it) {
1624 //invalidate the cache by incrementing the age
1625 (*it)->incrementKnobsAge();
1626 if ( (*it)->areKeyframesVisibleOnTimeline() ) {
1627 (*it)->hideKeyframesFromTimeline( next == instances.end() );
1628 }
1629 const std::vector<KnobIPtr> & knobs = (*it)->getKnobs();
1630 for (U32 i = 0; i < knobs.size(); ++i) {
1631 KnobButton* isBtn = dynamic_cast<KnobButton*>( knobs[i].get() );
1632
1633 if ( !isBtn && (knobs[i]->getName() != kUserLabelKnobName) && (knobs[i]->getName() != kNatronOfxParamStringSublabelName) ) {
1634 knobs[i]->beginChanges();
1635 int dims = knobs[i]->getDimension();
1636 for (int j = 0; j < dims; ++j) {
1637 knobs[i]->resetToDefaultValue(j);
1638 }
1639 knobs[i]->endChanges();
1640 }
1641 }
1642
1643 // increment for next iteration
1644 if ( next != instances.end() ) {
1645 ++next;
1646 }
1647 } // for(it)
1648
1649 instances.front()->getEffectInstance()->incrHashAndEvaluate(true, true);
1650
1651 ///To update interacts, kinda hack but can't figure out where else put this
1652 getMainInstance()->getApp()->redrawAllViewers();
1653}
1654
1655void
1656MultiInstancePanel::onButtonTriggered(KnobButton* button)

Callers

nothing calls this directly

Calls 15

getMainInstanceFunction · 0.85
emptyMethod · 0.80
incrementKnobsAgeMethod · 0.80
getNameMethod · 0.80
resetToDefaultValueMethod · 0.80
incrHashAndEvaluateMethod · 0.80
getEffectInstanceMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected