| 1038 | } |
| 1039 | |
| 1040 | bool |
| 1041 | KnobHelper::transformValueAtTimeInternal(bool useGuiCurve, |
| 1042 | double time, |
| 1043 | ViewSpec view, |
| 1044 | int dimension, |
| 1045 | const Transform::Matrix3x3& matrix, |
| 1046 | KeyFrame* newKey) |
| 1047 | { |
| 1048 | boost::shared_ptr<Curve> curve; |
| 1049 | boost::shared_ptr<KnobGuiI> hasGui = getKnobGuiPointer(); |
| 1050 | |
| 1051 | if (!useGuiCurve) { |
| 1052 | curve = _imp->curves[dimension]; |
| 1053 | } else { |
| 1054 | assert(hasGui); |
| 1055 | curve = hasGui->getCurve(view, dimension); |
| 1056 | } |
| 1057 | assert(curve); |
| 1058 | |
| 1059 | KeyFrame k; |
| 1060 | int keyindex = curve->keyFrameIndex(time); |
| 1061 | if (keyindex == -1) { |
| 1062 | return false; |
| 1063 | } |
| 1064 | |
| 1065 | bool gotKey = curve->getKeyFrameWithIndex(keyindex, &k); |
| 1066 | if (!gotKey) { |
| 1067 | return false; |
| 1068 | } |
| 1069 | |
| 1070 | Transform::Point3D p; |
| 1071 | p.x = k.getTime(); |
| 1072 | p.y = k.getValue(); |
| 1073 | p.z = 1; |
| 1074 | |
| 1075 | p = Transform::matApply(matrix, p); |
| 1076 | |
| 1077 | |
| 1078 | if ( curve->areKeyFramesValuesClampedToIntegers() ) { |
| 1079 | p.y = std::floor(p.y + 0.5); |
| 1080 | } else if ( curve->areKeyFramesValuesClampedToBooleans() ) { |
| 1081 | p.y = p.y < 0.5 ? 0 : 1; |
| 1082 | } |
| 1083 | |
| 1084 | ///Make sure string animation follows up |
| 1085 | AnimatingKnobStringHelper* isString = dynamic_cast<AnimatingKnobStringHelper*>(this); |
| 1086 | std::string v; |
| 1087 | if (isString) { |
| 1088 | isString->stringFromInterpolatedValue(k.getValue(), view, &v); |
| 1089 | } |
| 1090 | keyframeRemoved_virtual(dimension, time); |
| 1091 | if (isString) { |
| 1092 | double ret; |
| 1093 | isString->stringToKeyFrameValue(p.x, view, v, &ret); |
| 1094 | } |
| 1095 | |
| 1096 | |
| 1097 | try { |
nothing calls this directly
no test coverage detected