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

Method onHideUnmodifiedButtonClicked

Gui/DockablePanel.cpp:1826–1882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1824} // DockablePanel::onEnterInGroupClicked
1825
1826void
1827DockablePanel::onHideUnmodifiedButtonClicked(bool checked)
1828{
1829 if (checked) {
1830 _imp->_knobsVisibilityBeforeHideModif.clear();
1831 const KnobsGuiMapping& knobsMap = getKnobsMapping();
1832 KnobsGuiMapping groups;
1833 std::set<KnobGuiPtr> toHideGui;
1834 std::set<KnobIPtr> toHide;
1835 //printf("hiding...\n");
1836 for (KnobsGuiMapping::const_iterator it = knobsMap.begin(); it != knobsMap.end(); ++it) {
1837 KnobIPtr knob = it->first.lock();
1838 KnobGroup* isGroup = dynamic_cast<KnobGroup*>( knob.get() );
1839 KnobParametric* isParametric = dynamic_cast<KnobParametric*>( knob.get() );
1840 if (isGroup) {
1841 //printf("groups += %s\n",knob->getName().c_str());
1842 groups.push_back(std::make_pair(it->first, it->second));
1843 } else if (!isParametric && !knob->hasModifications() && knob->getName() != kNatronWriteParamStartRender) {
1844 //printf("toHide += %s\n",knob->getName().c_str());
1845 toHide.insert(knob);
1846 toHideGui.insert(it->second);
1847 }
1848 }
1849 // now check if each groups is empty, i.e. all its children are either not visible or going to be hidden
1850 for (KnobsGuiMapping::const_iterator it = groups.begin(); it != groups.end(); ++it) {
1851 KnobIPtr knob = it->first.lock();
1852 KnobGroup* isGroup = dynamic_cast<KnobGroup*>( knob.get() );
1853 assert(isGroup);
1854 std::vector<KnobIPtr> children = isGroup->getChildren();
1855 bool hideMe = true;
1856 //printf("should we hide group %s?\n",knob->getName().c_str());
1857 for (std::vector<KnobIPtr>::const_iterator it2 = children.begin(); it2 != children.end(); ++it2) {
1858 KnobGroup* isGroup2 = dynamic_cast<KnobGroup*>( (*it2).get() );
1859 if (!isGroup2 && toHide.find(*it2) == toHide.end() && !(*it2)->getIsSecret()) {
1860 //printf("- child %s still visible: NO\n",(*it2)->getName().c_str());
1861 hideMe = false;
1862 break;
1863 }
1864 }
1865 if (hideMe) {
1866 toHideGui.insert(it->second);
1867 }
1868 }
1869 for (std::set<KnobGuiPtr>::const_iterator it = toHideGui.begin(); it != toHideGui.end(); ++it) {
1870 _imp->_knobsVisibilityBeforeHideModif.insert( std::make_pair( *it, (*it)->isSecretRecursive() ) );
1871 (*it)->hide();
1872 }
1873 } else {
1874 for (DockablePanelPrivate::KnobGuisMap::iterator it = _imp->_knobsVisibilityBeforeHideModif.begin();
1875 it != _imp->_knobsVisibilityBeforeHideModif.end(); ++it) {
1876 KnobGuiPtr knobGui = it->first.lock();
1877 if (!it->second && knobGui) {
1878 knobGui->show();
1879 }
1880 }
1881 }
1882}
1883

Callers

nothing calls this directly

Calls 15

hasModificationsMethod · 0.80
getNameMethod · 0.80
getIsSecretMethod · 0.80
isSecretRecursiveMethod · 0.80
hideMethod · 0.80
showMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected