Add <expression> to animations

Allow complex animation expressions

Example: translate along the y-axis following a sin
function.
<animation>
  <type>translate</type>
  <axis>
    <y>1</y>
  </axis>
  <expression>
    <sin>
      <product>
        <property>/some/position-norm</property>
        <value>6.28</value>
      </product>
    </sin>
  </expression>
</animation>
This commit is contained in:
Torsten Dreyer
2011-01-07 22:43:46 +01:00
parent acec1ba4bf
commit 122d7f681f

View File

@@ -206,6 +206,10 @@ SGExpressiond*
read_value(const SGPropertyNode* configNode, SGPropertyNode* modelRoot,
const char* unit, double defMin, double defMax)
{
const SGPropertyNode * expression = configNode->getNode( "expression" );
if( expression != NULL )
return SGReadDoubleExpression( modelRoot, expression->getChild(0) );
SGExpression<double>* value = 0;
std::string inputPropertyName = configNode->getStringValue("property", "");