Пример #1
0
 protected virtual void OpenPrefab()
 {
     if (!sceneNode.prefabOpened)
     {
         var path = AssetDatabase.GetAssetPath(sceneNode.prefab);
         AssetDatabase.OpenAsset(sceneNode.prefab);
     }
     else
     {
         if (openedPrefabRoot != null)
         {
             PrefabUtility.SaveAsPrefabAsset(openedPrefabRoot, openedPrefabPath);
         }
         StageUtility.GoBackToPreviousStage();
     }
 }
Пример #2
0
        void OpenPrefab()
        {
            if (!sceneNode.prefabOpened)
            {
                var path = AssetDatabase.GetAssetPath(sceneNode.prefab);
                AssetDatabase.OpenAsset(sceneNode.prefab);
            }
            else
            {
                if (openedPrefabRoot != null)
                {
                    PrefabUtility.SaveAsPrefabAsset(openedPrefabRoot, openedPrefabPath);
                }
                StageUtility.GoBackToPreviousStage();
            }

            owner.graph.NotifyNodeChanged(nodeTarget);
        }
Пример #3
0
        private static void ProcessPrefab(string path)
        {
            var assetObject = AssetDatabase.LoadMainAssetAtPath(path);

            if (assetObject == null)
            {
                return;
            }

            var prefabRootGameObject = assetObject as GameObject;

            if (prefabRootGameObject == null)
            {
                return;
            }

            bool prefabOpened;
            var  stageRoot = TryGetPrefabRootFromStage(path, assetObject, out prefabOpened);

            if (stageRoot != null)
            {
                prefabRootGameObject = stageRoot;
            }

            EntryFinder.currentLocation = Location.PrefabAssetGameObject;
            CSTraverseTools.TraversePrefabGameObjects(prefabRootGameObject, true, false, EntryFinder.OnGameObjectTraverse);

            // specific cases handling for main asset -----------------------------------------------------

            /*var importSettings = AssetImporter.GetAtPath(path) as ModelImporter;
             * if (importSettings == null) return;
             *
             * var settings = new EntryAddSettings { suffix = "| Model Importer: RIG > Source" };
             * TryAddEntryToMatchedConjunctions(assetConjunctions.conjunctions, prefabRootGameObject, importSettings.sourceAvatar, settings);
             *
             * for (var i = 0; i < importSettings.clipAnimations.Length; i++)
             * {
             *      var clipAnimation = importSettings.clipAnimations[i];
             *      settings.suffix = "| Model Importer: Animations [" + clipAnimation.name + "] > Mask";
             *      TryAddEntryToMatchedConjunctions(assetConjunctions.conjunctions, prefabRootGameObject, clipAnimation.maskSource, settings);
             * }*/

            var allObjectsInPrefab = AssetDatabase.LoadAllAssetsAtPath(path);

            foreach (var objectOnPrefab in allObjectsInPrefab)
            {
                if (objectOnPrefab == null)
                {
                    continue;
                }
                if (objectOnPrefab is GameObject || objectOnPrefab is Component)
                {
                    continue;
                }

                EntryFinder.currentLocation = Location.PrefabAssetObject;

                var addSettings = new EntryAddSettings();

                EntryFinder.TraverseObjectProperties(objectOnPrefab, objectOnPrefab, addSettings);

                /*if (AssetDatabase.IsMainAsset(objectOnPrefab))
                 * {
                 *
                 * }
                 * else*/
                {
                    // specific cases handling ------------------------------------------------------------------------

                    /*if (objectOnPrefab is BillboardAsset)
                     * {
                     *      var billboardAsset = objectOnPrefab as BillboardAsset;
                     *      var settings = new EntryAddSettings { suffix = "| BillboardAsset: Material" };
                     *      TryAddEntryToMatchedConjunctions(assetConjunctions.conjunctions, billboardAsset, billboardAsset.material, settings);
                     * }
                     * else if (objectOnPrefab is TreeData)
                     * {
                     *      CachedObjectData objectInAssetCachedData = null;
                     *      InspectComponent(assetConjunctions.conjunctions, objectOnPrefab, objectOnPrefab, -1, true, ref objectInAssetCachedData);
                     * }*/
                }
            }

            if (prefabOpened)
            {
                StageUtility.GoBackToPreviousStage();
            }
        }