| 4273 | } |
| 4274 | |
| 4275 | bool |
| 4276 | Node::handleFormatKnob(KnobI* knob) |
| 4277 | { |
| 4278 | boost::shared_ptr<KnobChoice> choice = _imp->pluginFormatKnobs.formatChoice.lock(); |
| 4279 | |
| 4280 | if (!choice) { |
| 4281 | return false; |
| 4282 | } |
| 4283 | |
| 4284 | if ( knob != choice.get() ) { |
| 4285 | return false; |
| 4286 | } |
| 4287 | if (choice->getIsSecret()) { |
| 4288 | return true; |
| 4289 | } |
| 4290 | int curIndex = choice->getValue(); |
| 4291 | Format f; |
| 4292 | if ( !getApp()->getProject()->getProjectFormatAtIndex(curIndex, &f) ) { |
| 4293 | assert(false); |
| 4294 | |
| 4295 | return true; |
| 4296 | } |
| 4297 | |
| 4298 | boost::shared_ptr<KnobInt> size = _imp->pluginFormatKnobs.size.lock(); |
| 4299 | boost::shared_ptr<KnobDouble> par = _imp->pluginFormatKnobs.par.lock(); |
| 4300 | assert(size && par); |
| 4301 | |
| 4302 | _imp->effect->beginChanges(); |
| 4303 | size->blockValueChanges(); |
| 4304 | size->setValues(f.width(), f.height(), ViewSpec::all(), eValueChangedReasonNatronInternalEdited); |
| 4305 | size->unblockValueChanges(); |
| 4306 | par->blockValueChanges(); |
| 4307 | par->setValue( f.getPixelAspectRatio() ); |
| 4308 | par->unblockValueChanges(); |
| 4309 | |
| 4310 | _imp->effect->endChanges(); |
| 4311 | |
| 4312 | return true; |
| 4313 | } |
| 4314 | |
| 4315 | void |
| 4316 | Node::refreshFormatParamChoice(const std::vector<ChoiceOption>& entries, |
no test coverage detected