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

Method resetTransformCenter

Engine/RotoDrawableItem.cpp:1492–1516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490}
1491
1492void
1493RotoDrawableItem::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
1518NATRON_NAMESPACE_EXIT
1519

Callers

nothing calls this directly

Calls 14

allFunction · 0.85
getMasterMethod · 0.80
unSlaveMethod · 0.80
setValuesMethod · 0.80
currentFrameMethod · 0.45
getTimeLineMethod · 0.45
getAppMethod · 0.45
getNodeMethod · 0.45
beginChangesMethod · 0.45
getDimensionMethod · 0.45
getMethod · 0.45
removeAnimationMethod · 0.45

Tested by

no test coverage detected