Example #1
0
    private static void ProcessCommand(string aCommandLine)
    {
        int    argumentsStart = aCommandLine.IndexOf(OPERATOR_ARGUMENTS_START);
        string command        = argumentsStart > 0 ? aCommandLine.Substring(0, argumentsStart) : aCommandLine;

        string[] arguments = GetArguments(aCommandLine);

        for (int i = 0; i < mCommands.Length; ++i)
        {
            if (mCommands[i].name == command && mCommands[i].arguments == arguments.Length)
            {
                PMesh.BaseRule rule = mCommands[i].ruleObject.DeepCopy();
                rule.SetVariables(arguments, aCommandLine);
                mCurrentSet.mRules.Add(rule);
            }
        }
    }
Example #2
0
        private eRuleReply ProcessRule(BaseRule aRule, Shape aShape)
        {
            Dictionary <string, float> variables = new Dictionary <string, float>();

            foreach (KeyValuePair <string, float> kvp in mVariables)
            {
                variables.Add(kvp.Key, kvp.Value);
            }
            variables.Add("scope.position.x", aShape.mScope.mPosition.x);
            variables.Add("scope.position.y", aShape.mScope.mPosition.y);
            variables.Add("scope.position.z", aShape.mScope.mPosition.z);
            variables.Add("scope.scale.x", aShape.mScope.mScale.x);
            variables.Add("scope.scale.y", aShape.mScope.mScale.y);
            variables.Add("scope.scale.z", aShape.mScope.mScale.z);
            if (aShape.mSplitData != null)
            {
                variables.Add("split.index", aShape.mSplitData.mSplitIndex);
                variables.Add("split.total", aShape.mSplitData.mSplitTotal);
            }
            mExpressionParser.SetVariables(variables);

            return(aRule.Process(aShape, ref mTempShapes, mExpressionParser));
        }