void KnobSerialization::restoreTracks(const boost::shared_ptr<KnobI> & knob, const std::vector<boost::shared_ptr<Natron::Node> > & allNodes) { Double_Knob* isDouble = dynamic_cast<Double_Knob*>( knob.get() ); if ( isDouble && (isDouble->getName() == "center") && (isDouble->getDimension() == 2) ) { isDouble->restoreTracks(slavedTracks,allNodes); } }
bool KnobSerialization::restoreTracks(const boost::shared_ptr<KnobI>& knob,const std::vector<boost::shared_ptr<Natron::Node> >& allNodes) { Double_Knob* isDouble = dynamic_cast<Double_Knob*>(knob.get()); if (!isDouble) { return false; } if (isDouble->getName() != "center" || isDouble->getDimension() != 2) { return false; } isDouble->restoreTracks(slavedTracks,allNodes); return !slavedTracks.empty(); }
std::pair<double,double> Curve::getCurveYRange() const { QReadLocker l(&_imp->_lock); if (!mustClamp()) { throw std::logic_error("Curve::getCurveYRange() called for a curve without owner or Y range"); } if (_imp->owner) { Double_Knob* isDouble = dynamic_cast<Double_Knob*>(_imp->owner); Int_Knob* isInt = dynamic_cast<Int_Knob*>(_imp->owner); if (isDouble) { return isDouble->getMinMaxForCurve(this); } else if(isInt) { return isInt->getMinMaxForCurve(this); } else { return std::make_pair((double)INT_MIN, (double)INT_MAX); } } assert(hasYRange()); return std::make_pair(_imp->yMin, _imp->yMax); }
void MultiInstancePanelPrivate::addTableRow(Node* node) { int newRowIndex = table->rowCount(); table->insertRow(newRowIndex); std::list<boost::shared_ptr<KnobI> > instanceSpecificKnobs; getInstanceSpecificKnobs(node, &instanceSpecificKnobs); ///first add the enabled column { QWidget* enabledContainer = createCheckBoxForTable(true); table->setCellWidget(newRowIndex, 0, enabledContainer); } int columnIndex = 1; for (std::list<boost::shared_ptr<KnobI> >::iterator it = instanceSpecificKnobs.begin();it!=instanceSpecificKnobs.end();++it) { Int_Knob* isInt = dynamic_cast<Int_Knob*>(it->get()); Bool_Knob* isBool = dynamic_cast<Bool_Knob*>(it->get()); Double_Knob* isDouble = dynamic_cast<Double_Knob*>(it->get()); Color_Knob* isColor = dynamic_cast<Color_Knob*>(it->get()); String_Knob* isString = dynamic_cast<String_Knob*>(it->get()); if (!isInt || !isBool || !isDouble || !isColor || !isString) { continue; } bool createCheckBox = false; bool createSpinBox = false; if (isBool) { createCheckBox = true; } else if (isInt || isDouble || isColor) { createSpinBox = true; } for (int i = 0; i < (*it)->getDimension(); ++it) { if (createCheckBox) { assert(isBool); bool checked = isBool->getValue(); QWidget* enabledContainer = createCheckBoxForTable(checked); table->setCellWidget(newRowIndex, columnIndex, enabledContainer); } else if (createSpinBox) { double mini = INT_MIN,maxi = INT_MAX; SpinBox::SPINBOX_TYPE type = SpinBox::DOUBLE_SPINBOX; if (isInt) { mini = isInt->getMinimums()[i]; maxi = isInt->getMaximums()[i]; type = SpinBox::INT_SPINBOX; } else if (isDouble) { mini = isDouble->getMinimums()[i]; maxi = isDouble->getMaximums()[i]; } SpinBox* sb = new SpinBox(NULL,type); sb->setMinimum(mini); sb->setMaximum(maxi); table->setCellWidget(newRowIndex, columnIndex, sb); } else { assert(isString); std::string value = isString->getValue(); LineEdit* le = new LineEdit(NULL); le->setText(value.c_str()); table->setCellWidget(newRowIndex, columnIndex, le); } ++columnIndex; } } }