Main
|
Resume
|
Showreel
|
Blog
|
Script
|
Contact
connexion
go to footer
expand all
|
collapse all
languages
class
All
JScript|XSI
Python|XSI
JScript|WEB
Python|Maya
All
Memo
learning
DDD
php
tool
keyboard tooltips
rig
TestExpr( inExpr )
- All - felixlecha
// Test if an expression is valid or not. It try to apply expression in a known valid expression. function TestExpr( inExpr ) { // Create tmp property named : "Expression_Manager_Eval" var oEvalProp = ActiveSceneRoot.AddProperty("CustomProperty",false,"Expression_Manager_Eval"); var pEval = oEvalProp.AddParameter3( "fEval", siDouble, 0, -999999, 999999, true, false ); // Create a tmp Valid expression var tmpExpr = pEval.AddExpression("0"); var bReturn; try { // Try Apply Expr tmpExpr.definition.Value = inExpr; // Read Evaluate Value var fEvalValue = pEval.Value; // Log Value LogMessage( " Current Expression is valide.\n value : " + fEvalValue ); bReturn = 1; } catch(e) { LogMessage( "Current Expression Error :\n " + e.description ); bReturn = 0; } // Delete tmp Property DeleteObj( oEvalProp ); return bReturn; } // Test an expression // TestExpr( "Fc + 1 + A" );