Merge pull request #55092 from KoBeWi/thelp_item

Add [theme_item] tag to editor help
This commit is contained in:
Rémi Verschelde 2021-11-18 17:39:17 +01:00 committed by GitHub
commit 4a4b363da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 6 deletions

View File

@ -78,7 +78,7 @@
</member>
<member name="icon" type="Texture2D" setter="set_button_icon" getter="get_button_icon">
Button's icon, if text is present the icon will be placed before the text.
To edit margin and spacing of the icon, use [code]hseparation[/code] theme property of [Button] and [code]content_margin_*[/code] properties of the used [StyleBox]es.
To edit margin and spacing of the icon, use [theme_item hseparation] theme property and [code]content_margin_*[/code] properties of the used [StyleBox]es.
</member>
<member name="icon_align" type="int" setter="set_icon_align" getter="get_icon_align" enum="Button.TextAlign" default="0">
Specifies if the icon should be aligned to the left, right, or center of a button. Uses the same [enum TextAlign] constants as the text alignment. If centered, text will draw on top of the icon.

View File

@ -141,7 +141,7 @@
<argument index="3" name="to_port" type="int" />
<argument index="4" name="amount" type="float" />
<description>
Sets the coloration of the connection between [code]from[/code]'s [code]from_port[/code] and [code]to[/code]'s [code]to_port[/code] with the color provided in the [code]activity[/code] theme property.
Sets the coloration of the connection between [code]from[/code]'s [code]from_port[/code] and [code]to[/code]'s [code]to_port[/code] with the color provided in the [theme_item activity] theme property.
</description>
</method>
<method name="set_selected">

View File

@ -285,10 +285,10 @@
No overlay is shown.
</constant>
<constant name="OVERLAY_BREAKPOINT" value="1" enum="Overlay">
Show overlay set in the [code]breakpoint[/code] theme property.
Show overlay set in the [theme_item breakpoint] theme property.
</constant>
<constant name="OVERLAY_POSITION" value="2" enum="Overlay">
Show overlay set in the [code]position[/code] theme property.
Show overlay set in the [theme_item position] theme property.
</constant>
</constants>
<theme_items>

View File

@ -328,7 +328,7 @@ class State:
theme_item.text,
default_value,
)
class_def.theme_items[theme_item_id] = theme_item_def
class_def.theme_items[theme_item_name] = theme_item_def
tutorials = class_root.find("tutorials")
if tutorials is not None:
@ -905,6 +905,7 @@ def rstize_text(text, state): # type: (str, State) -> str
or cmd.startswith("member")
or cmd.startswith("signal")
or cmd.startswith("constant")
or cmd.startswith("theme_item")
):
param = tag_text[space_pos + 1 :]
@ -941,6 +942,13 @@ def rstize_text(text, state): # type: (str, State) -> str
print_error("Unresolved member '{}', file: {}".format(param, state.current_class), state)
ref_type = "_property"
elif cmd.startswith("theme_item"):
if method_param not in class_def.theme_items:
print_error(
"Unresolved theme item '{}', file: {}".format(param, state.current_class), state
)
ref_type = "_theme_item"
elif cmd.startswith("signal"):
if method_param not in class_def.signals:
print_error("Unresolved signal '{}', file: {}".format(param, state.current_class), state)

View File

@ -109,6 +109,9 @@ void EditorHelp::_class_desc_select(const String &p_select) {
} else if (tag == "constant") {
topic = "class_constant";
table = &this->constant_line;
} else if (tag == "theme_item") {
topic = "theme_item";
table = &this->theme_property_line;
} else {
return;
}
@ -1538,7 +1541,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
p_rt->add_text("[");
pos = brk_pos + 1;
} else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ")) {
} else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ")) {
int tag_end = tag.find(" ");
String link_tag = tag.substr(0, tag_end);