Exemple #1
0
        //Find the cluster that links to the skeleton bone node
        public static FbxCluster FindCluster(FbxNode boneNode, FbxSkin[] skins, out FbxSkin skin)
        {
            for (int i = 0; i < skins.Length; i++)
            {
                skin = skins[i];

                int nClusterCount = skin.GetClusterCount();
                for (int j = 0; j < nClusterCount; j++)
                {
                    FbxCluster fbxCluster = skin.GetCluster(j);
                    if (fbxCluster == null)
                    {
                        continue;
                    }

                    if (fbxCluster.GetLinkMode() == FbxCluster.ELinkMode.eAdditive && fbxCluster.GetAssociateModel() != null)
                    {
                        FbxImportLog.LogMessage(boneNode, "Warning! Associated model.");
                    }

                    if (fbxCluster.GetLink()?.GetUniqueID() == boneNode.GetUniqueID())
                    {
                        return(fbxCluster);
                    }
                }
            }

            skin = null;
            return(null);
        }