RLinkSettings
Turns a method from non-tool class into a button in editor. Must be accessible from obj.GetType().GetMethod(name)
[Export] public RLinkButtonCS HelloWorld = new(nameof(HelloWorldImpl));
public void HelloWorldImpl()
{
GD.Print("Hello World");
}
Properties
Text: string
The button's text that will be displayed inside the button's area
TooltipText: string
Sets Control.TooltipText
Icon: string
Sets editor icon by name, setting it unsets IconTexture
IconTexture: Texture2D
Sets texture as icon, unsets Icon
IconAlignment: HorizontalAlignment
Icon behavior for Button.IconAlignment
IconAlignmentVertical: VerticalAlignment
Icon behavior for Button.VerticalIconAlignment
Modulate: Color
Sets CanvasItem.Modulate
on button
MaxWidth: int
Sets maximum width, can be shrunk
MinHeight: int
Sets minimum height, can't be shrunk
MarginLeft: int
Sets left margin
MarginTop: int
Sets top margin
MarginRight: int
Sets right margin
MarginBottom: int
Sets bottom margin
Disabled: bool
Sets BaseButton.Disabled
on the button
ClipText: bool
Sets Button.ClipText
on the button
SizeFlags: 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
BoundArgs: Godot.Collections.Array
The args that will be passed to method using Callable rules
UnbindNext: int
Unbind next args using normal Callable rules
CallableMethodName: StringName
Method that will be called
Methods
Constructor()
Required for [Tool]
support, creates it without defaults
public RLinkButtonCS();
Constructor(Callable, Godot.Collections.Dictionary?)
Callable must be from method, tries to extract bound arguments and unbound if supported. Optionally can accept properties as dictionary
public RLinkButtonCS(Callable callable, Godot.Collections.Dictionary? properties = null);
Constructor(CallGodotObject, StringName, Godot.Collections.Dictionary?)
Creates RLinkButtonCS for method
. Optionally can accept properties as dictionary
public RLinkButtonCS(GodotObject target, StringName method, Godot.Collections.Dictionary? properties = null);
Constructor(StringName, Dictionary<StringName, Variant>?)
Sets method name, will retrieve method info when SetObject
is called. Supports static methods from current type. Optionally can accept properties as dictionary
public RLinkButtonCS(StringName method, Dictionary<StringName, Variant>? properties = null);
Constructor(Delegate, Dictionary<StringName, Variant>?)
Delegate
must be accessible from obj.GetType().GetMethod(name)
. Optionally can accept properties as dictionary
INFO
Can be created from lambda that only captures this
in constructor
ClearModulationAction = new RLinkButtonCS((Color color) => SelfModulate = color)
.Bind(Colors.White);
public RLinkButtonCS(Delegate method, Dictionary<StringName, Variant>? properties = null);
SetObject()
Sets object and, optionally, method to prepare it for calling. If possible stores MethodInfo
from GetMethod
. If no MethodInfo
is found checks if it exist in GDScript
public RLinkButtonCS SetObject(GodotObject obj, StringName? newMethod = null);
RLinkCall()
Calls stored method without waiting. Tries to convert the result to Variant, doesn't emit Completed
signal
public Variant RLinkCall();
public Variant RLinkCall(Variant arg);
RLinkCallv()
Calls stored method without waiting. Tries to convert the result to Variant, doesn't emit Completed
signal
public Variant RLinkCallv(Godot.Collections.Array args);
RLinkCallAwait()
Begin task without waiting, and returns a Signal
Completed
that will be emitted on task complition
public Signal RLinkCallAwait();
public Signal RLinkCallAwait(Variant arg);
RLinkCallvAwait()
Begin task without waiting, and returns a Signal
Completed
that will be emitted on task complition
public Signal RLinkCallvAwait(Godot.Collections.Array args);
RLinkCallvAwaitTask()
Calls and awaits stored method. Gets result using reflection if exist. Emits Completed
signal with deferred on any result, if the result is convertible to Variant
it gets emitted with signal, if not null
Variant
gets emitted instead
public async Task RLinkCallvAwaitTask(Godot.Collections.Array args);
CancelTask()
Communicates a request for cancellation to a running task if it exists
public void CancelTask();
Bind()
Adds argument that method will be called with and returns current instance
public RLinkButtonCS Bind(Variant arg);
Bindv()
Adds arguments that method will be called with and returns current instance
public RLinkButtonCS Bindv(Godot.Collections.Array args);
public RLinkButtonCS Bindv(params Variant[] args);
Unbind()
Next arguments passed to bind or call will be ignored and returns current instance
public RLinkButtonCS Unbind(int argCount);
GetArgCount()
Returns calculated argument count
public int GetArgCount();
GetMethodName()
Returns method that will be called
public StringName GetMethodName();
SetDictionary()
Sets exported properties by name from dictionary and returns current instance
public RLinkButtonCS SetDictionary(Godot.Collections.Dictionary properties);
public RLinkButtonCS SetDictionary(IDictionary<StringName, Variant> properties)
SetText()
Sets Text
and returns current instance
public RLinkButtonCS SetText(string text);
SetTooltipText()
Sets TooltipText
and returns current instance
public RLinkButtonCS SetTooltipText(string text);
SetIcon()
Sets Icon
and returns current instance
public RLinkButtonCS SetIcon(string editorIcon);
SetIconTexture()
Sets IconTexture
and returns current instance
public RLinkButtonCS SetIconTexture(Texture2D icon);
SetIconAlignment()
Sets IconAlignment
and returns current instance
public RLinkButtonCS SetIconAlignment(HorizontalAlignment alignment);
SetIconAlignmentVertical()
Sets IconAlignmentVertical
and returns current instance
public RLinkButtonCS SetIconAlignmentVertical(VerticalAlignment alignment)
SetModulate()
Sets Modulate
and returns current instance
public RLinkButtonCS SetModulate(Color color);
SetMaxWidth()
Sets MaxWidth
and returns current instance
public RLinkButtonCS SetMaxWidth(int width);
SetMinHeight()
Sets MinHeight
and returns current instance
public RLinkButtonCS SetMinHeight(int height);
SetMarginLeft()
Sets MarginLeft
and returns current instance
public RLinkButtonCS SetMarginLeft(int margin);
SetMarginTop()
Sets MarginTop
and returns current instance
public RLinkButtonCS SetMarginTop(int margin);
SetMarginRight()
Sets MarginRight
and returns current instance
public RLinkButtonCS SetMarginRight(int margin);
SetMarginBottom()
Sets MarginBottom
and returns current instance
public RLinkButtonCS SetMarginBottom(int margin);
SetDisabled()
Sets Disabled
and returns current instance
public RLinkButtonCS SetDisabled(bool disabled = true);
SetSizeFlags()
Sets SizeFlags
and returns current instance
public RLinkButtonCS SetSizeFlags(ControlSizes sizeFlags);
SetSizeFlagsControl()
Sets SizeFlags
and returns current instance
public RLinkButtonCS SetSizeFlagsControl(Control.SizeFlags sizeFlags);
ToggleDisabled()
Toggles Disabled
and returns current instance
public RLinkButtonCS ToggleDisabled();
SetCurrentAsDefault()
Stores current exported properties as default
public void SetCurrentAsDefault();
restore_default()
Sets exported properties to stored defaults
public void RestoreDefault();
Signals
Completed
Fires after RLinkCallvAwaitTask
. RLinkCallAwait
and RLinkCallvAwait
calls RLinkCallvAwaitTask
and return this Signal
without waiting
Enums
public enum ControlSizes
Sizes from Control
with added unset
- SizeUnset = -1
- SizeShrinkBegin = 0
- SizeFill = 1
- SizeExpand = 2
- SizeExpandFill = 3
- SizeShrinkCenter = 4
- SizeShrinkEnd = 8