Now PROPERTY_HINT_BUTTON adds the property's name as the called method's first parameter.

This commit is contained in:
Relintai 2024-02-25 22:09:25 +01:00
parent c6c864a683
commit 8c06dce33f
4 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ enum PropertyHint {
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" 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_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_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_KEY_ACCEL, ///< hint_text= "length" (as integer)
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PROPERTY_HINT_LAYERS_2D_RENDER, PROPERTY_HINT_LAYERS_2D_RENDER,

View File

@ -1464,7 +1464,7 @@
Deprecated hint, unused. Deprecated hint, unused.
</constant> </constant>
<constant name="PROPERTY_HINT_BUTTON" value="6" enum="PropertyHint"> <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>
<constant name="PROPERTY_HINT_KEY_ACCEL" value="7" enum="PropertyHint"> <constant name="PROPERTY_HINT_KEY_ACCEL" value="7" enum="PropertyHint">
Deprecated hint, unused. Deprecated hint, unused.

View File

@ -688,7 +688,7 @@ void EditorPropertyButton::_button_pressed() {
//get_edited_object()->get(get_edited_property()); //get_edited_object()->get(get_edited_property());
if (_method_name != "") { if (_method_name != "") {
get_edited_object()->call(_method_name); get_edited_object()->call(_method_name, get_edited_property());
} }
} }

View File

@ -55,7 +55,7 @@ typedef enum {
PANDEMONIUM_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" 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_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_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_KEY_ACCEL, ///< hint_text= "length" (as integer)
PANDEMONIUM_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) PANDEMONIUM_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
PANDEMONIUM_PROPERTY_HINT_LAYERS_2D_RENDER, PANDEMONIUM_PROPERTY_HINT_LAYERS_2D_RENDER,