Esempio n. 1
0
 public void UpdateScaleCompensate(FbxNode pNode, FbxIOSettings pIOS)
 {
     fbx_wrapperPINVOKE.FbxScene_UpdateScaleCompensate(swigCPtr, FbxNode.getCPtr(pNode), FbxIOSettings.getCPtr(pIOS));
     if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
     {
         throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 2
0
 public void SetLink(FbxNode pNode)
 {
     NativeMethods.FbxCluster_SetLink(swigCPtr, FbxNode.getCPtr(pNode));
     if (NativeMethods.SWIGPendingException.Pending)
     {
         throw NativeMethods.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 3
0
        protected void LinkMeshToSkeleton(FbxScene scene, FbxNode meshNode, FbxNode skelRootNode)
        {
            FbxNode limb1 = skelRootNode.GetChild(0);
            FbxNode limb2 = limb1.GetChild(0);

            FbxCluster rootCluster = FbxCluster.Create(scene, "RootCluster");

            rootCluster.SetLink(skelRootNode);
            rootCluster.SetLinkMode(FbxCluster.ELinkMode.eTotalOne);
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    rootCluster.AddControlPointIndex(4 * i + j, 1.0 - 0.25 * i);
                }
            }

            FbxCluster limb1Cluster = FbxCluster.Create(scene, "Limb1Cluster");

            limb1Cluster.SetLink(limb1);
            limb1Cluster.SetLinkMode(FbxCluster.ELinkMode.eTotalOne);
            for (int i = 1; i < 6; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    limb1Cluster.AddControlPointIndex(4 * i + j, (i == 1 || i == 5 ? 0.25 : 0.5));
                }
            }

            FbxCluster limb2Cluster = FbxCluster.Create(scene, "Limb2Cluster");

            limb2Cluster.SetLink(limb2);
            limb2Cluster.SetLinkMode(FbxCluster.ELinkMode.eTotalOne);
            for (int i = 3; i < 7; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    limb2Cluster.AddControlPointIndex(4 * i + j, 0.25 * (i - 2));
                }
            }

            FbxAMatrix globalTransform = meshNode.EvaluateGlobalTransform();

            rootCluster.SetTransformMatrix(globalTransform);
            limb1Cluster.SetTransformMatrix(globalTransform);
            limb2Cluster.SetTransformMatrix(globalTransform);

            rootCluster.SetTransformLinkMatrix(skelRootNode.EvaluateGlobalTransform());
            limb1Cluster.SetTransformLinkMatrix(limb1.EvaluateGlobalTransform());
            limb2Cluster.SetTransformLinkMatrix(limb2.EvaluateGlobalTransform());

            FbxSkin skin = FbxSkin.Create(scene, "Skin");

            skin.AddCluster(rootCluster);
            skin.AddCluster(limb1Cluster);
            skin.AddCluster(limb2Cluster);
            meshNode.GetMesh().AddDeformer(skin);
        }
Esempio n. 4
0
        protected FbxNode setRootSection(FbxNode property, FbxNode node)
        {
            if (property != null)
            {
                throw new FbxConverterException($"Duplicate root node with name: {property.Name}");
            }

            return(node);
        }
Esempio n. 5
0
 public bool TryGetDeformer(long id, out FbxNode deformer)
 {
     if (_dic is null)
     {
         deformer = default;
         return(false);
     }
     return(_dic.TryGetValue(id, out deformer));
 }
Esempio n. 6
0
        public FbxNode buildLayerElementMaterial(LayerElementMaterial layer)
        {
            FbxNode node = new FbxNode("LayerElementMaterial", 0);

            node.Nodes.Add(new FbxNode("Version", 101));
            buildLayerElement(node, layer);
            node.Nodes.Add(new FbxNode("Materials", layer.Indices.ToArray()));
            return(node);
        }
Esempio n. 7
0
        static void PrintFbxNode(FbxNode node, string prefix = "")
        {
            Console.WriteLine(prefix + node.GetName());

            for (int childIndex = 0; childIndex < node.GetChildCount(); ++childIndex)
            {
                PrintFbxNode(node.GetChild(childIndex), prefix + "--");
            }
        }
Esempio n. 8
0
        public FbxNode buildLayerElementPolygonGroup(LayerElementPolygonGroup layer)
        {
            FbxNode node = new FbxNode("LayerElementPolygonGroup", 0);

            node.Nodes.Add(new FbxNode("Version", 101));
            buildLayerElement(node, layer);
            //node.Nodes.Add(new FbxNode("Materials", layer..ToArray()));
            return(node);
        }
Esempio n. 9
0
        public SemanticResolver(FbxObject fbx)
        {
            _objectsNode = fbx.FindChild(FbxConstStrings.Objects());
            var connectionsNode = fbx.FindChild(FbxConstStrings.Connections());

            _deformerList = new(_objectsNode);
            _connResolver = new(connectionsNode);
            _modelList    = new(_objectsNode);
        }
Esempio n. 10
0
        public FbxNode buildLayerElementNormal(LayerElementNormal layer)
        {
            FbxNode node = new FbxNode("LayerElementNormal", 0);

            node.Nodes.Add(new FbxNode("Version", 102));
            buildLayerElement(node, layer);
            node.Nodes.Add(new FbxNode("Normals", layer.Normals.SelectMany(x => x.GetComponents()).ToArray()));
            return(node);
        }
Esempio n. 11
0
        public ClusterDeformer(FbxNode clusterDeformerNode)
        {
#if DEBUG
            Debug.Assert(clusterDeformerNode.Properties[2].AsString() == "Cluster");
#endif
            _node = clusterDeformerNode;
            ID    = clusterDeformerNode.Properties[0].AsInt64();
            Name  = clusterDeformerNode.Properties[1].AsString();
        }
        private FbxNode CreateTextureNode()
        {
            FbxNode textureNode = new FbxNode("LayerElementTexture", 0)
                                  .AddProperty("Version", 101)
                                  .AddProperty("Name", "\"\"")
                                  .AddProperty("MappingInformationType", "\"AllSame\"")
                                  .AddProperty("ReferenceInformationType", "\"IndexToDirect\"");

            return(textureNode);
        }
Esempio n. 13
0
        public FbxAMatrix GetNodeGlobalTransform(FbxNode pNode, FbxTime pTime, FbxNode.EPivotSet pPivotSet)
        {
            FbxAMatrix ret = new FbxAMatrix(FbxWrapperNativePINVOKE.FbxAnimEvaluator_GetNodeGlobalTransform__SWIG_2(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime), (int)pPivotSet), false);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 14
0
        public FbxVector4 GetNodeLocalScaling(FbxNode pNode, FbxTime pTime)
        {
            FbxVector4 ret = new FbxVector4(FbxWrapperNativePINVOKE.FbxAnimEvaluator_GetNodeLocalScaling__SWIG_3(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime)), false);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 15
0
        public FbxAMatrix GetNodeLocalTransform(FbxNode pNode, FbxTime pTime)
        {
            FbxAMatrix ret = new FbxAMatrix(fbx_wrapperPINVOKE.FbxAnimEvaluator_GetNodeLocalTransform__SWIG_3(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime)), false);

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 16
0
        private bool IsByPolygonVertexMapType(FbxNode node)
        {
            var mapType = node["MappingInformationType"]?.Value as string;

            if (mapType != "ByPolygonVertex")
            {
                return(false);
            }                 //any other types?
            return(true);
        }
Esempio n. 17
0
        public FbxNode buildLayerElementUV(LayerElementUV layer)
        {
            FbxNode node = new FbxNode("LayerElementUV", 0);

            node.Nodes.Add(new FbxNode("Version", 101));
            buildLayerElement(node, layer);
            node.Nodes.Add(new FbxNode("UV", layer.UV.SelectMany(x => x.GetComponents()).ToArray()));
            node.Nodes.Add(new FbxNode("UVIndex", layer.Indices.ToArray()));
            return(node);
        }
        private FbxNode CreateTextureDefinitionNode()
        {
            FbxNode textureNode = new FbxNode("Texture", string.Format("\"Texture::{0}{1}\"", mesh.name, MAIN_TEXTURE_NAME_SUFFIX))
                                  .AddProperty("Type", "\"TextureVideoClip\"")
                                  .AddProperty("Version", 202)
                                  .AddProperty("TextureName", string.Format("\"Texture::{0}{1}\"", mesh.name, MAIN_TEXTURE_NAME_SUFFIX))
                                  .AddProperty("RelativeFilename", string.Format("\"{0}\"", GetDesTextureRelativeFileName()));

            return(textureNode);
        }
Esempio n. 19
0
        public FbxAMatrix GetNodeGlobalTransform(FbxNode pNode, FbxTime pTime, FbxNode.EPivotSet pPivotSet, bool pApplyTarget, bool pForceEval)
        {
            FbxAMatrix ret = new FbxAMatrix(fbx_wrapperPINVOKE.FbxAnimEvaluator_GetNodeGlobalTransform__SWIG_0(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime), (int)pPivotSet, pApplyTarget, pForceEval), false);

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 20
0
        public FbxVector4 GetNodeLocalRotation(FbxNode pNode, FbxTime pTime, FbxNode.EPivotSet pPivotSet)
        {
            FbxVector4 ret = new FbxVector4(fbx_wrapperPINVOKE.FbxAnimEvaluator_GetNodeLocalRotation__SWIG_2(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime), (int)pPivotSet), false);

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 21
0
        public bool AddChild(FbxNode pNode)
        {
            bool ret = NativeMethods.FbxNode_AddChild(swigCPtr, FbxNode.getCPtr(pNode));

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 22
0
    public FbxObjectMaterial(FbxDocument fbxDocument, FbxNode node)
    {
        FbxDocument = fbxDocument;
        Id          = new FbxObjectId {
            Id = (long)node.Properties[0]
        };
        Name = (string)node.Properties[1];

        FbxDocument.ObjectCache.Add(this, Id);
    }
Esempio n. 23
0
        public FbxVector4 GetNodeLocalScaling(FbxNode pNode, FbxTime pTime, FbxNode.EPivotSet pPivotSet, bool pApplyTarget)
        {
            FbxVector4 ret = new FbxVector4(FbxWrapperNativePINVOKE.FbxAnimEvaluator_GetNodeLocalScaling__SWIG_1(swigCPtr, FbxNode.getCPtr(pNode), FbxTime.getCPtr(pTime), (int)pPivotSet, pApplyTarget), false);

            if (FbxWrapperNativePINVOKE.SWIGPendingException.Pending)
            {
                throw FbxWrapperNativePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 24
0
        public virtual bool CheckSpaceInNodeNameRecursive(FbxNode pNode, FbxString pNodeNameList)
        {
            bool ret = fbx_wrapperPINVOKE.FbxWriter_CheckSpaceInNodeNameRecursive(swigCPtr, FbxNode.getCPtr(pNode), FbxString.getCPtr(pNodeNameList));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 25
0
        protected override void CheckScene(FbxScene scene)
        {
            FbxScene origScene = CreateScene(FbxManager);

            // Compare the hierarchy of the two scenes
            FbxNode origRoot   = origScene.GetRootNode();
            FbxNode importRoot = scene.GetRootNode();

            CheckSceneHelper(origRoot, importRoot);
        }
        public virtual bool PropagateNameSpaceChange(FbxNode pNode, FbxString OldNS, FbxString NewNS)
        {
            bool ret = fbx_wrapperPINVOKE.FbxRenamingStrategy_PropagateNameSpaceChange(swigCPtr, FbxNode.getCPtr(pNode), FbxString.getCPtr(OldNS), FbxString.getCPtr(NewNS));

            if (fbx_wrapperPINVOKE.SWIGPendingException.Pending)
            {
                throw fbx_wrapperPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 27
0
        public static FbxAMatrix EvaluateGlobalTransform(FbxNode node)
        {
            return(node.EvaluateGlobalTransform());

            //Warning: Эквивалент node.EvaluateGlobalTransform(). Но обнаружилось отличие на модели BaseMesh_Anim.fbx, эта модель в MaxAxisSystem не происходит конверсия.
            // На этой модели в контексте использования в Skeleton работает корректно. А в контексте использования координат Mesh не корректно: модель повернута на 90 градусов.
            // Видимо еще что-то надо учитывать кроме AxisSystem. Либо в CalculateGlobalTransform AxisSystem учитывается не полностью.
            // Сейчас в этой функции нет необходимости, достаточно node.EvaluateGlobalTransform() т.к. только в момент импорта все вычисляется.
            //return CalculateGlobalTransform(node);
        }
Esempio n. 28
0
        public int Add(FbxNode pNode, FbxMatrix pMatrix)
        {
            int ret = NativeMethods.FbxPose_Add__SWIG_2(swigCPtr, FbxNode.getCPtr(pNode), FbxMatrix.getCPtr(pMatrix));

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 29
0
        public int Add(FbxNode pNode, FbxMatrix pMatrix, bool pLocalMatrix, bool pMultipleBindPose)
        {
            int ret = NativeMethods.FbxPose_Add__SWIG_0(swigCPtr, FbxNode.getCPtr(pNode), FbxMatrix.getCPtr(pMatrix), pLocalMatrix, pMultipleBindPose);

            if (NativeMethods.SWIGPendingException.Pending)
            {
                throw NativeMethods.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 30
0
        static double[] LoadKeyTimes(FbxNode node, AnimationTrackInfo animationTrack)
        {
            HashSet <double> keyFrames = new HashSet <double>();

            LoadKeyFrames(animationTrack, node.LclTranslation, keyFrames, XChannelName, YChannelName, ZChannelName);
            LoadKeyFrames(animationTrack, node.LclRotation, keyFrames, XChannelName, YChannelName, ZChannelName);
            LoadKeyFrames(animationTrack, node.LclScaling, keyFrames, XChannelName, YChannelName, ZChannelName);

            return(keyFrames.OrderBy(_ => _).ToArray());
        }
Esempio n. 31
0
 public FbxScene()
 {
     RootNode = new FbxNode();
 }
Esempio n. 32
0
			public FbxContainerNode(int i, string k, string v, FbxNode[] n) : base (i, k, v, "") {
				subnodes = n;
			}