Skip to content

Commit

Permalink
Now PROPERTY_HINT_BUTTON adds the property's name as the called metho…
Browse files Browse the repository at this point in the history
…d's first parameter.
  • Loading branch information
Relintai committed Feb 25, 2024
1 parent c6c864a commit 8c06dce
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum PropertyHint {
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "full" to also include in/out. (ie: "attenuation,inout")
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
PROPERTY_HINT_BUTTON, // Use a button in the inspector for this property. The property's type has to be Variant::NIL. hint_text="call_func:name/theme_type" -> calls call_func on press, optional: ":name/theme_type" -> get_theme_icon("name", "theme_type")
PROPERTY_HINT_BUTTON, // Use a button in the inspector for this property. The property's type has to be Variant::NIL. hint_text="call_func:name/theme_type" -> calls call_func(const StringName &p_property) on press, optional: ":name/theme_type" -> get_theme_icon("name", "theme_type")
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PROPERTY_HINT_LAYERS_2D_RENDER,
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@
Deprecated hint, unused.
</constant>
<constant name="PROPERTY_HINT_BUTTON" value="6" enum="PropertyHint">
Use a button in the inspector for this property. The property's type has to be Variant::NIL. The hint string has to contain a method that you want called. [code]"my_method"[/code] will call [code]my_method()[/code] on press. Optionally it can also contain a theme icon like: [code]"my_method:name/theme_type"[/code] -&gt; [code]get_theme_icon("name", "theme_type")[/code]
Use a button in the inspector for this property. The property's type has to be Variant::NIL. The hint string has to contain a method that you want called. [code]"my_method"[/code] will call [code]my_method(property : StringName)[/code] on press. Optionally it can also contain a theme icon like: [code]"my_method:name/theme_type"[/code] -&gt; [code]get_theme_icon("name", "theme_type")[/code]
</constant>
<constant name="PROPERTY_HINT_KEY_ACCEL" value="7" enum="PropertyHint">
Deprecated hint, unused.
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ void EditorPropertyButton::_button_pressed() {
//get_edited_object()->get(get_edited_property());

if (_method_name != "") {
get_edited_object()->call(_method_name);
get_edited_object()->call(_method_name, get_edited_property());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ typedef enum {
PANDEMONIUM_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
PANDEMONIUM_PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "full" to also include in/out. (ie: "attenuation,inout")
PANDEMONIUM_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
PANDEMONIUM_PROPERTY_HINT_BUTTON, // Use a button in the inspector for this property. The property's type has to be Variant::NIL. hint_text="call_func:name/theme_type" -> calls call_func on press, optional: ":name/theme_type" -> get_theme_icon("name", "theme_type")
PANDEMONIUM_PROPERTY_HINT_BUTTON, // Use a button in the inspector for this property. The property's type has to be Variant::NIL. hint_text="call_func:name/theme_type" -> calls call_func(const StringName &p_property) on press, optional: ":name/theme_type" -> get_theme_icon("name", "theme_type")
PANDEMONIUM_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
PANDEMONIUM_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PANDEMONIUM_PROPERTY_HINT_LAYERS_2D_RENDER,
Expand Down

0 comments on commit 8c06dce

Please sign in to comment.