Exemple #1
0
            public FbxObject AddAnimationCurveNode(FbxAnimationCurveNodeType NodeType, Vector3 DefaultValue)
            {
                //	note no name. matters?
                var Node = new FbxObject(AllocIdent(), "AnimationCurveNode");

                Objects.Add(Node);

                //string nodeData = inputId + ", \"AnimCurveNode::" + curveTypeStr + "\", \"\"";
                //FbxDataNode animCurveNode = new FbxDataNode(nodeName, nodeData, 1);
                string CurveTypeStr = GetTypeString(NodeType);

                Node.Definition.AddValue(Node.Ident);
                Node.Definition.AddValue("AnimCurveNode::" + CurveTypeStr);
                Node.Definition.AddValue("");

                //FbxDataNode propertiesNode = new FbxDataNode("Properties70", "", 2);
                //animCurveNode.addSubNode(propertiesNode);
                var PropertiesNode = Node.Definition.AddProperty("Properties70");
                //propertiesNode.addSubNode(new FbxDataNode("P", "\"d|X\", \"Number\", \"\", \"A\"," + initData.x, 3));
                //propertiesNode.addSubNode(new FbxDataNode("P", "\"d|Y\", \"Number\", \"\", \"A\"," + initData.y, 3));
                //propertiesNode.addSubNode(new FbxDataNode("P", "\"d|Z\", \"Number\", \"\", \"A\"," + initData.z, 3));
                var px = PropertiesNode.AddProperty("P");

                px.AddValue("d|X");
                px.AddValue("Number");
                px.AddValue("");
                px.AddValue("A");
                px.AddValue(DefaultValue.x);

                var py = PropertiesNode.AddProperty("P");

                py.AddValue("d|Y");
                py.AddValue("Number");
                py.AddValue("");
                py.AddValue("A");
                py.AddValue(DefaultValue.y);


                var pz = PropertiesNode.AddProperty("P");

                pz.AddValue("d|Z");
                pz.AddValue("Number");
                pz.AddValue("");
                pz.AddValue("A");
                pz.AddValue(DefaultValue.z);

                // release memory
                //animCurveNode.saveDataOnDisk(saveFileFolder);
                //objMainNode.addSubNode(animCurveNode);


                return(Node);
            }
Exemple #2
0
        static string GetTypeString(FbxAnimationCurveNodeType Type)
        {
            switch (Type)
            {
            case FbxAnimationCurveNodeType.Translation: return("T");

            case FbxAnimationCurveNodeType.Rotation: return("R");

            case FbxAnimationCurveNodeType.Scale: return("S");

            case FbxAnimationCurveNodeType.Visibility: return("Visibility");

            default: throw new System.Exception("Unknown type " + Type);
            }
        }
    public void AddAnimationCurveNode(string inputId, FbxAnimationCurveNodeType animCurveType, Vector3 initData)
    {
        string nodeName     = "AnimationCurveNode";
        string curveTypeStr = "";

        if (animCurveType == FbxAnimationCurveNodeType.Translation)
        {
            curveTypeStr = "T";
        }
        else if (animCurveType == FbxAnimationCurveNodeType.Rotation)
        {
            curveTypeStr = "R";
        }
        else if (animCurveType == FbxAnimationCurveNodeType.Scale)
        {
            curveTypeStr = "S";
        }
        else if (animCurveType == FbxAnimationCurveNodeType.Visibility)
        {
            curveTypeStr = "Visibility";
        }

        string nodeData = inputId + ", \"AnimCurveNode::" + curveTypeStr + "\", \"\"";

        FbxDataNode animCurveNode = new FbxDataNode(nodeName, nodeData, 1);

        FbxDataNode propertiesNode = new FbxDataNode("Properties70", "", 2);

        propertiesNode.addSubNode(new FbxDataNode("P", "\"d|X\", \"Number\", \"\", \"A\"," + initData.x, 3));
        propertiesNode.addSubNode(new FbxDataNode("P", "\"d|Y\", \"Number\", \"\", \"A\"," + initData.y, 3));
        propertiesNode.addSubNode(new FbxDataNode("P", "\"d|Z\", \"Number\", \"\", \"A\"," + initData.z, 3));

        animCurveNode.addSubNode(propertiesNode);

        // release memory
        animCurveNode.saveDataOnDisk(saveFileFolder);

        objMainNode.addSubNode(animCurveNode);
    }