From 6598eb954750e869cea700059619174990da3f4c Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 12 Apr 2022 11:45:15 +0800 Subject: [PATCH] Improves EditorInspector documentation (cherry picked from commit 2fa3c65d30fc60ae701d17434d8fd88d0a0454a9) --- doc/classes/@GlobalScope.xml | 2 +- doc/classes/EditorInspector.xml | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 37b230aa6ab..d957afbed5f 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1501,7 +1501,7 @@ The property is a translatable string. - Used to group properties together in the editor. + Used to group properties together in the editor. See [EditorInspector]. Used to categorize properties together in the editor. diff --git a/doc/classes/EditorInspector.xml b/doc/classes/EditorInspector.xml index 4cd815ba3aa..291b86f2434 100644 --- a/doc/classes/EditorInspector.xml +++ b/doc/classes/EditorInspector.xml @@ -1,11 +1,14 @@ - A tab used to edit properties of the selected node. + A control used to edit properties of an object. - The editor inspector is by default located on the right-hand side of the editor. It's used to edit the properties of the selected node. For example, you can select a node such as [Sprite] then edit its transform through the inspector tool. The editor inspector is an essential tool in the game development workflow. - [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_inspector]. + This is the control that implements property editing in the editor's Settings dialogs, the Inspector dock, etc. To get the [EditorInspector] used in the editor's Inspector dock, use [method EditorInterface.get_inspector]. + [EditorInspector] will show properties in the same order as the array returned by [method Object.get_property_list]. + If a property's name is path-like (i.e. if it contains forward slashes), [EditorInspector] will create nested sections for "directories" along the path. For example, if a property is named [code]highlighting/gdscript/node_path_color[/code], it will be shown as "Node Path Color" inside the "GDScript" section nested inside the "Highlighting" section. + If a property has [constant @GlobalScope.PROPERTY_USAGE_GROUP] usage, it will group subsequent properties whose name starts with the property's hint string. The group ends when a property does not start with that hint string or when a new group starts. An empty group name effectively ends the current group. [EditorInspector] will create a top-level section for each group. For example, if a property with group usage is named [code]Collide With[/code] and its hint string is [code]collide_with_[/code], a subsequent [code]collide_with_area[/code] property will be shown as "Area" inside the "Collide With" section. + [b]Note:[/b] Unlike sections created from path-like property names, [EditorInspector] won't capitalize the name for sections created from groups. So properties with group usage usually use capitalized names instead of snake_cased names.