public void DrawPropertyTree() { if (this.ScriptableObj == null) { return; } if (this.window.isScanning && Event.current.type == EventType.Repaint) { OdinInspectorValidationChecker.BeginValidationCheck(); } GUILayout.BeginVertical(new GUIStyle() { padding = new RectOffset(10, 10, 6, 10) }); { if (this.propertyTree != null) { if (this.window.isScanning) { InspectorUtilities.BeginDrawPropertyTree(this.propertyTree, true); foreach (var property in this.propertyTree.EnumerateTree(true)) { try { InspectorUtilities.DrawProperty(property); } catch (System.Exception ex) { if (ex is ExitGUIException || ex.InnerException is ExitGUIException) { throw ex; } Debug.Log("The following exception was thrown when drawing property " + property.Path + "."); Debug.LogException(ex); } } InspectorUtilities.EndDrawPropertyTree(this.propertyTree); } else { this.propertyTree.Draw(); } } else { SirenixEditorGUI.ErrorMessageBox("Missing Reference."); } } GUILayout.EndVertical(); if (this.window.isScanning && Event.current.type == EventType.Repaint) { // We can't count the correct the correct number of warnings and errors for each behavior // until we have a proper way of drawing a property tree with the guarantee that every property will be drawn. this.WarningCount = OdinInspectorValidationChecker.WarningMessages.Count(); this.ErrorCount = OdinInspectorValidationChecker.ErrorMessages.Count(); OdinInspectorValidationChecker.EndValidationCheck(); } }
/// <summary> /// Draws all properties in a given property tree; must be wrapped by a <see cref="BeginDrawPropertyTree(PropertyTree, bool)"/> and <see cref="EndDrawPropertyTree(PropertyTree)"/>. /// </summary> /// <param name="tree">The tree to be drawn.</param> public static void DrawPropertiesInTree(PropertyTree tree) { foreach (var property in tree.EnumerateTree(false)) { try { InspectorUtilities.DrawProperty(property); } catch (Exception ex) { if (ex is ExitGUIException || ex.InnerException is ExitGUIException) { throw ex; } else { Debug.Log("The following exception was thrown when drawing property " + property.Path + "."); Debug.LogException(ex); } } } }
/// <summary> /// Draws this property in the inspector with a given label. This is a shorthand for <see cref="InspectorUtilities.DrawProperty(InspectorProperty, GUIContent)"/>. /// </summary> public void Draw(GUIContent label) { InspectorUtilities.DrawProperty(this, label); }
/// <summary> /// Draws this property in the inspector. This is a shorthand for <see cref="InspectorUtilities.DrawProperty(InspectorProperty)"/>. /// </summary> public void Draw() { InspectorUtilities.DrawProperty(this); }