MCPcopy Create free account
hub / github.com/carbonengine/trinity / SetExpression

Method SetExpression

trinity/Curves/Tr2CurveEulerRotationExpression.cpp:142–174  ·  view source on GitHub ↗

--------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

140
141// --------------------------------------------------------------------------------
142void Tr2CurveEulerRotationExpression::SetExpression( size_t index, const std::string& expression )
143{
144 if( expression.empty() )
145 {
146 m_expressions[index] = expression;
147 return;
148 }
149
150 CcpParser::Variable s_variables[] = {
151 { "time", 0, offsetof( Arguments, m_time ) },
152 { "input1", 0, offsetof( Arguments, m_input1 ) },
153 { "input2", 0, offsetof( Arguments, m_input2 ) },
154 { "input3", 0, offsetof( Arguments, m_input3 ) },
155 { "input4", 0, offsetof( Arguments, m_input4 ) },
156 };
157
158 CcpParser::FunctionView functionView[] = { s_functions };
159 CcpParser::ConstantView constantView[] = { s_constants };
160 CcpParser::VariableView variableView[] = { s_variables };
161
162 CcpParser::Externals externals;
163 externals.functions = functionView;
164 externals.variables = variableView;
165 externals.constants = constantView;
166 auto result = CcpParser::Parse( expression.c_str(), externals, m_programs[index] );
167 if( !result )
168 {
169 CCP_LOGERR( "Tr2CurveEulerRotationExpression::SetExpression invalid expression \"%s\": %s", expression.c_str(), ToString( result, expression.c_str() ).c_str() );
170 return;
171 }
172 m_tempArena.reset( new uint8_t[std::max( m_programs[0].GetTempArenaSize(), std::max( m_programs[1].GetTempArenaSize(), m_programs[2].GetTempArenaSize() ) )] );
173 m_expressions[index] = expression;
174}
175
176// --------------------------------------------------------------------------------
177std::string Tr2CurveEulerRotationExpression::GetExpressionYaw() const

Callers

nothing calls this directly

Calls 4

ParseFunction · 0.85
emptyMethod · 0.80
resetMethod · 0.80
ToStringFunction · 0.50

Tested by

no test coverage detected