public static void SetUpCollectionNavigation( string collectionLabel, SceneExplorerState state, ReferenceChain refChain, ReferenceChain oldRefChain, int collectionSize, out uint arrayStart, out uint arrayEnd) { GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(refChain.Indentation); GUILayout.Label($"{collectionLabel} size: {collectionSize}"); if (!state.SelectedArrayStartIndices.TryGetValue(refChain.UniqueId, out arrayStart)) { state.SelectedArrayStartIndices.Add(refChain.UniqueId, 0); } if (!state.SelectedArrayEndIndices.TryGetValue(refChain.UniqueId, out arrayEnd)) { state.SelectedArrayEndIndices.Add(refChain.UniqueId, 32); arrayEnd = 32; } arrayStart = GUIControls.NumericValueField($"{oldRefChain}.arrayStart", "Start index", arrayStart); arrayEnd = GUIControls.NumericValueField($"{oldRefChain}.arrayEnd", "End index", arrayEnd); GUILayout.Label("(32 items max)"); var pageSize = (uint)Mathf.Clamp(arrayEnd - arrayStart + 1, 1, Mathf.Min(32, collectionSize - arrayStart, arrayEnd + 1)); if (GUILayout.Button("◄", GUILayout.ExpandWidth(false))) { arrayStart -= pageSize; arrayEnd -= pageSize; } if (GUILayout.Button("►", GUILayout.ExpandWidth(false))) { arrayStart += pageSize; arrayEnd += pageSize; } arrayStart = (uint)Mathf.Clamp(arrayStart, 0, collectionSize - pageSize); arrayEnd = (uint)Mathf.Max(0, Mathf.Clamp(arrayEnd, pageSize - 1, collectionSize - 1)); if (arrayStart > arrayEnd) { arrayEnd = arrayStart; } if (arrayEnd - arrayStart > 32) { arrayEnd = arrayStart + 32; arrayEnd = (uint)Mathf.Max(0, Mathf.Clamp(arrayEnd, 32, collectionSize - 1)); } state.SelectedArrayStartIndices[refChain.UniqueId] = arrayStart; state.SelectedArrayEndIndices[refChain.UniqueId] = arrayEnd; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
public static void OnSceneTreeComponent(SceneExplorerState state, ReferenceChain refChain, Component component) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (component == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(refChain.Indentation); GUI.contentColor = GameObjectUtil.ComponentIsEnabled(component) ? MainWindow.Instance.Config.EnabledComponentColor : MainWindow.Instance.Config.DisabledComponentColor; if (state.CurrentRefChain?.IsSameChain(refChain) != true) { if (GUILayout.Button(">", GUILayout.ExpandWidth(false))) { var sceneExplorer = Object.FindObjectOfType <SceneExplorer>(); sceneExplorer.Show(refChain, false); } } else { GUI.contentColor = MainWindow.Instance.Config.SelectedComponentColor; state.PreventCircularReferences.Add(component.gameObject); if (GUILayout.Button("<", GUILayout.ExpandWidth(false))) { state.CurrentRefChain = null; } } GUILayout.Label(component.GetType().ToString()); GUI.contentColor = Color.white; GUILayout.EndHorizontal(); }
public static void OnSceneTreeReflectProperty(SceneExplorerState state, ReferenceChain refChain, object obj, PropertyInfo property, TypeUtil.SmartType smartType = TypeUtil.SmartType.Undefined, int nameHighlightFrom = -1, int nameHighlightLength = 0) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (obj == null || property == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(refChain.Indentation); object value = null; Exception exceptionOnGetting = null; if (property.CanRead && MainWindow.Instance.Config.EvaluateProperties || state.EvaluatedProperties.Contains(refChain.UniqueId)) { try { value = property.GetValue(obj, null); } catch (Exception e) { exceptionOnGetting = e; } if (value != null && exceptionOnGetting == null) { GUIExpander.ExpanderControls(state, refChain, property.PropertyType, obj); } } GUI.contentColor = Color.white; if (!property.CanWrite) { GUI.enabled = false; } if (MainWindow.Instance.Config.ShowModifiers) { GUI.contentColor = MainWindow.Instance.Config.MemberTypeColor; GUILayout.Label("property "); if (!property.CanWrite) { GUI.contentColor = MainWindow.Instance.Config.KeywordColor; GUILayout.Label("const "); } } GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(property.PropertyType.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUIMemberName.MemberName(property, nameHighlightFrom, nameHighlightLength); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; if (exceptionOnGetting != null) { GUI.contentColor = Color.red; GUILayout.Label("Exception happened when getting property value"); GUI.contentColor = Color.white; GUI.enabled = true; if (exceptionOnGetting.InnerException != null) { GUIStackTrace.StackTraceButton(new StackTrace(exceptionOnGetting.InnerException, true), exceptionOnGetting.InnerException.Message); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return; } if (!MainWindow.Instance.Config.EvaluateProperties && !state.EvaluatedProperties.Contains(refChain.UniqueId)) { GUI.enabled = true; if (GUILayout.Button("Evaluate")) { state.EvaluatedProperties.Add(refChain.UniqueId); } } else if (value == null || !TypeUtil.IsSpecialType(property.PropertyType)) { if (property.CanRead) { GUILayout.Label(value == null ? "null" : value.ToString()); } else { GUILayout.Label("(no get method)"); } GUI.contentColor = Color.white; } else { try { var newValue = GUIControls.EditorValueField(refChain.UniqueId, property.PropertyType, value); if (newValue != value) { property.SetValue(obj, newValue, null); } } catch (Exception) { if (property.CanRead) { GUILayout.Label(value == null ? "null" : value.ToString()); } else { GUILayout.Label("(no get method)"); } GUI.contentColor = Color.white; } } GUI.enabled = true; GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(refChain, value, valueIndex: 0, smartType); object paste = null; var doPaste = property.CanWrite; if (doPaste) { doPaste = GUIButtons.SetupPasteButon(property.PropertyType, value, out paste); } if (value != null) { GUIButtons.SetupJumpButton(value, refChain); } GUILayout.EndHorizontal(); if (value != null && state.ExpandedObjects.Contains(refChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, refChain, value, false); } if (doPaste) { try { property.SetValue(obj, paste, null); } catch (Exception e) { Logger.Warning(e.Message); } } }
public static void OnSceneTreeReflectICollection(SceneExplorerState state, ReferenceChain refChain, object myProperty, TypeUtil.SmartType elementSmartType = TypeUtil.SmartType.Undefined) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (!(myProperty is ICollection collection)) { return; } var oldRefChain = refChain; var collectionSize = collection.Count; if (collectionSize == 0) { GUILayout.BeginHorizontal(); GUI.contentColor = Color.yellow; GUILayout.Label("Collection is empty!"); GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return; } var collectionItemType = collection.GetType().GetElementType(); var flagsField = collectionItemType?.GetField("m_flags"); var flagIsEnum = flagsField?.FieldType.IsEnum == true && Type.GetTypeCode(flagsField.FieldType) == TypeCode.Int32; GUICollectionNavigation.SetUpCollectionNavigation("Collection", state, refChain, oldRefChain, collectionSize, out var arrayStart, out var arrayEnd); uint count = 0; foreach (var value in collection) { if (count < arrayStart) { count++; continue; } refChain = oldRefChain.Add(count); GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(refChain.Indentation); var isNullOrEmpty = value == null || flagIsEnum && Convert.ToInt32(flagsField.GetValue(value)) == 0; var type = value?.GetType() ?? collectionItemType; if (type != null) { if (!isNullOrEmpty) { GUIExpander.ExpanderControls(state, refChain, type); } GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); } GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label($"{oldRefChain.LastItemName}.[{count}]"); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; GUILayout.Label(value == null ? "null" : isNullOrEmpty ? "empty" : value.ToString()); GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); if (!isNullOrEmpty) { GUIButtons.SetupCommonButtons(refChain, value, count, elementSmartType); } if (value != null) { GUIButtons.SetupJumpButton(value, refChain); } GUILayout.EndHorizontal(); if (!isNullOrEmpty && !TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(refChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, refChain, value, false); } count++; if (count > arrayEnd) { break; } } }
public static void OnSceneTreeRecursive(GameObject modToolsGo, SceneExplorerState state, ReferenceChain refChain, GameObject obj) { #if !DEBUG if (obj == modToolsGo) { return; } #endif if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (obj == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } if (state.ExpandedGameObjects.Contains(refChain.UniqueId)) { try { GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(refChain.Indentation); if (GUILayout.Button("-", GUILayout.ExpandWidth(false))) { state.ExpandedGameObjects.Remove(refChain.UniqueId); } var currentlySelected = state.CurrentRefChain?.IsSameChain(refChain) == true; GUI.contentColor = currentlySelected ? MainWindow.Instance.Config.SelectedComponentColor : obj.activeInHierarchy ? MainWindow.Instance.Config.GameObjectColor : MainWindow.Instance.Config.DisabledComponentColor; GUILayout.Label(obj.name); GUI.contentColor = Color.white; if (currentlySelected) { if (GUILayout.Button("<", GUILayout.ExpandWidth(false))) { state.CurrentRefChain = null; } } else { if (GUILayout.Button(">", GUILayout.ExpandWidth(false))) { var sceneExplorer = Object.FindObjectOfType <SceneExplorer>(); sceneExplorer.Show(refChain, false); } } GUILayout.EndHorizontal(); var gameObjects = new GameObject[obj.transform.childCount]; for (var i = 0; i < obj.transform.childCount; i++) { gameObjects[i] = obj.transform.GetChild(i).gameObject; } if (MainWindow.Instance.Config.SortItemsAlphabetically) { Array.Sort(gameObjects, (x, y) => string.CompareOrdinal(x?.name, y?.name)); } foreach (var gameObject in gameObjects) { OnSceneTreeRecursive(modToolsGo, state, refChain.Add(gameObject), gameObject); } var components = obj.GetComponents(typeof(Component)); if (MainWindow.Instance.Config.SortItemsAlphabetically) { Array.Sort(components, (x, y) => string.CompareOrdinal(x.GetType().ToString(), y.GetType().ToString())); } foreach (var component in components) { GUIComponent.OnSceneTreeComponent(state, refChain.Add(component), component); } } catch (Exception) { state.ExpandedGameObjects.Remove(refChain.UniqueId); throw; } } else { GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(refChain.Indentation); if (GUILayout.Button("+", GUILayout.ExpandWidth(false))) { state.ExpandedGameObjects.Add(refChain.UniqueId); } var currentlySelected = state.CurrentRefChain?.IsSameChain(refChain) == true; GUI.contentColor = currentlySelected ? MainWindow.Instance.Config.SelectedComponentColor : obj.activeInHierarchy ? MainWindow.Instance.Config.GameObjectColor : MainWindow.Instance.Config.DisabledComponentColor; GUILayout.Label(obj.name); GUI.contentColor = Color.white; GUILayout.EndHorizontal(); } }
public static void OnSceneTreeReflectField(SceneExplorerState state, ReferenceChain refChain, object obj, FieldInfo field, TypeUtil.SmartType smartType = TypeUtil.SmartType.Undefined, int nameHighlightFrom = -1, int nameHighlightLength = 0) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (obj == null || field == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(refChain.Indentation); GUI.contentColor = Color.white; object value = null; try { value = field.GetValue(obj); } catch (Exception e) { Debug.LogException(e); } if (value != null) { GUIExpander.ExpanderControls(state, refChain, field.FieldType); } if (field.IsInitOnly) { GUI.enabled = false; } if (MainWindow.Instance.Config.ShowModifiers) { GUI.contentColor = MainWindow.Instance.Config.ModifierColor; if (field.IsPublic) { GUILayout.Label("public "); } else if (field.IsPrivate) { GUILayout.Label("private "); } GUI.contentColor = MainWindow.Instance.Config.MemberTypeColor; GUILayout.Label("field "); if (field.IsStatic) { GUI.contentColor = MainWindow.Instance.Config.KeywordColor; GUILayout.Label("static "); } if (field.IsInitOnly) { GUI.contentColor = MainWindow.Instance.Config.KeywordColor; GUILayout.Label("const "); } } GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(field.FieldType + " "); GUIMemberName.MemberName(field, nameHighlightFrom, nameHighlightLength); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; if (value == null || !TypeUtil.IsSpecialType(field.FieldType)) { GUILayout.Label(value?.ToString() ?? "null"); } else { try { var newValue = GUIControls.EditorValueField(refChain.UniqueId, field.FieldType, value); if (!newValue.Equals(value)) { field.SetValue(obj, newValue); } } catch (Exception) { GUILayout.Label(value.ToString()); } } GUI.enabled = true; GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(refChain, value, valueIndex: 0, smartType); object paste = null; var doPaste = !field.IsLiteral && !field.IsInitOnly; if (doPaste) { doPaste = GUIButtons.SetupPasteButon(field.FieldType, value, out paste); } if (value != null) { GUIButtons.SetupJumpButton(value, refChain); } GUILayout.EndHorizontal(); if (value != null && !TypeUtil.IsSpecialType(field.FieldType) && state.ExpandedObjects.Contains(refChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, refChain, value, false, smartType); } if (doPaste) { try { field.SetValue(obj, paste); } catch (Exception e) { Logger.Warning(e.Message); } } }
public static void OnSceneTreeReflectMethod(ReferenceChain refChain, object obj, MethodInfo method, int nameHighlightFrom = -1, int nameHighlightLength = 0) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (obj == null || method == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(refChain.Indentation); GUI.contentColor = MainWindow.Instance.Config.MemberTypeColor; GUILayout.Label("method "); GUI.contentColor = Color.white; GUILayout.Label(method.ReturnType + " "); GUIMemberName.MemberName(method, nameHighlightFrom, nameHighlightLength); GUI.contentColor = Color.white; GUILayout.Label(method.ReturnType + "("); GUI.contentColor = MainWindow.Instance.Config.NameColor; var first = true; foreach (var param in method.GetParameters()) { if (!first) { GUILayout.Label(", "); } else { first = false; } GUILayout.Label(param.ParameterType.ToString() + " " + param.Name); } GUI.contentColor = Color.white; GUILayout.Label(")"); GUILayout.FlexibleSpace(); if (!method.IsGenericMethod) { if (method.GetParameters().Length == 0) { if (GUILayout.Button("Invoke", GUILayout.ExpandWidth(false))) { method.Invoke(method.IsStatic ? null : obj, new object[] { }); } } else if (method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType.IsInstanceOfType(obj)) { if (GUILayout.Button("Invoke", GUILayout.ExpandWidth(false))) { method.Invoke(method.IsStatic ? null : obj, new[] { obj }); } } } GUILayout.EndHorizontal(); }
public static void OnSceneReflectUnityEngineMaterial( SceneExplorerState state, ReferenceChain refChain, Material material) { Debug.Log($"OnSceneReflectUnityEngineMaterial(): " + System.Environment.StackTrace); if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (material == null) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "null"); return; } GUILayout.BeginHorizontal(); GUI.contentColor = Color.white; GUILayout.Label("Special Properties:"); GUILayout.EndHorizontal(); foreach (var prop in ShaderUtil.GetTextureProperties()) { if (!material.HasProperty(prop)) { continue; } var value = material.GetTexture(prop); if (value == null) { continue; } var newRefChain = refChain.Add(prop); var type = value.GetType(); GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(newRefChain.Indentation + 1); GUIExpander.ExpanderControls(state, newRefChain, type); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label(prop); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; GUILayout.Label(value.ToString()); GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(newRefChain, value, valueIndex: 0); var doPaste = GUIButtons.SetupPasteButon(type, value, out var paste); if (value != null) { GUIButtons.SetupJumpButton(value, newRefChain); } GUILayout.EndHorizontal(); if (!TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(newRefChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, newRefChain, value, false); } if (doPaste) { material.SetTexture(prop, (Texture)paste); } } foreach (var prop in ShaderUtil.GetColorProperties()) { if (!material.HasProperty(prop)) { continue; } var value = material.GetColor(prop); var newRefChain = refChain.Add(prop); var type = value.GetType(); GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(newRefChain.Indentation + 1); GUIExpander.ExpanderControls(state, newRefChain, type); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label(prop); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; var newColor = GUIControls.CustomValueField(newRefChain.UniqueId, string.Empty, GUIControls.PresentColor, value); if (newColor != value) { material.SetColor(prop, newColor); } GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(newRefChain, value, valueIndex: 0); var doPaste = GUIButtons.SetupPasteButon(type, value, out var paste); GUIButtons.SetupJumpButton(value, newRefChain); GUILayout.EndHorizontal(); if (!TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(newRefChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, newRefChain, value, false); } if (doPaste) { material.SetColor(prop, (Color)paste); } } foreach (var prop in ShaderUtil.GetFloatProperties()) { if (!material.HasProperty(prop)) { continue; } var value = material.GetFloat(prop); var newRefChain = refChain.Add(prop); var type = value.GetType(); GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(newRefChain.Indentation + 1); GUIExpander.ExpanderControls(state, newRefChain, type); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label(prop); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; var newValue = GUIControls.NumericValueField(newRefChain.UniqueId, string.Empty, value); if (newValue != value) { material.SetFloat(prop, newValue); } GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(newRefChain, value, 0); var doPaste = GUIButtons.SetupPasteButon(type, value, out var paste); GUIButtons.SetupJumpButton(value, newRefChain); GUILayout.EndHorizontal(); if (!TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(newRefChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, newRefChain, value, false); } if (doPaste) { material.SetColor(prop, (Color)paste); } } foreach (var prop in ShaderUtil.GetVectorProperties()) { if (!material.HasProperty(prop)) { continue; } var value = material.GetVector(prop); var newRefChain = refChain.Add(prop); var type = value.GetType(); GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(newRefChain.Indentation + 1); GUIExpander.ExpanderControls(state, newRefChain, type); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label(prop); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; var newValue = GUIControls.PresentVector4(newRefChain.UniqueId, value); if (newValue != value) { material.SetVector(prop, newValue); } GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUIButtons.SetupCommonButtons(newRefChain, value, valueIndex: 0); var doPaste = GUIButtons.SetupPasteButon(type, value, out var paste); GUIButtons.SetupJumpButton(value, newRefChain); GUILayout.EndHorizontal(); if (!TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(newRefChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, newRefChain, value, false); } if (doPaste) { material.SetColor(prop, (Color)paste); } } var shaderKeywords = material.shaderKeywords; if (shaderKeywords != null && shaderKeywords.Length > 0) { var valueTyoe = shaderKeywords.GetType(); GUILayout.BeginHorizontal(); SceneExplorerCommon.InsertIndent(refChain.Indentation + 2); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(valueTyoe.ToString() + " "); GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label("Shader keywords "); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; GUILayout.Label(string.Join(", ", shaderKeywords)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUIReflect.OnSceneTreeReflect(state, refChain, material, true); }
public static void OnSceneTreeReflectIEnumerable(SceneExplorerState state, ReferenceChain refChain, object myProperty, TypeUtil.SmartType elementSmartType = TypeUtil.SmartType.Undefined) { if (!SceneExplorerCommon.SceneTreeCheckDepth(refChain)) { return; } if (!(myProperty is IEnumerable enumerable)) { return; } uint count = 0; var oldRefChain = refChain; foreach (var value in enumerable) { refChain = oldRefChain.Add(count); GUILayout.BeginHorizontal(GUIWindow.HighlightStyle); SceneExplorerCommon.InsertIndent(refChain.Indentation); var type = value?.GetType(); if (type != null) { GUIExpander.ExpanderControls(state, refChain, type); GUI.contentColor = MainWindow.Instance.Config.TypeColor; GUILayout.Label(type.ToString() + " "); } GUI.contentColor = MainWindow.Instance.Config.NameColor; GUILayout.Label($"{oldRefChain.LastItemName}.[{count}]"); GUI.contentColor = Color.white; GUILayout.Label(" = "); GUI.contentColor = MainWindow.Instance.Config.ValueColor; GUILayout.Label(value == null ? "null" : value.ToString()); GUI.contentColor = Color.white; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (type != null && !TypeUtil.IsSpecialType(type) && state.ExpandedObjects.Contains(refChain.UniqueId)) { GUIReflect.OnSceneTreeReflect(state, refChain, value, false, elementSmartType, string.Empty); } count++; if (count >= 128) { SceneExplorerCommon.OnSceneTreeMessage(refChain, "Enumerable too large to display"); break; } } }