예제 #1
0
        // Returns the root, or a node right under the root.
        // Either way, the transform stack is guaranteed to be identity.
        static FbxNode GetGroupNode(FbxManager manager, FbxScene scene, UInt32 group)
        {
            FbxNode root = scene.GetRootNode();

            if (group == 0)
            {
                return(root);
            }
            string  childName = $"group_{group}";
            FbxNode child     = root.FindChild(childName, false);

            if (child == null)
            {
                child = FbxNode.Create(manager, childName);
                root.AddChild(child);
            }
            return(child);
        }
예제 #2
0
파일: Model.cs 프로젝트: ikorin24/Elffy
        public LimbNode(FbxNode node)
        {
            Debug.Assert(node.Properties[2].AsString().ToModelType() == ModelType.LimbNode);
            Node = node;
            ID   = node.Properties[0].AsInt64();
            Name = node.Properties[1].AsString();
            var property70 = node.FindChild(FbxConstStrings.Properties70());

            Translation = default;
            Rotation    = default;
            Scale       = Vector3.One;
            foreach (var p in property70.Children)
            {
                var props = p.Properties;
                if (props.Length < 1 || props[0].Type != FbxPropertyType.String)
                {
                    continue;
                }
                var propTypeName = props[0].AsString();
                if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Translation()))
                {
                    Translation = new Vector3(
                        (float)props[4].AsDouble(),
                        (float)props[5].AsDouble(),
                        (float)props[6].AsDouble());
                }
                else if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Rotation()))
                {
                    Rotation = new Vector3(
                        (float)props[4].AsDouble(),
                        (float)props[5].AsDouble(),
                        (float)props[6].AsDouble());
                }
                else if (propTypeName.SequenceEqual(FbxConstStrings.Lcl_Scaling()))
                {
                    Scale = new Vector3(
                        (float)props[4].AsDouble(),
                        (float)props[5].AsDouble(),
                        (float)props[6].AsDouble());
                }
            }
        }
예제 #3
0
파일: Deformer.cs 프로젝트: ikorin24/Elffy
 public RawArray <int> GetIndices()
 {
     return(_node.FindChild(FbxConstStrings.Indexes()).Properties[0].AsInt32Array());
 }