- inputProperty = modelRoot->getNode(inputPropertyName.c_str(), true);
- SGInterpTable* interpTable = read_interpolation_table(configNode);
- if (interpTable) {
- SGInterpTableValue* value;
- value = new SGInterpTableValue(inputProperty, interpTable);
- _animationValue[0] = value;
- _animationValue[1] = value;
- _animationValue[2] = value;
- } else if (configNode->getBoolValue("use-personality", false)) {
- SGPersScaleOffsetValue* value;
- value = new SGPersScaleOffsetValue(inputProperty, configNode,
- "x-factor", "x-offset",
- factor, offset);
- value->setMin(configNode->getDoubleValue("x-min", 0));
- value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
- _animationValue[0] = value;
- value = new SGPersScaleOffsetValue(inputProperty, configNode,
- "y-factor", "y-offset",
- factor, offset);
- value->setMin(configNode->getDoubleValue("y-min", 0));
- value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
- _animationValue[1] = value;
- value = new SGPersScaleOffsetValue(inputProperty, configNode,
- "z-factor", "z-offset",
- factor, offset);
- value->setMin(configNode->getDoubleValue("z-min", 0));
- value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
- _animationValue[2] = value;
- } else {
- SGScaleOffsetValue* value = new SGScaleOffsetValue(inputProperty);
- value->setScale(configNode->getDoubleValue("x-factor", factor));
- value->setOffset(configNode->getDoubleValue("x-offset", offset));
- value->setMin(configNode->getDoubleValue("x-min", 0));
- value->setMax(configNode->getDoubleValue("x-max", SGLimitsd::max()));
- _animationValue[0] = value;
- value = new SGScaleOffsetValue(inputProperty);
- value->setScale(configNode->getDoubleValue("y-factor", factor));
- value->setOffset(configNode->getDoubleValue("y-offset", offset));
- value->setMin(configNode->getDoubleValue("y-min", 0));
- value->setMax(configNode->getDoubleValue("y-max", SGLimitsd::max()));
- _animationValue[1] = value;
- value = new SGScaleOffsetValue(inputProperty);
- value->setScale(configNode->getDoubleValue("z-factor", factor));
- value->setOffset(configNode->getDoubleValue("z-offset", offset));
- value->setMin(configNode->getDoubleValue("z-min", 0));
- value->setMax(configNode->getDoubleValue("z-max", SGLimitsd::max()));
- _animationValue[2] = value;
- }
+ inputProperty = modelRoot->getNode(inputPropertyName, true);
+ inPropExpr = new SGPropertyExpression<double>(inputProperty);
+ }
+
+ SGInterpTable* interpTable = read_interpolation_table(configNode);
+ if (interpTable) {
+ SGSharedPtr<SGExpressiond> value;
+ value = new SGInterpTableExpression<double>(inPropExpr, interpTable);
+ _animationValue[0] = value->simplify();
+ _animationValue[1] = value->simplify();
+ _animationValue[2] = value->simplify();
+ } else if (configNode->getBoolValue("use-personality", false)) {
+ SGSharedPtr<SGExpressiond> value;
+ value = new SGPersonalityScaleOffsetExpression(inPropExpr, configNode,
+ "x-factor", "x-offset",
+ factor, offset);
+ double minClip = configNode->getDoubleValue("x-min", 0);
+ double maxClip = configNode->getDoubleValue("x-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[0] = value->simplify();
+
+ value = new SGPersonalityScaleOffsetExpression(inPropExpr, configNode,
+ "y-factor", "y-offset",
+ factor, offset);
+ minClip = configNode->getDoubleValue("y-min", 0);
+ maxClip = configNode->getDoubleValue("y-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[1] = value->simplify();
+
+ value = new SGPersonalityScaleOffsetExpression(inPropExpr, configNode,
+ "z-factor", "z-offset",
+ factor, offset);
+ minClip = configNode->getDoubleValue("z-min", 0);
+ maxClip = configNode->getDoubleValue("z-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[2] = value->simplify();
+ } else {
+ SGSharedPtr<SGExpressiond> value;
+ value = read_factor_offset(configNode, inPropExpr, "x-factor", "x-offset");
+ double minClip = configNode->getDoubleValue("x-min", 0);
+ double maxClip = configNode->getDoubleValue("x-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[0] = value->simplify();
+
+ value = read_factor_offset(configNode, inPropExpr, "y-factor", "y-offset");
+ minClip = configNode->getDoubleValue("y-min", 0);
+ maxClip = configNode->getDoubleValue("y-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[1] = value->simplify();
+
+ value = read_factor_offset(configNode, inPropExpr, "z-factor", "z-offset");
+ minClip = configNode->getDoubleValue("z-min", 0);
+ maxClip = configNode->getDoubleValue("z-max", SGLimitsd::max());
+ value = new SGClipExpression<double>(value, minClip, maxClip);
+ _animationValue[2] = value->simplify();