Exemplo n.º 1
0
        private void OnListViewItemSelected(int index)
        {
            currentCreatorData        = null;
            skeletonCreatorDataDrawer = null;
            partOutputDataDrawer      = null;

            string assetPath = dataListView.GetItem(index);

            if (!string.IsNullOrEmpty(assetPath))
            {
                currentCreatorData        = AssetDatabase.LoadAssetAtPath <AvatarCreatorData>(assetPath);
                skeletonCreatorDataDrawer = new DrawerObject(currentCreatorData.skeletonData)
                {
                    IsShowScroll = true,
                };
                partOutputDataDrawer = new DrawerObject(currentCreatorData.skeletonPartData)
                {
                    IsShowScroll = true
                };
            }

            Repaint();
        }
Exemplo n.º 2
0
        private void DeleteCreatorData(AvatarCreatorData data)
        {
            string skeletonAssetPath = data.skeletonData.GetSkeletonPrefabPath();

            if (AssetDatabase.LoadAssetAtPath <UnityObject>(skeletonAssetPath) != null)
            {
                AssetDatabase.DeleteAsset(skeletonAssetPath);
            }

            AvatarSkeletonPartCreatorData partOutputData = data.skeletonPartData;

            foreach (var partData in partOutputData.partDatas)
            {
                string         partAssetPath  = partData.GetPartAssetPath(partOutputData.outputFolder);
                AvatarPartData avatarPartData = AssetDatabase.LoadAssetAtPath <AvatarPartData>(partAssetPath);
                if (avatarPartData != null)
                {
                    foreach (var avatarRendererPartData in avatarPartData.rendererParts)
                    {
                        if (avatarRendererPartData.mesh != null)
                        {
                            string meshAssetPath = AssetDatabase.GetAssetPath(avatarRendererPartData.mesh);
                            if (Path.GetExtension(meshAssetPath).ToLower() == ".asset" && Path.GetFileNameWithoutExtension(meshAssetPath).EndsWith("_mesh"))
                            {
                                AssetDatabase.DeleteAsset(meshAssetPath);
                            }
                        }
                    }

                    AssetDatabase.DeleteAsset(partAssetPath);
                }
            }

            string assetPath = AssetDatabase.GetAssetPath(currentCreatorData);

            AssetDatabase.DeleteAsset(assetPath);
        }