| 1490 | } |
| 1491 | |
| 1492 | void |
| 1493 | RotoDrawableItem::resetTransformCenter() |
| 1494 | { |
| 1495 | double time = getContext()->getNode()->getApp()->getTimeLine()->currentFrame(); |
| 1496 | RectD bbox = getBoundingBox(time); |
| 1497 | KnobDoublePtr centerKnob = _imp->center; |
| 1498 | |
| 1499 | centerKnob->beginChanges(); |
| 1500 | |
| 1501 | std::pair<int, KnobIPtr> hasMaster = centerKnob->getMaster(0); |
| 1502 | if (hasMaster.second) { |
| 1503 | for (int i = 0; i < centerKnob->getDimension(); ++i) { |
| 1504 | dynamic_cast<KnobI*>( centerKnob.get() )->unSlave(i, false); |
| 1505 | } |
| 1506 | } |
| 1507 | dynamic_cast<KnobI*>( centerKnob.get() )->removeAnimation(ViewSpec::all(), 0); |
| 1508 | dynamic_cast<KnobI*>( centerKnob.get() )->removeAnimation(ViewSpec::all(), 1); |
| 1509 | centerKnob->setValues( (bbox.x1 + bbox.x2) / 2., (bbox.y1 + bbox.y2) / 2., ViewSpec::all(), eValueChangedReasonNatronInternalEdited ); |
| 1510 | if (hasMaster.second) { |
| 1511 | for (int i = 0; i < centerKnob->getDimension(); ++i) { |
| 1512 | dynamic_cast<KnobI*>( centerKnob.get() )->slaveTo(i, hasMaster.second, i); |
| 1513 | } |
| 1514 | } |
| 1515 | centerKnob->endChanges(); |
| 1516 | } |
| 1517 | |
| 1518 | NATRON_NAMESPACE_EXIT |
| 1519 |
nothing calls this directly
no test coverage detected