コード例 #1
0
        /// <summary>
        /// 收集依赖
        /// </summary>
        public static ResDepSkinnedMesh CollectDependencies(GameObject go, bool bCollectChildren)
        {
            ResDepSkinnedMesh dep = null;

            EditorUtil.VisitComponents <SkinnedMeshRenderer>(go, bCollectChildren, renderer =>
            {
                // 没有Mesh
                if (null == renderer.sharedMesh)
                {
                    Debug.LogErrorFormat("Null mesh of \"{0}\"!", go.name);
                    return;
                }

                if (null == dep)
                {
                    dep = new ResDepSkinnedMesh();
                }

                // 生成信息
                var item      = new Item();
                item.go       = go;
                item.renderer = renderer;
                item.mesh     = renderer.sharedMesh;
                dep._items.Add(item);

                // 备份材质
                AssetsBackuper.inst.Backup(item.mesh);
            });

            return(dep);
        }
コード例 #2
0
        /// <summary>
        /// 收集依赖
        /// </summary>
        public static void CollectRendererDependencies(GameObject go, bool bCollectChildren, List <ResDepBase> list, GameObject refObject = null, bool bCollectLightmap = true)
        {
            // 模型
            {
                MeshFilter meshfilter = null;
                if (refObject != null)
                {
                    meshfilter = refObject.GetComponent <MeshFilter>();
                }
                var dep = ResDepMesh.CollectDependencies(go, bCollectChildren, meshfilter);
                if (null != dep)
                {
                    list.Add(dep);
                }
            }

            // 蒙皮
            {
                var dep = ResDepSkinnedMesh.CollectDependencies(go, bCollectChildren);
                if (null != dep)
                {
                    list.Add(dep);
                }
            }

            // 贴图
            {
                var dep = ResDepTexture.CollectDependencies(go, bCollectChildren);
                if (null != dep)
                {
                    list.Add(dep);
                }
            }

            // Lightmap
            if (bCollectLightmap)
            {
                var dep = ResDepLightMap.CollectDependencies(refObject ?? go, bCollectChildren);
                if (null != dep)
                {
                    list.Add(dep);
                }
            }
        }