コード例 #1
0
        private static void CheckLightMapSettings(TreeConjunction conjunction, int candidateInstanceId)
        {
            lightmapSettings = lightmapSettings ? lightmapSettings : CSSettingsTools.GetInSceneLightmapSettings();

            if (lightmapSettings == null)
            {
                return;
            }

            lightmapSettingsSo      = lightmapSettingsSo ?? new SerializedObject(lightmapSettings);
            lightmapParametersField = lightmapParametersField ??
                                      lightmapSettingsSo.FindProperty(
                "m_LightmapEditorSettings.m_LightmapParameters");
            if (lightmapParametersField != null && lightmapParametersField.propertyType ==
                SerializedPropertyType.ObjectReference)
            {
                if (lightmapParametersField.objectReferenceInstanceIDValue == candidateInstanceId)
                {
                    var entry = new ReferencingEntryData
                    {
                        location    = Location.SceneLightingSettings,
                        prefixLabel =
                            "Lighting settings (Scene tab > Lightmapping Settings > Lightmap Parameters)"
                    };

                    conjunction.referencedAtInfo.AddNewEntry(entry);
                }
            }
            else
            {
                Debug.LogError(
                    Maintainer.ConstructError(
                        "Can't find m_LightmapParameters at the LightmapSettings!"));
            }
        }
コード例 #2
0
        private static void CheckRenderSettingsTexture(TreeConjunction conjunction, int candidateInstanceId)
        {
            renderSettings = renderSettings ? renderSettings : CSSettingsTools.GetInSceneRenderSettings();
            if (renderSettings == null)
            {
                return;
            }

            renderSettingsSo = renderSettingsSo ?? new SerializedObject(renderSettings);
            renderHaloField  = renderHaloField ?? renderSettingsSo.FindProperty("m_HaloTexture");

            if (renderHaloField != null && renderHaloField.propertyType == SerializedPropertyType.ObjectReference)
            {
                if (renderHaloField.objectReferenceInstanceIDValue == candidateInstanceId)
                {
                    var entry = new ReferencingEntryData
                    {
                        location    = Location.SceneLightingSettings,
                        prefixLabel = "Lighting settings (Scene tab > Other Settings > Halo Texture)"
                    };

                    conjunction.referencedAtInfo.AddNewEntry(entry);
                }
            }
            else
            {
                Debug.LogError(Maintainer.ConstructError("Can't find m_HaloTexture at the RenderSettings!"));
            }

            renderSpotField = renderSpotField ?? renderSettingsSo.FindProperty("m_SpotCookie");
            if (renderSpotField != null && renderSpotField.propertyType == SerializedPropertyType.ObjectReference)
            {
                if (renderSpotField.objectReferenceInstanceIDValue == candidateInstanceId)
                {
                    var entry = new ReferencingEntryData
                    {
                        location    = Location.SceneLightingSettings,
                        prefixLabel = "Lighting settings (Scene tab > Other Settings > Spot Cookie)"
                    };

                    conjunction.referencedAtInfo.AddNewEntry(entry);
                }
            }
            else
            {
                Debug.LogError(Maintainer.ConstructError("Can't find m_SpotCookie at the RenderSettings!"));
            }

            /*var iterator = renderSettingsSo.GetIterator();
             * while (iterator.Next(true))
             * {
             *      if (iterator.propertyType == SerializedPropertyType.ObjectReference)
             *      {
             *              Debug.Log(iterator.propertyPath + " [" + iterator.objectReferenceValue + "]");
             *      }
             * }*/
        }
コード例 #3
0
        private static void CheckSun(TreeConjunction conjunction, int candidateInstanceId)
        {
            if (RenderSettings.sun == null || RenderSettings.sun.GetInstanceID() != candidateInstanceId)
            {
                return;
            }

            var entry = new ReferencingEntryData
            {
                location    = Location.SceneLightingSettings,
                prefixLabel = "Lighting settings (Scene tab > Environment > Sun Source)"
            };

            conjunction.referencedAtInfo.AddNewEntry(entry);
        }
コード例 #4
0
        private static void CheckLightingDataAsset(TreeConjunction conjunction, int candidateInstanceId)
        {
            if (Lightmapping.lightingDataAsset == null || Lightmapping.lightingDataAsset.GetInstanceID() != candidateInstanceId)
            {
                return;
            }

            var entry = new ReferencingEntryData
            {
                location    = Location.SceneLightingSettings,
                prefixLabel = "Lighting settings (Global maps tab)"
            };

            conjunction.referencedAtInfo.AddNewEntry(entry);
        }
コード例 #5
0
        private static void CheckLightingCubemap(TreeConjunction conjunction, int candidateInstanceId)
        {
            if (RenderSettings.customReflection == null || RenderSettings.customReflection.GetInstanceID() != candidateInstanceId)
            {
                return;
            }

            var entry = new ReferencingEntryData {
                location = Location.SceneLightingSettings
            };

            if (RenderSettings.defaultReflectionMode == DefaultReflectionMode.Custom)
            {
                entry.prefixLabel = "Lighting settings (Scene tab > Environment > Cubemap)";
            }
            else
            {
                entry.prefixLabel =
                    "Lighting settings (Scene tab > Environment > Cubemap), set Reflections > Source > Custom to see";
            }

            conjunction.referencedAtInfo.AddNewEntry(entry);
        }
コード例 #6
0
        private static void CheckNavMesh(TreeConjunction conjunction, int candidateInstanceId)
        {
            navMeshSettingsSo = navMeshSettingsSo ?? new SerializedObject(UnityEditor.AI.NavMeshBuilder.navMeshSettingsObject);
            navMeshDataField  = navMeshDataField ?? navMeshSettingsSo.FindProperty("m_NavMeshData");

            if (navMeshDataField != null && navMeshDataField.propertyType == SerializedPropertyType.ObjectReference)
            {
                if (navMeshDataField.objectReferenceInstanceIDValue == candidateInstanceId)
                {
                    var entry = new ReferencingEntryData
                    {
                        location    = Location.SceneNavigationSettings,
                        prefixLabel = "Navigation settings of scene"
                    };

                    conjunction.referencedAtInfo.AddNewEntry(entry);
                }
            }
            else
            {
                Debug.LogError(
                    Maintainer.ConstructError("Can't find m_NavMeshData at the navMeshSettingsObject!"));
            }
        }
コード例 #7
0
ファイル: TreeBuilder.cs プロジェクト: dqchess/fire-emblem
        public static ReferencesTreeElement BuildTreeBranch(AssetInfo referencedAsset, int depth, int id, List <ReferencesTreeElement> results)
        {
            // excludes assets without references if necessary and excludes assets which were ignored
            if (AssetIsFilteredOut(referencedAsset, depth))
            {
                return(null);
            }

            var    assetPath = referencedAsset.Path;
            var    assetType = referencedAsset.Type;
            string assetTypeName;

            if (referencedAsset.SettingsKind == AssetSettingsKind.NotSettings)
            {
                assetTypeName = assetType != null && !string.IsNullOrEmpty(assetType.Name) ? assetType.Name : "Unknown type";
            }
            else
            {
                assetTypeName = "Settings Asset";
            }

            var element = new ReferencesTreeElement
            {
                id                 = id + results.Count,
                name               = CSPathTools.NicifyAssetPath(referencedAsset.Path, referencedAsset.Kind),
                assetPath          = assetPath,
                assetTypeName      = assetTypeName,
                assetSize          = referencedAsset.Size,
                assetSizeFormatted = CSEditorTools.FormatBytes(referencedAsset.Size),
                assetIsTexture     = assetType != null && (assetType.BaseType == CSReflectionTools.textureType),
                assetSettingsKind  = referencedAsset.SettingsKind,
                isReferenced       = referencedAsset.referencedAtInfoList != null && referencedAsset.referencedAtInfoList.Length > 0,
                depth              = depth
            };

            results.Add(element);

            var recursionId = CheckParentsForRecursion(element, results);

            if (recursionId > -1)
            {
                element.name       += " [RECURSION]";
                element.recursionId = recursionId;
                return(element);
            }

            if (referencedAsset.referencedAtInfoList.Length > 0)
            {
                foreach (var referencedAtInfo in referencedAsset.referencedAtInfoList)
                {
                    //if (CSFilterTools.IsValueMatchesAnyFilter(referencedAtInfo.assetInfo.Path, MaintainerSettings.References.pathIgnoresFilters)) continue;
                    if (referencedAtInfo.assetInfo.Kind == AssetKind.FromPackage)
                    {
                        continue;
                    }

                    var newDepth = depth + 1;

                    if (newDepth > 1)
                    {
                        continue;
                    }

                    var childElement = BuildTreeBranch(referencedAtInfo.assetInfo, newDepth, id, results);
                    if (childElement == null)
                    {
                        continue;
                    }

                    var referencedAtType = referencedAtInfo.assetInfo.Type;

                    if (referencedAtType == CSReflectionTools.gameObjectType ||
                        referencedAtType == CSReflectionTools.sceneAssetType ||
                        referencedAtType == CSReflectionTools.monoScriptType ||
                        referencedAtType == CSReflectionTools.monoBehaviourType ||
                        referencedAtType != null && referencedAtType.BaseType == CSReflectionTools.scriptableObjectType)
                    {
                        if (referencedAtInfo.entries != null)
                        {
                            childElement.referencingEntries = referencedAtInfo.entries;
                        }
                        else
                        {
                            var collectedData = ReferencesFinder.ConjunctionInfoList.FirstOrDefault(d => d.asset == referencedAtInfo.assetInfo);

                            if (collectedData == null)
                            {
                                collectedData = new AssetConjunctions();
                                ReferencesFinder.ConjunctionInfoList.Add(collectedData);
                                collectedData.asset = referencedAtInfo.assetInfo;
                            }

                            var tc = collectedData.conjunctions.FirstOrDefault(c => c.referencedAsset == referencedAsset);

                            if (tc == null)
                            {
                                tc = new TreeConjunction
                                {
                                    referencedAsset  = referencedAsset,
                                    referencedAtInfo = referencedAtInfo
                                };

                                collectedData.conjunctions.Add(tc);
                            }
                            tc.treeElements.Add(childElement);
                        }
                    }
                }
            }

            return(element);
        }