Esempio n. 1
0
        private static void ProcessScriptableObjectAsset(string path)
        {
            var mainAsset = AssetDatabase.LoadMainAssetAtPath(path);

            if (mainAsset == null)
            {
                return;
            }

            EntryFinder.currentLocation = Location.ScriptableObjectAsset;

            var addSettings = new EntryAddSettings();

            EntryFinder.TraverseObjectProperties(mainAsset, mainAsset, addSettings);
        }
Esempio n. 2
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();
            }
        }