Esempio n. 1
0
        static List <UniGLTF.MeshUtility.MeshIntegrationResult> Integrate(GameObject root, IEnumerable <Mesh> excludes, bool separateByBlendShape)
        {
            var results = new List <UniGLTF.MeshUtility.MeshIntegrationResult>();

            if (separateByBlendShape)
            {
                results.Add(MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: MeshEnumerateOption.OnlyWithoutBlendShape, excludes: excludes));
                results.Add(MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: MeshEnumerateOption.OnlyWithBlendShape, excludes: excludes));
            }
            else
            {
                results.Add(MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: MeshEnumerateOption.All, excludes: excludes));
            }
            return(results);
        }
        public static List <UniGLTF.MeshUtility.MeshIntegrationResult> Integrate(GameObject root, List <BlendShapeClip> blendshapeClips)
        {
            var result = new List <UniGLTF.MeshUtility.MeshIntegrationResult>();

            var withoutBlendShape = MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: false);

            if (withoutBlendShape.IntegratedRenderer != null)
            {
                result.Add(withoutBlendShape);
            }

            var onlyBlendShape = MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: true);

            if (onlyBlendShape.IntegratedRenderer != null)
            {
                result.Add(onlyBlendShape);
                FollowBlendshapeRendererChange(blendshapeClips, onlyBlendShape, root);
            }

            return(result);
        }
Esempio n. 3
0
        void OnValidate()
        {
            isValid = false;
            if (m_root == null)
            {
                Clear(HelpMessage.SetTarget, ValidationError.NoTarget);
                return;
            }

            if (m_root.GetGameObjectType() != GameObjectType.AssetPrefab)
            {
                Clear(HelpMessage.SetTarget, ValidationError.NotPrefab);
                return;
            }

            if (m_root.transform.parent != null)
            {
                Clear(HelpMessage.InvalidTarget, ValidationError.HasParent);
                return;
            }

            var backup = m_excludes.ToArray();

            Clear(HelpMessage.Ready, ValidationError.None);
            isValid           = true;
            m_uniqueMaterials = MeshIntegratorUtility.EnumerateSkinnedMeshRenderer(m_root.transform, MeshEnumerateOption.OnlyWithoutBlendShape)
                                .SelectMany(x => x.sharedMaterials)
                                .Distinct()
                                .ToArray();

            m_duplicateMaterials = m_uniqueMaterials
                                   .GroupBy(x => GetMaterialKey(x), x => x)
                                   .Select(x => new MaterialList(x.ToArray()))
                                   .Where(x => x.Materials.Length > 1)
                                   .ToArray()
            ;

            UpdateExcludes(backup);
        }
Esempio n. 4
0
        void OnValidate()
        {
            Debug.Log("OnValidate");
            if (m_root == null)
            {
                m_uniqueMaterials    = new Material[] { };
                m_duplicateMaterials = new MaterialList[] { };
                return;
            }

            m_uniqueMaterials = MeshIntegratorUtility.EnumerateSkinnedMeshRenderer(m_root.transform, false)
                                .SelectMany(x => x.sharedMaterials)
                                .Distinct()
                                .ToArray();

            m_duplicateMaterials = m_uniqueMaterials
                                   .GroupBy(x => GetMaterialKey(x), x => x)
                                   .Select(x => new MaterialList(x.ToArray()))
                                   .Where(x => x.Materials.Length > 1)
                                   .ToArray()
            ;
        }