Beispiel #1
0
    private void ImportOperation(SplineOperationBuilder splineOperationBuilder, List <OperationRecipe> operations, DsonTypes.DsonDocument doc, DsonTypes.Operation operation)
    {
        if (operation.op == DsonTypes.Operator.Push)
        {
            if (operation.url != null)
            {
                splineOperationBuilder.ConfirmInactive();
                string channelRef = ConvertChannelUri(doc, operation.url);
                operations.Add(OperationRecipe.MakePushChannel(channelRef));
            }
            else
            {
                Object val = operation.val;
                switch (val)
                {
                case JArray arrayValue:
                    float[] values = arrayValue.ToObject <float[]>();
                    splineOperationBuilder.AddValueArray(values);
                    break;

                default:
                    if (splineOperationBuilder.Active)
                    {
                        splineOperationBuilder.AddSize(Convert.ToInt32(operation.val));
                    }
                    else
                    {
                        float value = Convert.ToSingle(operation.val);
                        operations.Add(OperationRecipe.MakePushConstant(value));
                    }
                    break;
                }
            }
        }
        else if (operation.op == DsonTypes.Operator.Add)
        {
            splineOperationBuilder.ConfirmInactive();
            operations.Add(OperationRecipe.Make(OperationRecipe.OperationKind.Add));
        }
        else if (operation.op == DsonTypes.Operator.Sub)
        {
            splineOperationBuilder.ConfirmInactive();
            operations.Add(OperationRecipe.Make(OperationRecipe.OperationKind.Sub));
        }
        else if (operation.op == DsonTypes.Operator.Mult)
        {
            splineOperationBuilder.ConfirmInactive();
            operations.Add(OperationRecipe.Make(OperationRecipe.OperationKind.Mul));
        }
        else if (operation.op == DsonTypes.Operator.Div)
        {
            splineOperationBuilder.ConfirmInactive();
            operations.Add(OperationRecipe.Make(OperationRecipe.OperationKind.Div));
        }
        else if (operation.op == DsonTypes.Operator.SplineTcb)
        {
            operations.Add(splineOperationBuilder.Build());
        }
    }
Beispiel #2
0
    public FormulaRecipe SynthesizeFormula()
    {
        var rootBoneScaleChannelName = bones[0].Name + "?scale/general";

        return(new FormulaRecipe {
            Output = rootBoneScaleChannelName,
            Stage = FormulaRecipe.FormulaStage.Multiply,
            Operations = new List <OperationRecipe> {
                OperationRecipe.MakePushChannel(ChannelName),
                OperationRecipe.MakePushConstant(1),
                OperationRecipe.Make(OperationRecipe.OperationKind.Add)
            }
        });
    }