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

Method transformValueAtTimeInternal

Engine/Knob.cpp:1186–1264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1184}
1185
1186bool
1187KnobHelper::transformValueAtTimeInternal(bool useGuiCurve,
1188 double time,
1189 ViewSpec view,
1190 int dimension,
1191 const Transform::Matrix3x3& matrix,
1192 KeyFrame* newKey)
1193{
1194 CurvePtr curve;
1195 KnobGuiIPtr hasGui = getKnobGuiPointer();
1196
1197 if (!useGuiCurve) {
1198 curve = _imp->curves[dimension];
1199 } else {
1200 assert(hasGui);
1201 curve = hasGui->getCurve(view, dimension);
1202 }
1203 assert(curve);
1204
1205 KeyFrame k;
1206 int keyindex = curve->keyFrameIndex(time);
1207 if (keyindex == -1) {
1208 return false;
1209 }
1210
1211 bool gotKey = curve->getKeyFrameWithIndex(keyindex, &k);
1212 if (!gotKey) {
1213 return false;
1214 }
1215
1216 Transform::Point3D p;
1217 p.x = k.getTime();
1218 p.y = k.getValue();
1219 p.z = 1;
1220
1221 p = Transform::matApply(matrix, p);
1222
1223
1224 if ( curve->areKeyFramesValuesClampedToIntegers() ) {
1225 p.y = std::floor(p.y + 0.5);
1226 } else if ( curve->areKeyFramesValuesClampedToBooleans() ) {
1227 p.y = p.y < 0.5 ? 0 : 1;
1228 }
1229
1230 ///Make sure string animation follows up
1231 AnimatingKnobStringHelper* isString = dynamic_cast<AnimatingKnobStringHelper*>(this);
1232 std::string v;
1233 if (isString) {
1234 isString->stringFromInterpolatedValue(k.getValue(), view, &v);
1235 }
1236 keyframeRemoved_virtual(dimension, time);
1237 if (isString) {
1238 double ret;
1239 isString->stringToKeyFrameValue(p.x, view, v, &ret);
1240 }
1241
1242
1243 try {

Callers

nothing calls this directly

Calls 12

matApplyFunction · 0.85
keyFrameIndexMethod · 0.80
getKeyFrameWithIndexMethod · 0.80
getTimeMethod · 0.80
stringToKeyFrameValueMethod · 0.80
floorFunction · 0.50
getCurveMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected