RLinkButton
Turns a method from non-tool class into a button in editor
@export var hello_world := RLinkButton.new(hello_world_impl)
func hello_world_impl() -> void:
print("Hello World")Properties
text: String
The button's text that will be displayed inside the button's area
tooltip_text: String
Sets Control.tooltip_text
icon: String
Sets editor icon by name, setting it unsets icon_texture
icon_texture: Texture2D
Sets texture as icon, unsets icon
icon_alignment: HorizontalAlignment
Icon behavior for Button.icon_alignment
icon_alignment_vertical: VerticalAlignment
Icon behavior for Button.vertical_icon_alignment
modulate: Color
Sets CanvasItem.modulate on button
max_width: int
Sets maximum width, can be shrunk
min_height: int
Sets minimum height, can't be shrunk
margin_left: int
Sets left margin
margin_top: int
Sets top margin
margin_right: int
Sets right margin
margin_bottom: int
Sets bottom margin
disabled: bool
Sets BaseButton.disabled on the button
clip_text: bool
Sets Button.clip_text on the button
size_flags: ControlSizes
If size is less than max width the flag is always SIZE_FILL, else it's SIZE_SHRINK_CENTER. This allows to override the flag to other when the size of container is more than its max width
bound_args: Array
The args that will be passed to method using Callable rules
unbind_next: int
Unbind next args using normal Callable rules
callable_method_name: StringName
Method that will be called
Methods
Constructor
method can be either Callable or method name as a String. Doesn't support lambdas. Optionally can accept properties as dictionary
Information
When method is string it can't be called until set_object was called
func _init(method: Variant = null, properties: Dictionary = Dictionary()) -> voidset_object()
Sets object and, optionally, method to prepare it for calling
func set_object(object: Object, method: StringName = "") -> RLinkButtonrlink_call()
Calls stored method without waiting
func rlink_call(arg: Variant = null) -> Variantrlink_callv()
Calls stored method without waiting
func rlink_callv(args: Array) -> Variantrlink_call_await()
Calls stored method with waiting
func rlink_call_await(arg: Variant = null) -> Variantrlink_callv_await()
Calls stored method with waiting
func rlink_callv_await(args: Array) -> Variantbind()
Adds argument that method will be called with and returns current instance
func bind(arg: Variant) -> RLinkButtonbindv()
Adds arguments that method will be called with and returns current instance
func bindv(args: Array) -> RLinkButtonunbind()
Next arguments passed to bind or call will be ignored and returns current instance
func unbind(argcount: int) -> RLinkButtonget_arg_count()
Returns calculated argument count
func get_arg_count() -> intget_method_name()
Returns method that will be called
func get_method_name() -> StringNameset_dictioanary()
Sets exported properties by name from dictionary and returns current instance
func set_dictioanary(properties: Dictionary) -> RLinkButtonset_text()
Sets text and returns current instance
func set_text(in_text: String) -> RLinkButtonset_tooltip_text()
Sets tooltip_text and returns current instance
func set_tooltip_text(in_text: String) -> RLinkButtonset_icon()
Sets icon and returns current instance
func set_icon(in_icon: String) -> RLinkButtonset_icon_texture()
Sets icon_texture and returns current instance
func set_icon_texture(in_icon: Texture2D) -> RLinkButtonset_icon_alignment()
Sets icon_alignment and returns current instance
func set_icon_alignment(alignment: HorizontalAlignment) -> RLinkButtonset_icon_alignment_vertical()
Sets icon_alignment_vertical and returns current instance
func set_icon_alignment_vertical(alignment: HorizontalAlignment) -> RLinkButtonset_modulate()
Sets modulate and returns current instance
func set_modulate(color: Color) -> RLinkButtonset_max_width()
Sets max_width and returns current instance
func set_max_width(width: int) -> RLinkButtonset_min_height()
Sets min_height and returns current instance
func set_min_height(height: int) -> RLinkButtonset_margin_left()
Sets margin_left and returns current instance
func set_margin_left(margin: int) -> RLinkButtonset_margin_top()
Sets margin_top and returns current instance
func set_margin_top(margin: int) -> RLinkButtonset_margin_right()
Sets margin_right and returns current instance
func set_margin_right(margin: int) -> RLinkButtonset_margin_bottom()
Sets margin_bottom and returns current instance
func set_margin_bottom(margin: int) -> RLinkButtonset_disabled()
Sets disabled and returns current instance
func set_disabled(in_disabled: bool = true) -> RLinkButtonset_size_flags()
Sets size_flags and returns current instance
func set_size_flags(in_size_flags: ControlSizes) -> RLinkButtonset_size_flags_control()
Sets size_flags and returns current instance
func set_size_flags_control(in_size_flags: Control.SizeFlags) -> RLinkButtontoggle_disabled()
Toggles disabled and returns current instance
func toggle_disabled() -> RLinkButtonset_current_as_default()
Stores current exported properties as default
func set_current_as_default() -> voidrestore_default()
Sets exported properties to stored defaults
func restore_default() -> voidEnums
enum ControlSizes
Sizes from Control with added unset
- SIZE_UNSET = -1
- SIZE_SHRINK_BEGIN = 0
- SIZE_FILL = 1
- SIZE_EXPAND = 2
- SIZE_EXPAND_FILL = 3
- SIZE_SHRINK_CENTER = 4
- SIZE_SHRINK_END = 8