Add [theme_item] tag to editor help

This commit is contained in:
kobewi 2021-11-18 15:03:03 +01:00
parent e7216d4085
commit 6f929395d9
5 changed files with 17 additions and 6 deletions

View File

@ -78,7 +78,7 @@
</member> </member>
<member name="icon" type="Texture2D" setter="set_button_icon" getter="get_button_icon"> <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. 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>
<member name="icon_align" type="int" setter="set_icon_align" getter="get_icon_align" enum="Button.TextAlign" default="0"> <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. 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="3" name="to_port" type="int" />
<argument index="4" name="amount" type="float" /> <argument index="4" name="amount" type="float" />
<description> <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> </description>
</method> </method>
<method name="set_selected"> <method name="set_selected">

View File

@ -285,10 +285,10 @@
No overlay is shown. No overlay is shown.
</constant> </constant>
<constant name="OVERLAY_BREAKPOINT" value="1" enum="Overlay"> <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>
<constant name="OVERLAY_POSITION" value="2" enum="Overlay"> <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> </constant>
</constants> </constants>
<theme_items> <theme_items>

View File

@ -328,7 +328,7 @@ class State:
theme_item.text, theme_item.text,
default_value, 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") tutorials = class_root.find("tutorials")
if tutorials is not None: 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("member")
or cmd.startswith("signal") or cmd.startswith("signal")
or cmd.startswith("constant") or cmd.startswith("constant")
or cmd.startswith("theme_item")
): ):
param = tag_text[space_pos + 1 :] 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) print_error("Unresolved member '{}', file: {}".format(param, state.current_class), state)
ref_type = "_property" 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"): elif cmd.startswith("signal"):
if method_param not in class_def.signals: if method_param not in class_def.signals:
print_error("Unresolved signal '{}', file: {}".format(param, state.current_class), state) 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") { } else if (tag == "constant") {
topic = "class_constant"; topic = "class_constant";
table = &this->constant_line; table = &this->constant_line;
} else if (tag == "theme_item") {
topic = "theme_item";
table = &this->theme_property_line;
} else { } else {
return; return;
} }
@ -1538,7 +1541,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
p_rt->add_text("["); p_rt->add_text("[");
pos = brk_pos + 1; 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(" "); int tag_end = tag.find(" ");
String link_tag = tag.substr(0, tag_end); String link_tag = tag.substr(0, tag_end);