9283 lines
567 KiB
TypeScript
9283 lines
567 KiB
TypeScript
// AUTO-GENERATED
|
|
/// <reference no-default-lib="true"/>
|
|
declare module "godot" {
|
|
/** Represents a gamepad button being pressed or released.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventjoypadbutton.html
|
|
*/
|
|
class InputEventJoypadButton extends InputEvent {
|
|
constructor(identifier?: any)
|
|
/** Button identifier. One of the [enum JoyButton] button constants. */
|
|
get button_index(): int64
|
|
set button_index(value: int64)
|
|
get pressure(): float64
|
|
set pressure(value: float64)
|
|
|
|
/** If `true`, the button's state is pressed. If `false`, the button's state is released. */
|
|
get pressed(): boolean
|
|
set pressed(value: boolean)
|
|
}
|
|
/** Represents axis motions (such as joystick or analog triggers) from a gamepad.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventjoypadmotion.html
|
|
*/
|
|
class InputEventJoypadMotion extends InputEvent {
|
|
constructor(identifier?: any)
|
|
/** Axis identifier. Use one of the [enum JoyAxis] axis constants. */
|
|
get axis(): int64
|
|
set axis(value: int64)
|
|
|
|
/** Current position of the joystick on the given axis. The value ranges from `-1.0` to `1.0`. A value of `0` means the axis is in its resting position. */
|
|
get axis_value(): float64
|
|
set axis_value(value: float64)
|
|
}
|
|
/** Represents a key on a keyboard being pressed or released.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventkey.html
|
|
*/
|
|
class InputEventKey extends InputEventWithModifiers {
|
|
constructor(identifier?: any)
|
|
/** Returns the Latin keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
|
|
* To get a human-readable representation of the [InputEventKey] with modifiers, use `OS.get_keycode_string(event.get_keycode_with_modifiers())` where `event` is the [InputEventKey].
|
|
*/
|
|
get_keycode_with_modifiers(): Key
|
|
|
|
/** Returns the physical keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
|
|
* To get a human-readable representation of the [InputEventKey] with modifiers, use `OS.get_keycode_string(event.get_physical_keycode_with_modifiers())` where `event` is the [InputEventKey].
|
|
*/
|
|
get_physical_keycode_with_modifiers(): Key
|
|
|
|
/** Returns the localized key label combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
|
|
* To get a human-readable representation of the [InputEventKey] with modifiers, use `OS.get_keycode_string(event.get_key_label_with_modifiers())` where `event` is the [InputEventKey].
|
|
*/
|
|
get_key_label_with_modifiers(): Key
|
|
|
|
/** Returns a [String] representation of the event's [member keycode] and modifiers. */
|
|
as_text_keycode(): string
|
|
|
|
/** Returns a [String] representation of the event's [member physical_keycode] and modifiers. */
|
|
as_text_physical_keycode(): string
|
|
|
|
/** Returns a [String] representation of the event's [member key_label] and modifiers. */
|
|
as_text_key_label(): string
|
|
|
|
/** Returns a [String] representation of the event's [member location]. This will be a blank string if the event is not specific to a location. */
|
|
as_text_location(): string
|
|
|
|
/** If `true`, the key's state is pressed. If `false`, the key's state is released. */
|
|
get pressed(): boolean
|
|
set pressed(value: boolean)
|
|
|
|
/** Latin label printed on the key in the current keyboard layout, which corresponds to one of the [enum Key] constants.
|
|
* To get a human-readable representation of the [InputEventKey], use `OS.get_keycode_string(event.keycode)` where `event` is the [InputEventKey].
|
|
* [codeblock lang=text]
|
|
* +-----+ +-----+
|
|
* | Q | | Q | - "Q" - keycode
|
|
* | Й | | ض | - "Й" and "ض" - key_label
|
|
* +-----+ +-----+
|
|
* [/codeblock]
|
|
*/
|
|
get keycode(): int64
|
|
set keycode(value: int64)
|
|
|
|
/** Represents the physical location of a key on the 101/102-key US QWERTY keyboard, which corresponds to one of the [enum Key] constants.
|
|
* To get a human-readable representation of the [InputEventKey], use [method OS.get_keycode_string] in combination with [method DisplayServer.keyboard_get_keycode_from_physical]:
|
|
*
|
|
*/
|
|
get physical_keycode(): int64
|
|
set physical_keycode(value: int64)
|
|
|
|
/** Represents the localized label printed on the key in the current keyboard layout, which corresponds to one of the [enum Key] constants or any valid Unicode character.
|
|
* For keyboard layouts with a single label on the key, it is equivalent to [member keycode].
|
|
* To get a human-readable representation of the [InputEventKey], use `OS.get_keycode_string(event.key_label)` where `event` is the [InputEventKey].
|
|
* [codeblock lang=text]
|
|
* +-----+ +-----+
|
|
* | Q | | Q | - "Q" - keycode
|
|
* | Й | | ض | - "Й" and "ض" - key_label
|
|
* +-----+ +-----+
|
|
* [/codeblock]
|
|
*/
|
|
get key_label(): int64
|
|
set key_label(value: int64)
|
|
|
|
/** The key Unicode character code (when relevant), shifted by modifier keys. Unicode character codes for composite characters and complex scripts may not be available unless IME input mode is active. See [method Window.set_ime_active] for more information. */
|
|
get unicode(): int64
|
|
set unicode(value: int64)
|
|
|
|
/** Represents the location of a key which has both left and right versions, such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. */
|
|
get location(): int64
|
|
set location(value: int64)
|
|
|
|
/** If `true`, the key was already pressed before this event. An echo event is a repeated key event sent when the user is holding down the key.
|
|
*
|
|
* **Note:** The rate at which echo events are sent is typically around 20 events per second (after holding down the key for roughly half a second). However, the key repeat delay/speed can be changed by the user or disabled entirely in the operating system settings. To ensure your project works correctly on all configurations, do not assume the user has a specific key repeat configuration in your project's behavior.
|
|
*/
|
|
get echo(): boolean
|
|
set echo(value: boolean)
|
|
}
|
|
/** Represents a MIDI message from a MIDI device, such as a musical keyboard.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventmidi.html
|
|
*/
|
|
class InputEventMIDI extends InputEvent {
|
|
constructor(identifier?: any)
|
|
/** The MIDI channel of this message, ranging from `0` to `15`. MIDI channel `9` is reserved for percussion instruments. */
|
|
get channel(): int64
|
|
set channel(value: int64)
|
|
|
|
/** Represents the type of MIDI message (see the [enum MIDIMessage] enum).
|
|
* For more information, see the [url=https://www.midi.org/specifications-old/item/table-2-expanded-messages-list-status-bytes]MIDI message status byte list chart[/url].
|
|
*/
|
|
get message(): int64
|
|
set message(value: int64)
|
|
|
|
/** The pitch index number of this MIDI message. This value ranges from `0` to `127`.
|
|
* On a piano, the **middle C** is `60`, followed by a **C-sharp** (`61`), then a **D** (`62`), and so on. Each octave is split in offsets of 12. See the "MIDI note number" column of the [url=https://en.wikipedia.org/wiki/Piano_key_frequencies]piano key frequency chart[/url] a full list.
|
|
*/
|
|
get pitch(): int64
|
|
set pitch(value: int64)
|
|
|
|
/** The velocity of the MIDI message. This value ranges from `0` to `127`. For a musical keyboard, this corresponds to how quickly the key was pressed, and is rarely above `110` in practice.
|
|
*
|
|
* **Note:** Some MIDI devices may send a [constant MIDI_MESSAGE_NOTE_ON] message with `0` velocity and expect it to be treated the same as a [constant MIDI_MESSAGE_NOTE_OFF] message. If necessary, this can be handled with a few lines of code:
|
|
*
|
|
*/
|
|
get velocity(): int64
|
|
set velocity(value: int64)
|
|
|
|
/** The instrument (also called *program* or *preset* ) used on this MIDI message. This value ranges from `0` to `127`.
|
|
* To see what each value means, refer to the [url=https://en.wikipedia.org/wiki/General_MIDI#Program_change_events]General MIDI's instrument list[/url]. Keep in mind that the list is off by 1 because it does not begin from 0. A value of `0` corresponds to the acoustic grand piano.
|
|
*/
|
|
get instrument(): int64
|
|
set instrument(value: int64)
|
|
|
|
/** The strength of the key being pressed. This value ranges from `0` to `127`.
|
|
*
|
|
* **Note:** For many devices, this value is always `0`. Other devices such as musical keyboards may simulate pressure by changing the [member velocity], instead.
|
|
*/
|
|
get pressure(): int64
|
|
set pressure(value: int64)
|
|
|
|
/** The unique number of the controller, if [member message] is [constant MIDI_MESSAGE_CONTROL_CHANGE], otherwise this is `0`. This value can be used to identify sliders for volume, balance, and panning, as well as switches and pedals on the MIDI device. See the [url=https://en.wikipedia.org/wiki/General_MIDI#Controller_events]General MIDI specification[/url] for a small list. */
|
|
get controller_number(): int64
|
|
set controller_number(value: int64)
|
|
|
|
/** The value applied to the controller. If [member message] is [constant MIDI_MESSAGE_CONTROL_CHANGE], this value ranges from `0` to `127`, otherwise it is `0`. See also [member controller_value]. */
|
|
get controller_value(): int64
|
|
set controller_value(value: int64)
|
|
}
|
|
/** Represents a magnifying touch gesture.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventmagnifygesture.html
|
|
*/
|
|
class InputEventMagnifyGesture extends InputEventGesture {
|
|
constructor(identifier?: any)
|
|
/** The amount (or delta) of the event. This value is closer to `1.0` the slower the gesture is performed. */
|
|
get factor(): float64
|
|
set factor(value: float64)
|
|
}
|
|
/** Base input event type for mouse events.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventmouse.html
|
|
*/
|
|
class InputEventMouse extends InputEventWithModifiers {
|
|
constructor(identifier?: any)
|
|
/** The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks. */
|
|
get button_mask(): int64
|
|
set button_mask(value: int64)
|
|
|
|
/** When received in [method Node._input] or [method Node._unhandled_input], returns the mouse's position in the [Viewport] this [Node] is in using the coordinate system of this [Viewport].
|
|
* When received in [method Control._gui_input], returns the mouse's position in the [Control] using the local coordinate system of the [Control].
|
|
*/
|
|
get position(): Vector2
|
|
set position(value: Vector2)
|
|
|
|
/** When received in [method Node._input] or [method Node._unhandled_input], returns the mouse's position in the root [Viewport] using the coordinate system of the root [Viewport].
|
|
* When received in [method Control._gui_input], returns the mouse's position in the [CanvasLayer] that the [Control] is in using the coordinate system of the [CanvasLayer].
|
|
*/
|
|
get global_position(): Vector2
|
|
set global_position(value: Vector2)
|
|
}
|
|
/** Represents a mouse button being pressed or released.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventmousebutton.html
|
|
*/
|
|
class InputEventMouseButton extends InputEventMouse {
|
|
constructor(identifier?: any)
|
|
/** The amount (or delta) of the event. When used for high-precision scroll events, this indicates the scroll amount (vertical or horizontal). This is only supported on some platforms; the reported sensitivity varies depending on the platform. May be `0` if not supported. */
|
|
get factor(): float64
|
|
set factor(value: float64)
|
|
|
|
/** The mouse button identifier, one of the [enum MouseButton] button or button wheel constants. */
|
|
get button_index(): int64
|
|
set button_index(value: int64)
|
|
|
|
/** If `true`, the mouse button event has been canceled. */
|
|
get canceled(): boolean
|
|
set canceled(value: boolean)
|
|
|
|
/** If `true`, the mouse button's state is pressed. If `false`, the mouse button's state is released. */
|
|
get pressed(): boolean
|
|
set pressed(value: boolean)
|
|
|
|
/** If `true`, the mouse button's state is a double-click. */
|
|
get double_click(): boolean
|
|
set double_click(value: boolean)
|
|
}
|
|
/** Represents a mouse or a pen movement.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventmousemotion.html
|
|
*/
|
|
class InputEventMouseMotion extends InputEventMouse {
|
|
constructor(identifier?: any)
|
|
/** Represents the angles of tilt of the pen. Positive X-coordinate value indicates a tilt to the right. Positive Y-coordinate value indicates a tilt toward the user. Ranges from `-1.0` to `1.0` for both axes. */
|
|
get tilt(): Vector2
|
|
set tilt(value: Vector2)
|
|
|
|
/** Represents the pressure the user puts on the pen. Ranges from `0.0` to `1.0`. */
|
|
get pressure(): float64
|
|
set pressure(value: float64)
|
|
|
|
/** Returns `true` when using the eraser end of a stylus pen.
|
|
*
|
|
* **Note:** This property is implemented on Linux, macOS and Windows.
|
|
*/
|
|
get pen_inverted(): boolean
|
|
set pen_inverted(value: boolean)
|
|
|
|
/** The mouse position relative to the previous position (position at the last frame).
|
|
*
|
|
* **Note:** Since [InputEventMouseMotion] may only be emitted when the mouse moves, it is not possible to reliably detect when the mouse has stopped moving by checking this property. A separate, short timer may be necessary.
|
|
*
|
|
* **Note:** [member relative] is automatically scaled according to the content scale factor, which is defined by the project's stretch mode settings. This means mouse sensitivity will appear different depending on resolution when using [member relative] in a script that handles mouse aiming with the [constant Input.MOUSE_MODE_CAPTURED] mouse mode. To avoid this, use [member screen_relative] instead.
|
|
*/
|
|
get relative(): Vector2
|
|
set relative(value: Vector2)
|
|
|
|
/** The unscaled mouse position relative to the previous position in the coordinate system of the screen (position at the last frame).
|
|
*
|
|
* **Note:** Since [InputEventMouseMotion] may only be emitted when the mouse moves, it is not possible to reliably detect when the mouse has stopped moving by checking this property. A separate, short timer may be necessary.
|
|
*
|
|
* **Note:** This coordinate is *not* scaled according to the content scale factor or calls to [method InputEvent.xformed_by]. This should be preferred over [member relative] for mouse aiming when using the [constant Input.MOUSE_MODE_CAPTURED] mouse mode, regardless of the project's stretch mode.
|
|
*/
|
|
get screen_relative(): Vector2
|
|
set screen_relative(value: Vector2)
|
|
|
|
/** The mouse velocity in pixels per second.
|
|
*
|
|
* **Note:** [member velocity] is automatically scaled according to the content scale factor, which is defined by the project's stretch mode settings. This means mouse sensitivity will appear different depending on resolution when using [member velocity] in a script that handles mouse aiming with the [constant Input.MOUSE_MODE_CAPTURED] mouse mode. To avoid this, use [member screen_velocity] instead.
|
|
*/
|
|
get velocity(): Vector2
|
|
set velocity(value: Vector2)
|
|
|
|
/** The unscaled mouse velocity in pixels per second in screen coordinates. This velocity is *not* scaled according to the content scale factor or calls to [method InputEvent.xformed_by]. This should be preferred over [member velocity] for mouse aiming when using the [constant Input.MOUSE_MODE_CAPTURED] mouse mode, regardless of the project's stretch mode. */
|
|
get screen_velocity(): Vector2
|
|
set screen_velocity(value: Vector2)
|
|
}
|
|
/** Represents a panning touch gesture.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventpangesture.html
|
|
*/
|
|
class InputEventPanGesture extends InputEventGesture {
|
|
constructor(identifier?: any)
|
|
/** Panning amount since last pan event. */
|
|
get delta(): Vector2
|
|
set delta(value: Vector2)
|
|
}
|
|
/** Represents a screen drag event.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventscreendrag.html
|
|
*/
|
|
class InputEventScreenDrag extends InputEventFromWindow {
|
|
constructor(identifier?: any)
|
|
/** The drag event index in the case of a multi-drag event. */
|
|
get index(): int64
|
|
set index(value: int64)
|
|
|
|
/** Represents the angles of tilt of the pen. Positive X-coordinate value indicates a tilt to the right. Positive Y-coordinate value indicates a tilt toward the user. Ranges from `-1.0` to `1.0` for both axes. */
|
|
get tilt(): Vector2
|
|
set tilt(value: Vector2)
|
|
|
|
/** Represents the pressure the user puts on the pen. Ranges from `0.0` to `1.0`. */
|
|
get pressure(): float64
|
|
set pressure(value: float64)
|
|
|
|
/** Returns `true` when using the eraser end of a stylus pen. */
|
|
get pen_inverted(): boolean
|
|
set pen_inverted(value: boolean)
|
|
|
|
/** The drag position in the viewport the node is in, using the coordinate system of this viewport. */
|
|
get position(): Vector2
|
|
set position(value: Vector2)
|
|
|
|
/** The drag position relative to the previous position (position at the last frame).
|
|
*
|
|
* **Note:** [member relative] is automatically scaled according to the content scale factor, which is defined by the project's stretch mode settings. This means touch sensitivity will appear different depending on resolution when using [member relative] in a script that handles touch aiming. To avoid this, use [member screen_relative] instead.
|
|
*/
|
|
get relative(): Vector2
|
|
set relative(value: Vector2)
|
|
|
|
/** The unscaled drag position relative to the previous position in screen coordinates (position at the last frame). This position is *not* scaled according to the content scale factor or calls to [method InputEvent.xformed_by]. This should be preferred over [member relative] for touch aiming regardless of the project's stretch mode. */
|
|
get screen_relative(): Vector2
|
|
set screen_relative(value: Vector2)
|
|
|
|
/** The drag velocity.
|
|
*
|
|
* **Note:** [member velocity] is automatically scaled according to the content scale factor, which is defined by the project's stretch mode settings. This means touch sensitivity will appear different depending on resolution when using [member velocity] in a script that handles touch aiming. To avoid this, use [member screen_velocity] instead.
|
|
*/
|
|
get velocity(): Vector2
|
|
set velocity(value: Vector2)
|
|
|
|
/** The unscaled drag velocity in pixels per second in screen coordinates. This velocity is *not* scaled according to the content scale factor or calls to [method InputEvent.xformed_by]. This should be preferred over [member velocity] for touch aiming regardless of the project's stretch mode. */
|
|
get screen_velocity(): Vector2
|
|
set screen_velocity(value: Vector2)
|
|
}
|
|
/** Represents a screen touch event.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventscreentouch.html
|
|
*/
|
|
class InputEventScreenTouch extends InputEventFromWindow {
|
|
constructor(identifier?: any)
|
|
/** The touch index in the case of a multi-touch event. One index = one finger. */
|
|
get index(): int64
|
|
set index(value: int64)
|
|
|
|
/** The touch position in the viewport the node is in, using the coordinate system of this viewport. */
|
|
get position(): Vector2
|
|
set position(value: Vector2)
|
|
|
|
/** If `true`, the touch event has been canceled. */
|
|
get canceled(): boolean
|
|
set canceled(value: boolean)
|
|
|
|
/** If `true`, the touch's state is pressed. If `false`, the touch's state is released. */
|
|
get pressed(): boolean
|
|
set pressed(value: boolean)
|
|
|
|
/** If `true`, the touch's state is a double tap. */
|
|
get double_tap(): boolean
|
|
set double_tap(value: boolean)
|
|
}
|
|
/** Represents a triggered keyboard [Shortcut].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventshortcut.html
|
|
*/
|
|
class InputEventShortcut extends InputEvent {
|
|
constructor(identifier?: any)
|
|
/** The [Shortcut] represented by this event. Its [method Shortcut.matches_event] method will always return `true` for this event. */
|
|
get shortcut(): Shortcut
|
|
set shortcut(value: Shortcut)
|
|
}
|
|
/** Abstract base class for input events affected by modifier keys like [kbd]Shift[/kbd] and [kbd]Alt[/kbd].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_inputeventwithmodifiers.html
|
|
*/
|
|
class InputEventWithModifiers extends InputEventFromWindow {
|
|
constructor(identifier?: any)
|
|
/** On macOS, returns `true` if [kbd]Meta[/kbd] ([kbd]Cmd[/kbd]) is pressed.
|
|
* On other platforms, returns `true` if [kbd]Ctrl[/kbd] is pressed.
|
|
*/
|
|
is_command_or_control_pressed(): boolean
|
|
|
|
/** Returns the keycode combination of modifier keys. */
|
|
get_modifiers_mask(): KeyModifierMask
|
|
|
|
/** Automatically use [kbd]Meta[/kbd] ([kbd]Cmd[/kbd]) on macOS and [kbd]Ctrl[/kbd] on other platforms. If `true`, [member ctrl_pressed] and [member meta_pressed] cannot be set. */
|
|
get command_or_control_autoremap(): boolean
|
|
set command_or_control_autoremap(value: boolean)
|
|
|
|
/** State of the [kbd]Alt[/kbd] modifier. */
|
|
get alt_pressed(): boolean
|
|
set alt_pressed(value: boolean)
|
|
|
|
/** State of the [kbd]Shift[/kbd] modifier. */
|
|
get shift_pressed(): boolean
|
|
set shift_pressed(value: boolean)
|
|
|
|
/** State of the [kbd]Ctrl[/kbd] modifier. */
|
|
get ctrl_pressed(): boolean
|
|
set ctrl_pressed(value: boolean)
|
|
|
|
/** State of the [kbd]Meta[/kbd] modifier. On Windows and Linux, this represents the Windows key (sometimes called "meta" or "super" on Linux). On macOS, this represents the Command key. */
|
|
get meta_pressed(): boolean
|
|
set meta_pressed(value: boolean)
|
|
}
|
|
class InspectorDock<Map extends Record<string, Node> = Record<string, Node>> extends VBoxContainer<Map> {
|
|
constructor(identifier?: any)
|
|
store_script_properties(_unnamed_arg0: Object): void
|
|
apply_script_properties(_unnamed_arg0: Object): void
|
|
readonly request_help: Signal0
|
|
}
|
|
class InstallGodotJSPresetConfirmationDialog<Map extends Record<string, Node> = Record<string, Node>> extends ConfirmationDialog<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Placeholder for the root [Node] of a [PackedScene].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_instanceplaceholder.html
|
|
*/
|
|
class InstancePlaceholder<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the list of properties that will be applied to the node when [method create_instance] is called.
|
|
* If [param with_order] is `true`, a key named `.order` (note the leading period) is added to the dictionary. This `.order` key is an [Array] of [String] property names specifying the order in which properties will be applied (with index 0 being the first).
|
|
*/
|
|
get_stored_values(with_order: boolean = false): GDictionary
|
|
|
|
/** Call this method to actually load in the node. The created node will be placed as a sibling *above* the [InstancePlaceholder] in the scene tree. The [Node]'s reference is also returned for convenience.
|
|
*
|
|
* **Note:** [method create_instance] is not thread-safe. Use [method Object.call_deferred] if calling from a thread.
|
|
*/
|
|
create_instance(replace: boolean = false, custom_scene: PackedScene = undefined): Node
|
|
|
|
/** Gets the path to the [PackedScene] resource file that is loaded by default when calling [method create_instance]. Not thread-safe. Use [method Object.call_deferred] if calling from a thread. */
|
|
get_instance_path(): string
|
|
}
|
|
/** Creates an idle interval in a [Tween] animation.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_intervaltweener.html
|
|
*/
|
|
class IntervalTweener extends Tweener {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace ItemList {
|
|
enum IconMode {
|
|
/** Icon is drawn above the text. */
|
|
ICON_MODE_TOP = 0,
|
|
|
|
/** Icon is drawn to the left of the text. */
|
|
ICON_MODE_LEFT = 1,
|
|
}
|
|
enum SelectMode {
|
|
/** Only allow selecting a single item. */
|
|
SELECT_SINGLE = 0,
|
|
|
|
/** Allows selecting multiple items by holding [kbd]Ctrl[/kbd] or [kbd]Shift[/kbd]. */
|
|
SELECT_MULTI = 1,
|
|
|
|
/** Allows selecting multiple items by toggling them on and off. */
|
|
SELECT_TOGGLE = 2,
|
|
}
|
|
}
|
|
/** A vertical list of selectable items with one or multiple columns.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_itemlist.html
|
|
*/
|
|
class ItemList<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
/** Adds an item to the item list with specified text. Returns the index of an added item.
|
|
* Specify an [param icon], or use `null` as the [param icon] for a list item with no icon.
|
|
* If [param selectable] is `true`, the list item will be selectable.
|
|
*/
|
|
add_item(text: string, icon: Texture2D = undefined, selectable: boolean = true): int64
|
|
|
|
/** Adds an item to the item list with no text, only an icon. Returns the index of an added item. */
|
|
add_icon_item(icon: Texture2D, selectable: boolean = true): int64
|
|
|
|
/** Sets text of the item associated with the specified index. */
|
|
set_item_text(idx: int64, text: string): void
|
|
|
|
/** Returns the text associated with the specified index. */
|
|
get_item_text(idx: int64): string
|
|
|
|
/** Sets (or replaces) the icon's [Texture2D] associated with the specified index. */
|
|
set_item_icon(idx: int64, icon: Texture2D): void
|
|
|
|
/** Returns the icon associated with the specified index. */
|
|
get_item_icon(idx: int64): Texture2D
|
|
|
|
/** Sets item's text base writing direction. */
|
|
set_item_text_direction(idx: int64, direction: Control.TextDirection): void
|
|
|
|
/** Returns item's text base writing direction. */
|
|
get_item_text_direction(idx: int64): Control.TextDirection
|
|
|
|
/** Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead. */
|
|
set_item_language(idx: int64, language: string): void
|
|
|
|
/** Returns item's text language code. */
|
|
get_item_language(idx: int64): string
|
|
|
|
/** Sets the auto translate mode of the item associated with the specified index.
|
|
* Items use [constant Node.AUTO_TRANSLATE_MODE_INHERIT] by default, which uses the same auto translate mode as the [ItemList] itself.
|
|
*/
|
|
set_item_auto_translate_mode(idx: int64, mode: Node.AutoTranslateMode): void
|
|
|
|
/** Returns item's auto translate mode. */
|
|
get_item_auto_translate_mode(idx: int64): Node.AutoTranslateMode
|
|
|
|
/** Sets whether the item icon will be drawn transposed. */
|
|
set_item_icon_transposed(idx: int64, transposed: boolean): void
|
|
|
|
/** Returns `true` if the item icon will be drawn transposed, i.e. the X and Y axes are swapped. */
|
|
is_item_icon_transposed(idx: int64): boolean
|
|
|
|
/** Sets the region of item's icon used. The whole icon will be used if the region has no area. */
|
|
set_item_icon_region(idx: int64, rect: Rect2): void
|
|
|
|
/** Returns the region of item's icon used. The whole icon will be used if the region has no area. */
|
|
get_item_icon_region(idx: int64): Rect2
|
|
|
|
/** Sets a modulating [Color] of the item associated with the specified index. */
|
|
set_item_icon_modulate(idx: int64, modulate: Color): void
|
|
|
|
/** Returns a [Color] modulating item's icon at the specified index. */
|
|
get_item_icon_modulate(idx: int64): Color
|
|
|
|
/** Allows or disallows selection of the item associated with the specified index. */
|
|
set_item_selectable(idx: int64, selectable: boolean): void
|
|
|
|
/** Returns `true` if the item at the specified index is selectable. */
|
|
is_item_selectable(idx: int64): boolean
|
|
|
|
/** Disables (or enables) the item at the specified index.
|
|
* Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing [kbd]Enter[/kbd]).
|
|
*/
|
|
set_item_disabled(idx: int64, disabled: boolean): void
|
|
|
|
/** Returns `true` if the item at the specified index is disabled. */
|
|
is_item_disabled(idx: int64): boolean
|
|
|
|
/** Sets a value (of any type) to be stored with the item associated with the specified index. */
|
|
set_item_metadata(idx: int64, metadata: any): void
|
|
|
|
/** Returns the metadata value of the specified index. */
|
|
get_item_metadata(idx: int64): any
|
|
|
|
/** Sets the background color of the item specified by [param idx] index to the specified [Color]. */
|
|
set_item_custom_bg_color(idx: int64, custom_bg_color: Color): void
|
|
|
|
/** Returns the custom background color of the item specified by [param idx] index. */
|
|
get_item_custom_bg_color(idx: int64): Color
|
|
|
|
/** Sets the foreground color of the item specified by [param idx] index to the specified [Color]. */
|
|
set_item_custom_fg_color(idx: int64, custom_fg_color: Color): void
|
|
|
|
/** Returns the custom foreground color of the item specified by [param idx] index. */
|
|
get_item_custom_fg_color(idx: int64): Color
|
|
|
|
/** Returns the position and size of the item with the specified index, in the coordinate system of the [ItemList] node. If [param expand] is `true` the last column expands to fill the rest of the row.
|
|
*
|
|
* **Note:** The returned value is unreliable if called right after modifying the [ItemList], before it redraws in the next frame.
|
|
*/
|
|
get_item_rect(idx: int64, expand: boolean = true): Rect2
|
|
|
|
/** Sets whether the tooltip hint is enabled for specified item index. */
|
|
set_item_tooltip_enabled(idx: int64, enable: boolean): void
|
|
|
|
/** Returns `true` if the tooltip is enabled for specified item index. */
|
|
is_item_tooltip_enabled(idx: int64): boolean
|
|
|
|
/** Sets the tooltip hint for the item associated with the specified index. */
|
|
set_item_tooltip(idx: int64, tooltip: string): void
|
|
|
|
/** Returns the tooltip hint associated with the specified index. */
|
|
get_item_tooltip(idx: int64): string
|
|
|
|
/** Select the item at the specified index.
|
|
*
|
|
* **Note:** This method does not trigger the item selection signal.
|
|
*/
|
|
select(idx: int64, single: boolean = true): void
|
|
|
|
/** Ensures the item associated with the specified index is not selected. */
|
|
deselect(idx: int64): void
|
|
|
|
/** Ensures there are no items selected. */
|
|
deselect_all(): void
|
|
|
|
/** Returns `true` if the item at the specified index is currently selected. */
|
|
is_selected(idx: int64): boolean
|
|
|
|
/** Returns an array with the indexes of the selected items. */
|
|
get_selected_items(): PackedInt32Array
|
|
|
|
/** Moves item from index [param from_idx] to [param to_idx]. */
|
|
move_item(from_idx: int64, to_idx: int64): void
|
|
|
|
/** Removes the item specified by [param idx] index from the list. */
|
|
remove_item(idx: int64): void
|
|
|
|
/** Removes all items from the list. */
|
|
clear(): void
|
|
|
|
/** Sorts items in the list by their text. */
|
|
sort_items_by_text(): void
|
|
|
|
/** Returns `true` if one or more items are selected. */
|
|
is_anything_selected(): boolean
|
|
|
|
/** Returns the item index at the given [param position].
|
|
* When there is no item at that point, -1 will be returned if [param exact] is `true`, and the closest item index will be returned otherwise.
|
|
*
|
|
* **Note:** The returned value is unreliable if called right after modifying the [ItemList], before it redraws in the next frame.
|
|
*/
|
|
get_item_at_position(position: Vector2, exact: boolean = false): int64
|
|
|
|
/** Ensure current selection is visible, adjusting the scroll position as necessary. */
|
|
ensure_current_is_visible(): void
|
|
|
|
/** Returns the vertical scrollbar.
|
|
* **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
|
|
*/
|
|
get_v_scroll_bar(): VScrollBar
|
|
|
|
/** Returns the horizontal scrollbar.
|
|
* **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
|
|
*/
|
|
get_h_scroll_bar(): HScrollBar
|
|
|
|
/** Forces an update to the list size based on its items. This happens automatically whenever size of the items, or other relevant settings like [member auto_height], change. The method can be used to trigger the update ahead of next drawing pass. */
|
|
force_update_list_size(): void
|
|
|
|
/** Allows single or multiple item selection. See the [enum SelectMode] constants. */
|
|
get select_mode(): int64
|
|
set select_mode(value: int64)
|
|
|
|
/** If `true`, the currently selected item can be selected again. */
|
|
get allow_reselect(): boolean
|
|
set allow_reselect(value: boolean)
|
|
|
|
/** If `true`, right mouse button click can select items. */
|
|
get allow_rmb_select(): boolean
|
|
set allow_rmb_select(value: boolean)
|
|
|
|
/** If `true`, allows navigating the [ItemList] with letter keys through incremental search. */
|
|
get allow_search(): boolean
|
|
set allow_search(value: boolean)
|
|
|
|
/** Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display.
|
|
*
|
|
* **Note:** This property takes effect only when [member icon_mode] is [constant ICON_MODE_TOP]. To make the text wrap, [member fixed_column_width] should be greater than zero.
|
|
*/
|
|
get max_text_lines(): int64
|
|
set max_text_lines(value: int64)
|
|
|
|
/** If `true`, the control will automatically resize the width to fit its content. */
|
|
get auto_width(): boolean
|
|
set auto_width(value: boolean)
|
|
|
|
/** If `true`, the control will automatically resize the height to fit its content. */
|
|
get auto_height(): boolean
|
|
set auto_height(value: boolean)
|
|
|
|
/** Sets the clipping behavior when the text exceeds an item's bounding rectangle. See [enum TextServer.OverrunBehavior] for a description of all modes. */
|
|
get text_overrun_behavior(): int64
|
|
set text_overrun_behavior(value: int64)
|
|
|
|
/** If `true`, the control will automatically move items into a new row to fit its content. See also [HFlowContainer] for this behavior.
|
|
* If `false`, the control will add a horizontal scrollbar to make all items visible.
|
|
*/
|
|
get wraparound_items(): boolean
|
|
set wraparound_items(value: boolean)
|
|
|
|
/** The number of items currently in the list. */
|
|
get item_count(): any /*Items,item_*/
|
|
set item_count(value: any /*Items,item_*/)
|
|
|
|
/** Maximum columns the list will have.
|
|
* If greater than zero, the content will be split among the specified columns.
|
|
* A value of zero means unlimited columns, i.e. all items will be put in the same row.
|
|
*/
|
|
get max_columns(): int64
|
|
set max_columns(value: int64)
|
|
|
|
/** Whether all columns will have the same width.
|
|
* If `true`, the width is equal to the largest column width of all columns.
|
|
*/
|
|
get same_column_width(): boolean
|
|
set same_column_width(value: boolean)
|
|
|
|
/** The width all columns will be adjusted to.
|
|
* A value of zero disables the adjustment, each item will have a width equal to the width of its content and the columns will have an uneven width.
|
|
*/
|
|
get fixed_column_width(): int64
|
|
set fixed_column_width(value: int64)
|
|
|
|
/** The icon position, whether above or to the left of the text. See the [enum IconMode] constants. */
|
|
get icon_mode(): int64
|
|
set icon_mode(value: int64)
|
|
|
|
/** The scale of icon applied after [member fixed_icon_size] and transposing takes effect. */
|
|
get icon_scale(): float64
|
|
set icon_scale(value: float64)
|
|
|
|
/** The size all icons will be adjusted to.
|
|
* If either X or Y component is not greater than zero, icon size won't be affected.
|
|
*/
|
|
get fixed_icon_size(): Vector2i
|
|
set fixed_icon_size(value: Vector2i)
|
|
|
|
/** Emitted when specified item has been selected. Only applicable in single selection mode.
|
|
* [member allow_reselect] must be enabled to reselect an item.
|
|
*/
|
|
readonly item_selected: Signal1<int64>
|
|
|
|
/** Emitted when any mouse click is issued within the rect of the list but on empty space.
|
|
* [param at_position] is the click position in this control's local coordinate system.
|
|
*/
|
|
readonly empty_clicked: Signal2<Vector2, int64>
|
|
|
|
/** Emitted when specified list item has been clicked with any mouse button.
|
|
* [param at_position] is the click position in this control's local coordinate system.
|
|
*/
|
|
readonly item_clicked: Signal3<int64, Vector2, int64>
|
|
|
|
/** Emitted when a multiple selection is altered on a list allowing multiple selection. */
|
|
readonly multi_selected: Signal2<int64, boolean>
|
|
|
|
/** Emitted when specified list item is activated via double-clicking or by pressing [kbd]Enter[/kbd]. */
|
|
readonly item_activated: Signal1<int64>
|
|
}
|
|
/** Singleton that connects the engine with Android plugins to interface with native Android code.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_jnisingleton.html
|
|
*/
|
|
class JNISingleton extends Object {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Helper class for creating and parsing JSON data.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_json.html
|
|
*/
|
|
class JSON extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Converts a [Variant] var to JSON text and returns the result. Useful for serializing data to store or send over the network.
|
|
*
|
|
* **Note:** The JSON specification does not define integer or float types, but only a *number* type. Therefore, converting a Variant to JSON text will convert all numerical values to [float] types.
|
|
*
|
|
* **Note:** If [param full_precision] is `true`, when stringifying floats, the unreliable digits are stringified in addition to the reliable digits to guarantee exact decoding.
|
|
* The [param indent] parameter controls if and how something is indented; its contents will be used where there should be an indent in the output. Even spaces like `" "` will work. `\t` and `\n` can also be used for a tab indent, or to make a newline for each indent respectively.
|
|
* **Example output:**
|
|
*
|
|
*/
|
|
static stringify(data: any, indent: string = '', sort_keys: boolean = true, full_precision: boolean = false): string
|
|
|
|
/** Attempts to parse the [param json_string] provided and returns the parsed data. Returns `null` if parse failed. */
|
|
static parse_string(json_string: string): any
|
|
|
|
/** Attempts to parse the [param json_text] provided.
|
|
* Returns an [enum Error]. If the parse was successful, it returns [constant OK] and the result can be retrieved using [member data]. If unsuccessful, use [method get_error_line] and [method get_error_message] to identify the source of the failure.
|
|
* Non-static variant of [method parse_string], if you want custom error handling.
|
|
* The optional [param keep_text] argument instructs the parser to keep a copy of the original text. This text can be obtained later by using the [method get_parsed_text] function and is used when saving the resource (instead of generating new text from [member data]).
|
|
*/
|
|
parse(json_text: string, keep_text: boolean = false): GError
|
|
|
|
/** Return the text parsed by [method parse] (requires passing `keep_text` to [method parse]). */
|
|
get_parsed_text(): string
|
|
|
|
/** Returns `0` if the last call to [method parse] was successful, or the line number where the parse failed. */
|
|
get_error_line(): int64
|
|
|
|
/** Returns an empty string if the last call to [method parse] was successful, or the error message if it failed. */
|
|
get_error_message(): string
|
|
|
|
/** Converts a native engine type to a JSON-compliant value.
|
|
* By default, objects are ignored for security reasons, unless [param full_objects] is `true`.
|
|
* You can convert a native value to a JSON string like this:
|
|
*
|
|
*/
|
|
static from_native(variant: any, full_objects: boolean = false): any
|
|
|
|
/** Converts a JSON-compliant value that was created with [method from_native] back to native engine types.
|
|
* By default, objects are ignored for security reasons, unless [param allow_objects] is `true`.
|
|
* You can convert a JSON string back to a native value like this:
|
|
*
|
|
*/
|
|
static to_native(json: any, allow_objects: boolean = false): any
|
|
|
|
/** Contains the parsed JSON data in [Variant] form. */
|
|
get data(): any
|
|
set data(value: any)
|
|
}
|
|
namespace JSONRPC {
|
|
enum ErrorCode {
|
|
/** The request could not be parsed as it was not valid by JSON standard ([method JSON.parse] failed). */
|
|
PARSE_ERROR = -32700,
|
|
|
|
/** A method call was requested but the request's format is not valid. */
|
|
INVALID_REQUEST = -32600,
|
|
|
|
/** A method call was requested but no function of that name existed in the JSONRPC subclass. */
|
|
METHOD_NOT_FOUND = -32601,
|
|
|
|
/** A method call was requested but the given method parameters are not valid. Not used by the built-in JSONRPC. */
|
|
INVALID_PARAMS = -32602,
|
|
|
|
/** An internal error occurred while processing the request. Not used by the built-in JSONRPC. */
|
|
INTERNAL_ERROR = -32603,
|
|
}
|
|
}
|
|
/** A helper to handle dictionaries which look like JSONRPC documents.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_jsonrpc.html
|
|
*/
|
|
class JSONRPC extends Object {
|
|
constructor(identifier?: any)
|
|
set_scope(scope: string, target: Object): void
|
|
|
|
/** Given a Dictionary which takes the form of a JSON-RPC request: unpack the request and run it. Methods are resolved by looking at the field called "method" and looking for an equivalently named function in the JSONRPC object. If one is found that method is called.
|
|
* To add new supported methods extend the JSONRPC class and call [method process_action] on your subclass.
|
|
* [param action]: The action to be run, as a Dictionary in the form of a JSON-RPC request or notification.
|
|
*/
|
|
process_action(action: any, recurse: boolean = false): any
|
|
process_string(action: string): string
|
|
|
|
/** Returns a dictionary in the form of a JSON-RPC request. Requests are sent to a server with the expectation of a response. The ID field is used for the server to specify which exact request it is responding to.
|
|
* - [param method]: Name of the method being called.
|
|
* - [param params]: An array or dictionary of parameters being passed to the method.
|
|
* - [param id]: Uniquely identifies this request. The server is expected to send a response with the same ID.
|
|
*/
|
|
make_request(method: string, params: any, id: any): GDictionary
|
|
|
|
/** When a server has received and processed a request, it is expected to send a response. If you did not want a response then you need to have sent a Notification instead.
|
|
* - [param result]: The return value of the function which was called.
|
|
* - [param id]: The ID of the request this response is targeted to.
|
|
*/
|
|
make_response(result: any, id: any): GDictionary
|
|
|
|
/** Returns a dictionary in the form of a JSON-RPC notification. Notifications are one-shot messages which do not expect a response.
|
|
* - [param method]: Name of the method being called.
|
|
* - [param params]: An array or dictionary of parameters being passed to the method.
|
|
*/
|
|
make_notification(method: string, params: any): GDictionary
|
|
|
|
/** Creates a response which indicates a previous reply has failed in some way.
|
|
* - [param code]: The error code corresponding to what kind of error this is. See the [enum ErrorCode] constants.
|
|
* - [param message]: A custom message about this error.
|
|
* - [param id]: The request this error is a response to.
|
|
*/
|
|
make_response_error(code: int64, message: string, id: any = <any> {}): GDictionary
|
|
}
|
|
/** Represents a class from the Java Native Interface.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_javaclass.html
|
|
*/
|
|
class JavaClass extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns the Java class name. */
|
|
get_java_class_name(): string
|
|
|
|
/** Returns the object's Java methods and their signatures as an [Array] of dictionaries, in the same format as [method Object.get_method_list]. */
|
|
get_java_method_list(): GArray
|
|
|
|
/** Returns a [JavaClass] representing the Java parent class of this class. */
|
|
get_java_parent_class(): JavaClass
|
|
}
|
|
/** Represents an object from the Java Native Interface.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_javaobject.html
|
|
*/
|
|
class JavaObject extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns the [JavaClass] that this object is an instance of. */
|
|
get_java_class(): JavaClass
|
|
}
|
|
/** A wrapper class for web native JavaScript objects.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_javascriptobject.html
|
|
*/
|
|
class JavaScriptObject extends RefCounted {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Abstract base class for all 2D physics joints.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_joint2d.html
|
|
*/
|
|
class Joint2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the joint's internal [RID] from the [PhysicsServer2D]. */
|
|
get_rid(): RID
|
|
|
|
/** Path to the first body (A) attached to the joint. The node must inherit [PhysicsBody2D]. */
|
|
get node_a(): NodePath
|
|
set node_a(value: NodePath | string)
|
|
|
|
/** Path to the second body (B) attached to the joint. The node must inherit [PhysicsBody2D]. */
|
|
get node_b(): NodePath
|
|
set node_b(value: NodePath | string)
|
|
|
|
/** When [member node_a] and [member node_b] move in different directions the [member bias] controls how fast the joint pulls them back to their original position. The lower the [member bias] the more the two bodies can pull on the joint.
|
|
* When set to `0`, the default value from [member ProjectSettings.physics/2d/solver/default_constraint_bias] is used.
|
|
*/
|
|
get bias(): float64
|
|
set bias(value: float64)
|
|
|
|
/** If `true`, the two bodies bound together do not collide with each other. */
|
|
get disable_collision(): boolean
|
|
set disable_collision(value: boolean)
|
|
}
|
|
/** Abstract base class for all 3D physics joints.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_joint3d.html
|
|
*/
|
|
class Joint3D<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the joint's internal [RID] from the [PhysicsServer3D]. */
|
|
get_rid(): RID
|
|
|
|
/** Path to the first node (A) attached to the joint. The node must inherit [PhysicsBody3D].
|
|
* If left empty and [member node_b] is set, the body is attached to a fixed [StaticBody3D] without collision shapes.
|
|
*/
|
|
get node_a(): NodePath
|
|
set node_a(value: NodePath | string)
|
|
|
|
/** Path to the second node (B) attached to the joint. The node must inherit [PhysicsBody3D].
|
|
* If left empty and [member node_a] is set, the body is attached to a fixed [StaticBody3D] without collision shapes.
|
|
*/
|
|
get node_b(): NodePath
|
|
set node_b(value: NodePath | string)
|
|
|
|
/** The priority used to define which solver is executed first for multiple joints. The lower the value, the higher the priority. */
|
|
get solver_priority(): int64
|
|
set solver_priority(value: int64)
|
|
|
|
/** If `true`, the two bodies bound together do not collide with each other. */
|
|
get exclude_nodes_from_collision(): boolean
|
|
set exclude_nodes_from_collision(value: boolean)
|
|
}
|
|
class Joint3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Holds collision data from the movement of a [PhysicsBody2D].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_kinematiccollision2d.html
|
|
*/
|
|
class KinematicCollision2D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns the point of collision in global coordinates. */
|
|
get_position(): Vector2
|
|
|
|
/** Returns the colliding body's shape's normal at the point of collision. */
|
|
get_normal(): Vector2
|
|
|
|
/** Returns the moving object's travel before collision. */
|
|
get_travel(): Vector2
|
|
|
|
/** Returns the moving object's remaining movement vector. */
|
|
get_remainder(): Vector2
|
|
|
|
/** Returns the collision angle according to [param up_direction], which is [constant Vector2.UP] by default. This value is always positive. */
|
|
get_angle(up_direction: Vector2 = new Vector2(0, -1)): float64
|
|
|
|
/** Returns the colliding body's length of overlap along the collision normal. */
|
|
get_depth(): float64
|
|
|
|
/** Returns the moving object's colliding shape. */
|
|
get_local_shape(): Object
|
|
|
|
/** Returns the colliding body's attached [Object]. */
|
|
get_collider(): Object
|
|
|
|
/** Returns the unique instance ID of the colliding body's attached [Object]. See [method Object.get_instance_id]. */
|
|
get_collider_id(): int64
|
|
|
|
/** Returns the colliding body's [RID] used by the [PhysicsServer2D]. */
|
|
get_collider_rid(): RID
|
|
|
|
/** Returns the colliding body's shape. */
|
|
get_collider_shape(): Object
|
|
|
|
/** Returns the colliding body's shape index. See [CollisionObject2D]. */
|
|
get_collider_shape_index(): int64
|
|
|
|
/** Returns the colliding body's velocity. */
|
|
get_collider_velocity(): Vector2
|
|
}
|
|
/** Holds collision data from the movement of a [PhysicsBody3D].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_kinematiccollision3d.html
|
|
*/
|
|
class KinematicCollision3D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns the moving object's travel before collision. */
|
|
get_travel(): Vector3
|
|
|
|
/** Returns the moving object's remaining movement vector. */
|
|
get_remainder(): Vector3
|
|
|
|
/** Returns the colliding body's length of overlap along the collision normal. */
|
|
get_depth(): float64
|
|
|
|
/** Returns the number of detected collisions. */
|
|
get_collision_count(): int64
|
|
|
|
/** Returns the point of collision in global coordinates given a collision index (the deepest collision by default). */
|
|
get_position(collision_index: int64 = 0): Vector3
|
|
|
|
/** Returns the colliding body's shape's normal at the point of collision given a collision index (the deepest collision by default). */
|
|
get_normal(collision_index: int64 = 0): Vector3
|
|
|
|
/** Returns the collision angle according to [param up_direction], which is [constant Vector3.UP] by default. This value is always positive. */
|
|
get_angle(collision_index: int64 = 0, up_direction: Vector3 = Vector3.ZERO): float64
|
|
|
|
/** Returns the moving object's colliding shape given a collision index (the deepest collision by default). */
|
|
get_local_shape(collision_index: int64 = 0): Object
|
|
|
|
/** Returns the colliding body's attached [Object] given a collision index (the deepest collision by default). */
|
|
get_collider(collision_index: int64 = 0): Object
|
|
|
|
/** Returns the unique instance ID of the colliding body's attached [Object] given a collision index (the deepest collision by default). See [method Object.get_instance_id]. */
|
|
get_collider_id(collision_index: int64 = 0): int64
|
|
|
|
/** Returns the colliding body's [RID] used by the [PhysicsServer3D] given a collision index (the deepest collision by default). */
|
|
get_collider_rid(collision_index: int64 = 0): RID
|
|
|
|
/** Returns the colliding body's shape given a collision index (the deepest collision by default). */
|
|
get_collider_shape(collision_index: int64 = 0): Object
|
|
|
|
/** Returns the colliding body's shape index given a collision index (the deepest collision by default). See [CollisionObject3D]. */
|
|
get_collider_shape_index(collision_index: int64 = 0): int64
|
|
|
|
/** Returns the colliding body's velocity given a collision index (the deepest collision by default). */
|
|
get_collider_velocity(collision_index: int64 = 0): Vector3
|
|
}
|
|
/** A control for displaying plain text.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_label.html
|
|
*/
|
|
class Label<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the height of the line [param line].
|
|
* If [param line] is set to `-1`, returns the biggest line height.
|
|
* If there are no lines, returns font size in pixels.
|
|
*/
|
|
get_line_height(line: int64 = -1): int64
|
|
|
|
/** Returns the number of lines of text the Label has. */
|
|
get_line_count(): int64
|
|
|
|
/** Returns the number of lines shown. Useful if the [Label]'s height cannot currently display all lines. */
|
|
get_visible_line_count(): int64
|
|
|
|
/** Returns the total number of printable characters in the text (excluding spaces and newlines). */
|
|
get_total_character_count(): int64
|
|
|
|
/** Returns the bounding rectangle of the character at position [param pos] in the label's local coordinate system. If the character is a non-visual character or [param pos] is outside the valid range, an empty [Rect2] is returned. If the character is a part of a composite grapheme, the bounding rectangle of the whole grapheme is returned. */
|
|
get_character_bounds(pos: int64): Rect2
|
|
|
|
/** The text to display on screen. */
|
|
get text(): string
|
|
set text(value: string)
|
|
|
|
/** A [LabelSettings] resource that can be shared between multiple [Label] nodes. Takes priority over theme properties. */
|
|
get label_settings(): LabelSettings
|
|
set label_settings(value: LabelSettings)
|
|
|
|
/** Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants. */
|
|
get horizontal_alignment(): int64
|
|
set horizontal_alignment(value: int64)
|
|
|
|
/** Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the [enum VerticalAlignment] constants. */
|
|
get vertical_alignment(): int64
|
|
set vertical_alignment(value: int64)
|
|
|
|
/** If set to something other than [constant TextServer.AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see [enum TextServer.AutowrapMode]. */
|
|
get autowrap_mode(): int64
|
|
set autowrap_mode(value: int64)
|
|
|
|
/** Line fill alignment rules. See [enum TextServer.JustificationFlag] for more information. */
|
|
get justification_flags(): int64
|
|
set justification_flags(value: int64)
|
|
|
|
/** String used as a paragraph separator. Each paragraph is processed independently, in its own BiDi context. */
|
|
get paragraph_separator(): string
|
|
set paragraph_separator(value: string)
|
|
|
|
/** If `true`, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally. */
|
|
get clip_text(): boolean
|
|
set clip_text(value: boolean)
|
|
|
|
/** Sets the clipping behavior when the text exceeds the node's bounding rectangle. See [enum TextServer.OverrunBehavior] for a description of all modes. */
|
|
get text_overrun_behavior(): int64
|
|
set text_overrun_behavior(value: int64)
|
|
|
|
/** Ellipsis character used for text clipping. */
|
|
get ellipsis_char(): string
|
|
set ellipsis_char(value: string)
|
|
|
|
/** If `true`, all the text displays as UPPERCASE. */
|
|
get uppercase(): boolean
|
|
set uppercase(value: boolean)
|
|
|
|
/** Aligns text to the given tab-stops. */
|
|
get tab_stops(): PackedFloat32Array
|
|
set tab_stops(value: PackedFloat32Array | float32[])
|
|
|
|
/** The number of the lines ignored and not displayed from the start of the [member text] value. */
|
|
get lines_skipped(): int64
|
|
set lines_skipped(value: int64)
|
|
|
|
/** Limits the lines of text the node shows on screen. */
|
|
get max_lines_visible(): int64
|
|
set max_lines_visible(value: int64)
|
|
|
|
/** The number of characters to display. If set to `-1`, all characters are displayed. This can be useful when animating the text appearing in a dialog box.
|
|
*
|
|
* **Note:** Setting this property updates [member visible_ratio] accordingly.
|
|
*/
|
|
get visible_characters(): int64
|
|
set visible_characters(value: int64)
|
|
|
|
/** Sets the clipping behavior when [member visible_characters] or [member visible_ratio] is set. See [enum TextServer.VisibleCharactersBehavior] for more info. */
|
|
get visible_characters_behavior(): int64
|
|
set visible_characters_behavior(value: int64)
|
|
|
|
/** The fraction of characters to display, relative to the total number of characters (see [method get_total_character_count]). If set to `1.0`, all characters are displayed. If set to `0.5`, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.
|
|
*
|
|
* **Note:** Setting this property updates [member visible_characters] accordingly.
|
|
*/
|
|
get visible_ratio(): float64
|
|
set visible_ratio(value: float64)
|
|
|
|
/** Base text writing direction. */
|
|
get text_direction(): int64
|
|
set text_direction(value: int64)
|
|
|
|
/** Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. */
|
|
get language(): string
|
|
set language(value: string)
|
|
|
|
/** Set BiDi algorithm override for the structured text. */
|
|
get structured_text_bidi_override(): int64
|
|
set structured_text_bidi_override(value: int64)
|
|
|
|
/** Set additional options for BiDi override. */
|
|
get structured_text_bidi_override_options(): GArray
|
|
set structured_text_bidi_override_options(value: GArray)
|
|
}
|
|
namespace Label3D {
|
|
enum DrawFlags {
|
|
/** If set, lights in the environment affect the label. */
|
|
FLAG_SHADED = 0,
|
|
|
|
/** If set, text can be seen from the back as well. If not, the text is invisible when looking at it from behind. */
|
|
FLAG_DOUBLE_SIDED = 1,
|
|
|
|
/** Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it. */
|
|
FLAG_DISABLE_DEPTH_TEST = 2,
|
|
|
|
/** Label is scaled by depth so that it always appears the same size on screen. */
|
|
FLAG_FIXED_SIZE = 3,
|
|
|
|
/** Represents the size of the [enum DrawFlags] enum. */
|
|
FLAG_MAX = 4,
|
|
}
|
|
enum AlphaCutMode {
|
|
/** This mode performs standard alpha blending. It can display translucent areas, but transparency sorting issues may be visible when multiple transparent materials are overlapping. [member GeometryInstance3D.cast_shadow] has no effect when this transparency mode is used; the [Label3D] will never cast shadows. */
|
|
ALPHA_CUT_DISABLED = 0,
|
|
|
|
/** This mode only allows fully transparent or fully opaque pixels. Harsh edges will be visible unless some form of screen-space antialiasing is enabled (see [member ProjectSettings.rendering/anti_aliasing/quality/screen_space_aa]). This mode is also known as *alpha testing* or *1-bit transparency* .
|
|
*
|
|
* **Note:** This mode might have issues with anti-aliased fonts and outlines, try adjusting [member alpha_scissor_threshold] or using MSDF font.
|
|
*
|
|
* **Note:** When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline.
|
|
*/
|
|
ALPHA_CUT_DISCARD = 1,
|
|
|
|
/** This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting.
|
|
*
|
|
* **Note:** When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline.
|
|
*/
|
|
ALPHA_CUT_OPAQUE_PREPASS = 2,
|
|
|
|
/** This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque. */
|
|
ALPHA_CUT_HASH = 3,
|
|
}
|
|
}
|
|
/** A node for displaying plain text in 3D space.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_label3d.html
|
|
*/
|
|
class Label3D<Map extends Record<string, Node> = Record<string, Node>> extends GeometryInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** If `true`, the specified flag will be enabled. See [enum Label3D.DrawFlags] for a list of flags. */
|
|
set_draw_flag(flag: Label3D.DrawFlags, enabled: boolean): void
|
|
|
|
/** Returns the value of the specified flag. */
|
|
get_draw_flag(flag: Label3D.DrawFlags): boolean
|
|
|
|
/** Returns a [TriangleMesh] with the label's vertices following its current configuration (such as its [member pixel_size]). */
|
|
generate_triangle_mesh(): TriangleMesh
|
|
|
|
/** The size of one pixel's width on the label to scale it in 3D. To make the font look more detailed when up close, increase [member font_size] while decreasing [member pixel_size] at the same time. */
|
|
get pixel_size(): float64
|
|
set pixel_size(value: float64)
|
|
|
|
/** The text drawing offset (in pixels). */
|
|
get offset(): Vector2
|
|
set offset(value: Vector2)
|
|
|
|
/** The billboard mode to use for the label. See [enum BaseMaterial3D.BillboardMode] for possible values. */
|
|
get billboard(): int64
|
|
set billboard(value: int64)
|
|
|
|
/** If `true`, the [Light3D] in the [Environment] has effects on the label. */
|
|
get shaded(): boolean
|
|
set shaded(value: boolean)
|
|
|
|
/** If `true`, text can be seen from the back as well, if `false`, it is invisible when looking at it from behind. */
|
|
get double_sided(): boolean
|
|
set double_sided(value: boolean)
|
|
|
|
/** If `true`, depth testing is disabled and the object will be drawn in render order. */
|
|
get no_depth_test(): boolean
|
|
set no_depth_test(value: boolean)
|
|
|
|
/** If `true`, the label is rendered at the same size regardless of distance. */
|
|
get fixed_size(): boolean
|
|
set fixed_size(value: boolean)
|
|
|
|
/** The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values. */
|
|
get alpha_cut(): int64
|
|
set alpha_cut(value: int64)
|
|
|
|
/** Threshold at which the alpha scissor will discard values. */
|
|
get alpha_scissor_threshold(): float64
|
|
set alpha_scissor_threshold(value: float64)
|
|
|
|
/** The hashing scale for Alpha Hash. Recommended values between `0` and `2`. */
|
|
get alpha_hash_scale(): float64
|
|
set alpha_hash_scale(value: float64)
|
|
|
|
/** The type of alpha antialiasing to apply. See [enum BaseMaterial3D.AlphaAntiAliasing]. */
|
|
get alpha_antialiasing_mode(): int64
|
|
set alpha_antialiasing_mode(value: int64)
|
|
|
|
/** Threshold at which antialiasing will be applied on the alpha channel. */
|
|
get alpha_antialiasing_edge(): float64
|
|
set alpha_antialiasing_edge(value: float64)
|
|
|
|
/** Filter flags for the texture. See [enum BaseMaterial3D.TextureFilter] for options. */
|
|
get texture_filter(): int64
|
|
set texture_filter(value: int64)
|
|
|
|
/** Sets the render priority for the text. Higher priority objects will be sorted in front of lower priority objects.
|
|
*
|
|
* **Note:** This only applies if [member alpha_cut] is set to [constant ALPHA_CUT_DISABLED] (default value).
|
|
*
|
|
* **Note:** This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
|
|
*/
|
|
get render_priority(): int64
|
|
set render_priority(value: int64)
|
|
|
|
/** Sets the render priority for the text outline. Higher priority objects will be sorted in front of lower priority objects.
|
|
*
|
|
* **Note:** This only applies if [member alpha_cut] is set to [constant ALPHA_CUT_DISABLED] (default value).
|
|
*
|
|
* **Note:** This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
|
|
*/
|
|
get outline_render_priority(): int64
|
|
set outline_render_priority(value: int64)
|
|
|
|
/** Text [Color] of the [Label3D]. */
|
|
get modulate(): Color
|
|
set modulate(value: Color)
|
|
|
|
/** The tint of text outline. */
|
|
get outline_modulate(): Color
|
|
set outline_modulate(value: Color)
|
|
|
|
/** The text to display on screen. */
|
|
get text(): string
|
|
set text(value: string)
|
|
|
|
/** Font configuration used to display text. */
|
|
get font(): Font
|
|
set font(value: Font)
|
|
|
|
/** Font size of the [Label3D]'s text. To make the font look more detailed when up close, increase [member font_size] while decreasing [member pixel_size] at the same time.
|
|
* Higher font sizes require more time to render new characters, which can cause stuttering during gameplay.
|
|
*/
|
|
get font_size(): int64
|
|
set font_size(value: int64)
|
|
|
|
/** Text outline size. */
|
|
get outline_size(): int64
|
|
set outline_size(value: int64)
|
|
|
|
/** Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants. */
|
|
get horizontal_alignment(): int64
|
|
set horizontal_alignment(value: int64)
|
|
|
|
/** Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the [enum VerticalAlignment] constants. */
|
|
get vertical_alignment(): int64
|
|
set vertical_alignment(value: int64)
|
|
|
|
/** If `true`, all the text displays as UPPERCASE. */
|
|
get uppercase(): boolean
|
|
set uppercase(value: boolean)
|
|
|
|
/** Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative. */
|
|
get line_spacing(): float64
|
|
set line_spacing(value: float64)
|
|
|
|
/** If set to something other than [constant TextServer.AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see [enum TextServer.AutowrapMode]. */
|
|
get autowrap_mode(): int64
|
|
set autowrap_mode(value: int64)
|
|
|
|
/** Line fill alignment rules. See [enum TextServer.JustificationFlag] for more information. */
|
|
get justification_flags(): int64
|
|
set justification_flags(value: int64)
|
|
|
|
/** Text width (in pixels), used for autowrap and fill alignment. */
|
|
get width(): float64
|
|
set width(value: float64)
|
|
|
|
/** Base text writing direction. */
|
|
get text_direction(): int64
|
|
set text_direction(value: int64)
|
|
|
|
/** Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. */
|
|
get language(): string
|
|
set language(value: string)
|
|
|
|
/** Set BiDi algorithm override for the structured text. */
|
|
get structured_text_bidi_override(): int64
|
|
set structured_text_bidi_override(value: int64)
|
|
|
|
/** Set additional options for BiDi override. */
|
|
get structured_text_bidi_override_options(): GArray
|
|
set structured_text_bidi_override_options(value: GArray)
|
|
}
|
|
class Label3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Provides common settings to customize the text in a [Label].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_labelsettings.html
|
|
*/
|
|
class LabelSettings extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative. */
|
|
get line_spacing(): float64
|
|
set line_spacing(value: float64)
|
|
|
|
/** Vertical space between paragraphs. Added on top of [member line_spacing]. */
|
|
get paragraph_spacing(): float64
|
|
set paragraph_spacing(value: float64)
|
|
|
|
/** [Font] used for the text. */
|
|
get font(): Font
|
|
set font(value: Font)
|
|
|
|
/** Size of the text. */
|
|
get font_size(): int64
|
|
set font_size(value: int64)
|
|
|
|
/** Color of the text. */
|
|
get font_color(): Color
|
|
set font_color(value: Color)
|
|
|
|
/** Text outline size. */
|
|
get outline_size(): int64
|
|
set outline_size(value: int64)
|
|
|
|
/** The color of the outline. */
|
|
get outline_color(): Color
|
|
set outline_color(value: Color)
|
|
|
|
/** Size of the shadow effect. */
|
|
get shadow_size(): int64
|
|
set shadow_size(value: int64)
|
|
|
|
/** Color of the shadow effect. If alpha is `0`, no shadow will be drawn. */
|
|
get shadow_color(): Color
|
|
set shadow_color(value: Color)
|
|
|
|
/** Offset of the shadow effect, in pixels. */
|
|
get shadow_offset(): Vector2
|
|
set shadow_offset(value: Vector2)
|
|
}
|
|
namespace Light2D {
|
|
enum ShadowFilter {
|
|
/** No filter applies to the shadow map. This provides hard shadow edges and is the fastest to render. See [member shadow_filter]. */
|
|
SHADOW_FILTER_NONE = 0,
|
|
|
|
/** Percentage closer filtering (5 samples) applies to the shadow map. This is slower compared to hard shadow rendering. See [member shadow_filter]. */
|
|
SHADOW_FILTER_PCF5 = 1,
|
|
|
|
/** Percentage closer filtering (13 samples) applies to the shadow map. This is the slowest shadow filtering mode, and should be used sparingly. See [member shadow_filter]. */
|
|
SHADOW_FILTER_PCF13 = 2,
|
|
}
|
|
enum BlendMode {
|
|
/** Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behavior of a light. */
|
|
BLEND_MODE_ADD = 0,
|
|
|
|
/** Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect. */
|
|
BLEND_MODE_SUB = 1,
|
|
|
|
/** Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation. */
|
|
BLEND_MODE_MIX = 2,
|
|
}
|
|
}
|
|
/** Casts light in a 2D environment.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_light2d.html
|
|
*/
|
|
class Light2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Sets the light's height, which is used in 2D normal mapping. See [member PointLight2D.height] and [member DirectionalLight2D.height]. */
|
|
set_height(height: float64): void
|
|
|
|
/** Returns the light's height, which is used in 2D normal mapping. See [member PointLight2D.height] and [member DirectionalLight2D.height]. */
|
|
get_height(): float64
|
|
|
|
/** If `true`, Light2D will emit light. */
|
|
get enabled(): boolean
|
|
set enabled(value: boolean)
|
|
|
|
/** If `true`, Light2D will only appear when editing the scene. */
|
|
get editor_only(): boolean
|
|
set editor_only(value: boolean)
|
|
|
|
/** The Light2D's [Color]. */
|
|
get color(): Color
|
|
set color(value: Color)
|
|
|
|
/** The Light2D's energy value. The larger the value, the stronger the light. */
|
|
get energy(): float64
|
|
set energy(value: float64)
|
|
|
|
/** The Light2D's blend mode. See [enum BlendMode] constants for values. */
|
|
get blend_mode(): int64
|
|
set blend_mode(value: int64)
|
|
|
|
/** Minimum `z` value of objects that are affected by the Light2D. */
|
|
get range_z_min(): int64
|
|
set range_z_min(value: int64)
|
|
|
|
/** Maximum `z` value of objects that are affected by the Light2D. */
|
|
get range_z_max(): int64
|
|
set range_z_max(value: int64)
|
|
|
|
/** Minimum layer value of objects that are affected by the Light2D. */
|
|
get range_layer_min(): int64
|
|
set range_layer_min(value: int64)
|
|
|
|
/** Maximum layer value of objects that are affected by the Light2D. */
|
|
get range_layer_max(): int64
|
|
set range_layer_max(value: int64)
|
|
|
|
/** The layer mask. Only objects with a matching [member CanvasItem.light_mask] will be affected by the Light2D. See also [member shadow_item_cull_mask], which affects which objects can cast shadows.
|
|
*
|
|
* **Note:** [member range_item_cull_mask] is ignored by [DirectionalLight2D], which will always light a 2D node regardless of the 2D node's [member CanvasItem.light_mask].
|
|
*/
|
|
get range_item_cull_mask(): int64
|
|
set range_item_cull_mask(value: int64)
|
|
|
|
/** If `true`, the Light2D will cast shadows. */
|
|
get shadow_enabled(): boolean
|
|
set shadow_enabled(value: boolean)
|
|
|
|
/** [Color] of shadows cast by the Light2D. */
|
|
get shadow_color(): Color
|
|
set shadow_color(value: Color)
|
|
|
|
/** Shadow filter type. See [enum ShadowFilter] for possible values. */
|
|
get shadow_filter(): int64
|
|
set shadow_filter(value: int64)
|
|
|
|
/** Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. [member shadow_filter_smooth] only has an effect if [member shadow_filter] is [constant SHADOW_FILTER_PCF5] or [constant SHADOW_FILTER_PCF13]. */
|
|
get shadow_filter_smooth(): float64
|
|
set shadow_filter_smooth(value: float64)
|
|
|
|
/** The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching [member CanvasItem.light_mask] will cast shadows. See also [member range_item_cull_mask], which affects which objects can *receive* the light. */
|
|
get shadow_item_cull_mask(): int64
|
|
set shadow_item_cull_mask(value: int64)
|
|
}
|
|
namespace Light3D {
|
|
enum Param {
|
|
/** Constant for accessing [member light_energy]. */
|
|
PARAM_ENERGY = 0,
|
|
|
|
/** Constant for accessing [member light_indirect_energy]. */
|
|
PARAM_INDIRECT_ENERGY = 1,
|
|
|
|
/** Constant for accessing [member light_volumetric_fog_energy]. */
|
|
PARAM_VOLUMETRIC_FOG_ENERGY = 2,
|
|
|
|
/** Constant for accessing [member light_specular]. */
|
|
PARAM_SPECULAR = 3,
|
|
|
|
/** Constant for accessing [member OmniLight3D.omni_range] or [member SpotLight3D.spot_range]. */
|
|
PARAM_RANGE = 4,
|
|
|
|
/** Constant for accessing [member light_size]. */
|
|
PARAM_SIZE = 5,
|
|
|
|
/** Constant for accessing [member OmniLight3D.omni_attenuation] or [member SpotLight3D.spot_attenuation]. */
|
|
PARAM_ATTENUATION = 6,
|
|
|
|
/** Constant for accessing [member SpotLight3D.spot_angle]. */
|
|
PARAM_SPOT_ANGLE = 7,
|
|
|
|
/** Constant for accessing [member SpotLight3D.spot_angle_attenuation]. */
|
|
PARAM_SPOT_ATTENUATION = 8,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_max_distance]. */
|
|
PARAM_SHADOW_MAX_DISTANCE = 9,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_split_1]. */
|
|
PARAM_SHADOW_SPLIT_1_OFFSET = 10,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_split_2]. */
|
|
PARAM_SHADOW_SPLIT_2_OFFSET = 11,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_split_3]. */
|
|
PARAM_SHADOW_SPLIT_3_OFFSET = 12,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_fade_start]. */
|
|
PARAM_SHADOW_FADE_START = 13,
|
|
|
|
/** Constant for accessing [member shadow_normal_bias]. */
|
|
PARAM_SHADOW_NORMAL_BIAS = 14,
|
|
|
|
/** Constant for accessing [member shadow_bias]. */
|
|
PARAM_SHADOW_BIAS = 15,
|
|
|
|
/** Constant for accessing [member DirectionalLight3D.directional_shadow_pancake_size]. */
|
|
PARAM_SHADOW_PANCAKE_SIZE = 16,
|
|
|
|
/** Constant for accessing [member shadow_opacity]. */
|
|
PARAM_SHADOW_OPACITY = 17,
|
|
|
|
/** Constant for accessing [member shadow_blur]. */
|
|
PARAM_SHADOW_BLUR = 18,
|
|
|
|
/** Constant for accessing [member shadow_transmittance_bias]. */
|
|
PARAM_TRANSMITTANCE_BIAS = 19,
|
|
|
|
/** Constant for accessing [member light_intensity_lumens] and [member light_intensity_lux]. Only used when [member ProjectSettings.rendering/lights_and_shadows/use_physical_light_units] is `true`. */
|
|
PARAM_INTENSITY = 20,
|
|
|
|
/** Represents the size of the [enum Param] enum. */
|
|
PARAM_MAX = 21,
|
|
}
|
|
enum BakeMode {
|
|
/** Light is ignored when baking. This is the fastest mode, but the light will be taken into account when baking global illumination. This mode should generally be used for dynamic lights that change quickly, as the effect of global illumination is less noticeable on those lights.
|
|
*
|
|
* **Note:** Hiding a light does *not* affect baking [LightmapGI]. Hiding a light will still affect baking [VoxelGI] and SDFGI (see [member Environment.sdfgi_enabled]).
|
|
*/
|
|
BAKE_DISABLED = 0,
|
|
|
|
/** Light is taken into account in static baking ([VoxelGI], [LightmapGI], SDFGI ([member Environment.sdfgi_enabled])). The light can be moved around or modified, but its global illumination will not update in real-time. This is suitable for subtle changes (such as flickering torches), but generally not large changes such as toggling a light on and off.
|
|
*
|
|
* **Note:** The light is not baked in [LightmapGI] if [member editor_only] is `true`.
|
|
*/
|
|
BAKE_STATIC = 1,
|
|
|
|
/** Light is taken into account in dynamic baking ([VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) only). The light can be moved around or modified with global illumination updating in real-time. The light's global illumination appearance will be slightly different compared to [constant BAKE_STATIC]. This has a greater performance cost compared to [constant BAKE_STATIC]. When using SDFGI, the update speed of dynamic lights is affected by [member ProjectSettings.rendering/global_illumination/sdfgi/frames_to_update_lights]. */
|
|
BAKE_DYNAMIC = 2,
|
|
}
|
|
}
|
|
/** Provides a base class for different kinds of light nodes.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_light3d.html
|
|
*/
|
|
class Light3D<Map extends Record<string, Node> = Record<string, Node>> extends VisualInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Sets the value of the specified [enum Light3D.Param] parameter. */
|
|
set_param(param: Light3D.Param, value: float64): void
|
|
|
|
/** Returns the value of the specified [enum Light3D.Param] parameter. */
|
|
get_param(param: Light3D.Param): float64
|
|
|
|
/** Returns the [Color] of an idealized blackbody at the given [member light_temperature]. This value is calculated internally based on the [member light_temperature]. This [Color] is multiplied by [member light_color] before being sent to the [RenderingServer]. */
|
|
get_correlated_color(): Color
|
|
|
|
/** Used by positional lights ([OmniLight3D] and [SpotLight3D]) when [member ProjectSettings.rendering/lights_and_shadows/use_physical_light_units] is `true`. Sets the intensity of the light source measured in Lumens. Lumens are a measure of luminous flux, which is the total amount of visible light emitted by a light source per unit of time.
|
|
* For [SpotLight3D]s, we assume that the area outside the visible cone is surrounded by a perfect light absorbing material. Accordingly, the apparent brightness of the cone area does not change as the cone increases and decreases in size.
|
|
* A typical household lightbulb can range from around 600 lumens to 1,200 lumens, a candle is about 13 lumens, while a streetlight can be approximately 60,000 lumens.
|
|
*/
|
|
get light_intensity_lumens(): float64
|
|
set light_intensity_lumens(value: float64)
|
|
|
|
/** Used by [DirectionalLight3D]s when [member ProjectSettings.rendering/lights_and_shadows/use_physical_light_units] is `true`. Sets the intensity of the light source measured in Lux. Lux is a measure of luminous flux per unit area, it is equal to one lumen per square meter. Lux is the measure of how much light hits a surface at a given time.
|
|
* On a clear sunny day a surface in direct sunlight may be approximately 100,000 lux, a typical room in a home may be approximately 50 lux, while the moonlit ground may be approximately 0.1 lux.
|
|
*/
|
|
get light_intensity_lux(): float64
|
|
set light_intensity_lux(value: float64)
|
|
|
|
/** Sets the color temperature of the light source, measured in Kelvin. This is used to calculate a correlated color temperature which tints the [member light_color].
|
|
* The sun on a cloudy day is approximately 6500 Kelvin, on a clear day it is between 5500 to 6000 Kelvin, and on a clear day at sunrise or sunset it ranges to around 1850 Kelvin.
|
|
*/
|
|
get light_temperature(): float64
|
|
set light_temperature(value: float64)
|
|
|
|
/** The light's color. An *overbright* color can be used to achieve a result equivalent to increasing the light's [member light_energy]. */
|
|
get light_color(): Color
|
|
set light_color(value: Color)
|
|
|
|
/** The light's strength multiplier (this is not a physical unit). For [OmniLight3D] and [SpotLight3D], changing this value will only change the light color's intensity, not the light's radius. */
|
|
get light_energy(): float64
|
|
set light_energy(value: float64)
|
|
|
|
/** Secondary multiplier used with indirect light (light bounces). Used with [VoxelGI] and SDFGI (see [member Environment.sdfgi_enabled]).
|
|
*
|
|
* **Note:** This property is ignored if [member light_energy] is equal to `0.0`, as the light won't be present at all in the GI shader.
|
|
*/
|
|
get light_indirect_energy(): float64
|
|
set light_indirect_energy(value: float64)
|
|
|
|
/** Secondary multiplier multiplied with [member light_energy] then used with the [Environment]'s volumetric fog (if enabled). If set to `0.0`, computing volumetric fog will be skipped for this light, which can improve performance for large amounts of lights when volumetric fog is enabled.
|
|
*
|
|
* **Note:** To prevent short-lived dynamic light effects from poorly interacting with volumetric fog, lights used in those effects should have [member light_volumetric_fog_energy] set to `0.0` unless [member Environment.volumetric_fog_temporal_reprojection_enabled] is disabled (or unless the reprojection amount is significantly lowered).
|
|
*/
|
|
get light_volumetric_fog_energy(): float64
|
|
set light_volumetric_fog_energy(value: float64)
|
|
|
|
/** [Texture2D] projected by light. [member shadow_enabled] must be on for the projector to work. Light projectors make the light appear as if it is shining through a colored but transparent object, almost like light shining through stained-glass.
|
|
*
|
|
* **Note:** Unlike [BaseMaterial3D] whose filter mode can be adjusted on a per-material basis, the filter mode for light projector textures is set globally with [member ProjectSettings.rendering/textures/light_projectors/filter].
|
|
*
|
|
* **Note:** Light projector textures are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
|
|
*/
|
|
get light_projector(): Texture2D | any /*-AnimatedTexture*/ | any /*-AtlasTexture*/ | any /*-CameraTexture*/ | any /*-CanvasTexture*/ | any /*-MeshTexture*/ | any /*-Texture2DRD*/ | any /*-ViewportTexture*/
|
|
set light_projector(value: Texture2D | any /*-AnimatedTexture*/ | any /*-AtlasTexture*/ | any /*-CameraTexture*/ | any /*-CanvasTexture*/ | any /*-MeshTexture*/ | any /*-Texture2DRD*/ | any /*-ViewportTexture*/)
|
|
|
|
/** The size of the light in Godot units. Only available for [OmniLight3D]s and [SpotLight3D]s. Increasing this value will make the light fade out slower and shadows appear blurrier (also called percentage-closer soft shadows, or PCSS). This can be used to simulate area lights to an extent. Increasing this value above `0.0` for lights with shadows enabled will have a noticeable performance cost due to PCSS.
|
|
*
|
|
* **Note:** [member light_size] is not affected by [member Node3D.scale] (the light's scale or its parent's scale).
|
|
*
|
|
* **Note:** PCSS for positional lights is only supported in the Forward+ and Mobile rendering methods, not Compatibility.
|
|
*/
|
|
get light_size(): float64
|
|
set light_size(value: float64)
|
|
|
|
/** The light's angular size in degrees. Increasing this will make shadows softer at greater distances (also called percentage-closer soft shadows, or PCSS). Only available for [DirectionalLight3D]s. For reference, the Sun from the Earth is approximately `0.5`. Increasing this value above `0.0` for lights with shadows enabled will have a noticeable performance cost due to PCSS.
|
|
*
|
|
* **Note:** [member light_angular_distance] is not affected by [member Node3D.scale] (the light's scale or its parent's scale).
|
|
*
|
|
* **Note:** PCSS for directional lights is only supported in the Forward+ rendering method, not Mobile or Compatibility.
|
|
*/
|
|
get light_angular_distance(): float64
|
|
set light_angular_distance(value: float64)
|
|
|
|
/** If `true`, the light's effect is reversed, darkening areas and casting bright shadows. */
|
|
get light_negative(): boolean
|
|
set light_negative(value: boolean)
|
|
|
|
/** The intensity of the specular blob in objects affected by the light. At `0`, the light becomes a pure diffuse light. When not baking emission, this can be used to avoid unrealistic reflections when placing lights above an emissive surface. */
|
|
get light_specular(): float64
|
|
set light_specular(value: float64)
|
|
|
|
/** The light's bake mode. This will affect the global illumination techniques that have an effect on the light's rendering. See [enum BakeMode].
|
|
*
|
|
* **Note:** Meshes' global illumination mode will also affect the global illumination rendering. See [member GeometryInstance3D.gi_mode].
|
|
*/
|
|
get light_bake_mode(): int64
|
|
set light_bake_mode(value: int64)
|
|
|
|
/** The light will affect objects in the selected layers. */
|
|
get light_cull_mask(): int64
|
|
set light_cull_mask(value: int64)
|
|
|
|
/** If `true`, the light will cast real-time shadows. This has a significant performance cost. Only enable shadow rendering when it makes a noticeable difference in the scene's appearance, and consider using [member distance_fade_enabled] to hide the light when far away from the [Camera3D]. */
|
|
get shadow_enabled(): boolean
|
|
set shadow_enabled(value: boolean)
|
|
|
|
/** Used to adjust shadow appearance. Too small a value results in self-shadowing ("shadow acne"), while too large a value causes shadows to separate from casters ("peter-panning"). Adjust as needed. */
|
|
get shadow_bias(): float64
|
|
set shadow_bias(value: float64)
|
|
|
|
/** Offsets the lookup into the shadow map by the object's normal. This can be used to reduce self-shadowing artifacts without using [member shadow_bias]. In practice, this value should be tweaked along with [member shadow_bias] to reduce artifacts as much as possible. */
|
|
get shadow_normal_bias(): float64
|
|
set shadow_normal_bias(value: float64)
|
|
|
|
/** If `true`, reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with [constant GeometryInstance3D.SHADOW_CASTING_SETTING_DOUBLE_SIDED]. */
|
|
get shadow_reverse_cull_face(): boolean
|
|
set shadow_reverse_cull_face(value: boolean)
|
|
get shadow_transmittance_bias(): float64
|
|
set shadow_transmittance_bias(value: float64)
|
|
|
|
/** The opacity to use when rendering the light's shadow map. Values lower than `1.0` make the light appear through shadows. This can be used to fake global illumination at a low performance cost. */
|
|
get shadow_opacity(): float64
|
|
set shadow_opacity(value: float64)
|
|
|
|
/** Blurs the edges of the shadow. Can be used to hide pixel artifacts in low-resolution shadow maps. A high value can impact performance, make shadows appear grainy and can cause other unwanted artifacts. Try to keep as near default as possible. */
|
|
get shadow_blur(): float64
|
|
set shadow_blur(value: float64)
|
|
|
|
/** The light will only cast shadows using objects in the selected layers. */
|
|
get shadow_caster_mask(): int64
|
|
set shadow_caster_mask(value: int64)
|
|
|
|
/** If `true`, the light will smoothly fade away when far from the active [Camera3D] starting at [member distance_fade_begin]. This acts as a form of level of detail (LOD). The light will fade out over [member distance_fade_begin] + [member distance_fade_length], after which it will be culled and not sent to the shader at all. Use this to reduce the number of active lights in a scene and thus improve performance.
|
|
*
|
|
* **Note:** Only effective for [OmniLight3D] and [SpotLight3D].
|
|
*/
|
|
get distance_fade_enabled(): boolean
|
|
set distance_fade_enabled(value: boolean)
|
|
|
|
/** The distance from the camera at which the light begins to fade away (in 3D units).
|
|
*
|
|
* **Note:** Only effective for [OmniLight3D] and [SpotLight3D].
|
|
*/
|
|
get distance_fade_begin(): float64
|
|
set distance_fade_begin(value: float64)
|
|
|
|
/** The distance from the camera at which the light's shadow cuts off (in 3D units). Set this to a value lower than [member distance_fade_begin] + [member distance_fade_length] to further improve performance, as shadow rendering is often more expensive than light rendering itself.
|
|
*
|
|
* **Note:** Only effective for [OmniLight3D] and [SpotLight3D], and only when [member shadow_enabled] is `true`.
|
|
*/
|
|
get distance_fade_shadow(): float64
|
|
set distance_fade_shadow(value: float64)
|
|
|
|
/** Distance over which the light and its shadow fades. The light's energy and shadow's opacity is progressively reduced over this distance and is completely invisible at the end.
|
|
*
|
|
* **Note:** Only effective for [OmniLight3D] and [SpotLight3D].
|
|
*/
|
|
get distance_fade_length(): float64
|
|
set distance_fade_length(value: float64)
|
|
|
|
/** If `true`, the light only appears in the editor and will not be visible at runtime. If `true`, the light will never be baked in [LightmapGI] regardless of its [member light_bake_mode]. */
|
|
get editor_only(): boolean
|
|
set editor_only(value: boolean)
|
|
}
|
|
class Light3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Occludes light cast by a Light2D, casting shadows.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightoccluder2d.html
|
|
*/
|
|
class LightOccluder2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The [OccluderPolygon2D] used to compute the shadow. */
|
|
get occluder(): OccluderPolygon2D
|
|
set occluder(value: OccluderPolygon2D)
|
|
|
|
/** If enabled, the occluder will be part of a real-time generated signed distance field that can be used in custom shaders. */
|
|
get sdf_collision(): boolean
|
|
set sdf_collision(value: boolean)
|
|
|
|
/** The LightOccluder2D's occluder light mask. The LightOccluder2D will cast shadows only from Light2D(s) that have the same light mask(s). */
|
|
get occluder_light_mask(): int64
|
|
set occluder_light_mask(value: int64)
|
|
}
|
|
class LightOccluder2DEditor<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditor<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class LightOccluder2DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace LightmapGI {
|
|
enum BakeQuality {
|
|
/** Low bake quality (fastest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/low_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/low_quality_probe_ray_count]. */
|
|
BAKE_QUALITY_LOW = 0,
|
|
|
|
/** Medium bake quality (fast bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_probe_ray_count]. */
|
|
BAKE_QUALITY_MEDIUM = 1,
|
|
|
|
/** High bake quality (slow bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_probe_ray_count]. */
|
|
BAKE_QUALITY_HIGH = 2,
|
|
|
|
/** Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count]. */
|
|
BAKE_QUALITY_ULTRA = 3,
|
|
}
|
|
enum GenerateProbes {
|
|
/** Don't generate lightmap probes for lighting dynamic objects. */
|
|
GENERATE_PROBES_DISABLED = 0,
|
|
|
|
/** Lowest level of subdivision (fastest bake times, smallest file sizes). */
|
|
GENERATE_PROBES_SUBDIV_4 = 1,
|
|
|
|
/** Low level of subdivision (fast bake times, small file sizes). */
|
|
GENERATE_PROBES_SUBDIV_8 = 2,
|
|
|
|
/** High level of subdivision (slow bake times, large file sizes). */
|
|
GENERATE_PROBES_SUBDIV_16 = 3,
|
|
|
|
/** Highest level of subdivision (slowest bake times, largest file sizes). */
|
|
GENERATE_PROBES_SUBDIV_32 = 4,
|
|
}
|
|
enum BakeError {
|
|
/** Lightmap baking was successful. */
|
|
BAKE_ERROR_OK = 0,
|
|
|
|
/** Lightmap baking failed because the root node for the edited scene could not be accessed. */
|
|
BAKE_ERROR_NO_SCENE_ROOT = 1,
|
|
|
|
/** Lightmap baking failed as the lightmap data resource is embedded in a foreign resource. */
|
|
BAKE_ERROR_FOREIGN_DATA = 2,
|
|
|
|
/** Lightmap baking failed as there is no lightmapper available in this Godot build. */
|
|
BAKE_ERROR_NO_LIGHTMAPPER = 3,
|
|
|
|
/** Lightmap baking failed as the [LightmapGIData] save path isn't configured in the resource. */
|
|
BAKE_ERROR_NO_SAVE_PATH = 4,
|
|
|
|
/** Lightmap baking failed as there are no meshes whose [member GeometryInstance3D.gi_mode] is [constant GeometryInstance3D.GI_MODE_STATIC] and with valid UV2 mapping in the current scene. You may need to select 3D scenes in the Import dock and change their global illumination mode accordingly. */
|
|
BAKE_ERROR_NO_MESHES = 5,
|
|
|
|
/** Lightmap baking failed as the lightmapper failed to analyze some of the meshes marked as static for baking. */
|
|
BAKE_ERROR_MESHES_INVALID = 6,
|
|
|
|
/** Lightmap baking failed as the resulting image couldn't be saved or imported by Godot after it was saved. */
|
|
BAKE_ERROR_CANT_CREATE_IMAGE = 7,
|
|
|
|
/** The user aborted the lightmap baking operation (typically by clicking the **Cancel** button in the progress dialog). */
|
|
BAKE_ERROR_USER_ABORTED = 8,
|
|
|
|
/** Lightmap baking failed as the maximum texture size is too small to fit some of the meshes marked for baking. */
|
|
BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL = 9,
|
|
|
|
/** Lightmap baking failed as the lightmap is too small. */
|
|
BAKE_ERROR_LIGHTMAP_TOO_SMALL = 10,
|
|
|
|
/** Lightmap baking failed as the lightmap was unable to fit into an atlas. */
|
|
BAKE_ERROR_ATLAS_TOO_SMALL = 11,
|
|
}
|
|
enum EnvironmentMode {
|
|
/** Ignore environment lighting when baking lightmaps. */
|
|
ENVIRONMENT_MODE_DISABLED = 0,
|
|
|
|
/** Use the scene's environment lighting when baking lightmaps.
|
|
*
|
|
* **Note:** If baking lightmaps in a scene with no [WorldEnvironment] node, this will act like [constant ENVIRONMENT_MODE_DISABLED]. The editor's preview sky and sun is *not* taken into account by [LightmapGI] when baking lightmaps.
|
|
*/
|
|
ENVIRONMENT_MODE_SCENE = 1,
|
|
|
|
/** Use [member environment_custom_sky] as a source of environment lighting when baking lightmaps. */
|
|
ENVIRONMENT_MODE_CUSTOM_SKY = 2,
|
|
|
|
/** Use [member environment_custom_color] multiplied by [member environment_custom_energy] as a constant source of environment lighting when baking lightmaps. */
|
|
ENVIRONMENT_MODE_CUSTOM_COLOR = 3,
|
|
}
|
|
}
|
|
/** Computes and stores baked lightmaps for fast global illumination.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightmapgi.html
|
|
*/
|
|
class LightmapGI<Map extends Record<string, Node> = Record<string, Node>> extends VisualInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The quality preset to use when baking lightmaps. This affects bake times, but output file sizes remain mostly identical across quality levels.
|
|
* To further speed up bake times, decrease [member bounces], disable [member use_denoiser] and/or decrease [member texel_scale].
|
|
* To further increase quality, enable [member supersampling] and/or increase [member texel_scale].
|
|
*/
|
|
get quality(): int64
|
|
set quality(value: int64)
|
|
|
|
/** If `true`, lightmaps are baked with the texel scale multiplied with [member supersampling_factor] and downsampled before saving the lightmap (so the effective texel density is identical to having supersampling disabled).
|
|
* Supersampling provides increased lightmap quality with less noise, smoother shadows and better shadowing of small-scale features in objects. However, it may result in significantly increased bake times and memory usage while baking lightmaps. Padding is automatically adjusted to avoid increasing light leaking.
|
|
*/
|
|
get supersampling(): boolean
|
|
set supersampling(value: boolean)
|
|
|
|
/** The factor by which the texel density is multiplied for supersampling. For best results, use an integer value. While fractional values are allowed, they can result in increased light leaking and a blurry lightmap.
|
|
* Higher values may result in better quality, but also increase bake times and memory usage while baking.
|
|
* See [member supersampling] for more information.
|
|
*/
|
|
get supersampling_factor(): float64
|
|
set supersampling_factor(value: float64)
|
|
|
|
/** Number of light bounces that are taken into account during baking. Higher values result in brighter, more realistic lighting, at the cost of longer bake times. If set to `0`, only environment lighting, direct light and emissive lighting is baked. */
|
|
get bounces(): int64
|
|
set bounces(value: int64)
|
|
|
|
/** The energy multiplier for each bounce. Higher values will make indirect lighting brighter. A value of `1.0` represents physically accurate behavior, but higher values can be used to make indirect lighting propagate more visibly when using a low number of bounces. This can be used to speed up bake times by lowering the number of [member bounces] then increasing [member bounce_indirect_energy].
|
|
*
|
|
* **Note:** [member bounce_indirect_energy] only has an effect if [member bounces] is set to a value greater than or equal to `1`.
|
|
*/
|
|
get bounce_indirect_energy(): float64
|
|
set bounce_indirect_energy(value: float64)
|
|
|
|
/** If `true`, bakes lightmaps to contain directional information as spherical harmonics. This results in more realistic lighting appearance, especially with normal mapped materials and for lights that have their direct light baked ([member Light3D.light_bake_mode] set to [constant Light3D.BAKE_STATIC] and with [member Light3D.editor_only] set to `false`). The directional information is also used to provide rough reflections for static and dynamic objects. This has a small run-time performance cost as the shader has to perform more work to interpret the direction information from the lightmap. Directional lightmaps also take longer to bake and result in larger file sizes.
|
|
*
|
|
* **Note:** The property's name has no relationship with [DirectionalLight3D]. [member directional] works with all light types.
|
|
*/
|
|
get directional(): boolean
|
|
set directional(value: boolean)
|
|
|
|
/** The shadowmasking policy to use for directional shadows on static objects that are baked with this [LightmapGI] instance.
|
|
* Shadowmasking allows [DirectionalLight3D] nodes to cast shadows even outside the range defined by their [member DirectionalLight3D.directional_shadow_max_distance] property. This is done by baking a texture that contains a shadowmap for the directional light, then using this texture according to the current shadowmask mode.
|
|
*
|
|
* **Note:** The shadowmask texture is only created if [member shadowmask_mode] is not [constant LightmapGIData.SHADOWMASK_MODE_NONE]. To see a difference, you need to bake lightmaps again after switching from [constant LightmapGIData.SHADOWMASK_MODE_NONE] to any other mode.
|
|
*/
|
|
get shadowmask_mode(): int64
|
|
set shadowmask_mode(value: int64)
|
|
|
|
/** If `true`, a texture with the lighting information will be generated to speed up the generation of indirect lighting at the cost of some accuracy. The geometry might exhibit extra light leak artifacts when using low resolution lightmaps or UVs that stretch the lightmap significantly across surfaces. Leave [member use_texture_for_bounces] at its default value of `true` if unsure.
|
|
*
|
|
* **Note:** [member use_texture_for_bounces] only has an effect if [member bounces] is set to a value greater than or equal to `1`.
|
|
*/
|
|
get use_texture_for_bounces(): boolean
|
|
set use_texture_for_bounces(value: boolean)
|
|
|
|
/** If `true`, ignore environment lighting when baking lightmaps. */
|
|
get interior(): boolean
|
|
set interior(value: boolean)
|
|
|
|
/** If `true`, uses a GPU-based denoising algorithm on the generated lightmap. This eliminates most noise within the generated lightmap at the cost of longer bake times. File sizes are generally not impacted significantly by the use of a denoiser, although lossless compression may do a better job at compressing a denoised image. */
|
|
get use_denoiser(): boolean
|
|
set use_denoiser(value: boolean)
|
|
|
|
/** The strength of denoising step applied to the generated lightmaps. Only effective if [member use_denoiser] is `true` and [member ProjectSettings.rendering/lightmapping/denoising/denoiser] is set to JNLM. */
|
|
get denoiser_strength(): float64
|
|
set denoiser_strength(value: float64)
|
|
|
|
/** The distance in pixels from which the denoiser samples. Lower values preserve more details, but may give blotchy results if the lightmap quality is not high enough. Only effective if [member use_denoiser] is `true` and [member ProjectSettings.rendering/lightmapping/denoising/denoiser] is set to JNLM. */
|
|
get denoiser_range(): int64
|
|
set denoiser_range(value: int64)
|
|
|
|
/** The bias to use when computing shadows. Increasing [member bias] can fix shadow acne on the resulting baked lightmap, but can introduce peter-panning (shadows not connecting to their casters). Real-time [Light3D] shadows are not affected by this [member bias] property. */
|
|
get bias(): float64
|
|
set bias(value: float64)
|
|
|
|
/** Scales the lightmap texel density of all meshes for the current bake. This is a multiplier that builds upon the existing lightmap texel size defined in each imported 3D scene, along with the per-mesh density multiplier (which is designed to be used when the same mesh is used at different scales). Lower values will result in faster bake times.
|
|
* For example, doubling [member texel_scale] doubles the lightmap texture resolution for all objects *on each axis* , so it will *quadruple* the texel count.
|
|
*/
|
|
get texel_scale(): float64
|
|
set texel_scale(value: float64)
|
|
|
|
/** The maximum texture size for the generated texture atlas. Higher values will result in fewer slices being generated, but may not work on all hardware as a result of hardware limitations on texture sizes. Leave [member max_texture_size] at its default value of `16384` if unsure. */
|
|
get max_texture_size(): int64
|
|
set max_texture_size(value: int64)
|
|
|
|
/** The environment mode to use when baking lightmaps. */
|
|
get environment_mode(): int64
|
|
set environment_mode(value: int64)
|
|
|
|
/** The sky to use as a source of environment lighting. Only effective if [member environment_mode] is [constant ENVIRONMENT_MODE_CUSTOM_SKY]. */
|
|
get environment_custom_sky(): Sky
|
|
set environment_custom_sky(value: Sky)
|
|
|
|
/** The color to use for environment lighting. Only effective if [member environment_mode] is [constant ENVIRONMENT_MODE_CUSTOM_COLOR]. */
|
|
get environment_custom_color(): Color
|
|
set environment_custom_color(value: Color)
|
|
|
|
/** The color multiplier to use for environment lighting. Only effective if [member environment_mode] is [constant ENVIRONMENT_MODE_CUSTOM_COLOR]. */
|
|
get environment_custom_energy(): float64
|
|
set environment_custom_energy(value: float64)
|
|
|
|
/** The [CameraAttributes] resource that specifies exposure levels to bake at. Auto-exposure and non exposure properties will be ignored. Exposure settings should be used to reduce the dynamic range present when baking. If exposure is too high, the [LightmapGI] will have banding artifacts or may have over-exposure artifacts. */
|
|
get camera_attributes(): CameraAttributesPractical | CameraAttributesPhysical
|
|
set camera_attributes(value: CameraAttributesPractical | CameraAttributesPhysical)
|
|
|
|
/** The level of subdivision to use when automatically generating [LightmapProbe]s for dynamic object lighting. Higher values result in more accurate indirect lighting on dynamic objects, at the cost of longer bake times and larger file sizes.
|
|
*
|
|
* **Note:** Automatically generated [LightmapProbe]s are not visible as nodes in the Scene tree dock, and cannot be modified this way after they are generated.
|
|
*
|
|
* **Note:** Regardless of [member generate_probes_subdiv], direct lighting on dynamic objects is always applied using [Light3D] nodes in real-time.
|
|
*/
|
|
get generate_probes_subdiv(): int64
|
|
set generate_probes_subdiv(value: int64)
|
|
|
|
/** The [LightmapGIData] associated to this [LightmapGI] node. This resource is automatically created after baking, and is not meant to be created manually. */
|
|
get light_data(): LightmapGIData
|
|
set light_data(value: LightmapGIData)
|
|
}
|
|
namespace LightmapGIData {
|
|
enum ShadowmaskMode {
|
|
/** Shadowmasking is disabled. No shadowmask texture will be created when baking lightmaps. Existing shadowmask textures will be removed during baking. */
|
|
SHADOWMASK_MODE_NONE = 0,
|
|
|
|
/** Shadowmasking is enabled. Directional shadows that are outside the [member DirectionalLight3D.directional_shadow_max_distance] will be rendered using the shadowmask texture. Shadows that are inside the range will be rendered using real-time shadows exclusively. This mode allows for more precise real-time shadows up close, without the potential "smearing" effect that can occur when using lightmaps with a high texel size. The downside is that when the camera moves fast, the transition between the real-time light and shadowmask can be obvious. Also, objects that only have shadows baked in the shadowmask (and no real-time shadows) won't display any shadows up close. */
|
|
SHADOWMASK_MODE_REPLACE = 1,
|
|
|
|
/** Shadowmasking is enabled. Directional shadows will be rendered with real-time shadows overlaid on top of the shadowmask texture. This mode makes for smoother shadow transitions when the camera moves fast, at the cost of a potential smearing effect for directional shadows that are up close (due to the real-time shadow being mixed with a low-resolution shadowmask). Objects that only have shadows baked in the shadowmask (and no real-time shadows) will keep their shadows up close. */
|
|
SHADOWMASK_MODE_OVERLAY = 2,
|
|
}
|
|
}
|
|
/** Contains baked lightmap and dynamic object probe data for [LightmapGI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightmapgidata.html
|
|
*/
|
|
class LightmapGIData extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Adds an object that is considered baked within this [LightmapGIData]. */
|
|
add_user(path: NodePath | string, uv_scale: Rect2, slice_index: int64, sub_instance: int64): void
|
|
|
|
/** Returns the number of objects that are considered baked within this [LightmapGIData]. */
|
|
get_user_count(): int64
|
|
|
|
/** Returns the [NodePath] of the baked object at index [param user_idx]. */
|
|
get_user_path(user_idx: int64): NodePath
|
|
|
|
/** Clear all objects that are considered baked within this [LightmapGIData]. */
|
|
clear_users(): void
|
|
|
|
/** The lightmap atlas textures generated by the lightmapper. */
|
|
get lightmap_textures(): GArray
|
|
set lightmap_textures(value: GArray)
|
|
|
|
/** The shadowmask atlas textures generated by the lightmapper. */
|
|
get shadowmask_textures(): GArray
|
|
set shadowmask_textures(value: GArray)
|
|
get uses_spherical_harmonics(): boolean
|
|
set uses_spherical_harmonics(value: boolean)
|
|
get user_data(): GArray
|
|
set user_data(value: GArray)
|
|
get probe_data(): GDictionary
|
|
set probe_data(value: GDictionary)
|
|
get _uses_packed_directional(): boolean
|
|
set _uses_packed_directional(value: boolean)
|
|
|
|
/** The lightmap atlas texture generated by the lightmapper. */
|
|
get light_texture(): TextureLayered
|
|
set light_texture(value: TextureLayered)
|
|
get light_textures(): GArray
|
|
set light_textures(value: GArray)
|
|
}
|
|
class LightmapGIEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
_bake(): void
|
|
}
|
|
class LightmapGIGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Represents a single manually placed probe for dynamic object lighting with [LightmapGI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightmapprobe.html
|
|
*/
|
|
class LightmapProbe<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class LightmapProbeGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Abstract class extended by lightmappers, for use in [LightmapGI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightmapper.html
|
|
*/
|
|
class Lightmapper extends RefCounted {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** The built-in GPU-based lightmapper for use with [LightmapGI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lightmapperrd.html
|
|
*/
|
|
class LightmapperRD extends Lightmapper {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace Line2D {
|
|
enum LineJointMode {
|
|
/** Makes the polyline's joints pointy, connecting the sides of the two segments by extending them until they intersect. If the rotation of a joint is too big (based on [member sharp_limit]), the joint falls back to [constant LINE_JOINT_BEVEL] to prevent very long miters. */
|
|
LINE_JOINT_SHARP = 0,
|
|
|
|
/** Makes the polyline's joints bevelled/chamfered, connecting the sides of the two segments with a simple line. */
|
|
LINE_JOINT_BEVEL = 1,
|
|
|
|
/** Makes the polyline's joints rounded, connecting the sides of the two segments with an arc. The detail of this arc depends on [member round_precision]. */
|
|
LINE_JOINT_ROUND = 2,
|
|
}
|
|
enum LineCapMode {
|
|
/** Draws no line cap. */
|
|
LINE_CAP_NONE = 0,
|
|
|
|
/** Draws the line cap as a box, slightly extending the first/last segment. */
|
|
LINE_CAP_BOX = 1,
|
|
|
|
/** Draws the line cap as a semicircle attached to the first/last segment. */
|
|
LINE_CAP_ROUND = 2,
|
|
}
|
|
enum LineTextureMode {
|
|
/** Takes the left pixels of the texture and renders them over the whole polyline. */
|
|
LINE_TEXTURE_NONE = 0,
|
|
|
|
/** Tiles the texture over the polyline. [member CanvasItem.texture_repeat] of the [Line2D] node must be [constant CanvasItem.TEXTURE_REPEAT_ENABLED] or [constant CanvasItem.TEXTURE_REPEAT_MIRROR] for it to work properly. */
|
|
LINE_TEXTURE_TILE = 1,
|
|
|
|
/** Stretches the texture across the polyline. [member CanvasItem.texture_repeat] of the [Line2D] node must be [constant CanvasItem.TEXTURE_REPEAT_DISABLED] for best results. */
|
|
LINE_TEXTURE_STRETCH = 2,
|
|
}
|
|
}
|
|
/** A 2D polyline that can optionally be textured.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_line2d.html
|
|
*/
|
|
class Line2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Overwrites the position of the point at the given [param index] with the supplied [param position]. */
|
|
set_point_position(index: int64, position: Vector2): void
|
|
|
|
/** Returns the position of the point at index [param index]. */
|
|
get_point_position(index: int64): Vector2
|
|
|
|
/** Returns the number of points in the polyline. */
|
|
get_point_count(): int64
|
|
|
|
/** Adds a point with the specified [param position] relative to the polyline's own position. If no [param index] is provided, the new point will be added to the end of the points array.
|
|
* If [param index] is given, the new point is inserted before the existing point identified by index [param index]. The indices of the points after the new point get increased by 1. The provided [param index] must not exceed the number of existing points in the polyline. See [method get_point_count].
|
|
*/
|
|
add_point(position: Vector2, index: int64 = -1): void
|
|
|
|
/** Removes the point at index [param index] from the polyline. */
|
|
remove_point(index: int64): void
|
|
|
|
/** Removes all points from the polyline, making it empty. */
|
|
clear_points(): void
|
|
|
|
/** The points of the polyline, interpreted in local 2D coordinates. Segments are drawn between the adjacent points in this array. */
|
|
get points(): PackedVector2Array
|
|
set points(value: PackedVector2Array | Vector2[])
|
|
|
|
/** If `true` and the polyline has more than 2 points, the last point and the first one will be connected by a segment.
|
|
*
|
|
* **Note:** The shape of the closing segment is not guaranteed to be seamless if a [member width_curve] is provided.
|
|
*
|
|
* **Note:** The joint between the closing segment and the first segment is drawn first and it samples the [member gradient] and the [member width_curve] at the beginning. This is an implementation detail that might change in a future version.
|
|
*/
|
|
get closed(): boolean
|
|
set closed(value: boolean)
|
|
|
|
/** The polyline's width. */
|
|
get width(): float64
|
|
set width(value: float64)
|
|
|
|
/** The polyline's width curve. The width of the polyline over its length will be equivalent to the value of the width curve over its domain. The width curve should be a unit [Curve]. */
|
|
get width_curve(): Curve
|
|
set width_curve(value: Curve)
|
|
|
|
/** The color of the polyline. Will not be used if a gradient is set. */
|
|
get default_color(): Color
|
|
set default_color(value: Color)
|
|
|
|
/** The gradient is drawn through the whole line from start to finish. The [member default_color] will not be used if this property is set. */
|
|
get gradient(): Gradient
|
|
set gradient(value: Gradient)
|
|
|
|
/** The texture used for the polyline. Uses [member texture_mode] for drawing style. */
|
|
get texture(): Texture2D
|
|
set texture(value: Texture2D)
|
|
|
|
/** The style to render the [member texture] of the polyline. Use [enum LineTextureMode] constants. */
|
|
get texture_mode(): int64
|
|
set texture_mode(value: int64)
|
|
|
|
/** The style of the connections between segments of the polyline. Use [enum LineJointMode] constants. */
|
|
get joint_mode(): int64
|
|
set joint_mode(value: int64)
|
|
|
|
/** The style of the beginning of the polyline, if [member closed] is `false`. Use [enum LineCapMode] constants. */
|
|
get begin_cap_mode(): int64
|
|
set begin_cap_mode(value: int64)
|
|
|
|
/** The style of the end of the polyline, if [member closed] is `false`. Use [enum LineCapMode] constants. */
|
|
get end_cap_mode(): int64
|
|
set end_cap_mode(value: int64)
|
|
|
|
/** Determines the miter limit of the polyline. Normally, when [member joint_mode] is set to [constant LINE_JOINT_SHARP], sharp angles fall back to using the logic of [constant LINE_JOINT_BEVEL] joints to prevent very long miters. Higher values of this property mean that the fallback to a bevel joint will happen at sharper angles. */
|
|
get sharp_limit(): float64
|
|
set sharp_limit(value: float64)
|
|
|
|
/** The smoothness used for rounded joints and caps. Higher values result in smoother corners, but are more demanding to render and update. */
|
|
get round_precision(): int64
|
|
set round_precision(value: int64)
|
|
|
|
/** If `true`, the polyline's border will be anti-aliased.
|
|
*
|
|
* **Note:** [Line2D] is not accelerated by batching when being anti-aliased.
|
|
*/
|
|
get antialiased(): boolean
|
|
set antialiased(value: boolean)
|
|
}
|
|
class Line2DEditor<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditor<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class Line2DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace LineEdit {
|
|
enum MenuItems {
|
|
/** Cuts (copies and clears) the selected text. */
|
|
MENU_CUT = 0,
|
|
|
|
/** Copies the selected text. */
|
|
MENU_COPY = 1,
|
|
|
|
/** Pastes the clipboard text over the selected text (or at the caret's position).
|
|
* Non-printable escape characters are automatically stripped from the OS clipboard via [method String.strip_escapes].
|
|
*/
|
|
MENU_PASTE = 2,
|
|
|
|
/** Erases the whole [LineEdit] text. */
|
|
MENU_CLEAR = 3,
|
|
|
|
/** Selects the whole [LineEdit] text. */
|
|
MENU_SELECT_ALL = 4,
|
|
|
|
/** Undoes the previous action. */
|
|
MENU_UNDO = 5,
|
|
|
|
/** Reverse the last undo action. */
|
|
MENU_REDO = 6,
|
|
|
|
/** ID of "Text Writing Direction" submenu. */
|
|
MENU_SUBMENU_TEXT_DIR = 7,
|
|
|
|
/** Sets text direction to inherited. */
|
|
MENU_DIR_INHERITED = 8,
|
|
|
|
/** Sets text direction to automatic. */
|
|
MENU_DIR_AUTO = 9,
|
|
|
|
/** Sets text direction to left-to-right. */
|
|
MENU_DIR_LTR = 10,
|
|
|
|
/** Sets text direction to right-to-left. */
|
|
MENU_DIR_RTL = 11,
|
|
|
|
/** Toggles control character display. */
|
|
MENU_DISPLAY_UCC = 12,
|
|
|
|
/** ID of "Insert Control Character" submenu. */
|
|
MENU_SUBMENU_INSERT_UCC = 13,
|
|
|
|
/** Inserts left-to-right mark (LRM) character. */
|
|
MENU_INSERT_LRM = 14,
|
|
|
|
/** Inserts right-to-left mark (RLM) character. */
|
|
MENU_INSERT_RLM = 15,
|
|
|
|
/** Inserts start of left-to-right embedding (LRE) character. */
|
|
MENU_INSERT_LRE = 16,
|
|
|
|
/** Inserts start of right-to-left embedding (RLE) character. */
|
|
MENU_INSERT_RLE = 17,
|
|
|
|
/** Inserts start of left-to-right override (LRO) character. */
|
|
MENU_INSERT_LRO = 18,
|
|
|
|
/** Inserts start of right-to-left override (RLO) character. */
|
|
MENU_INSERT_RLO = 19,
|
|
|
|
/** Inserts pop direction formatting (PDF) character. */
|
|
MENU_INSERT_PDF = 20,
|
|
|
|
/** Inserts Arabic letter mark (ALM) character. */
|
|
MENU_INSERT_ALM = 21,
|
|
|
|
/** Inserts left-to-right isolate (LRI) character. */
|
|
MENU_INSERT_LRI = 22,
|
|
|
|
/** Inserts right-to-left isolate (RLI) character. */
|
|
MENU_INSERT_RLI = 23,
|
|
|
|
/** Inserts first strong isolate (FSI) character. */
|
|
MENU_INSERT_FSI = 24,
|
|
|
|
/** Inserts pop direction isolate (PDI) character. */
|
|
MENU_INSERT_PDI = 25,
|
|
|
|
/** Inserts zero width joiner (ZWJ) character. */
|
|
MENU_INSERT_ZWJ = 26,
|
|
|
|
/** Inserts zero width non-joiner (ZWNJ) character. */
|
|
MENU_INSERT_ZWNJ = 27,
|
|
|
|
/** Inserts word joiner (WJ) character. */
|
|
MENU_INSERT_WJ = 28,
|
|
|
|
/** Inserts soft hyphen (SHY) character. */
|
|
MENU_INSERT_SHY = 29,
|
|
|
|
/** Opens system emoji and symbol picker. */
|
|
MENU_EMOJI_AND_SYMBOL = 30,
|
|
|
|
/** Represents the size of the [enum MenuItems] enum. */
|
|
MENU_MAX = 31,
|
|
}
|
|
enum VirtualKeyboardType {
|
|
/** Default text virtual keyboard. */
|
|
KEYBOARD_TYPE_DEFAULT = 0,
|
|
|
|
/** Multiline virtual keyboard. */
|
|
KEYBOARD_TYPE_MULTILINE = 1,
|
|
|
|
/** Virtual number keypad, useful for PIN entry. */
|
|
KEYBOARD_TYPE_NUMBER = 2,
|
|
|
|
/** Virtual number keypad, useful for entering fractional numbers. */
|
|
KEYBOARD_TYPE_NUMBER_DECIMAL = 3,
|
|
|
|
/** Virtual phone number keypad. */
|
|
KEYBOARD_TYPE_PHONE = 4,
|
|
|
|
/** Virtual keyboard with additional keys to assist with typing email addresses. */
|
|
KEYBOARD_TYPE_EMAIL_ADDRESS = 5,
|
|
|
|
/** Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.
|
|
*
|
|
* **Note:** This is not supported on Web. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT].
|
|
*/
|
|
KEYBOARD_TYPE_PASSWORD = 6,
|
|
|
|
/** Virtual keyboard with additional keys to assist with typing URLs. */
|
|
KEYBOARD_TYPE_URL = 7,
|
|
}
|
|
}
|
|
/** An input field for single-line text.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lineedit.html
|
|
*/
|
|
class LineEdit<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns `true` if the user has text in the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME). */
|
|
has_ime_text(): boolean
|
|
|
|
/** Closes the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME) if it is open. Any text in the IME will be lost. */
|
|
cancel_ime(): void
|
|
|
|
/** Applies text from the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME) and closes the IME if it is open. */
|
|
apply_ime(): void
|
|
|
|
/** Allows entering edit mode whether the [LineEdit] is focused or not.
|
|
* See also [member keep_editing_on_text_submit].
|
|
*/
|
|
edit(): void
|
|
|
|
/** Allows exiting edit mode while preserving focus. */
|
|
unedit(): void
|
|
|
|
/** Returns whether the [LineEdit] is being edited. */
|
|
is_editing(): boolean
|
|
|
|
/** Erases the [LineEdit]'s [member text]. */
|
|
clear(): void
|
|
|
|
/** Selects characters inside [LineEdit] between [param from] and [param to]. By default, [param from] is at the beginning and [param to] at the end.
|
|
*
|
|
*/
|
|
select(from: int64 = 0, to: int64 = -1): void
|
|
|
|
/** Selects the whole [String]. */
|
|
select_all(): void
|
|
|
|
/** Clears the current selection. */
|
|
deselect(): void
|
|
|
|
/** Returns `true` if an "undo" action is available. */
|
|
has_undo(): boolean
|
|
|
|
/** Returns `true` if a "redo" action is available. */
|
|
has_redo(): boolean
|
|
|
|
/** Returns `true` if the user has selected text. */
|
|
has_selection(): boolean
|
|
|
|
/** Returns the text inside the selection. */
|
|
get_selected_text(): string
|
|
|
|
/** Returns the selection begin column. */
|
|
get_selection_from_column(): int64
|
|
|
|
/** Returns the selection end column. */
|
|
get_selection_to_column(): int64
|
|
|
|
/** Returns the scroll offset due to [member caret_column], as a number of characters. */
|
|
get_scroll_offset(): float64
|
|
|
|
/** Inserts [param text] at the caret. If the resulting value is longer than [member max_length], nothing happens. */
|
|
insert_text_at_caret(text: string): void
|
|
|
|
/** Deletes one character at the caret's current position (equivalent to pressing [kbd]Delete[/kbd]). */
|
|
delete_char_at_caret(): void
|
|
|
|
/** Deletes a section of the [member text] going from position [param from_column] to [param to_column]. Both parameters should be within the text's length. */
|
|
delete_text(from_column: int64, to_column: int64): void
|
|
|
|
/** Executes a given action as defined in the [enum MenuItems] enum. */
|
|
menu_option(option: int64): void
|
|
|
|
/** Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit].
|
|
* You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example:
|
|
*
|
|
* **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
|
|
*/
|
|
get_menu(): PopupMenu
|
|
|
|
/** Returns whether the menu is visible. Use this instead of `get_menu().visible` to improve performance (so the creation of the menu is avoided). */
|
|
is_menu_visible(): boolean
|
|
|
|
/** String value of the [LineEdit].
|
|
*
|
|
* **Note:** Changing text using this property won't emit the [signal text_changed] signal.
|
|
*/
|
|
get text(): string
|
|
set text(value: string)
|
|
|
|
/** Text shown when the [LineEdit] is empty. It is **not** the [LineEdit]'s default value (see [member text]). */
|
|
get placeholder_text(): string
|
|
set placeholder_text(value: string)
|
|
|
|
/** Text alignment as defined in the [enum HorizontalAlignment] enum. */
|
|
get alignment(): int64
|
|
set alignment(value: int64)
|
|
|
|
/** Maximum number of characters that can be entered inside the [LineEdit]. If `0`, there is no limit.
|
|
* When a limit is defined, characters that would exceed [member max_length] are truncated. This happens both for existing [member text] contents when setting the max length, or for new text inserted in the [LineEdit], including pasting.
|
|
* If any input text is truncated, the [signal text_change_rejected] signal is emitted with the truncated substring as parameter:
|
|
*
|
|
*/
|
|
get max_length(): int64
|
|
set max_length(value: int64)
|
|
|
|
/** If `false`, existing text cannot be modified and new text cannot be added. */
|
|
get editable(): boolean
|
|
set editable(value: boolean)
|
|
|
|
/** If `true`, the [LineEdit] will not exit edit mode when text is submitted by pressing `ui_text_submit` action (by default: [kbd]Enter[/kbd] or [kbd]Kp Enter[/kbd]). */
|
|
get keep_editing_on_text_submit(): boolean
|
|
set keep_editing_on_text_submit(value: boolean)
|
|
|
|
/** If `true`, the [LineEdit] width will increase to stay longer than the [member text]. It will **not** compress if the [member text] is shortened. */
|
|
get expand_to_text_length(): boolean
|
|
set expand_to_text_length(value: boolean)
|
|
|
|
/** If `true`, the context menu will appear when right-clicked. */
|
|
get context_menu_enabled(): boolean
|
|
set context_menu_enabled(value: boolean)
|
|
|
|
/** If `true`, "Emoji and Symbols" menu is enabled. */
|
|
get emoji_menu_enabled(): boolean
|
|
set emoji_menu_enabled(value: boolean)
|
|
|
|
/** If `true`, the native virtual keyboard is shown when focused on platforms that support it. */
|
|
get virtual_keyboard_enabled(): boolean
|
|
set virtual_keyboard_enabled(value: boolean)
|
|
|
|
/** Specifies the type of virtual keyboard to show. */
|
|
get virtual_keyboard_type(): int64
|
|
set virtual_keyboard_type(value: int64)
|
|
|
|
/** If `true`, the [LineEdit] will show a clear button if [member text] is not empty, which can be used to clear the text quickly. */
|
|
get clear_button_enabled(): boolean
|
|
set clear_button_enabled(value: boolean)
|
|
|
|
/** If `true`, shortcut keys for context menu items are enabled, even if the context menu is disabled. */
|
|
get shortcut_keys_enabled(): boolean
|
|
set shortcut_keys_enabled(value: boolean)
|
|
|
|
/** If `false`, using middle mouse button to paste clipboard will be disabled.
|
|
*
|
|
* **Note:** This method is only implemented on Linux.
|
|
*/
|
|
get middle_mouse_paste_enabled(): boolean
|
|
set middle_mouse_paste_enabled(value: boolean)
|
|
|
|
/** If `false`, it's impossible to select the text using mouse nor keyboard. */
|
|
get selecting_enabled(): boolean
|
|
set selecting_enabled(value: boolean)
|
|
|
|
/** If `true`, the selected text will be deselected when focus is lost. */
|
|
get deselect_on_focus_loss_enabled(): boolean
|
|
set deselect_on_focus_loss_enabled(value: boolean)
|
|
|
|
/** If `true`, allow drag and drop of selected text. */
|
|
get drag_and_drop_selection_enabled(): boolean
|
|
set drag_and_drop_selection_enabled(value: boolean)
|
|
|
|
/** Sets the icon that will appear in the right end of the [LineEdit] if there's no [member text], or always, if [member clear_button_enabled] is set to `false`. */
|
|
get right_icon(): Texture2D
|
|
set right_icon(value: Texture2D)
|
|
|
|
/** If `true`, the [LineEdit] doesn't display decoration. */
|
|
get flat(): boolean
|
|
set flat(value: boolean)
|
|
|
|
/** If `true`, control characters are displayed. */
|
|
get draw_control_chars(): boolean
|
|
set draw_control_chars(value: boolean)
|
|
|
|
/** If `true`, the [LineEdit] will select the whole text when it gains focus. */
|
|
get select_all_on_focus(): boolean
|
|
set select_all_on_focus(value: boolean)
|
|
|
|
/** If `true`, makes the caret blink. */
|
|
get caret_blink(): boolean
|
|
set caret_blink(value: boolean)
|
|
|
|
/** The interval at which the caret blinks (in seconds). */
|
|
get caret_blink_interval(): float64
|
|
set caret_blink_interval(value: float64)
|
|
|
|
/** The caret's column position inside the [LineEdit]. When set, the text may scroll to accommodate it. */
|
|
get caret_column(): int64
|
|
set caret_column(value: int64)
|
|
|
|
/** If `true`, the [LineEdit] will always show the caret, even if not editing or focus is lost. */
|
|
get caret_force_displayed(): boolean
|
|
set caret_force_displayed(value: boolean)
|
|
|
|
/** Allow moving caret, selecting and removing the individual composite character components.
|
|
*
|
|
* **Note:** [kbd]Backspace[/kbd] is always removing individual composite character components.
|
|
*/
|
|
get caret_mid_grapheme(): boolean
|
|
set caret_mid_grapheme(value: boolean)
|
|
|
|
/** If `true`, every character is replaced with the secret character (see [member secret_character]). */
|
|
get secret(): boolean
|
|
set secret(value: boolean)
|
|
|
|
/** The character to use to mask secret input. Only a single character can be used as the secret character. If it is longer than one character, only the first one will be used. If it is empty, a space will be used instead. */
|
|
get secret_character(): string
|
|
set secret_character(value: string)
|
|
|
|
/** Base text writing direction. */
|
|
get text_direction(): int64
|
|
set text_direction(value: int64)
|
|
|
|
/** Language code used for line-breaking and text shaping algorithms. If left empty, current locale is used instead. */
|
|
get language(): string
|
|
set language(value: string)
|
|
|
|
/** Set BiDi algorithm override for the structured text. */
|
|
get structured_text_bidi_override(): int64
|
|
set structured_text_bidi_override(value: int64)
|
|
|
|
/** Set additional options for BiDi override. */
|
|
get structured_text_bidi_override_options(): GArray
|
|
set structured_text_bidi_override_options(value: GArray)
|
|
|
|
/** Emitted when the text changes. */
|
|
readonly text_changed: Signal1<string>
|
|
|
|
/** Emitted when appending text that overflows the [member max_length]. The appended text is truncated to fit [member max_length], and the part that couldn't fit is passed as the [param rejected_substring] argument. */
|
|
readonly text_change_rejected: Signal1<string>
|
|
|
|
/** Emitted when the user presses the `ui_text_submit` action (by default: [kbd]Enter[/kbd] or [kbd]Kp Enter[/kbd]) while the [LineEdit] has focus. */
|
|
readonly text_submitted: Signal1<string>
|
|
|
|
/** Emitted when the [LineEdit] switches in or out of edit mode. */
|
|
readonly editing_toggled: Signal1<boolean>
|
|
}
|
|
namespace LinkButton {
|
|
enum UnderlineMode {
|
|
/** The LinkButton will always show an underline at the bottom of its text. */
|
|
UNDERLINE_MODE_ALWAYS = 0,
|
|
|
|
/** The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it. */
|
|
UNDERLINE_MODE_ON_HOVER = 1,
|
|
|
|
/** The LinkButton will never show an underline at the bottom of its text. */
|
|
UNDERLINE_MODE_NEVER = 2,
|
|
}
|
|
}
|
|
/** A button that represents a link.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_linkbutton.html
|
|
*/
|
|
class LinkButton<Map extends Record<string, Node> = Record<string, Node>> extends BaseButton<Map> {
|
|
constructor(identifier?: any)
|
|
/** The button's text that will be displayed inside the button's area. */
|
|
get text(): string
|
|
set text(value: string)
|
|
|
|
/** The underline mode to use for the text. See [enum LinkButton.UnderlineMode] for the available modes. */
|
|
get underline(): int64
|
|
set underline(value: int64)
|
|
|
|
/** The [url=https://en.wikipedia.org/wiki/Uniform_Resource_Identifier]URI[/url] for this [LinkButton]. If set to a valid URI, pressing the button opens the URI using the operating system's default program for the protocol (via [method OS.shell_open]). HTTP and HTTPS URLs open the default web browser.
|
|
*
|
|
*/
|
|
get uri(): string
|
|
set uri(value: string)
|
|
|
|
/** Base text writing direction. */
|
|
get text_direction(): int64
|
|
set text_direction(value: int64)
|
|
|
|
/** Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. */
|
|
get language(): string
|
|
set language(value: string)
|
|
|
|
/** Set BiDi algorithm override for the structured text. */
|
|
get structured_text_bidi_override(): int64
|
|
set structured_text_bidi_override(value: int64)
|
|
|
|
/** Set additional options for BiDi override. */
|
|
get structured_text_bidi_override_options(): GArray
|
|
set structured_text_bidi_override_options(value: GArray)
|
|
}
|
|
class LocalizationEditor<Map extends Record<string, Node> = Record<string, Node>> extends VBoxContainer<Map> {
|
|
constructor(identifier?: any)
|
|
update_translations(): void
|
|
readonly localization_changed: Signal0
|
|
}
|
|
namespace LookAtModifier3D {
|
|
enum OriginFrom {
|
|
/** The bone rest position of the bone specified in [member bone] is used as origin. */
|
|
ORIGIN_FROM_SELF = 0,
|
|
|
|
/** The bone global pose position of the bone specified in [member origin_bone] is used as origin.
|
|
*
|
|
* **Note:** It is recommended that you select only the parent bone unless you are familiar with the bone processing process. The specified bone pose at the time the [LookAtModifier3D] is processed is used as a reference. In other words, if you specify a child bone and the [LookAtModifier3D] causes the child bone to move, the rendered result and direction will not match.
|
|
*/
|
|
ORIGIN_FROM_SPECIFIC_BONE = 1,
|
|
|
|
/** The global position of the [Node3D] specified in [member origin_external_node] is used as origin.
|
|
*
|
|
* **Note:** Same as [constant ORIGIN_FROM_SPECIFIC_BONE], when specifying a [BoneAttachment3D] with a child bone assigned, the rendered result and direction will not match.
|
|
*/
|
|
ORIGIN_FROM_EXTERNAL_NODE = 2,
|
|
}
|
|
}
|
|
/** The [LookAtModifier3D] rotates a bone to look at a target.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_lookatmodifier3d.html
|
|
*/
|
|
class LookAtModifier3D<Map extends Record<string, Node> = Record<string, Node>> extends SkeletonModifier3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the remaining seconds of the time-based interpolation. */
|
|
get_interpolation_remaining(): float64
|
|
|
|
/** Returns whether the time-based interpolation is running or not. If `true`, it is equivalent to [method get_interpolation_remaining] being `0`.
|
|
* This is useful to determine whether a [LookAtModifier3D] can be removed safely.
|
|
*/
|
|
is_interpolating(): boolean
|
|
|
|
/** Returns whether the target is within the angle limitations. It is useful for unsetting the [member target_node] when the target is outside of the angle limitations.
|
|
*
|
|
* **Note:** The value is updated after [method SkeletonModifier3D._process_modification]. To retrieve this value correctly, we recommend using the signal [signal SkeletonModifier3D.modification_processed].
|
|
*/
|
|
is_target_within_limitation(): boolean
|
|
|
|
/** The [NodePath] to the node that is the target for the look at modification. This node is what the modification will rotate the bone to. */
|
|
get target_node(): NodePath
|
|
set target_node(value: NodePath | string)
|
|
|
|
/** The bone name of the [Skeleton3D] that the modification will operate on. */
|
|
get bone_name(): string
|
|
set bone_name(value: string)
|
|
|
|
/** Index of the [member bone_name] in the parent [Skeleton3D]. */
|
|
get bone(): int64
|
|
set bone(value: int64)
|
|
|
|
/** The forward axis of the bone. This [SkeletonModifier3D] modifies the bone so that this axis points toward the [member target_node]. */
|
|
get forward_axis(): int64
|
|
set forward_axis(value: int64)
|
|
|
|
/** The axis of the first rotation. This [SkeletonModifier3D] works by compositing the rotation by Euler angles to prevent to rotate the [member forward_axis]. */
|
|
get primary_rotation_axis(): int64
|
|
set primary_rotation_axis(value: int64)
|
|
|
|
/** If `true`, provides rotation by two axes. */
|
|
get use_secondary_rotation(): boolean
|
|
set use_secondary_rotation(value: boolean)
|
|
|
|
/** This value determines from what origin is retrieved for use in the calculation of the forward vector. */
|
|
get origin_from(): int64
|
|
set origin_from(value: int64)
|
|
|
|
/** If [member origin_from] is [constant ORIGIN_FROM_SPECIFIC_BONE], the bone global pose position specified for this is used as origin. */
|
|
get origin_bone_name(): string
|
|
set origin_bone_name(value: string)
|
|
|
|
/** Index of the [member origin_bone_name] in the parent [Skeleton3D]. */
|
|
get origin_bone(): int64
|
|
set origin_bone(value: int64)
|
|
|
|
/** If [member origin_from] is [constant ORIGIN_FROM_EXTERNAL_NODE], the global position of the [Node3D] specified for this is used as origin. */
|
|
get origin_external_node(): NodePath
|
|
set origin_external_node(value: NodePath | string)
|
|
|
|
/** The offset of the bone pose origin. Matching the origins by offset is useful for cases where multiple bones must always face the same direction, such as the eyes.
|
|
*
|
|
* **Note:** This value indicates the local position of the object set in [member origin_from].
|
|
*/
|
|
get origin_offset(): Vector3
|
|
set origin_offset(value: Vector3)
|
|
|
|
/** If the target passes through too close to the origin than this value, time-based interpolation is used even if the target is within the angular limitations, to prevent the angular velocity from becoming too high. */
|
|
get origin_safe_margin(): float64
|
|
set origin_safe_margin(value: float64)
|
|
|
|
/** The duration of the time-based interpolation. Interpolation is triggered at the following cases:
|
|
* - When the target node is changed
|
|
* - When an axis is flipped due to angle limitation
|
|
*
|
|
* **Note:** The flipping occurs when the target is outside the angle limitation and the internally computed secondary rotation axis of the forward vector is flipped. Visually, it occurs when the target is outside the angle limitation and crosses the plane of the [member forward_axis] and [member primary_rotation_axis].
|
|
*/
|
|
get duration(): float64
|
|
set duration(value: float64)
|
|
|
|
/** The transition type of the time-based interpolation. See also [enum Tween.TransitionType]. */
|
|
get transition_type(): int64
|
|
set transition_type(value: int64)
|
|
|
|
/** The ease type of the time-based interpolation. See also [enum Tween.EaseType]. */
|
|
get ease_type(): int64
|
|
set ease_type(value: int64)
|
|
|
|
/** If `true`, limits the degree of rotation. This helps prevent the character's neck from rotating 360 degrees.
|
|
*
|
|
* **Note:** As with [AnimationTree] blending, interpolation is provided that favors [method Skeleton3D.get_bone_rest]. This means that interpolation does not select the shortest path in some cases.
|
|
*
|
|
* **Note:** Some [member transition_type] may exceed the limitations (e.g. `Back`, `Elastic`, and `Spring`). If interpolation occurs while overshooting the limitations, the result might possibly not respect the bone rest.
|
|
*/
|
|
get use_angle_limitation(): boolean
|
|
set use_angle_limitation(value: boolean)
|
|
|
|
/** If `true`, the limitations are spread from the bone symmetrically.
|
|
* If `false`, the limitation can be specified separately for each side of the bone rest.
|
|
*/
|
|
get symmetry_limitation(): boolean
|
|
set symmetry_limitation(value: boolean)
|
|
|
|
/** The limit angle of the primary rotation when [member symmetry_limitation] is `true`. */
|
|
get primary_limit_angle(): float64
|
|
set primary_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member primary_limit_angle]. It provides non-linear (b-spline) interpolation, let it feel more resistance the more it rotate to the edge limit. This is useful for simulating the limits of human motion.
|
|
* If `1.0`, no damping is performed. If `0.0`, damping is always performed.
|
|
*/
|
|
get primary_damp_threshold(): float64
|
|
set primary_damp_threshold(value: float64)
|
|
|
|
/** The limit angle of positive side of the primary rotation when [member symmetry_limitation] is `false`. */
|
|
get primary_positive_limit_angle(): float64
|
|
set primary_positive_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member primary_positive_limit_angle]. */
|
|
get primary_positive_damp_threshold(): float64
|
|
set primary_positive_damp_threshold(value: float64)
|
|
|
|
/** The limit angle of negative side of the primary rotation when [member symmetry_limitation] is `false`. */
|
|
get primary_negative_limit_angle(): float64
|
|
set primary_negative_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member primary_negative_limit_angle]. */
|
|
get primary_negative_damp_threshold(): float64
|
|
set primary_negative_damp_threshold(value: float64)
|
|
|
|
/** The limit angle of the secondary rotation when [member symmetry_limitation] is `true`. */
|
|
get secondary_limit_angle(): float64
|
|
set secondary_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member secondary_limit_angle]. */
|
|
get secondary_damp_threshold(): float64
|
|
set secondary_damp_threshold(value: float64)
|
|
|
|
/** The limit angle of positive side of the secondary rotation when [member symmetry_limitation] is `false`. */
|
|
get secondary_positive_limit_angle(): float64
|
|
set secondary_positive_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member secondary_positive_limit_angle]. */
|
|
get secondary_positive_damp_threshold(): float64
|
|
set secondary_positive_damp_threshold(value: float64)
|
|
|
|
/** The limit angle of negative side of the secondary rotation when [member symmetry_limitation] is `false`. */
|
|
get secondary_negative_limit_angle(): float64
|
|
set secondary_negative_limit_angle(value: float64)
|
|
|
|
/** The threshold to start damping for [member secondary_negative_limit_angle]. */
|
|
get secondary_negative_damp_threshold(): float64
|
|
set secondary_negative_damp_threshold(value: float64)
|
|
}
|
|
/** Abstract base class for the game's main loop.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_mainloop.html
|
|
*/
|
|
class MainLoop extends Object {
|
|
/** Notification received from the OS when the application is exceeding its allocated memory.
|
|
* Specific to the iOS platform.
|
|
*/
|
|
static readonly NOTIFICATION_OS_MEMORY_WARNING = 2009
|
|
|
|
/** Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr]. */
|
|
static readonly NOTIFICATION_TRANSLATION_CHANGED = 2010
|
|
|
|
/** Notification received from the OS when a request for "About" information is sent.
|
|
* Specific to the macOS platform.
|
|
*/
|
|
static readonly NOTIFICATION_WM_ABOUT = 2011
|
|
|
|
/** Notification received from Godot's crash handler when the engine is about to crash.
|
|
* Implemented on desktop platforms if the crash handler is enabled.
|
|
*/
|
|
static readonly NOTIFICATION_CRASH = 2012
|
|
|
|
/** Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string).
|
|
* Specific to the macOS platform.
|
|
*/
|
|
static readonly NOTIFICATION_OS_IME_UPDATE = 2013
|
|
|
|
/** Notification received from the OS when the application is resumed.
|
|
* Specific to the Android and iOS platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_RESUMED = 2014
|
|
|
|
/** Notification received from the OS when the application is paused.
|
|
* Specific to the Android and iOS platforms.
|
|
*
|
|
* **Note:** On iOS, you only have approximately 5 seconds to finish a task started by this signal. If you go over this allotment, iOS will kill the app instead of pausing it.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_PAUSED = 2015
|
|
|
|
/** Notification received from the OS when the application is focused, i.e. when changing the focus from the OS desktop or a thirdparty application to any open window of the Godot instance.
|
|
* Implemented on desktop and mobile platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_FOCUS_IN = 2016
|
|
|
|
/** Notification received from the OS when the application is defocused, i.e. when changing the focus from any open window of the Godot instance to the OS desktop or a thirdparty application.
|
|
* Implemented on desktop and mobile platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_FOCUS_OUT = 2017
|
|
|
|
/** Notification received when text server is changed. */
|
|
static readonly NOTIFICATION_TEXT_SERVER_CHANGED = 2018
|
|
constructor(identifier?: any)
|
|
|
|
/** Called once during initialization. */
|
|
/* gdvirtual */ _initialize(): void
|
|
|
|
/** Called each physics frame with the time since the last physics frame as argument ([param delta], in seconds). Equivalent to [method Node._physics_process].
|
|
* If implemented, the method must return a boolean value. `true` ends the main loop, while `false` lets it proceed to the next frame.
|
|
*
|
|
* **Note:** [param delta] will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using [param delta] for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
/* gdvirtual */ _physics_process(delta: float64): boolean
|
|
|
|
/** Called each process (idle) frame with the time since the last process frame as argument (in seconds). Equivalent to [method Node._process].
|
|
* If implemented, the method must return a boolean value. `true` ends the main loop, while `false` lets it proceed to the next frame.
|
|
*
|
|
* **Note:** [param delta] will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using [param delta] for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
/* gdvirtual */ _process(delta: float64): boolean
|
|
|
|
/** Called before the program exits. */
|
|
/* gdvirtual */ _finalize(): void
|
|
|
|
/** Emitted when a user responds to a permission request. */
|
|
readonly on_request_permissions_result: Signal2<string, boolean>
|
|
}
|
|
/** A container that keeps a margin around its child controls.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_margincontainer.html
|
|
*/
|
|
class MarginContainer<Map extends Record<string, Node> = Record<string, Node>> extends Container<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Generic 2D position hint for editing.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_marker2d.html
|
|
*/
|
|
class Marker2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Size of the gizmo cross that appears in the editor. */
|
|
get gizmo_extents(): float64
|
|
set gizmo_extents(value: float64)
|
|
}
|
|
/** Generic 3D position hint for editing.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_marker3d.html
|
|
*/
|
|
class Marker3D<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Size of the gizmo cross that appears in the editor. */
|
|
get gizmo_extents(): float64
|
|
set gizmo_extents(value: float64)
|
|
}
|
|
class Marker3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Virtual base class for applying visual properties to an object, such as color and roughness.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_material.html
|
|
*/
|
|
class Material extends Resource {
|
|
/** Maximum value for the [member render_priority] parameter. */
|
|
static readonly RENDER_PRIORITY_MAX = 127
|
|
|
|
/** Minimum value for the [member render_priority] parameter. */
|
|
static readonly RENDER_PRIORITY_MIN = -128
|
|
constructor(identifier?: any)
|
|
|
|
/** Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools. Used to access the RID of the [Material]'s [Shader]. */
|
|
/* gdvirtual */ _get_shader_rid(): RID
|
|
|
|
/** Only exposed for the purpose of overriding. You cannot call this function directly. Used internally by various editor tools. */
|
|
/* gdvirtual */ _get_shader_mode(): Shader.Mode
|
|
|
|
/** Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if [member next_pass] should be shown in the editor or not. */
|
|
/* gdvirtual */ _can_do_next_pass(): boolean
|
|
|
|
/** Only exposed for the purpose of overriding. You cannot call this function directly. Used internally to determine if [member render_priority] should be shown in the editor or not. */
|
|
/* gdvirtual */ _can_use_render_priority(): boolean
|
|
|
|
/** Only available when running in the editor. Opens a popup that visualizes the generated shader code, including all variants and internal shader code. See also [method Shader.inspect_native_shader_code]. */
|
|
inspect_native_shader_code(): void
|
|
|
|
/** Creates a placeholder version of this resource ([PlaceholderMaterial]). */
|
|
create_placeholder(): Resource
|
|
|
|
/** Sets the render priority for objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects. In other words, all objects with [member render_priority] `1` will render before all objects with [member render_priority] `0`.
|
|
*
|
|
* **Note:** This only applies to [StandardMaterial3D]s and [ShaderMaterial]s with type "Spatial".
|
|
*
|
|
* **Note:** This will not impact how transparent objects are sorted relative to opaque objects or how dynamic meshes will be sorted relative to other opaque meshes. This is because all transparent objects are drawn after all opaque objects and all dynamic opaque meshes are drawn before other opaque meshes.
|
|
*/
|
|
get render_priority(): int64
|
|
set render_priority(value: int64)
|
|
|
|
/** Sets the [Material] to be used for the next pass. This renders the object again using a different material.
|
|
*
|
|
* **Note:** [member next_pass] materials are not necessarily drawn immediately after the source [Material]. Draw order is determined by material properties, [member render_priority], and distance to camera.
|
|
*
|
|
* **Note:** This only applies to [StandardMaterial3D]s and [ShaderMaterial]s with type "Spatial".
|
|
*/
|
|
get next_pass(): Material
|
|
set next_pass(value: Material)
|
|
}
|
|
class MaterialEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** A horizontal menu bar that creates a menu for each [PopupMenu] child.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_menubar.html
|
|
*/
|
|
class MenuBar<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
/** If `true`, shortcuts are disabled and cannot be used to trigger the button. */
|
|
set_disable_shortcuts(disabled: boolean): void
|
|
|
|
/** Returns `true`, if system global menu is supported and used by this [MenuBar]. */
|
|
is_native_menu(): boolean
|
|
|
|
/** Returns number of menu items. */
|
|
get_menu_count(): int64
|
|
|
|
/** Sets menu item title. */
|
|
set_menu_title(menu: int64, title: string): void
|
|
|
|
/** Returns menu item title. */
|
|
get_menu_title(menu: int64): string
|
|
|
|
/** Sets menu item tooltip. */
|
|
set_menu_tooltip(menu: int64, tooltip: string): void
|
|
|
|
/** Returns menu item tooltip. */
|
|
get_menu_tooltip(menu: int64): string
|
|
|
|
/** If `true`, menu item is disabled. */
|
|
set_menu_disabled(menu: int64, disabled: boolean): void
|
|
|
|
/** Returns `true`, if menu item is disabled. */
|
|
is_menu_disabled(menu: int64): boolean
|
|
|
|
/** If `true`, menu item is hidden. */
|
|
set_menu_hidden(menu: int64, hidden: boolean): void
|
|
|
|
/** Returns `true`, if menu item is hidden. */
|
|
is_menu_hidden(menu: int64): boolean
|
|
|
|
/** Returns [PopupMenu] associated with menu item. */
|
|
get_menu_popup(menu: int64): PopupMenu
|
|
|
|
/** Flat [MenuBar] don't display item decoration. */
|
|
get flat(): boolean
|
|
set flat(value: boolean)
|
|
|
|
/** Position order in the global menu to insert [MenuBar] items at. All menu items in the [MenuBar] are always inserted as a continuous range. Menus with lower [member start_index] are inserted first. Menus with [member start_index] equal to `-1` are inserted last. */
|
|
get start_index(): int64
|
|
set start_index(value: int64)
|
|
|
|
/** If `true`, when the cursor hovers above menu item, it will close the current [PopupMenu] and open the other one. */
|
|
get switch_on_hover(): boolean
|
|
set switch_on_hover(value: boolean)
|
|
|
|
/** If `true`, [MenuBar] will use system global menu when supported.
|
|
*
|
|
* **Note:** If `true` and global menu is supported, this node is not displayed, has zero size, and all its child nodes except [PopupMenu]s are inaccessible.
|
|
*
|
|
* **Note:** This property overrides the value of the [member PopupMenu.prefer_native_menu] property of the child nodes.
|
|
*/
|
|
get prefer_global_menu(): boolean
|
|
set prefer_global_menu(value: boolean)
|
|
|
|
/** Base text writing direction. */
|
|
get text_direction(): int64
|
|
set text_direction(value: int64)
|
|
|
|
/** Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. */
|
|
get language(): string
|
|
set language(value: string)
|
|
}
|
|
/** A button that brings up a [PopupMenu] when clicked.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_menubutton.html
|
|
*/
|
|
class MenuButton<Map extends Record<string, Node> = Record<string, Node>> extends Button<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [PopupMenu] contained in this button.
|
|
* **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
|
|
*/
|
|
get_popup(): PopupMenu
|
|
|
|
/** Adjusts popup position and sizing for the [MenuButton], then shows the [PopupMenu]. Prefer this over using `get_popup().popup()`. */
|
|
show_popup(): void
|
|
|
|
/** If `true`, shortcuts are disabled and cannot be used to trigger the button. */
|
|
set_disable_shortcuts(disabled: boolean): void
|
|
|
|
/** If `true`, when the cursor hovers above another [MenuButton] within the same parent which also has [member switch_on_hover] enabled, it will close the current [MenuButton] and open the other one. */
|
|
get switch_on_hover(): boolean
|
|
set switch_on_hover(value: boolean)
|
|
|
|
/** The number of items currently in the list. */
|
|
get item_count(): any /*Items,popup/item_*/
|
|
set item_count(value: any /*Items,popup/item_*/)
|
|
|
|
/** Emitted when the [PopupMenu] of this MenuButton is about to show. */
|
|
readonly about_to_popup: Signal0
|
|
}
|
|
namespace Mesh {
|
|
enum PrimitiveType {
|
|
/** Render array as points (one vertex equals one point). */
|
|
PRIMITIVE_POINTS = 0,
|
|
|
|
/** Render array as lines (every two vertices a line is created). */
|
|
PRIMITIVE_LINES = 1,
|
|
|
|
/** Render array as line strip. */
|
|
PRIMITIVE_LINE_STRIP = 2,
|
|
|
|
/** Render array as triangles (every three vertices a triangle is created). */
|
|
PRIMITIVE_TRIANGLES = 3,
|
|
|
|
/** Render array as triangle strips. */
|
|
PRIMITIVE_TRIANGLE_STRIP = 4,
|
|
}
|
|
enum ArrayType {
|
|
/** [PackedVector3Array], [PackedVector2Array], or [Array] of vertex positions. */
|
|
ARRAY_VERTEX = 0,
|
|
|
|
/** [PackedVector3Array] of vertex normals.
|
|
*
|
|
* **Note:** The array has to consist of normal vectors, otherwise they will be normalized by the engine, potentially causing visual discrepancies.
|
|
*/
|
|
ARRAY_NORMAL = 1,
|
|
|
|
/** [PackedFloat32Array] of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1. */
|
|
ARRAY_TANGENT = 2,
|
|
|
|
/** [PackedColorArray] of vertex colors. */
|
|
ARRAY_COLOR = 3,
|
|
|
|
/** [PackedVector2Array] for UV coordinates. */
|
|
ARRAY_TEX_UV = 4,
|
|
|
|
/** [PackedVector2Array] for second UV coordinates. */
|
|
ARRAY_TEX_UV2 = 5,
|
|
|
|
/** Contains custom color channel 0. [PackedByteArray] if `(format >> Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK` is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise. */
|
|
ARRAY_CUSTOM0 = 6,
|
|
|
|
/** Contains custom color channel 1. [PackedByteArray] if `(format >> Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK` is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise. */
|
|
ARRAY_CUSTOM1 = 7,
|
|
|
|
/** Contains custom color channel 2. [PackedByteArray] if `(format >> Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK` is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise. */
|
|
ARRAY_CUSTOM2 = 8,
|
|
|
|
/** Contains custom color channel 3. [PackedByteArray] if `(format >> Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK` is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise. */
|
|
ARRAY_CUSTOM3 = 9,
|
|
|
|
/** [PackedFloat32Array] or [PackedInt32Array] of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag. */
|
|
ARRAY_BONES = 10,
|
|
|
|
/** [PackedFloat32Array] or [PackedFloat64Array] of bone weights in the range `0.0` to `1.0` (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag. */
|
|
ARRAY_WEIGHTS = 11,
|
|
|
|
/** [PackedInt32Array] of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the *i* 'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices.
|
|
* For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.
|
|
*/
|
|
ARRAY_INDEX = 12,
|
|
|
|
/** Represents the size of the [enum ArrayType] enum. */
|
|
ARRAY_MAX = 13,
|
|
}
|
|
enum ArrayCustomFormat {
|
|
/** Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as [PackedByteArray]. */
|
|
ARRAY_CUSTOM_RGBA8_UNORM = 0,
|
|
|
|
/** Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as [PackedByteArray]. */
|
|
ARRAY_CUSTOM_RGBA8_SNORM = 1,
|
|
|
|
/** Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. Only red and green channels are used. */
|
|
ARRAY_CUSTOM_RG_HALF = 2,
|
|
|
|
/** Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. */
|
|
ARRAY_CUSTOM_RGBA_HALF = 3,
|
|
|
|
/** Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red channel is used. */
|
|
ARRAY_CUSTOM_R_FLOAT = 4,
|
|
|
|
/** Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used. */
|
|
ARRAY_CUSTOM_RG_FLOAT = 5,
|
|
|
|
/** Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red, green and blue channels are used. */
|
|
ARRAY_CUSTOM_RGB_FLOAT = 6,
|
|
|
|
/** Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. */
|
|
ARRAY_CUSTOM_RGBA_FLOAT = 7,
|
|
|
|
/** Represents the size of the [enum ArrayCustomFormat] enum. */
|
|
ARRAY_CUSTOM_MAX = 8,
|
|
}
|
|
enum ArrayFormat {
|
|
/** Mesh array contains vertices. All meshes require a vertex array so this should always be present. */
|
|
ARRAY_FORMAT_VERTEX = 1,
|
|
|
|
/** Mesh array contains normals. */
|
|
ARRAY_FORMAT_NORMAL = 2,
|
|
|
|
/** Mesh array contains tangents. */
|
|
ARRAY_FORMAT_TANGENT = 4,
|
|
|
|
/** Mesh array contains colors. */
|
|
ARRAY_FORMAT_COLOR = 8,
|
|
|
|
/** Mesh array contains UVs. */
|
|
ARRAY_FORMAT_TEX_UV = 16,
|
|
|
|
/** Mesh array contains second UV. */
|
|
ARRAY_FORMAT_TEX_UV2 = 32,
|
|
|
|
/** Mesh array contains custom channel index 0. */
|
|
ARRAY_FORMAT_CUSTOM0 = 64,
|
|
|
|
/** Mesh array contains custom channel index 1. */
|
|
ARRAY_FORMAT_CUSTOM1 = 128,
|
|
|
|
/** Mesh array contains custom channel index 2. */
|
|
ARRAY_FORMAT_CUSTOM2 = 256,
|
|
|
|
/** Mesh array contains custom channel index 3. */
|
|
ARRAY_FORMAT_CUSTOM3 = 512,
|
|
|
|
/** Mesh array contains bones. */
|
|
ARRAY_FORMAT_BONES = 1024,
|
|
|
|
/** Mesh array contains bone weights. */
|
|
ARRAY_FORMAT_WEIGHTS = 2048,
|
|
|
|
/** Mesh array uses indices. */
|
|
ARRAY_FORMAT_INDEX = 4096,
|
|
|
|
/** Mask of mesh channels permitted in blend shapes. */
|
|
ARRAY_FORMAT_BLEND_SHAPE_MASK = 7,
|
|
|
|
/** Shift of first custom channel. */
|
|
ARRAY_FORMAT_CUSTOM_BASE = 13,
|
|
|
|
/** Number of format bits per custom channel. See [enum ArrayCustomFormat]. */
|
|
ARRAY_FORMAT_CUSTOM_BITS = 3,
|
|
|
|
/** Amount to shift [enum ArrayCustomFormat] for custom channel index 0. */
|
|
ARRAY_FORMAT_CUSTOM0_SHIFT = 13,
|
|
|
|
/** Amount to shift [enum ArrayCustomFormat] for custom channel index 1. */
|
|
ARRAY_FORMAT_CUSTOM1_SHIFT = 16,
|
|
|
|
/** Amount to shift [enum ArrayCustomFormat] for custom channel index 2. */
|
|
ARRAY_FORMAT_CUSTOM2_SHIFT = 19,
|
|
|
|
/** Amount to shift [enum ArrayCustomFormat] for custom channel index 3. */
|
|
ARRAY_FORMAT_CUSTOM3_SHIFT = 22,
|
|
|
|
/** Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See [enum ArrayCustomFormat]. */
|
|
ARRAY_FORMAT_CUSTOM_MASK = 7,
|
|
|
|
/** Shift of first compress flag. Compress flags should be passed to [method ArrayMesh.add_surface_from_arrays] and [method SurfaceTool.commit]. */
|
|
ARRAY_COMPRESS_FLAGS_BASE = 25,
|
|
|
|
/** Flag used to mark that the array contains 2D vertices. */
|
|
ARRAY_FLAG_USE_2D_VERTICES = 33554432,
|
|
|
|
/** Flag indices that the mesh data will use `GL_DYNAMIC_DRAW` on GLES. Unused on Vulkan. */
|
|
ARRAY_FLAG_USE_DYNAMIC_UPDATE = 67108864,
|
|
|
|
/** Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that [constant ARRAY_BONES] and [constant ARRAY_WEIGHTS] elements will have double length. */
|
|
ARRAY_FLAG_USE_8_BONE_WEIGHTS = 134217728,
|
|
|
|
/** Flag used to mark that the mesh intentionally contains no vertex array. */
|
|
ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY = 268435456,
|
|
|
|
/** Flag used to mark that a mesh is using compressed attributes (vertices, normals, tangents, UVs). When this form of compression is enabled, vertex positions will be packed into an RGBA16UNORM attribute and scaled in the vertex shader. The normal and tangent will be packed into an RG16UNORM representing an axis, and a 16-bit float stored in the A-channel of the vertex. UVs will use 16-bit normalized floats instead of full 32-bit signed floats. When using this compression mode you must use either vertices, normals, and tangents or only vertices. You cannot use normals without tangents. Importers will automatically enable this compression if they can. */
|
|
ARRAY_FLAG_COMPRESS_ATTRIBUTES = 536870912,
|
|
}
|
|
enum BlendShapeMode {
|
|
/** Blend shapes are normalized. */
|
|
BLEND_SHAPE_MODE_NORMALIZED = 0,
|
|
|
|
/** Blend shapes are relative to base weight. */
|
|
BLEND_SHAPE_MODE_RELATIVE = 1,
|
|
}
|
|
}
|
|
/** A [Resource] that contains vertex array-based geometry.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_mesh.html
|
|
*/
|
|
class Mesh extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Virtual method to override the surface count for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _get_surface_count(): int64
|
|
|
|
/** Virtual method to override the surface array length for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_array_len(index: int64): int64
|
|
|
|
/** Virtual method to override the surface array index length for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_array_index_len(index: int64): int64
|
|
|
|
/** Virtual method to override the surface arrays for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_arrays(index: int64): GArray
|
|
|
|
/** Virtual method to override the blend shape arrays for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_blend_shape_arrays(index: int64): GArray
|
|
|
|
/** Virtual method to override the surface LODs for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_lods(index: int64): GDictionary
|
|
|
|
/** Virtual method to override the surface format for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_format(index: int64): int64
|
|
|
|
/** Virtual method to override the surface primitive type for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_primitive_type(index: int64): int64
|
|
|
|
/** Virtual method to override the setting of a [param material] at the given [param index] for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_set_material(index: int64, material: Material): void
|
|
|
|
/** Virtual method to override the surface material for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _surface_get_material(index: int64): Material
|
|
|
|
/** Virtual method to override the number of blend shapes for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _get_blend_shape_count(): int64
|
|
|
|
/** Virtual method to override the retrieval of blend shape names for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _get_blend_shape_name(index: int64): StringName
|
|
|
|
/** Virtual method to override the names of blend shapes for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _set_blend_shape_name(index: int64, name: StringName): void
|
|
|
|
/** Virtual method to override the [AABB] for a custom class extending [Mesh]. */
|
|
/* gdvirtual */ _get_aabb(): AABB
|
|
|
|
/** Returns the smallest [AABB] enclosing this mesh in local space. Not affected by `custom_aabb`.
|
|
*
|
|
* **Note:** This is only implemented for [ArrayMesh] and [PrimitiveMesh].
|
|
*/
|
|
get_aabb(): AABB
|
|
|
|
/** Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle. */
|
|
get_faces(): PackedVector3Array
|
|
|
|
/** Returns the number of surfaces that the [Mesh] holds. This is equivalent to [method MeshInstance3D.get_surface_override_material_count]. */
|
|
get_surface_count(): int64
|
|
|
|
/** Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]). */
|
|
surface_get_arrays(surf_idx: int64): GArray
|
|
|
|
/** Returns the blend shape arrays for the requested surface. */
|
|
surface_get_blend_shape_arrays(surf_idx: int64): GArray
|
|
|
|
/** Sets a [Material] for a given surface. Surface will be rendered using this material.
|
|
*
|
|
* **Note:** This assigns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To set the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.set_surface_override_material] instead.
|
|
*/
|
|
surface_set_material(surf_idx: int64, material: Material): void
|
|
|
|
/** Returns a [Material] in a given surface. Surface is rendered using this material.
|
|
*
|
|
* **Note:** This returns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To get the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.get_surface_override_material] instead.
|
|
*/
|
|
surface_get_material(surf_idx: int64): Material
|
|
|
|
/** Creates a placeholder version of this resource ([PlaceholderMesh]). */
|
|
create_placeholder(): Resource
|
|
|
|
/** Calculate a [ConcavePolygonShape3D] from the mesh. */
|
|
create_trimesh_shape(): ConcavePolygonShape3D
|
|
|
|
/** Calculate a [ConvexPolygonShape3D] from the mesh.
|
|
* If [param clean] is `true` (default), duplicate and interior vertices are removed automatically. You can set it to `false` to make the process faster if not needed.
|
|
* If [param simplify] is `true`, the geometry can be further simplified to reduce the number of vertices. Disabled by default.
|
|
*/
|
|
create_convex_shape(clean: boolean = true, simplify: boolean = false): ConvexPolygonShape3D
|
|
|
|
/** Calculate an outline mesh at a defined offset (margin) from the original mesh.
|
|
*
|
|
* **Note:** This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
|
|
*/
|
|
create_outline(margin: float64): Mesh
|
|
|
|
/** Generate a [TriangleMesh] from the mesh. Considers only surfaces using one of these primitive types: [constant PRIMITIVE_TRIANGLES], [constant PRIMITIVE_TRIANGLE_STRIP]. */
|
|
generate_triangle_mesh(): TriangleMesh
|
|
|
|
/** Sets a hint to be used for lightmap resolution. */
|
|
get lightmap_size_hint(): Vector2i
|
|
set lightmap_size_hint(value: Vector2i)
|
|
}
|
|
namespace MeshConvexDecompositionSettings {
|
|
enum Mode {
|
|
/** Constant for voxel-based approximate convex decomposition. */
|
|
CONVEX_DECOMPOSITION_MODE_VOXEL = 0,
|
|
|
|
/** Constant for tetrahedron-based approximate convex decomposition. */
|
|
CONVEX_DECOMPOSITION_MODE_TETRAHEDRON = 1,
|
|
}
|
|
}
|
|
/** Parameters to be used with a [Mesh] convex decomposition operation.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshconvexdecompositionsettings.html
|
|
*/
|
|
class MeshConvexDecompositionSettings extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Maximum concavity. Ranges from `0.0` to `1.0`. */
|
|
get max_concavity(): float64
|
|
set max_concavity(value: float64)
|
|
|
|
/** Controls the bias toward clipping along symmetry planes. Ranges from `0.0` to `1.0`. */
|
|
get symmetry_planes_clipping_bias(): float64
|
|
set symmetry_planes_clipping_bias(value: float64)
|
|
|
|
/** Controls the bias toward clipping along revolution axes. Ranges from `0.0` to `1.0`. */
|
|
get revolution_axes_clipping_bias(): float64
|
|
set revolution_axes_clipping_bias(value: float64)
|
|
|
|
/** Controls the adaptive sampling of the generated convex-hulls. Ranges from `0.0` to `0.01`. */
|
|
get min_volume_per_convex_hull(): float64
|
|
set min_volume_per_convex_hull(value: float64)
|
|
|
|
/** Maximum number of voxels generated during the voxelization stage. */
|
|
get resolution(): int64
|
|
set resolution(value: int64)
|
|
|
|
/** Controls the maximum number of triangles per convex-hull. Ranges from `4` to `1024`. */
|
|
get max_num_vertices_per_convex_hull(): int64
|
|
set max_num_vertices_per_convex_hull(value: int64)
|
|
|
|
/** Controls the granularity of the search for the "best" clipping plane. Ranges from `1` to `16`. */
|
|
get plane_downsampling(): int64
|
|
set plane_downsampling(value: int64)
|
|
|
|
/** Controls the precision of the convex-hull generation process during the clipping plane selection stage. Ranges from `1` to `16`. */
|
|
get convex_hull_downsampling(): int64
|
|
set convex_hull_downsampling(value: int64)
|
|
|
|
/** If `true`, normalizes the mesh before applying the convex decomposition. */
|
|
get normalize_mesh(): boolean
|
|
set normalize_mesh(value: boolean)
|
|
|
|
/** Mode for the approximate convex decomposition. */
|
|
get mode(): int64
|
|
set mode(value: int64)
|
|
|
|
/** If `true`, uses approximation for computing convex hulls. */
|
|
get convex_hull_approximation(): boolean
|
|
set convex_hull_approximation(value: boolean)
|
|
|
|
/** The maximum number of convex hulls to produce from the merge operation. */
|
|
get max_convex_hulls(): int64
|
|
set max_convex_hulls(value: int64)
|
|
|
|
/** If `true`, projects output convex hull vertices onto the original source mesh to increase floating-point accuracy of the results. */
|
|
get project_hull_vertices(): boolean
|
|
set project_hull_vertices(value: boolean)
|
|
}
|
|
/** Helper tool to access and edit [Mesh] data.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshdatatool.html
|
|
*/
|
|
class MeshDataTool extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Clears all data currently in MeshDataTool. */
|
|
clear(): void
|
|
|
|
/** Uses specified surface of given [Mesh] to populate data for MeshDataTool.
|
|
* Requires [Mesh] with primitive type [constant Mesh.PRIMITIVE_TRIANGLES].
|
|
*/
|
|
create_from_surface(mesh: ArrayMesh, surface: int64): GError
|
|
|
|
/** Adds a new surface to specified [Mesh] with edited data. */
|
|
commit_to_surface(mesh: ArrayMesh, compression_flags: int64 = 0): GError
|
|
|
|
/** Returns the [Mesh]'s format as a combination of the [enum Mesh.ArrayFormat] flags. For example, a mesh containing both vertices and normals would return a format of `3` because [constant Mesh.ARRAY_FORMAT_VERTEX] is `1` and [constant Mesh.ARRAY_FORMAT_NORMAL] is `2`. */
|
|
get_format(): int64
|
|
|
|
/** Returns the total number of vertices in [Mesh]. */
|
|
get_vertex_count(): int64
|
|
|
|
/** Returns the number of edges in this [Mesh]. */
|
|
get_edge_count(): int64
|
|
|
|
/** Returns the number of faces in this [Mesh]. */
|
|
get_face_count(): int64
|
|
|
|
/** Sets the position of the given vertex. */
|
|
set_vertex(idx: int64, vertex: Vector3): void
|
|
|
|
/** Returns the position of the given vertex. */
|
|
get_vertex(idx: int64): Vector3
|
|
|
|
/** Sets the normal of the given vertex. */
|
|
set_vertex_normal(idx: int64, normal: Vector3): void
|
|
|
|
/** Returns the normal of the given vertex. */
|
|
get_vertex_normal(idx: int64): Vector3
|
|
|
|
/** Sets the tangent of the given vertex. */
|
|
set_vertex_tangent(idx: int64, tangent: Plane): void
|
|
|
|
/** Returns the tangent of the given vertex. */
|
|
get_vertex_tangent(idx: int64): Plane
|
|
|
|
/** Sets the UV of the given vertex. */
|
|
set_vertex_uv(idx: int64, uv: Vector2): void
|
|
|
|
/** Returns the UV of the given vertex. */
|
|
get_vertex_uv(idx: int64): Vector2
|
|
|
|
/** Sets the UV2 of the given vertex. */
|
|
set_vertex_uv2(idx: int64, uv2: Vector2): void
|
|
|
|
/** Returns the UV2 of the given vertex. */
|
|
get_vertex_uv2(idx: int64): Vector2
|
|
|
|
/** Sets the color of the given vertex. */
|
|
set_vertex_color(idx: int64, color: Color): void
|
|
|
|
/** Returns the color of the given vertex. */
|
|
get_vertex_color(idx: int64): Color
|
|
|
|
/** Sets the bones of the given vertex. */
|
|
set_vertex_bones(idx: int64, bones: PackedInt32Array | int32[]): void
|
|
|
|
/** Returns the bones of the given vertex. */
|
|
get_vertex_bones(idx: int64): PackedInt32Array
|
|
|
|
/** Sets the bone weights of the given vertex. */
|
|
set_vertex_weights(idx: int64, weights: PackedFloat32Array | float32[]): void
|
|
|
|
/** Returns bone weights of the given vertex. */
|
|
get_vertex_weights(idx: int64): PackedFloat32Array
|
|
|
|
/** Sets the metadata associated with the given vertex. */
|
|
set_vertex_meta(idx: int64, meta: any): void
|
|
|
|
/** Returns the metadata associated with the given vertex. */
|
|
get_vertex_meta(idx: int64): any
|
|
|
|
/** Returns an array of edges that share the given vertex. */
|
|
get_vertex_edges(idx: int64): PackedInt32Array
|
|
|
|
/** Returns an array of faces that share the given vertex. */
|
|
get_vertex_faces(idx: int64): PackedInt32Array
|
|
|
|
/** Returns index of specified vertex connected to given edge.
|
|
* Vertex argument can only be 0 or 1 because edges are comprised of two vertices.
|
|
*/
|
|
get_edge_vertex(idx: int64, vertex: int64): int64
|
|
|
|
/** Returns array of faces that touch given edge. */
|
|
get_edge_faces(idx: int64): PackedInt32Array
|
|
|
|
/** Sets the metadata of the given edge. */
|
|
set_edge_meta(idx: int64, meta: any): void
|
|
|
|
/** Returns meta information assigned to given edge. */
|
|
get_edge_meta(idx: int64): any
|
|
|
|
/** Returns the specified vertex index of the given face.
|
|
* [param vertex] must be either `0`, `1`, or `2` because faces contain three vertices.
|
|
*
|
|
*/
|
|
get_face_vertex(idx: int64, vertex: int64): int64
|
|
|
|
/** Returns specified edge associated with given face.
|
|
* Edge argument must be either 0, 1, or 2 because a face only has three edges.
|
|
*/
|
|
get_face_edge(idx: int64, edge: int64): int64
|
|
|
|
/** Sets the metadata of the given face. */
|
|
set_face_meta(idx: int64, meta: any): void
|
|
|
|
/** Returns the metadata associated with the given face. */
|
|
get_face_meta(idx: int64): any
|
|
|
|
/** Calculates and returns the face normal of the given face. */
|
|
get_face_normal(idx: int64): Vector3
|
|
|
|
/** Sets the material to be used by newly-constructed [Mesh]. */
|
|
set_material(material: Material): void
|
|
|
|
/** Returns the material assigned to the [Mesh]. */
|
|
get_material(): Material
|
|
}
|
|
class MeshEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Node used for displaying a [Mesh] in 2D.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshinstance2d.html
|
|
*/
|
|
class MeshInstance2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The [Mesh] that will be drawn by the [MeshInstance2D]. */
|
|
get mesh(): Mesh
|
|
set mesh(value: Mesh)
|
|
|
|
/** The [Texture2D] that will be used if using the default [CanvasItemMaterial]. Can be accessed as `TEXTURE` in CanvasItem shader. */
|
|
get texture(): Texture2D
|
|
set texture(value: Texture2D)
|
|
|
|
/** Emitted when the [member texture] is changed. */
|
|
readonly texture_changed: Signal0
|
|
}
|
|
/** Node that instances meshes into a scenario.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshinstance3d.html
|
|
*/
|
|
class MeshInstance3D<Map extends Record<string, Node> = Record<string, Node>> extends GeometryInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the internal [SkinReference] containing the skeleton's [RID] attached to this RID. See also [method Resource.get_rid], [method SkinReference.get_skeleton], and [method RenderingServer.instance_attach_skeleton]. */
|
|
get_skin_reference(): SkinReference
|
|
|
|
/** Returns the number of surface override materials. This is equivalent to [method Mesh.get_surface_count]. See also [method get_surface_override_material]. */
|
|
get_surface_override_material_count(): int64
|
|
|
|
/** Sets the override [param material] for the specified [param surface] of the [Mesh] resource. This material is associated with this [MeshInstance3D] rather than with [member mesh].
|
|
*
|
|
* **Note:** This assigns the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, not the material within the [Mesh] resource. To set the material within the [Mesh] resource, use [method Mesh.surface_set_material] instead.
|
|
*/
|
|
set_surface_override_material(surface: int64, material: Material): void
|
|
|
|
/** Returns the override [Material] for the specified [param surface] of the [Mesh] resource. See also [method get_surface_override_material_count].
|
|
*
|
|
* **Note:** This returns the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, not the material within the [Mesh] resource. To get the material within the [Mesh] resource, use [method Mesh.surface_get_material] instead.
|
|
*/
|
|
get_surface_override_material(surface: int64): Material
|
|
|
|
/** Returns the [Material] that will be used by the [Mesh] when drawing. This can return the [member GeometryInstance3D.material_override], the surface override [Material] defined in this [MeshInstance3D], or the surface [Material] defined in the [member mesh]. For example, if [member GeometryInstance3D.material_override] is used, all surfaces will return the override material.
|
|
* Returns `null` if no material is active, including when [member mesh] is `null`.
|
|
*/
|
|
get_active_material(surface: int64): Material
|
|
|
|
/** This helper creates a [StaticBody3D] child node with a [ConcavePolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing. */
|
|
create_trimesh_collision(): void
|
|
|
|
/** This helper creates a [StaticBody3D] child node with a [ConvexPolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing.
|
|
* If [param clean] is `true` (default), duplicate and interior vertices are removed automatically. You can set it to `false` to make the process faster if not needed.
|
|
* If [param simplify] is `true`, the geometry can be further simplified to reduce the number of vertices. Disabled by default.
|
|
*/
|
|
create_convex_collision(clean: boolean = true, simplify: boolean = false): void
|
|
|
|
/** This helper creates a [StaticBody3D] child node with multiple [ConvexPolygonShape3D] collision shapes calculated from the mesh geometry via convex decomposition. The convex decomposition operation can be controlled with parameters from the optional [param settings]. */
|
|
create_multiple_convex_collisions(settings: MeshConvexDecompositionSettings = undefined): void
|
|
|
|
/** Returns the number of blend shapes available. Produces an error if [member mesh] is `null`. */
|
|
get_blend_shape_count(): int64
|
|
|
|
/** Returns the index of the blend shape with the given [param name]. Returns `-1` if no blend shape with this name exists, including when [member mesh] is `null`. */
|
|
find_blend_shape_by_name(name: StringName): int64
|
|
|
|
/** Returns the value of the blend shape at the given [param blend_shape_idx]. Returns `0.0` and produces an error if [member mesh] is `null` or doesn't have a blend shape at that index. */
|
|
get_blend_shape_value(blend_shape_idx: int64): float64
|
|
|
|
/** Sets the value of the blend shape at [param blend_shape_idx] to [param value]. Produces an error if [member mesh] is `null` or doesn't have a blend shape at that index. */
|
|
set_blend_shape_value(blend_shape_idx: int64, value: float64): void
|
|
|
|
/** This helper creates a [MeshInstance3D] child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing. */
|
|
create_debug_tangents(): void
|
|
|
|
/** Takes a snapshot from the current [ArrayMesh] with all blend shapes applied according to their current weights and bakes it to the provided [param existing] mesh. If no [param existing] mesh is provided a new [ArrayMesh] is created, baked and returned. Mesh surface materials are not copied.
|
|
* **Performance:** [Mesh] data needs to be received from the GPU, stalling the [RenderingServer] in the process.
|
|
*/
|
|
bake_mesh_from_current_blend_shape_mix(existing: ArrayMesh = undefined): ArrayMesh
|
|
|
|
/** Takes a snapshot of the current animated skeleton pose of the skinned mesh and bakes it to the provided [param existing] mesh. If no [param existing] mesh is provided a new [ArrayMesh] is created, baked, and returned. Requires a skeleton with a registered skin to work. Blendshapes are ignored. Mesh surface materials are not copied.
|
|
* **Performance:** [Mesh] data needs to be retrieved from the GPU, stalling the [RenderingServer] in the process.
|
|
*/
|
|
bake_mesh_from_current_skeleton_pose(existing: ArrayMesh = undefined): ArrayMesh
|
|
|
|
/** The [Mesh] resource for the instance. */
|
|
get mesh(): Mesh
|
|
set mesh(value: Mesh)
|
|
|
|
/** The [Skin] to be used by this instance. */
|
|
get skin(): Skin
|
|
set skin(value: Skin)
|
|
|
|
/** [NodePath] to the [Skeleton3D] associated with the instance. */
|
|
get skeleton(): NodePath
|
|
set skeleton(value: NodePath | string)
|
|
}
|
|
class MeshInstance3DEditor<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class MeshInstance3DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class MeshInstance3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Library of meshes.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshlibrary.html
|
|
*/
|
|
class MeshLibrary extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Creates a new item in the library with the given ID.
|
|
* You can get an unused ID from [method get_last_unused_item_id].
|
|
*/
|
|
create_item(id: int64): void
|
|
|
|
/** Sets the item's name.
|
|
* This name is shown in the editor. It can also be used to look up the item later using [method find_item_by_name].
|
|
*/
|
|
set_item_name(id: int64, name: string): void
|
|
|
|
/** Sets the item's mesh. */
|
|
set_item_mesh(id: int64, mesh: Mesh): void
|
|
|
|
/** Sets the transform to apply to the item's mesh. */
|
|
set_item_mesh_transform(id: int64, mesh_transform: Transform3D): void
|
|
|
|
/** Sets the item's shadow casting mode. See [enum RenderingServer.ShadowCastingSetting] for possible values. */
|
|
set_item_mesh_cast_shadow(id: int64, shadow_casting_setting: RenderingServer.ShadowCastingSetting): void
|
|
|
|
/** Sets the item's navigation mesh. */
|
|
set_item_navigation_mesh(id: int64, navigation_mesh: NavigationMesh): void
|
|
|
|
/** Sets the transform to apply to the item's navigation mesh. */
|
|
set_item_navigation_mesh_transform(id: int64, navigation_mesh: Transform3D): void
|
|
|
|
/** Sets the item's navigation layers bitmask. */
|
|
set_item_navigation_layers(id: int64, navigation_layers: int64): void
|
|
|
|
/** Sets an item's collision shapes.
|
|
* The array should consist of [Shape3D] objects, each followed by a [Transform3D] that will be applied to it. For shapes that should not have a transform, use [constant Transform3D.IDENTITY].
|
|
*/
|
|
set_item_shapes(id: int64, shapes: GArray): void
|
|
|
|
/** Sets a texture to use as the item's preview icon in the editor. */
|
|
set_item_preview(id: int64, texture: Texture2D): void
|
|
|
|
/** Returns the item's name. */
|
|
get_item_name(id: int64): string
|
|
|
|
/** Returns the item's mesh. */
|
|
get_item_mesh(id: int64): Mesh
|
|
|
|
/** Returns the transform applied to the item's mesh. */
|
|
get_item_mesh_transform(id: int64): Transform3D
|
|
|
|
/** Returns the item's shadow casting mode. See [enum RenderingServer.ShadowCastingSetting] for possible values. */
|
|
get_item_mesh_cast_shadow(id: int64): RenderingServer.ShadowCastingSetting
|
|
|
|
/** Returns the item's navigation mesh. */
|
|
get_item_navigation_mesh(id: int64): NavigationMesh
|
|
|
|
/** Returns the transform applied to the item's navigation mesh. */
|
|
get_item_navigation_mesh_transform(id: int64): Transform3D
|
|
|
|
/** Returns the item's navigation layers bitmask. */
|
|
get_item_navigation_layers(id: int64): int64
|
|
|
|
/** Returns an item's collision shapes.
|
|
* The array consists of each [Shape3D] followed by its [Transform3D].
|
|
*/
|
|
get_item_shapes(id: int64): GArray
|
|
|
|
/** When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using [method set_item_preview]. Returns an empty [Texture2D] if no preview was manually set in a running project. */
|
|
get_item_preview(id: int64): Texture2D
|
|
|
|
/** Removes the item. */
|
|
remove_item(id: int64): void
|
|
|
|
/** Returns the first item with the given name, or `-1` if no item is found. */
|
|
find_item_by_name(name: string): int64
|
|
|
|
/** Clears the library. */
|
|
clear(): void
|
|
|
|
/** Returns the list of item IDs in use. */
|
|
get_item_list(): PackedInt32Array
|
|
|
|
/** Gets an unused ID for a new item. */
|
|
get_last_unused_item_id(): int64
|
|
}
|
|
class MeshLibraryEditor<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class MeshLibraryEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Simple texture that uses a mesh to draw itself.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_meshtexture.html
|
|
*/
|
|
class MeshTexture extends Texture2D {
|
|
constructor(identifier?: any)
|
|
/** Sets the mesh used to draw. It must be a mesh using 2D vertices. */
|
|
get mesh(): Mesh
|
|
set mesh(value: Mesh)
|
|
|
|
/** Sets the base texture that the Mesh will use to draw. */
|
|
get base_texture(): Texture2D
|
|
set base_texture(value: Texture2D)
|
|
|
|
/** Sets the size of the image, needed for reference. */
|
|
get image_size(): Vector2
|
|
set image_size(value: Vector2)
|
|
}
|
|
/** Interpolates an abstract value and supplies it to a method called over time.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_methodtweener.html
|
|
*/
|
|
class MethodTweener extends Tweener {
|
|
constructor(identifier?: any)
|
|
/** Sets the time in seconds after which the [MethodTweener] will start interpolating. By default there's no delay. */
|
|
set_delay(delay: float64): MethodTweener
|
|
|
|
/** Sets the type of used transition from [enum Tween.TransitionType]. If not set, the default transition is used from the [Tween] that contains this Tweener. */
|
|
set_trans(trans: Tween.TransitionType): MethodTweener
|
|
|
|
/** Sets the type of used easing from [enum Tween.EaseType]. If not set, the default easing is used from the [Tween] that contains this Tweener. */
|
|
set_ease(ease: Tween.EaseType): MethodTweener
|
|
}
|
|
/** An internal editor class intended for keeping the data of unrecognized nodes.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_missingnode.html
|
|
*/
|
|
class MissingNode<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** The name of the class this node was supposed to be (see [method Object.get_class]). */
|
|
get original_class(): string
|
|
set original_class(value: string)
|
|
|
|
/** Returns the path of the scene this node was instance of originally. */
|
|
get original_scene(): string
|
|
set original_scene(value: string)
|
|
|
|
/** If `true`, allows new properties to be set along with existing ones. If `false`, only existing properties' values can be set, and new properties cannot be added. */
|
|
get recording_properties(): boolean
|
|
set recording_properties(value: boolean)
|
|
}
|
|
/** An internal editor class intended for keeping the data of unrecognized resources.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_missingresource.html
|
|
*/
|
|
class MissingResource extends Resource {
|
|
constructor(identifier?: any)
|
|
/** The name of the class this resource was supposed to be (see [method Object.get_class]). */
|
|
get original_class(): string
|
|
set original_class(value: string)
|
|
|
|
/** If set to `true`, allows new properties to be added on top of the existing ones with [method Object.set]. */
|
|
get recording_properties(): boolean
|
|
set recording_properties(value: boolean)
|
|
}
|
|
/** Generic mobile VR implementation.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_mobilevrinterface.html
|
|
*/
|
|
class MobileVRInterface extends XRInterface {
|
|
constructor(identifier?: any)
|
|
/** The height at which the camera is placed in relation to the ground (i.e. [XROrigin3D] node). */
|
|
get eye_height(): float64
|
|
set eye_height(value: float64)
|
|
|
|
/** The interocular distance, also known as the interpupillary distance. The distance between the pupils of the left and right eye. */
|
|
get iod(): float64
|
|
set iod(value: float64)
|
|
|
|
/** The width of the display in centimeters. */
|
|
get display_width(): float64
|
|
set display_width(value: float64)
|
|
|
|
/** The distance between the display and the lenses inside of the device in centimeters. */
|
|
get display_to_lens(): float64
|
|
set display_to_lens(value: float64)
|
|
|
|
/** Set the offset rect relative to the area being rendered. A length of 1 represents the whole rendering area on that axis. */
|
|
get offset_rect(): Rect2
|
|
set offset_rect(value: Rect2)
|
|
|
|
/** The oversample setting. Because of the lens distortion we have to render our buffers at a higher resolution then the screen can natively handle. A value between 1.5 and 2.0 often provides good results but at the cost of performance. */
|
|
get oversample(): float64
|
|
set oversample(value: float64)
|
|
|
|
/** The k1 lens factor is one of the two constants that define the strength of the lens used and directly influences the lens distortion effect. */
|
|
get k1(): float64
|
|
set k1(value: float64)
|
|
|
|
/** The k2 lens factor, see k1. */
|
|
get k2(): float64
|
|
set k2(value: float64)
|
|
|
|
/** The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.
|
|
*
|
|
* **Note:** Mobile and Forward+ renderers only. Requires [member Viewport.vrs_mode] to be set to [constant Viewport.VRS_XR].
|
|
*/
|
|
get vrs_min_radius(): float64
|
|
set vrs_min_radius(value: float64)
|
|
|
|
/** The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.
|
|
*
|
|
* **Note:** Mobile and Forward+ renderers only. Requires [member Viewport.vrs_mode] to be set to [constant Viewport.VRS_XR].
|
|
*/
|
|
get vrs_strength(): float64
|
|
set vrs_strength(value: float64)
|
|
}
|
|
/** Abstract class for non-real-time video recording encoders.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_moviewriter.html
|
|
*/
|
|
class MovieWriter extends Object {
|
|
constructor(identifier?: any)
|
|
/** Called when the audio sample rate used for recording the audio is requested by the engine. The value returned must be specified in Hz. Defaults to 48000 Hz if [method _get_audio_mix_rate] is not overridden. */
|
|
/* gdvirtual */ _get_audio_mix_rate(): int64
|
|
|
|
/** Called when the audio speaker mode used for recording the audio is requested by the engine. This can affect the number of output channels in the resulting audio file/stream. Defaults to [constant AudioServer.SPEAKER_MODE_STEREO] if [method _get_audio_speaker_mode] is not overridden. */
|
|
/* gdvirtual */ _get_audio_speaker_mode(): AudioServer.SpeakerMode
|
|
|
|
/** Called when the engine determines whether this [MovieWriter] is able to handle the file at [param path]. Must return `true` if this [MovieWriter] is able to handle the given file path, `false` otherwise. Typically, [method _handles_file] is overridden as follows to allow the user to record a file at any path with a given file extension:
|
|
*
|
|
*/
|
|
/* gdvirtual */ _handles_file(path: string): boolean
|
|
|
|
/** Called once before the engine starts writing video and audio data. [param movie_size] is the width and height of the video to save. [param fps] is the number of frames per second specified in the project settings or using the `--fixed-fps <fps>` [url=https://docs.godotengine.org/en/4.4/tutorials/editor/command_line_tutorial.html]command line argument[/url]. */
|
|
/* gdvirtual */ _write_begin(movie_size: Vector2i, fps: int64, base_path: string): GError
|
|
|
|
/** Called at the end of every rendered frame. The [param frame_image] and [param audio_frame_block] function arguments should be written to. */
|
|
/* gdvirtual */ _write_frame(frame_image: Image, audio_frame_block: int64): GError
|
|
|
|
/** Called when the engine finishes writing. This occurs when the engine quits by pressing the window manager's close button, or when [method SceneTree.quit] is called.
|
|
*
|
|
* **Note:** Pressing [kbd]Ctrl + C[/kbd] on the terminal running the editor/project does *not* result in [method _write_end] being called.
|
|
*/
|
|
/* gdvirtual */ _write_end(): void
|
|
|
|
/** Adds a writer to be usable by the engine. The supported file extensions can be set by overriding [method _handles_file].
|
|
*
|
|
* **Note:** [method add_writer] must be called early enough in the engine initialization to work, as movie writing is designed to start at the same time as the rest of the engine.
|
|
*/
|
|
static add_writer(writer: MovieWriter): void
|
|
}
|
|
class MovieWriterMJPEG extends MovieWriter {
|
|
constructor(identifier?: any)
|
|
}
|
|
class MovieWriterPNGWAV extends MovieWriter {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace MultiMesh {
|
|
enum TransformFormat {
|
|
/** Use this when using 2D transforms. */
|
|
TRANSFORM_2D = 0,
|
|
|
|
/** Use this when using 3D transforms. */
|
|
TRANSFORM_3D = 1,
|
|
}
|
|
enum PhysicsInterpolationQuality {
|
|
/** Always interpolate using Basis lerping, which can produce warping artifacts in some situations. */
|
|
INTERP_QUALITY_FAST = 0,
|
|
|
|
/** Attempt to interpolate using Basis slerping (spherical linear interpolation) where possible, otherwise fall back to lerping. */
|
|
INTERP_QUALITY_HIGH = 1,
|
|
}
|
|
}
|
|
/** Provides high-performance drawing of a mesh multiple times using GPU instancing.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multimesh.html
|
|
*/
|
|
class MultiMesh extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Sets the [Transform3D] for a specific instance. */
|
|
set_instance_transform(instance: int64, transform: Transform3D): void
|
|
|
|
/** Sets the [Transform2D] for a specific instance. */
|
|
set_instance_transform_2d(instance: int64, transform: Transform2D): void
|
|
|
|
/** Returns the [Transform3D] of a specific instance. */
|
|
get_instance_transform(instance: int64): Transform3D
|
|
|
|
/** Returns the [Transform2D] of a specific instance. */
|
|
get_instance_transform_2d(instance: int64): Transform2D
|
|
|
|
/** Sets the color of a specific instance by *multiplying* the mesh's existing vertex colors. This allows for different color tinting per instance.
|
|
*
|
|
* **Note:** Each component is stored in 32 bits in the Forward+ and Mobile rendering methods, but is packed into 16 bits in the Compatibility rendering method.
|
|
* For the color to take effect, ensure that [member use_colors] is `true` on the [MultiMesh] and [member BaseMaterial3D.vertex_color_use_as_albedo] is `true` on the material. If you intend to set an absolute color instead of tinting, make sure the material's albedo color is set to pure white (`Color(1, 1, 1)`).
|
|
*/
|
|
set_instance_color(instance: int64, color: Color): void
|
|
|
|
/** Gets a specific instance's color multiplier. */
|
|
get_instance_color(instance: int64): Color
|
|
|
|
/** Sets custom data for a specific instance. [param custom_data] is a [Color] type only to contain 4 floating-point numbers.
|
|
*
|
|
* **Note:** Each number is stored in 32 bits in the Forward+ and Mobile rendering methods, but is packed into 16 bits in the Compatibility rendering method.
|
|
* For the custom data to be used, ensure that [member use_custom_data] is `true`.
|
|
* This custom instance data has to be manually accessed in your custom shader using `INSTANCE_CUSTOM`.
|
|
*/
|
|
set_instance_custom_data(instance: int64, custom_data: Color): void
|
|
|
|
/** Returns the custom data that has been set for a specific instance. */
|
|
get_instance_custom_data(instance: int64): Color
|
|
|
|
/** When using *physics interpolation* , this function allows you to prevent interpolation on an instance in the current physics tick.
|
|
* This allows you to move instances instantaneously, and should usually be used when initially placing an instance such as a bullet to prevent graphical glitches.
|
|
*/
|
|
reset_instance_physics_interpolation(instance: int64): void
|
|
|
|
/** Returns the visibility axis-aligned bounding box in local space. */
|
|
get_aabb(): AABB
|
|
|
|
/** An alternative to setting the [member buffer] property, which can be used with *physics interpolation* . This method takes two arrays, and can set the data for the current and previous tick in one go. The renderer will automatically interpolate the data at each frame.
|
|
* This is useful for situations where the order of instances may change from physics tick to tick, such as particle systems.
|
|
* When the order of instances is coherent, the simpler alternative of setting [member buffer] can still be used with interpolation.
|
|
*/
|
|
set_buffer_interpolated(buffer_curr: PackedFloat32Array | float32[], buffer_prev: PackedFloat32Array | float32[]): void
|
|
|
|
/** Format of transform used to transform mesh, either 2D or 3D. */
|
|
get transform_format(): int64
|
|
set transform_format(value: int64)
|
|
|
|
/** If `true`, the [MultiMesh] will use color data (see [method set_instance_color]). Can only be set when [member instance_count] is `0` or less. This means that you need to call this method before setting the instance count, or temporarily reset it to `0`. */
|
|
get use_colors(): boolean
|
|
set use_colors(value: boolean)
|
|
|
|
/** If `true`, the [MultiMesh] will use custom data (see [method set_instance_custom_data]). Can only be set when [member instance_count] is `0` or less. This means that you need to call this method before setting the instance count, or temporarily reset it to `0`. */
|
|
get use_custom_data(): boolean
|
|
set use_custom_data(value: boolean)
|
|
|
|
/** Custom AABB for this MultiMesh resource. Setting this manually prevents costly runtime AABB recalculations. */
|
|
get custom_aabb(): AABB
|
|
set custom_aabb(value: AABB)
|
|
|
|
/** Number of instances that will get drawn. This clears and (re)sizes the buffers. Setting data format or flags afterwards will have no effect.
|
|
* By default, all instances are drawn but you can limit this with [member visible_instance_count].
|
|
*/
|
|
get instance_count(): int64
|
|
set instance_count(value: int64)
|
|
|
|
/** Limits the number of instances drawn, -1 draws all instances. Changing this does not change the sizes of the buffers. */
|
|
get visible_instance_count(): int64
|
|
set visible_instance_count(value: int64)
|
|
|
|
/** [Mesh] resource to be instanced.
|
|
* The looks of the individual instances can be modified using [method set_instance_color] and [method set_instance_custom_data].
|
|
*/
|
|
get mesh(): Mesh
|
|
set mesh(value: Mesh)
|
|
get buffer(): PackedFloat32Array
|
|
set buffer(value: PackedFloat32Array | float32[])
|
|
|
|
/** Array containing each [Transform3D] value used by all instances of this mesh, as a [PackedVector3Array]. Each transform is divided into 4 [Vector3] values corresponding to the transforms' `x`, `y`, `z`, and `origin`. */
|
|
get transform_array(): PackedVector3Array
|
|
set transform_array(value: PackedVector3Array | Vector3[])
|
|
|
|
/** Array containing each [Transform2D] value used by all instances of this mesh, as a [PackedVector2Array]. Each transform is divided into 3 [Vector2] values corresponding to the transforms' `x`, `y`, and `origin`. */
|
|
get transform_2d_array(): PackedVector2Array
|
|
set transform_2d_array(value: PackedVector2Array | Vector2[])
|
|
|
|
/** Array containing each [Color] used by all instances of this mesh. */
|
|
get color_array(): PackedColorArray
|
|
set color_array(value: PackedColorArray | Color[])
|
|
|
|
/** Array containing each custom data value used by all instances of this mesh, as a [PackedColorArray]. */
|
|
get custom_data_array(): PackedColorArray
|
|
set custom_data_array(value: PackedColorArray | Color[])
|
|
|
|
/** Choose whether to use an interpolation method that favors speed or quality.
|
|
* When using low physics tick rates (typically below 20) or high rates of object rotation, you may get better results from the high quality setting.
|
|
*
|
|
* **Note:** Fast quality does not equate to low quality. Except in the special cases mentioned above, the quality should be comparable to high quality.
|
|
*/
|
|
get physics_interpolation_quality(): int64
|
|
set physics_interpolation_quality(value: int64)
|
|
}
|
|
class MultiMeshEditor<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class MultiMeshEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Node that instances a [MultiMesh] in 2D.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multimeshinstance2d.html
|
|
*/
|
|
class MultiMeshInstance2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The [MultiMesh] that will be drawn by the [MultiMeshInstance2D]. */
|
|
get multimesh(): MultiMesh
|
|
set multimesh(value: MultiMesh)
|
|
|
|
/** The [Texture2D] that will be used if using the default [CanvasItemMaterial]. Can be accessed as `TEXTURE` in CanvasItem shader. */
|
|
get texture(): Texture2D
|
|
set texture(value: Texture2D)
|
|
|
|
/** Emitted when the [member texture] is changed. */
|
|
readonly texture_changed: Signal0
|
|
}
|
|
/** Node that instances a [MultiMesh].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multimeshinstance3d.html
|
|
*/
|
|
class MultiMeshInstance3D<Map extends Record<string, Node> = Record<string, Node>> extends GeometryInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The [MultiMesh] resource that will be used and shared among all instances of the [MultiMeshInstance3D]. */
|
|
get multimesh(): MultiMesh
|
|
set multimesh(value: MultiMesh)
|
|
}
|
|
namespace MultiplayerAPI {
|
|
enum RPCMode {
|
|
/** Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. */
|
|
RPC_MODE_DISABLED = 0,
|
|
|
|
/** Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the `@rpc("any_peer")` annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. */
|
|
RPC_MODE_ANY_PEER = 1,
|
|
|
|
/** Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the `@rpc("authority")` annotation. See [method Node.set_multiplayer_authority]. */
|
|
RPC_MODE_AUTHORITY = 2,
|
|
}
|
|
}
|
|
/** High-level multiplayer API interface.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayerapi.html
|
|
*/
|
|
class MultiplayerAPI extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns `true` if there is a [member multiplayer_peer] set. */
|
|
has_multiplayer_peer(): boolean
|
|
|
|
/** Returns the unique peer ID of this MultiplayerAPI's [member multiplayer_peer]. */
|
|
get_unique_id(): int64
|
|
|
|
/** Returns `true` if this MultiplayerAPI's [member multiplayer_peer] is valid and in server mode (listening for connections). */
|
|
is_server(): boolean
|
|
|
|
/** Returns the sender's peer ID for the RPC currently being executed.
|
|
*
|
|
* **Note:** This method returns `0` when called outside of an RPC. As such, the original peer ID may be lost when code execution is delayed (such as with GDScript's `await` keyword).
|
|
*/
|
|
get_remote_sender_id(): int64
|
|
|
|
/** Method used for polling the MultiplayerAPI. You only need to worry about this if you set [member SceneTree.multiplayer_poll] to `false`. By default, [SceneTree] will poll its MultiplayerAPI(s) for you.
|
|
*
|
|
* **Note:** This method results in RPCs being called, so they will be executed in the same context of this function (e.g. `_process`, `physics`, [Thread]).
|
|
*/
|
|
poll(): GError
|
|
|
|
/** Sends an RPC to the target [param peer]. The given [param method] will be called on the remote [param object] with the provided [param arguments]. The RPC may also be called locally depending on the implementation and RPC configuration. See [method Node.rpc] and [method Node.rpc_config].
|
|
*
|
|
* **Note:** Prefer using [method Node.rpc], [method Node.rpc_id], or `my_method.rpc(peer, arg1, arg2, ...)` (in GDScript), since they are faster. This method is mostly useful in conjunction with [MultiplayerAPIExtension] when extending or replacing the multiplayer capabilities.
|
|
*/
|
|
rpc(peer: int64, object: Object, method: StringName, arguments_: GArray = []): GError
|
|
|
|
/** Notifies the MultiplayerAPI of a new [param configuration] for the given [param object]. This method is used internally by [SceneTree] to configure the root path for this MultiplayerAPI (passing `null` and a valid [NodePath] as [param configuration]). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g. [SceneMultiplayer]) for details on how they use it.
|
|
*
|
|
* **Note:** This method is mostly relevant when extending or overriding the MultiplayerAPI behavior via [MultiplayerAPIExtension].
|
|
*/
|
|
object_configuration_add(object: Object, configuration: any): GError
|
|
|
|
/** Notifies the MultiplayerAPI to remove a [param configuration] for the given [param object]. This method is used internally by [SceneTree] to configure the root path for this MultiplayerAPI (passing `null` and an empty [NodePath] as [param configuration]). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g. [SceneMultiplayer]) for details on how they use it.
|
|
*
|
|
* **Note:** This method is mostly relevant when extending or overriding the MultiplayerAPI behavior via [MultiplayerAPIExtension].
|
|
*/
|
|
object_configuration_remove(object: Object, configuration: any): GError
|
|
|
|
/** Returns the peer IDs of all connected peers of this MultiplayerAPI's [member multiplayer_peer]. */
|
|
get_peers(): PackedInt32Array
|
|
|
|
/** Sets the default MultiplayerAPI implementation class. This method can be used by modules and extensions to configure which implementation will be used by [SceneTree] when the engine starts. */
|
|
static set_default_interface(interface_name: StringName): void
|
|
|
|
/** Returns the default MultiplayerAPI implementation class name. This is usually `"SceneMultiplayer"` when [SceneMultiplayer] is available. See [method set_default_interface]. */
|
|
static get_default_interface(): StringName
|
|
|
|
/** Returns a new instance of the default MultiplayerAPI. */
|
|
static create_default_interface(): MultiplayerAPI
|
|
|
|
/** The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_server]) and will set root node's network mode to authority, or it will become a regular client peer. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals. */
|
|
get multiplayer_peer(): MultiplayerPeer
|
|
set multiplayer_peer(value: MultiplayerPeer)
|
|
|
|
/** Emitted when this MultiplayerAPI's [member multiplayer_peer] connects with a new peer. ID is the peer ID of the new peer. Clients get notified when other clients connect to the same server. Upon connecting to a server, a client also receives this signal for the server (with ID being 1). */
|
|
readonly peer_connected: Signal1<int64>
|
|
|
|
/** Emitted when this MultiplayerAPI's [member multiplayer_peer] disconnects from a peer. Clients get notified when other clients disconnect from the same server. */
|
|
readonly peer_disconnected: Signal1<int64>
|
|
|
|
/** Emitted when this MultiplayerAPI's [member multiplayer_peer] successfully connected to a server. Only emitted on clients. */
|
|
readonly connected_to_server: Signal0
|
|
|
|
/** Emitted when this MultiplayerAPI's [member multiplayer_peer] fails to establish a connection to a server. Only emitted on clients. */
|
|
readonly connection_failed: Signal0
|
|
|
|
/** Emitted when this MultiplayerAPI's [member multiplayer_peer] disconnects from server. Only emitted on clients. */
|
|
readonly server_disconnected: Signal0
|
|
}
|
|
/** Base class used for extending the [MultiplayerAPI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayerapiextension.html
|
|
*/
|
|
class MultiplayerAPIExtension extends MultiplayerAPI {
|
|
constructor(identifier?: any)
|
|
/** Callback for [method MultiplayerAPI.poll]. */
|
|
/* gdvirtual */ _poll(): GError
|
|
|
|
/** Called when the [member MultiplayerAPI.multiplayer_peer] is set. */
|
|
/* gdvirtual */ _set_multiplayer_peer(multiplayer_peer: MultiplayerPeer): void
|
|
|
|
/** Called when the [member MultiplayerAPI.multiplayer_peer] is retrieved. */
|
|
/* gdvirtual */ _get_multiplayer_peer(): MultiplayerPeer
|
|
|
|
/** Callback for [method MultiplayerAPI.get_unique_id]. */
|
|
/* gdvirtual */ _get_unique_id(): int64
|
|
|
|
/** Callback for [method MultiplayerAPI.get_peers]. */
|
|
/* gdvirtual */ _get_peer_ids(): PackedInt32Array
|
|
|
|
/** Callback for [method MultiplayerAPI.rpc]. */
|
|
/* gdvirtual */ _rpc(peer: int64, object: Object, method: StringName, args: GArray): GError
|
|
|
|
/** Callback for [method MultiplayerAPI.get_remote_sender_id]. */
|
|
/* gdvirtual */ _get_remote_sender_id(): int64
|
|
|
|
/** Callback for [method MultiplayerAPI.object_configuration_add]. */
|
|
/* gdvirtual */ _object_configuration_add(object: Object, configuration: any): GError
|
|
|
|
/** Callback for [method MultiplayerAPI.object_configuration_remove]. */
|
|
/* gdvirtual */ _object_configuration_remove(object: Object, configuration: any): GError
|
|
}
|
|
class MultiplayerEditorDebugger extends EditorDebuggerPlugin {
|
|
constructor(identifier?: any)
|
|
readonly open_request: Signal1<string>
|
|
}
|
|
class MultiplayerEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace MultiplayerPeer {
|
|
enum ConnectionStatus {
|
|
/** The MultiplayerPeer is disconnected. */
|
|
CONNECTION_DISCONNECTED = 0,
|
|
|
|
/** The MultiplayerPeer is currently connecting to a server. */
|
|
CONNECTION_CONNECTING = 1,
|
|
|
|
/** This MultiplayerPeer is connected. */
|
|
CONNECTION_CONNECTED = 2,
|
|
}
|
|
enum TransferMode {
|
|
/** Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters. */
|
|
TRANSFER_MODE_UNRELIABLE = 0,
|
|
|
|
/** Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data. */
|
|
TRANSFER_MODE_UNRELIABLE_ORDERED = 1,
|
|
|
|
/** Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly. */
|
|
TRANSFER_MODE_RELIABLE = 2,
|
|
}
|
|
}
|
|
/** Abstract class for specialized [PacketPeer]s used by the [MultiplayerAPI].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayerpeer.html
|
|
*/
|
|
class MultiplayerPeer extends PacketPeer {
|
|
/** Packets are sent to all connected peers. */
|
|
static readonly TARGET_PEER_BROADCAST = 0
|
|
|
|
/** Packets are sent to the remote peer acting as server. */
|
|
static readonly TARGET_PEER_SERVER = 1
|
|
constructor(identifier?: any)
|
|
|
|
/** Sets the peer to which packets will be sent.
|
|
* The [param id] can be one of: [constant TARGET_PEER_BROADCAST] to send to all connected peers, [constant TARGET_PEER_SERVER] to send to the peer acting as server, a valid peer ID to send to that specific peer, a negative peer ID to send to all peers except that one. By default, the target peer is [constant TARGET_PEER_BROADCAST].
|
|
*/
|
|
set_target_peer(id: int64): void
|
|
|
|
/** Returns the ID of the [MultiplayerPeer] who sent the next available packet. See [method PacketPeer.get_available_packet_count]. */
|
|
get_packet_peer(): int64
|
|
|
|
/** Returns the channel over which the next available packet was received. See [method PacketPeer.get_available_packet_count]. */
|
|
get_packet_channel(): int64
|
|
|
|
/** Returns the transfer mode the remote peer used to send the next available packet. See [method PacketPeer.get_available_packet_count]. */
|
|
get_packet_mode(): MultiplayerPeer.TransferMode
|
|
|
|
/** Waits up to 1 second to receive a new network event. */
|
|
poll(): void
|
|
|
|
/** Immediately close the multiplayer peer returning to the state [constant CONNECTION_DISCONNECTED]. Connected peers will be dropped without emitting [signal peer_disconnected]. */
|
|
close(): void
|
|
|
|
/** Disconnects the given [param peer] from this host. If [param force] is `true` the [signal peer_disconnected] signal will not be emitted for this peer. */
|
|
disconnect_peer(peer: int64, force: boolean = false): void
|
|
|
|
/** Returns the current state of the connection. See [enum ConnectionStatus]. */
|
|
get_connection_status(): MultiplayerPeer.ConnectionStatus
|
|
|
|
/** Returns the ID of this [MultiplayerPeer]. */
|
|
get_unique_id(): int64
|
|
|
|
/** Returns a randomly generated integer that can be used as a network unique ID. */
|
|
generate_unique_id(): int64
|
|
|
|
/** Returns `true` if the server can act as a relay in the current configuration. That is, if the higher level [MultiplayerAPI] should notify connected clients of other peers, and implement a relay protocol to allow communication between them. */
|
|
is_server_relay_supported(): boolean
|
|
|
|
/** If `true`, this [MultiplayerPeer] refuses new connections. */
|
|
get refuse_new_connections(): boolean
|
|
set refuse_new_connections(value: boolean)
|
|
|
|
/** The manner in which to send packets to the target peer. See [enum TransferMode], and the [method set_target_peer] method. */
|
|
get transfer_mode(): int64
|
|
set transfer_mode(value: int64)
|
|
|
|
/** The channel to use to send packets. Many network APIs such as ENet and WebRTC allow the creation of multiple independent channels which behaves, in a way, like separate connections. This means that reliable data will only block delivery of other packets on that channel, and ordering will only be in respect to the channel the packet is being sent on. Using different channels to send **different and independent** state updates is a common way to optimize network usage and decrease latency in fast-paced games.
|
|
*
|
|
* **Note:** The default channel (`0`) actually works as 3 separate channels (one for each [enum TransferMode]) so that [constant TRANSFER_MODE_RELIABLE] and [constant TRANSFER_MODE_UNRELIABLE_ORDERED] does not interact with each other by default. Refer to the specific network API documentation (e.g. ENet or WebRTC) to learn how to set up channels correctly.
|
|
*/
|
|
get transfer_channel(): int64
|
|
set transfer_channel(value: int64)
|
|
|
|
/** Emitted when a remote peer connects. */
|
|
readonly peer_connected: Signal1<int64>
|
|
|
|
/** Emitted when a remote peer has disconnected. */
|
|
readonly peer_disconnected: Signal1<int64>
|
|
}
|
|
/** Class that can be inherited to implement custom multiplayer API networking layers via GDExtension.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayerpeerextension.html
|
|
*/
|
|
class MultiplayerPeerExtension extends MultiplayerPeer {
|
|
constructor(identifier?: any)
|
|
/** Called when a packet needs to be received by the [MultiplayerAPI], with [param r_buffer_size] being the size of the binary [param r_buffer] in bytes. */
|
|
/* gdvirtual */ _get_packet(r_buffer: int64, r_buffer_size: int64): GError
|
|
|
|
/** Called when a packet needs to be sent by the [MultiplayerAPI], with [param p_buffer_size] being the size of the binary [param p_buffer] in bytes. */
|
|
/* gdvirtual */ _put_packet(p_buffer: int64, p_buffer_size: int64): GError
|
|
|
|
/** Called when the available packet count is internally requested by the [MultiplayerAPI]. */
|
|
/* gdvirtual */ _get_available_packet_count(): int64
|
|
|
|
/** Called when the maximum allowed packet size (in bytes) is requested by the [MultiplayerAPI]. */
|
|
/* gdvirtual */ _get_max_packet_size(): int64
|
|
|
|
/** Called when a packet needs to be received by the [MultiplayerAPI], if [method _get_packet] isn't implemented. Use this when extending this class via GDScript. */
|
|
/* gdvirtual */ _get_packet_script(): PackedByteArray
|
|
|
|
/** Called when a packet needs to be sent by the [MultiplayerAPI], if [method _put_packet] isn't implemented. Use this when extending this class via GDScript. */
|
|
/* gdvirtual */ _put_packet_script(p_buffer: PackedByteArray | byte[] | ArrayBuffer): GError
|
|
|
|
/** Called to get the channel over which the next available packet was received. See [method MultiplayerPeer.get_packet_channel]. */
|
|
/* gdvirtual */ _get_packet_channel(): int64
|
|
|
|
/** Called to get the transfer mode the remote peer used to send the next available packet. See [method MultiplayerPeer.get_packet_mode]. */
|
|
/* gdvirtual */ _get_packet_mode(): MultiplayerPeer.TransferMode
|
|
|
|
/** Called when the channel to use is set for this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_channel]). */
|
|
/* gdvirtual */ _set_transfer_channel(p_channel: int64): void
|
|
|
|
/** Called when the transfer channel to use is read on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_channel]). */
|
|
/* gdvirtual */ _get_transfer_channel(): int64
|
|
|
|
/** Called when the transfer mode is set on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_mode]). */
|
|
/* gdvirtual */ _set_transfer_mode(p_mode: MultiplayerPeer.TransferMode): void
|
|
|
|
/** Called when the transfer mode to use is read on this [MultiplayerPeer] (see [member MultiplayerPeer.transfer_mode]). */
|
|
/* gdvirtual */ _get_transfer_mode(): MultiplayerPeer.TransferMode
|
|
|
|
/** Called when the target peer to use is set for this [MultiplayerPeer] (see [method MultiplayerPeer.set_target_peer]). */
|
|
/* gdvirtual */ _set_target_peer(p_peer: int64): void
|
|
|
|
/** Called when the ID of the [MultiplayerPeer] who sent the most recent packet is requested (see [method MultiplayerPeer.get_packet_peer]). */
|
|
/* gdvirtual */ _get_packet_peer(): int64
|
|
|
|
/** Called when the "is server" status is requested on the [MultiplayerAPI]. See [method MultiplayerAPI.is_server]. */
|
|
/* gdvirtual */ _is_server(): boolean
|
|
|
|
/** Called when the [MultiplayerAPI] is polled. See [method MultiplayerAPI.poll]. */
|
|
/* gdvirtual */ _poll(): void
|
|
|
|
/** Called when the multiplayer peer should be immediately closed (see [method MultiplayerPeer.close]). */
|
|
/* gdvirtual */ _close(): void
|
|
|
|
/** Called when the connected [param p_peer] should be forcibly disconnected (see [method MultiplayerPeer.disconnect_peer]). */
|
|
/* gdvirtual */ _disconnect_peer(p_peer: int64, p_force: boolean): void
|
|
|
|
/** Called when the unique ID of this [MultiplayerPeer] is requested (see [method MultiplayerPeer.get_unique_id]). The value must be between `1` and `2147483647`. */
|
|
/* gdvirtual */ _get_unique_id(): int64
|
|
|
|
/** Called when the "refuse new connections" status is set on this [MultiplayerPeer] (see [member MultiplayerPeer.refuse_new_connections]). */
|
|
/* gdvirtual */ _set_refuse_new_connections(p_enable: boolean): void
|
|
|
|
/** Called when the "refuse new connections" status is requested on this [MultiplayerPeer] (see [member MultiplayerPeer.refuse_new_connections]). */
|
|
/* gdvirtual */ _is_refusing_new_connections(): boolean
|
|
|
|
/** Called to check if the server can act as a relay in the current configuration. See [method MultiplayerPeer.is_server_relay_supported]. */
|
|
/* gdvirtual */ _is_server_relay_supported(): boolean
|
|
|
|
/** Called when the connection status is requested on the [MultiplayerPeer] (see [method MultiplayerPeer.get_connection_status]). */
|
|
/* gdvirtual */ _get_connection_status(): MultiplayerPeer.ConnectionStatus
|
|
}
|
|
/** Automatically replicates spawnable nodes from the authority to other multiplayer peers.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayerspawner.html
|
|
*/
|
|
class MultiplayerSpawner<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** Adds a scene path to spawnable scenes, making it automatically replicated from the multiplayer authority to other peers when added as children of the node pointed by [member spawn_path]. */
|
|
add_spawnable_scene(path: string): void
|
|
|
|
/** Returns the count of spawnable scene paths. */
|
|
get_spawnable_scene_count(): int64
|
|
|
|
/** Returns the spawnable scene path by index. */
|
|
get_spawnable_scene(index: int64): string
|
|
|
|
/** Clears all spawnable scenes. Does not despawn existing instances on remote peers. */
|
|
clear_spawnable_scenes(): void
|
|
|
|
/** Requests a custom spawn, with [param data] passed to [member spawn_function] on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed by [member spawn_path].
|
|
*
|
|
* **Note:** Spawnable scenes are spawned automatically. [method spawn] is only needed for custom spawns.
|
|
*/
|
|
spawn(data: any = <any> {}): Node
|
|
get _spawnable_scenes(): PackedStringArray
|
|
set _spawnable_scenes(value: PackedStringArray | string[])
|
|
|
|
/** Path to the spawn root. Spawnable scenes that are added as direct children are replicated to other peers. */
|
|
get spawn_path(): NodePath
|
|
set spawn_path(value: NodePath | string)
|
|
|
|
/** Maximum number of nodes allowed to be spawned by this spawner. Includes both spawnable scenes and custom spawns.
|
|
* When set to `0` (the default), there is no limit.
|
|
*/
|
|
get spawn_limit(): int64
|
|
set spawn_limit(value: int64)
|
|
|
|
/** Method called on all peers when a custom [method spawn] is requested by the authority. Will receive the `data` parameter, and should return a [Node] that is not in the scene tree.
|
|
*
|
|
* **Note:** The returned node should **not** be added to the scene with [method Node.add_child]. This is done automatically.
|
|
*/
|
|
get spawn_function(): Callable
|
|
set spawn_function(value: Callable)
|
|
|
|
/** Emitted when a spawnable scene or custom spawn was despawned by the multiplayer authority. Only called on remote peers. */
|
|
readonly despawned: Signal1<Node>
|
|
|
|
/** Emitted when a spawnable scene or custom spawn was spawned by the multiplayer authority. Only called on remote peers. */
|
|
readonly spawned: Signal1<Node>
|
|
}
|
|
namespace MultiplayerSynchronizer {
|
|
enum VisibilityUpdateMode {
|
|
/** Visibility filters are updated during process frames (see [constant Node.NOTIFICATION_INTERNAL_PROCESS]). */
|
|
VISIBILITY_PROCESS_IDLE = 0,
|
|
|
|
/** Visibility filters are updated during physics frames (see [constant Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]). */
|
|
VISIBILITY_PROCESS_PHYSICS = 1,
|
|
|
|
/** Visibility filters are not updated automatically, and must be updated manually by calling [method update_visibility]. */
|
|
VISIBILITY_PROCESS_NONE = 2,
|
|
}
|
|
}
|
|
/** Synchronizes properties from the multiplayer authority to the remote peers.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_multiplayersynchronizer.html
|
|
*/
|
|
class MultiplayerSynchronizer<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** Updates the visibility of [param for_peer] according to visibility filters. If [param for_peer] is `0` (the default), all peers' visibilties are updated. */
|
|
update_visibility(for_peer: int64 = 0): void
|
|
|
|
/** Adds a peer visibility filter for this synchronizer.
|
|
* [param filter] should take a peer ID [int] and return a [bool].
|
|
*/
|
|
add_visibility_filter(filter: Callable): void
|
|
|
|
/** Removes a peer visibility filter from this synchronizer. */
|
|
remove_visibility_filter(filter: Callable): void
|
|
|
|
/** Sets the visibility of [param peer] to [param visible]. If [param peer] is `0`, the value of [member public_visibility] will be updated instead. */
|
|
set_visibility_for(peer: int64, visible: boolean): void
|
|
|
|
/** Queries the current visibility for peer [param peer]. */
|
|
get_visibility_for(peer: int64): boolean
|
|
|
|
/** Node path that replicated properties are relative to.
|
|
* If [member root_path] was spawned by a [MultiplayerSpawner], the node will be also be spawned and despawned based on this synchronizer visibility options.
|
|
*/
|
|
get root_path(): NodePath
|
|
set root_path(value: NodePath | string)
|
|
|
|
/** Time interval between synchronizations. Used when the replication is set to [constant SceneReplicationConfig.REPLICATION_MODE_ALWAYS]. If set to `0.0` (the default), synchronizations happen every network process frame. */
|
|
get replication_interval(): float64
|
|
set replication_interval(value: float64)
|
|
|
|
/** Time interval between delta synchronizations. Used when the replication is set to [constant SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE]. If set to `0.0` (the default), delta synchronizations happen every network process frame. */
|
|
get delta_interval(): float64
|
|
set delta_interval(value: float64)
|
|
|
|
/** Resource containing which properties to synchronize. */
|
|
get replication_config(): SceneReplicationConfig
|
|
set replication_config(value: SceneReplicationConfig)
|
|
|
|
/** Specifies when visibility filters are updated (see [enum VisibilityUpdateMode] for options). */
|
|
get visibility_update_mode(): int64
|
|
set visibility_update_mode(value: int64)
|
|
|
|
/** Whether synchronization should be visible to all peers by default. See [method set_visibility_for] and [method add_visibility_filter] for ways of configuring fine-grained visibility options. */
|
|
get public_visibility(): boolean
|
|
set public_visibility(value: boolean)
|
|
|
|
/** Emitted when a new synchronization state is received by this synchronizer after the properties have been updated. */
|
|
readonly synchronized: Signal0
|
|
|
|
/** Emitted when a new delta synchronization state is received by this synchronizer after the properties have been updated. */
|
|
readonly delta_synchronized: Signal0
|
|
|
|
/** Emitted when visibility of [param for_peer] is updated. See [method update_visibility]. */
|
|
readonly visibility_changed: Signal1<int64>
|
|
}
|
|
/** A binary [Semaphore] for synchronization of multiple [Thread]s.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_mutex.html
|
|
*/
|
|
class Mutex extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Locks this [Mutex], blocks until it is unlocked by the current owner.
|
|
*
|
|
* **Note:** This function returns without blocking if the thread already has ownership of the mutex.
|
|
*/
|
|
lock(): void
|
|
|
|
/** Tries locking this [Mutex], but does not block. Returns `true` on success, `false` otherwise.
|
|
*
|
|
* **Note:** This function returns `true` if the thread already has ownership of the mutex.
|
|
*/
|
|
try_lock(): boolean
|
|
|
|
/** Unlocks this [Mutex], leaving it to other threads.
|
|
*
|
|
* **Note:** If a thread called [method lock] or [method try_lock] multiple times while already having ownership of the mutex, it must also call [method unlock] the same number of times in order to unlock it correctly.
|
|
* **Warning:** Calling [method unlock] more times that [method lock] on a given thread, thus ending up trying to unlock a non-locked mutex, is wrong and may causes crashes or deadlocks.
|
|
*/
|
|
unlock(): void
|
|
}
|
|
/** A 2D agent used to pathfind to a position while avoiding obstacles.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationagent2d.html
|
|
*/
|
|
class NavigationAgent2D<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this agent on the [NavigationServer2D]. */
|
|
get_rid(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the [RID] of the navigation map this NavigationAgent node should use and also updates the `agent` on the NavigationServer. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. */
|
|
get_next_path_position(): Vector2
|
|
|
|
/** Replaces the internal velocity in the collision avoidance simulation with [param velocity]. When an agent is teleported to a new position this function should be used in the same frame. If called frequently this function can get agents stuck. */
|
|
set_velocity_forced(velocity: Vector2): void
|
|
|
|
/** Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate. */
|
|
distance_to_target(): float64
|
|
|
|
/** Returns the path query result for the path the agent is currently following. */
|
|
get_current_navigation_result(): NavigationPathQueryResult2D
|
|
|
|
/** Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. */
|
|
get_current_navigation_path(): PackedVector2Array
|
|
|
|
/** Returns which index the agent is currently on in the navigation path's [PackedVector2Array]. */
|
|
get_current_navigation_path_index(): int64
|
|
|
|
/** Returns `true` if the agent reached the target, i.e. the agent moved within [member target_desired_distance] of the [member target_position]. It may not always be possible to reach the target but it should always be possible to reach the final position. See [method get_final_position]. */
|
|
is_target_reached(): boolean
|
|
|
|
/** Returns `true` if [method get_final_position] is within [member target_desired_distance] of the [member target_position]. */
|
|
is_target_reachable(): boolean
|
|
|
|
/** Returns `true` if the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached.
|
|
*
|
|
* **Note:** While `true` prefer to stop calling update functions like [method get_next_path_position]. This avoids jittering the standing agent due to calling repeated path updates.
|
|
*/
|
|
is_navigation_finished(): boolean
|
|
|
|
/** Returns the reachable final position of the current navigation path in global coordinates. This position can change if the agent needs to update the navigation path which makes the agent emit the [signal path_changed] signal. */
|
|
get_final_position(): Vector2
|
|
_avoidance_done(new_velocity: Vector3): void
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member avoidance_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_avoidance_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member avoidance_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_avoidance_layer_value(layer_number: int64): boolean
|
|
|
|
/** Based on [param value], enables or disables the specified mask in the [member avoidance_mask] bitmask, given a [param mask_number] between 1 and 32. */
|
|
set_avoidance_mask_value(mask_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified mask of the [member avoidance_mask] bitmask is enabled, given a [param mask_number] between 1 and 32. */
|
|
get_avoidance_mask_value(mask_number: int64): boolean
|
|
|
|
/** If set, a new navigation path from the current agent position to the [member target_position] is requested from the NavigationServer. */
|
|
get target_position(): Vector2
|
|
set target_position(value: Vector2)
|
|
|
|
/** The distance threshold before a path point is considered to be reached. This allows agents to not have to hit a path point on the path exactly, but only to reach its general area. If this value is set too high, the NavigationAgent will skip points on the path, which can lead to it leaving the navigation mesh. If this value is set too low, the NavigationAgent will be stuck in a repath loop because it will constantly overshoot the distance to the next point on each physics frame update. */
|
|
get path_desired_distance(): float64
|
|
set path_desired_distance(value: float64)
|
|
|
|
/** The distance threshold before the target is considered to be reached. On reaching the target, [signal target_reached] is emitted and navigation ends (see [method is_navigation_finished] and [signal navigation_finished]).
|
|
* You can make navigation end early by setting this property to a value greater than [member path_desired_distance] (navigation will end before reaching the last waypoint).
|
|
* You can also make navigation end closer to the target than each individual path position by setting this property to a value lower than [member path_desired_distance] (navigation won't immediately end when reaching the last waypoint). However, if the value set is too low, the agent will be stuck in a repath loop because it will constantly overshoot the distance to the target on each physics frame update.
|
|
*/
|
|
get target_desired_distance(): float64
|
|
set target_desired_distance(value: float64)
|
|
|
|
/** The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. */
|
|
get path_max_distance(): float64
|
|
set path_max_distance(value: float64)
|
|
|
|
/** A bitfield determining which navigation layers of navigation regions this agent will use to calculate a path. Changing it during runtime will clear the current navigation path and generate a new one, according to the new navigation layers. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** The pathfinding algorithm used in the path query. */
|
|
get pathfinding_algorithm(): int64
|
|
set pathfinding_algorithm(value: int64)
|
|
|
|
/** The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. */
|
|
get path_postprocessing(): int64
|
|
set path_postprocessing(value: int64)
|
|
|
|
/** Additional information to return with the navigation path. */
|
|
get path_metadata_flags(): int64
|
|
set path_metadata_flags(value: int64)
|
|
|
|
/** If `true` a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by [member simplify_epsilon]. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
|
|
* Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
|
|
*/
|
|
get simplify_path(): boolean
|
|
set simplify_path(value: boolean)
|
|
|
|
/** The path simplification amount in worlds units. */
|
|
get simplify_epsilon(): float64
|
|
set simplify_epsilon(value: float64)
|
|
|
|
/** If `true` the agent is registered for an RVO avoidance callback on the [NavigationServer2D]. When [member velocity] is used and the processing is completed a `safe_velocity` Vector2 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it. */
|
|
get avoidance_enabled(): boolean
|
|
set avoidance_enabled(value: boolean)
|
|
|
|
/** Sets the new wanted velocity for the agent. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agents and obstacles. When an agent is teleported to a new position, use [method set_velocity_forced] as well to reset the internal simulation velocity. */
|
|
get velocity(): Vector2
|
|
set velocity(value: Vector2)
|
|
|
|
/** The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_distance]).
|
|
* Does not affect normal pathfinding. To change an actor's pathfinding radius bake [NavigationMesh] resources with a different [member NavigationMesh.agent_radius] property and use different navigation maps for each actor size.
|
|
*/
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** The distance to search for other agents. */
|
|
get neighbor_distance(): float64
|
|
set neighbor_distance(value: float64)
|
|
|
|
/** The maximum number of neighbors for the agent to consider. */
|
|
get max_neighbors(): int64
|
|
set max_neighbors(value: int64)
|
|
|
|
/** The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive. */
|
|
get time_horizon_agents(): float64
|
|
set time_horizon_agents(value: float64)
|
|
|
|
/** The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to static avoidance obstacles. The larger the number, the sooner the agent will respond to static avoidance obstacles, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive. */
|
|
get time_horizon_obstacles(): float64
|
|
set time_horizon_obstacles(value: float64)
|
|
|
|
/** The maximum speed that an agent can move. */
|
|
get max_speed(): float64
|
|
set max_speed(value: float64)
|
|
|
|
/** A bitfield determining the avoidance layers for this NavigationAgent. Other agents with a matching bit on the [member avoidance_mask] will avoid this agent. */
|
|
get avoidance_layers(): int64
|
|
set avoidance_layers(value: int64)
|
|
|
|
/** A bitfield determining what other avoidance agents and obstacles this NavigationAgent will avoid when a bit matches at least one of their [member avoidance_layers]. */
|
|
get avoidance_mask(): int64
|
|
set avoidance_mask(value: int64)
|
|
|
|
/** The agent does not adjust the velocity for other agents that would match the [member avoidance_mask] but have a lower [member avoidance_priority]. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent. */
|
|
get avoidance_priority(): float64
|
|
set avoidance_priority(value: float64)
|
|
|
|
/** If `true` shows debug visuals for this agent. */
|
|
get debug_enabled(): boolean
|
|
set debug_enabled(value: boolean)
|
|
|
|
/** If `true` uses the defined [member debug_path_custom_color] for this agent instead of global color. */
|
|
get debug_use_custom(): boolean
|
|
set debug_use_custom(value: boolean)
|
|
|
|
/** If [member debug_use_custom] is `true` uses this color for this agent instead of global color. */
|
|
get debug_path_custom_color(): Color
|
|
set debug_path_custom_color(value: Color)
|
|
|
|
/** If [member debug_use_custom] is `true` uses this rasterized point size for rendering path points for this agent instead of global point size. */
|
|
get debug_path_custom_point_size(): float64
|
|
set debug_path_custom_point_size(value: float64)
|
|
|
|
/** If [member debug_use_custom] is `true` uses this line width for rendering paths for this agent instead of global line width. */
|
|
get debug_path_custom_line_width(): float64
|
|
set debug_path_custom_line_width(value: float64)
|
|
|
|
/** Emitted when the agent had to update the loaded path:
|
|
* - because path was previously empty.
|
|
* - because navigation map has changed.
|
|
* - because agent pushed further away from the current path segment than the [member path_max_distance].
|
|
*/
|
|
readonly path_changed: Signal0
|
|
|
|
/** Signals that the agent reached the target, i.e. the agent moved within [member target_desired_distance] of the [member target_position]. This signal is emitted only once per loaded path.
|
|
* This signal will be emitted just before [signal navigation_finished] when the target is reachable.
|
|
* It may not always be possible to reach the target but it should always be possible to reach the final position. See [method get_final_position].
|
|
*/
|
|
readonly target_reached: Signal0
|
|
|
|
/** Signals that the agent reached a waypoint. Emitted when the agent moves within [member path_desired_distance] of the next position of the path.
|
|
* The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
|
|
* - `position`: The position of the waypoint that was reached.
|
|
* - `type`: The type of navigation primitive (region or link) that contains this waypoint.
|
|
* - `rid`: The [RID] of the containing navigation primitive (region or link).
|
|
* - `owner`: The object which manages the containing navigation primitive (region or link).
|
|
*/
|
|
readonly waypoint_reached: Signal1<GDictionary>
|
|
|
|
/** Signals that the agent reached a navigation link. Emitted when the agent moves within [member path_desired_distance] of the next position of the path when that position is a navigation link.
|
|
* The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
|
|
* - `position`: The start position of the link that was reached.
|
|
* - `type`: Always [constant NavigationPathQueryResult2D.PATH_SEGMENT_TYPE_LINK].
|
|
* - `rid`: The [RID] of the link.
|
|
* - `owner`: The object which manages the link (usually [NavigationLink2D]).
|
|
* - `link_entry_position`: If `owner` is available and the owner is a [NavigationLink2D], it will contain the global position of the link's point the agent is entering.
|
|
* - `link_exit_position`: If `owner` is available and the owner is a [NavigationLink2D], it will contain the global position of the link's point which the agent is exiting.
|
|
*/
|
|
readonly link_reached: Signal1<GDictionary>
|
|
|
|
/** Signals that the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached. This signal is emitted only once per loaded path.
|
|
* This signal will be emitted just after [signal target_reached] when the target is reachable.
|
|
*/
|
|
readonly navigation_finished: Signal0
|
|
|
|
/** Notifies when the collision avoidance velocity is calculated. Emitted every update as long as [member avoidance_enabled] is `true` and the agent has a navigation map. */
|
|
readonly velocity_computed: Signal1<Vector2>
|
|
}
|
|
/** A 3D agent used to pathfind to a position while avoiding obstacles.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationagent3d.html
|
|
*/
|
|
class NavigationAgent3D<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this agent on the [NavigationServer3D]. */
|
|
get_rid(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the [RID] of the navigation map this NavigationAgent node should use and also updates the `agent` on the NavigationServer. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. */
|
|
get_next_path_position(): Vector3
|
|
|
|
/** Replaces the internal velocity in the collision avoidance simulation with [param velocity]. When an agent is teleported to a new position this function should be used in the same frame. If called frequently this function can get agents stuck. */
|
|
set_velocity_forced(velocity: Vector3): void
|
|
|
|
/** Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate. */
|
|
distance_to_target(): float64
|
|
|
|
/** Returns the path query result for the path the agent is currently following. */
|
|
get_current_navigation_result(): NavigationPathQueryResult3D
|
|
|
|
/** Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. */
|
|
get_current_navigation_path(): PackedVector3Array
|
|
|
|
/** Returns which index the agent is currently on in the navigation path's [PackedVector3Array]. */
|
|
get_current_navigation_path_index(): int64
|
|
|
|
/** Returns `true` if the agent reached the target, i.e. the agent moved within [member target_desired_distance] of the [member target_position]. It may not always be possible to reach the target but it should always be possible to reach the final position. See [method get_final_position]. */
|
|
is_target_reached(): boolean
|
|
|
|
/** Returns `true` if [method get_final_position] is within [member target_desired_distance] of the [member target_position]. */
|
|
is_target_reachable(): boolean
|
|
|
|
/** Returns `true` if the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached.
|
|
*
|
|
* **Note:** While `true` prefer to stop calling update functions like [method get_next_path_position]. This avoids jittering the standing agent due to calling repeated path updates.
|
|
*/
|
|
is_navigation_finished(): boolean
|
|
|
|
/** Returns the reachable final position of the current navigation path in global coordinates. This position can change if the agent needs to update the navigation path which makes the agent emit the [signal path_changed] signal. */
|
|
get_final_position(): Vector3
|
|
_avoidance_done(new_velocity: Vector3): void
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member avoidance_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_avoidance_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member avoidance_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_avoidance_layer_value(layer_number: int64): boolean
|
|
|
|
/** Based on [param value], enables or disables the specified mask in the [member avoidance_mask] bitmask, given a [param mask_number] between 1 and 32. */
|
|
set_avoidance_mask_value(mask_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified mask of the [member avoidance_mask] bitmask is enabled, given a [param mask_number] between 1 and 32. */
|
|
get_avoidance_mask_value(mask_number: int64): boolean
|
|
|
|
/** If set, a new navigation path from the current agent position to the [member target_position] is requested from the NavigationServer. */
|
|
get target_position(): Vector3
|
|
set target_position(value: Vector3)
|
|
|
|
/** The distance threshold before a path point is considered to be reached. This allows agents to not have to hit a path point on the path exactly, but only to reach its general area. If this value is set too high, the NavigationAgent will skip points on the path, which can lead to it leaving the navigation mesh. If this value is set too low, the NavigationAgent will be stuck in a repath loop because it will constantly overshoot the distance to the next point on each physics frame update. */
|
|
get path_desired_distance(): float64
|
|
set path_desired_distance(value: float64)
|
|
|
|
/** The distance threshold before the target is considered to be reached. On reaching the target, [signal target_reached] is emitted and navigation ends (see [method is_navigation_finished] and [signal navigation_finished]).
|
|
* You can make navigation end early by setting this property to a value greater than [member path_desired_distance] (navigation will end before reaching the last waypoint).
|
|
* You can also make navigation end closer to the target than each individual path position by setting this property to a value lower than [member path_desired_distance] (navigation won't immediately end when reaching the last waypoint). However, if the value set is too low, the agent will be stuck in a repath loop because it will constantly overshoot the distance to the target on each physics frame update.
|
|
*/
|
|
get target_desired_distance(): float64
|
|
set target_desired_distance(value: float64)
|
|
|
|
/** The height offset is subtracted from the y-axis value of any vector path position for this NavigationAgent. The NavigationAgent height offset does not change or influence the navigation mesh or pathfinding query result. Additional navigation maps that use regions with navigation meshes that the developer baked with appropriate agent radius or height values are required to support different-sized agents. */
|
|
get path_height_offset(): float64
|
|
set path_height_offset(value: float64)
|
|
|
|
/** The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. */
|
|
get path_max_distance(): float64
|
|
set path_max_distance(value: float64)
|
|
|
|
/** A bitfield determining which navigation layers of navigation regions this agent will use to calculate a path. Changing it during runtime will clear the current navigation path and generate a new one, according to the new navigation layers. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** The pathfinding algorithm used in the path query. */
|
|
get pathfinding_algorithm(): int64
|
|
set pathfinding_algorithm(value: int64)
|
|
|
|
/** The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. */
|
|
get path_postprocessing(): int64
|
|
set path_postprocessing(value: int64)
|
|
|
|
/** Additional information to return with the navigation path. */
|
|
get path_metadata_flags(): int64
|
|
set path_metadata_flags(value: int64)
|
|
|
|
/** If `true` a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by [member simplify_epsilon]. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
|
|
* Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
|
|
*/
|
|
get simplify_path(): boolean
|
|
set simplify_path(value: boolean)
|
|
|
|
/** The path simplification amount in worlds units. */
|
|
get simplify_epsilon(): float64
|
|
set simplify_epsilon(value: float64)
|
|
|
|
/** If `true` the agent is registered for an RVO avoidance callback on the [NavigationServer3D]. When [member velocity] is set and the processing is completed a `safe_velocity` Vector3 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it. */
|
|
get avoidance_enabled(): boolean
|
|
set avoidance_enabled(value: boolean)
|
|
|
|
/** Sets the new wanted velocity for the agent. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agents and obstacles. When an agent is teleported to a new position, use [method set_velocity_forced] as well to reset the internal simulation velocity. */
|
|
get velocity(): Vector3
|
|
set velocity(value: Vector3)
|
|
|
|
/** The height of the avoidance agent. Agents will ignore other agents or obstacles that are above or below their current position + height in 2D avoidance. Does nothing in 3D avoidance which uses radius spheres alone. */
|
|
get height(): float64
|
|
set height(value: float64)
|
|
|
|
/** The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by [member neighbor_distance]).
|
|
* Does not affect normal pathfinding. To change an actor's pathfinding radius bake [NavigationMesh] resources with a different [member NavigationMesh.agent_radius] property and use different navigation maps for each actor size.
|
|
*/
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** The distance to search for other agents. */
|
|
get neighbor_distance(): float64
|
|
set neighbor_distance(value: float64)
|
|
|
|
/** The maximum number of neighbors for the agent to consider. */
|
|
get max_neighbors(): int64
|
|
set max_neighbors(value: int64)
|
|
|
|
/** The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive. */
|
|
get time_horizon_agents(): float64
|
|
set time_horizon_agents(value: float64)
|
|
|
|
/** The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to static avoidance obstacles. The larger the number, the sooner the agent will respond to static avoidance obstacles, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive. */
|
|
get time_horizon_obstacles(): float64
|
|
set time_horizon_obstacles(value: float64)
|
|
|
|
/** The maximum speed that an agent can move. */
|
|
get max_speed(): float64
|
|
set max_speed(value: float64)
|
|
|
|
/** If `true`, the agent calculates avoidance velocities in 3D omnidirectionally, e.g. for games that take place in air, underwater or space. Agents using 3D avoidance only avoid other agents using 3D avoidance, and react to radius-based avoidance obstacles. They ignore any vertex-based obstacles.
|
|
* If `false`, the agent calculates avoidance velocities in 2D along the x and z-axes, ignoring the y-axis. Agents using 2D avoidance only avoid other agents using 2D avoidance, and react to radius-based avoidance obstacles or vertex-based avoidance obstacles. Other agents using 2D avoidance that are below or above their current position including [member height] are ignored.
|
|
*/
|
|
get use_3d_avoidance(): boolean
|
|
set use_3d_avoidance(value: boolean)
|
|
|
|
/** If `true`, and the agent uses 2D avoidance, it will remember the set y-axis velocity and reapply it after the avoidance step. While 2D avoidance has no y-axis and simulates on a flat plane this setting can help to soften the most obvious clipping on uneven 3D geometry. */
|
|
get keep_y_velocity(): boolean
|
|
set keep_y_velocity(value: boolean)
|
|
|
|
/** A bitfield determining the avoidance layers for this NavigationAgent. Other agents with a matching bit on the [member avoidance_mask] will avoid this agent. */
|
|
get avoidance_layers(): int64
|
|
set avoidance_layers(value: int64)
|
|
|
|
/** A bitfield determining what other avoidance agents and obstacles this NavigationAgent will avoid when a bit matches at least one of their [member avoidance_layers]. */
|
|
get avoidance_mask(): int64
|
|
set avoidance_mask(value: int64)
|
|
|
|
/** The agent does not adjust the velocity for other agents that would match the [member avoidance_mask] but have a lower [member avoidance_priority]. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent. */
|
|
get avoidance_priority(): float64
|
|
set avoidance_priority(value: float64)
|
|
|
|
/** If `true` shows debug visuals for this agent. */
|
|
get debug_enabled(): boolean
|
|
set debug_enabled(value: boolean)
|
|
|
|
/** If `true` uses the defined [member debug_path_custom_color] for this agent instead of global color. */
|
|
get debug_use_custom(): boolean
|
|
set debug_use_custom(value: boolean)
|
|
|
|
/** If [member debug_use_custom] is `true` uses this color for this agent instead of global color. */
|
|
get debug_path_custom_color(): Color
|
|
set debug_path_custom_color(value: Color)
|
|
|
|
/** If [member debug_use_custom] is `true` uses this rasterized point size for rendering path points for this agent instead of global point size. */
|
|
get debug_path_custom_point_size(): float64
|
|
set debug_path_custom_point_size(value: float64)
|
|
|
|
/** Emitted when the agent had to update the loaded path:
|
|
* - because path was previously empty.
|
|
* - because navigation map has changed.
|
|
* - because agent pushed further away from the current path segment than the [member path_max_distance].
|
|
*/
|
|
readonly path_changed: Signal0
|
|
|
|
/** Signals that the agent reached the target, i.e. the agent moved within [member target_desired_distance] of the [member target_position]. This signal is emitted only once per loaded path.
|
|
* This signal will be emitted just before [signal navigation_finished] when the target is reachable.
|
|
* It may not always be possible to reach the target but it should always be possible to reach the final position. See [method get_final_position].
|
|
*/
|
|
readonly target_reached: Signal0
|
|
|
|
/** Signals that the agent reached a waypoint. Emitted when the agent moves within [member path_desired_distance] of the next position of the path.
|
|
* The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
|
|
* - `position`: The position of the waypoint that was reached.
|
|
* - `type`: The type of navigation primitive (region or link) that contains this waypoint.
|
|
* - `rid`: The [RID] of the containing navigation primitive (region or link).
|
|
* - `owner`: The object which manages the containing navigation primitive (region or link).
|
|
*/
|
|
readonly waypoint_reached: Signal1<GDictionary>
|
|
|
|
/** Signals that the agent reached a navigation link. Emitted when the agent moves within [member path_desired_distance] of the next position of the path when that position is a navigation link.
|
|
* The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]:
|
|
* - `position`: The start position of the link that was reached.
|
|
* - `type`: Always [constant NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK].
|
|
* - `rid`: The [RID] of the link.
|
|
* - `owner`: The object which manages the link (usually [NavigationLink3D]).
|
|
* - `link_entry_position`: If `owner` is available and the owner is a [NavigationLink3D], it will contain the global position of the link's point the agent is entering.
|
|
* - `link_exit_position`: If `owner` is available and the owner is a [NavigationLink3D], it will contain the global position of the link's point which the agent is exiting.
|
|
*/
|
|
readonly link_reached: Signal1<GDictionary>
|
|
|
|
/** Signals that the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached. This signal is emitted only once per loaded path.
|
|
* This signal will be emitted just after [signal target_reached] when the target is reachable.
|
|
*/
|
|
readonly navigation_finished: Signal0
|
|
|
|
/** Notifies when the collision avoidance velocity is calculated. Emitted every update as long as [member avoidance_enabled] is `true` and the agent has a navigation map. */
|
|
readonly velocity_computed: Signal1<Vector3>
|
|
}
|
|
/** A link between two positions on [NavigationRegion2D]s that agents can be routed through.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationlink2d.html
|
|
*/
|
|
class NavigationLink2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this link on the [NavigationServer2D]. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this link should use. By default the link will automatically join the [World2D] default navigation map so this function is only required to override the default map. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the current navigation map [RID] used by this link. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the [member start_position] that is relative to the link from a global [param position]. */
|
|
set_global_start_position(position: Vector2): void
|
|
|
|
/** Returns the [member start_position] that is relative to the link as a global position. */
|
|
get_global_start_position(): Vector2
|
|
|
|
/** Sets the [member end_position] that is relative to the link from a global [param position]. */
|
|
set_global_end_position(position: Vector2): void
|
|
|
|
/** Returns the [member end_position] that is relative to the link as a global position. */
|
|
get_global_end_position(): Vector2
|
|
|
|
/** Whether this link is currently active. If `false`, [method NavigationServer2D.map_get_path] will ignore this link. */
|
|
get enabled(): boolean
|
|
set enabled(value: boolean)
|
|
|
|
/** Whether this link can be traveled in both directions or only from [member start_position] to [member end_position]. */
|
|
get bidirectional(): boolean
|
|
set bidirectional(value: boolean)
|
|
|
|
/** A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer2D.map_get_path]. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** Starting position of the link.
|
|
* This position will search out the nearest polygon in the navigation mesh to attach to.
|
|
* The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius].
|
|
*/
|
|
get start_position(): Vector2
|
|
set start_position(value: Vector2)
|
|
|
|
/** Ending position of the link.
|
|
* This position will search out the nearest polygon in the navigation mesh to attach to.
|
|
* The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius].
|
|
*/
|
|
get end_position(): Vector2
|
|
set end_position(value: Vector2)
|
|
|
|
/** When pathfinding enters this link from another regions navigation mesh the [member enter_cost] value is added to the path distance for determining the shortest path. */
|
|
get enter_cost(): float64
|
|
set enter_cost(value: float64)
|
|
|
|
/** When pathfinding moves along the link the traveled distance is multiplied with [member travel_cost] for determining the shortest path. */
|
|
get travel_cost(): float64
|
|
set travel_cost(value: float64)
|
|
}
|
|
class NavigationLink2DEditor<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NavigationLink2DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** A link between two positions on [NavigationRegion3D]s that agents can be routed through.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationlink3d.html
|
|
*/
|
|
class NavigationLink3D<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this link on the [NavigationServer3D]. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this link should use. By default the link will automatically join the [World3D] default navigation map so this function is only required to override the default map. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the current navigation map [RID] used by this link. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the [member start_position] that is relative to the link from a global [param position]. */
|
|
set_global_start_position(position: Vector3): void
|
|
|
|
/** Returns the [member start_position] that is relative to the link as a global position. */
|
|
get_global_start_position(): Vector3
|
|
|
|
/** Sets the [member end_position] that is relative to the link from a global [param position]. */
|
|
set_global_end_position(position: Vector3): void
|
|
|
|
/** Returns the [member end_position] that is relative to the link as a global position. */
|
|
get_global_end_position(): Vector3
|
|
|
|
/** Whether this link is currently active. If `false`, [method NavigationServer3D.map_get_path] will ignore this link. */
|
|
get enabled(): boolean
|
|
set enabled(value: boolean)
|
|
|
|
/** Whether this link can be traveled in both directions or only from [member start_position] to [member end_position]. */
|
|
get bidirectional(): boolean
|
|
set bidirectional(value: boolean)
|
|
|
|
/** A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer3D.map_get_path]. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** Starting position of the link.
|
|
* This position will search out the nearest polygon in the navigation mesh to attach to.
|
|
* The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius].
|
|
*/
|
|
get start_position(): Vector3
|
|
set start_position(value: Vector3)
|
|
|
|
/** Ending position of the link.
|
|
* This position will search out the nearest polygon in the navigation mesh to attach to.
|
|
* The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius].
|
|
*/
|
|
get end_position(): Vector3
|
|
set end_position(value: Vector3)
|
|
|
|
/** When pathfinding enters this link from another regions navigation mesh the [member enter_cost] value is added to the path distance for determining the shortest path. */
|
|
get enter_cost(): float64
|
|
set enter_cost(value: float64)
|
|
|
|
/** When pathfinding moves along the link the traveled distance is multiplied with [member travel_cost] for determining the shortest path. */
|
|
get travel_cost(): float64
|
|
set travel_cost(value: float64)
|
|
}
|
|
class NavigationLink3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace NavigationMesh {
|
|
enum SamplePartitionType {
|
|
/** Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas. */
|
|
SAMPLE_PARTITION_WATERSHED = 0,
|
|
|
|
/** Monotone partitioning. Use this if you want fast navigation mesh generation. */
|
|
SAMPLE_PARTITION_MONOTONE = 1,
|
|
|
|
/** Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles. */
|
|
SAMPLE_PARTITION_LAYERS = 2,
|
|
|
|
/** Represents the size of the [enum SamplePartitionType] enum. */
|
|
SAMPLE_PARTITION_MAX = 3,
|
|
}
|
|
enum ParsedGeometryType {
|
|
/** Parses mesh instances as geometry. This includes [MeshInstance3D], [CSGShape3D], and [GridMap] nodes. */
|
|
PARSED_GEOMETRY_MESH_INSTANCES = 0,
|
|
|
|
/** Parses [StaticBody3D] colliders as geometry. The collider should be in any of the layers specified by [member geometry_collision_mask]. */
|
|
PARSED_GEOMETRY_STATIC_COLLIDERS = 1,
|
|
|
|
/** Both [constant PARSED_GEOMETRY_MESH_INSTANCES] and [constant PARSED_GEOMETRY_STATIC_COLLIDERS]. */
|
|
PARSED_GEOMETRY_BOTH = 2,
|
|
|
|
/** Represents the size of the [enum ParsedGeometryType] enum. */
|
|
PARSED_GEOMETRY_MAX = 3,
|
|
}
|
|
enum SourceGeometryMode {
|
|
/** Scans the child nodes of the root node recursively for geometry. */
|
|
SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0,
|
|
|
|
/** Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member geometry_source_group_name]. */
|
|
SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN = 1,
|
|
|
|
/** Uses nodes in a group for geometry. The group is specified by [member geometry_source_group_name]. */
|
|
SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2,
|
|
|
|
/** Represents the size of the [enum SourceGeometryMode] enum. */
|
|
SOURCE_GEOMETRY_MAX = 3,
|
|
}
|
|
}
|
|
/** A navigation mesh that defines traversable areas and obstacles.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationmesh.html
|
|
*/
|
|
class NavigationMesh extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Based on [param value], enables or disables the specified layer in the [member geometry_collision_mask], given a [param layer_number] between 1 and 32. */
|
|
set_collision_mask_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member geometry_collision_mask] is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_collision_mask_value(layer_number: int64): boolean
|
|
|
|
/** Adds a polygon using the indices of the vertices you get when calling [method get_vertices]. */
|
|
add_polygon(polygon: PackedInt32Array | int32[]): void
|
|
|
|
/** Returns the number of polygons in the navigation mesh. */
|
|
get_polygon_count(): int64
|
|
|
|
/** Returns a [PackedInt32Array] containing the indices of the vertices of a created polygon. */
|
|
get_polygon(idx: int64): PackedInt32Array
|
|
|
|
/** Clears the array of polygons, but it doesn't clear the array of vertices. */
|
|
clear_polygons(): void
|
|
|
|
/** Initializes the navigation mesh by setting the vertices and indices according to a [Mesh].
|
|
*
|
|
* **Note:** The given [param mesh] must be of type [constant Mesh.PRIMITIVE_TRIANGLES] and have an index array.
|
|
*/
|
|
create_from_mesh(mesh: Mesh): void
|
|
|
|
/** Clears the internal arrays for vertices and polygon indices. */
|
|
clear(): void
|
|
get vertices(): PackedVector3Array
|
|
set vertices(value: PackedVector3Array | Vector3[])
|
|
get polygons(): GArray
|
|
set polygons(value: GArray)
|
|
|
|
/** Partitioning algorithm for creating the navigation mesh polys. See [enum SamplePartitionType] for possible values. */
|
|
get sample_partition_type(): int64
|
|
set sample_partition_type(value: int64)
|
|
|
|
/** Determines which type of nodes will be parsed as geometry. See [enum ParsedGeometryType] for possible values. */
|
|
get geometry_parsed_geometry_type(): int64
|
|
set geometry_parsed_geometry_type(value: int64)
|
|
|
|
/** The physics layers to scan for static colliders.
|
|
* Only used when [member geometry_parsed_geometry_type] is [constant PARSED_GEOMETRY_STATIC_COLLIDERS] or [constant PARSED_GEOMETRY_BOTH].
|
|
*/
|
|
get geometry_collision_mask(): int64
|
|
set geometry_collision_mask(value: int64)
|
|
|
|
/** The source of the geometry used when baking. See [enum SourceGeometryMode] for possible values. */
|
|
get geometry_source_geometry_mode(): int64
|
|
set geometry_source_geometry_mode(value: int64)
|
|
|
|
/** The name of the group to scan for geometry.
|
|
* Only used when [member geometry_source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT].
|
|
*/
|
|
get geometry_source_group_name(): string
|
|
set geometry_source_group_name(value: string)
|
|
|
|
/** The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map. */
|
|
get cell_size(): float64
|
|
set cell_size(value: float64)
|
|
|
|
/** The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map. */
|
|
get cell_height(): float64
|
|
set cell_height(value: float64)
|
|
|
|
/** The size of the non-navigable border around the bake bounding area.
|
|
* In conjunction with the [member filter_baking_aabb] and a [member edge_max_error] value at `1.0` or below the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by [member agent_radius].
|
|
*
|
|
* **Note:** While baking and not zero, this value will be rounded up to the nearest multiple of [member cell_size].
|
|
*/
|
|
get border_size(): float64
|
|
set border_size(value: float64)
|
|
|
|
/** The minimum floor to ceiling height that will still allow the floor area to be considered walkable.
|
|
*
|
|
* **Note:** While baking, this value will be rounded up to the nearest multiple of [member cell_height].
|
|
*/
|
|
get agent_height(): float64
|
|
set agent_height(value: float64)
|
|
|
|
/** The distance to erode/shrink the walkable area of the heightfield away from obstructions.
|
|
*
|
|
* **Note:** While baking, this value will be rounded up to the nearest multiple of [member cell_size].
|
|
*/
|
|
get agent_radius(): float64
|
|
set agent_radius(value: float64)
|
|
|
|
/** The minimum ledge height that is considered to still be traversable.
|
|
*
|
|
* **Note:** While baking, this value will be rounded down to the nearest multiple of [member cell_height].
|
|
*/
|
|
get agent_max_climb(): float64
|
|
set agent_max_climb(value: float64)
|
|
|
|
/** The maximum slope that is considered walkable, in degrees. */
|
|
get agent_max_slope(): float64
|
|
set agent_max_slope(value: float64)
|
|
|
|
/** The minimum size of a region for it to be created.
|
|
*
|
|
* **Note:** This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.
|
|
*/
|
|
get region_min_size(): float64
|
|
set region_min_size(value: float64)
|
|
|
|
/** Any regions with a size smaller than this will be merged with larger regions if possible.
|
|
*
|
|
* **Note:** This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.
|
|
*/
|
|
get region_merge_size(): float64
|
|
set region_merge_size(value: float64)
|
|
|
|
/** The maximum allowed length for contour edges along the border of the mesh. A value of `0.0` disables this feature.
|
|
*
|
|
* **Note:** While baking, this value will be rounded up to the nearest multiple of [member cell_size].
|
|
*/
|
|
get edge_max_length(): float64
|
|
set edge_max_length(value: float64)
|
|
|
|
/** The maximum distance a simplified contour's border edges should deviate the original raw contour. */
|
|
get edge_max_error(): float64
|
|
set edge_max_error(value: float64)
|
|
|
|
/** The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process. */
|
|
get vertices_per_polygon(): float64
|
|
set vertices_per_polygon(value: float64)
|
|
|
|
/** The sampling distance to use when generating the detail mesh, in cell unit. */
|
|
get detail_sample_distance(): float64
|
|
set detail_sample_distance(value: float64)
|
|
|
|
/** The maximum distance the detail mesh surface should deviate from heightfield, in cell unit. */
|
|
get detail_sample_max_error(): float64
|
|
set detail_sample_max_error(value: float64)
|
|
|
|
/** If `true`, marks non-walkable spans as walkable if their maximum is within [member agent_max_climb] of a walkable neighbor. */
|
|
get filter_low_hanging_obstacles(): boolean
|
|
set filter_low_hanging_obstacles(value: boolean)
|
|
|
|
/** If `true`, marks spans that are ledges as non-walkable. */
|
|
get filter_ledge_spans(): boolean
|
|
set filter_ledge_spans(value: boolean)
|
|
|
|
/** If `true`, marks walkable spans as not walkable if the clearance above the span is less than [member agent_height]. */
|
|
get filter_walkable_low_height_spans(): boolean
|
|
set filter_walkable_low_height_spans(value: boolean)
|
|
|
|
/** If the baking [AABB] has a volume the navigation mesh baking will be restricted to its enclosing area. */
|
|
get filter_baking_aabb(): AABB
|
|
set filter_baking_aabb(value: AABB)
|
|
|
|
/** The position offset applied to the [member filter_baking_aabb] [AABB]. */
|
|
get filter_baking_aabb_offset(): Vector3
|
|
set filter_baking_aabb_offset(value: Vector3)
|
|
}
|
|
class NavigationMeshEditor<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NavigationMeshEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Container for parsed source geometry data used in navigation mesh baking.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationmeshsourcegeometrydata2d.html
|
|
*/
|
|
class NavigationMeshSourceGeometryData2D extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Clears the internal data. */
|
|
clear(): void
|
|
|
|
/** Returns `true` when parsed source geometry data exists. */
|
|
has_data(): boolean
|
|
|
|
/** Appends another array of [param traversable_outlines] at the end of the existing traversable outlines array. */
|
|
append_traversable_outlines(traversable_outlines: GArray): void
|
|
|
|
/** Appends another array of [param obstruction_outlines] at the end of the existing obstruction outlines array. */
|
|
append_obstruction_outlines(obstruction_outlines: GArray): void
|
|
|
|
/** Adds the outline points of a shape as traversable area. */
|
|
add_traversable_outline(shape_outline: PackedVector2Array | Vector2[]): void
|
|
|
|
/** Adds the outline points of a shape as obstructed area. */
|
|
add_obstruction_outline(shape_outline: PackedVector2Array | Vector2[]): void
|
|
|
|
/** Adds the geometry data of another [NavigationMeshSourceGeometryData2D] to the navigation mesh baking data. */
|
|
merge(other_geometry: NavigationMeshSourceGeometryData2D): void
|
|
|
|
/** Adds a projected obstruction shape to the source geometry. If [param carve] is `true` the carved shape will not be affected by additional offsets (e.g. agent radius) of the navigation mesh baking process. */
|
|
add_projected_obstruction(vertices: PackedVector2Array | Vector2[], carve: boolean): void
|
|
|
|
/** Clears all projected obstructions. */
|
|
clear_projected_obstructions(): void
|
|
|
|
/** Returns an axis-aligned bounding box that covers all the stored geometry data. The bounds are calculated when calling this function with the result cached until further geometry changes are made. */
|
|
get_bounds(): Rect2
|
|
get traversable_outlines(): GArray
|
|
set traversable_outlines(value: GArray)
|
|
get obstruction_outlines(): GArray
|
|
set obstruction_outlines(value: GArray)
|
|
get projected_obstructions(): GArray
|
|
set projected_obstructions(value: GArray)
|
|
}
|
|
/** Container for parsed source geometry data used in navigation mesh baking.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationmeshsourcegeometrydata3d.html
|
|
*/
|
|
class NavigationMeshSourceGeometryData3D extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Appends arrays of [param vertices] and [param indices] at the end of the existing arrays. Adds the existing index as an offset to the appended indices. */
|
|
append_arrays(vertices: PackedFloat32Array | float32[], indices: PackedInt32Array | int32[]): void
|
|
|
|
/** Clears the internal data. */
|
|
clear(): void
|
|
|
|
/** Returns `true` when parsed source geometry data exists. */
|
|
has_data(): boolean
|
|
|
|
/** Adds the geometry data of a [Mesh] resource to the navigation mesh baking data. The mesh must have valid triangulated mesh data to be considered. Since [NavigationMesh] resources have no transform, all vertex positions need to be offset by the node's transform using [param xform]. */
|
|
add_mesh(mesh: Mesh, xform: Transform3D): void
|
|
|
|
/** Adds an [Array] the size of [constant Mesh.ARRAY_MAX] and with vertices at index [constant Mesh.ARRAY_VERTEX] and indices at index [constant Mesh.ARRAY_INDEX] to the navigation mesh baking data. The array must have valid triangulated mesh data to be considered. Since [NavigationMesh] resources have no transform, all vertex positions need to be offset by the node's transform using [param xform]. */
|
|
add_mesh_array(mesh_array: GArray, xform: Transform3D): void
|
|
|
|
/** Adds an array of vertex positions to the geometry data for navigation mesh baking to form triangulated faces. For each face the array must have three vertex positions in clockwise winding order. Since [NavigationMesh] resources have no transform, all vertex positions need to be offset by the node's transform using [param xform]. */
|
|
add_faces(faces: PackedVector3Array | Vector3[], xform: Transform3D): void
|
|
|
|
/** Adds the geometry data of another [NavigationMeshSourceGeometryData3D] to the navigation mesh baking data. */
|
|
merge(other_geometry: NavigationMeshSourceGeometryData3D): void
|
|
|
|
/** Adds a projected obstruction shape to the source geometry. The [param vertices] are considered projected on a xz-axes plane, placed at the global y-axis [param elevation] and extruded by [param height]. If [param carve] is `true` the carved shape will not be affected by additional offsets (e.g. agent radius) of the navigation mesh baking process. */
|
|
add_projected_obstruction(vertices: PackedVector3Array | Vector3[], elevation: float64, height: float64, carve: boolean): void
|
|
|
|
/** Clears all projected obstructions. */
|
|
clear_projected_obstructions(): void
|
|
|
|
/** Returns an axis-aligned bounding box that covers all the stored geometry data. The bounds are calculated when calling this function with the result cached until further geometry changes are made. */
|
|
get_bounds(): AABB
|
|
get vertices(): PackedVector3Array
|
|
set vertices(value: PackedVector3Array | Vector3[])
|
|
get indices(): PackedInt32Array
|
|
set indices(value: PackedInt32Array | int32[])
|
|
get projected_obstructions(): GArray
|
|
set projected_obstructions(value: GArray)
|
|
}
|
|
/** 2D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationobstacle2d.html
|
|
*/
|
|
class NavigationObstacle2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this obstacle on the [NavigationServer2D]. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this NavigationObstacle node should use and also updates the `obstacle` on the NavigationServer. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the [RID] of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member avoidance_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_avoidance_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member avoidance_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_avoidance_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the avoidance radius for the obstacle. */
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle. */
|
|
get vertices(): PackedVector2Array
|
|
set vertices(value: PackedVector2Array | Vector2[])
|
|
|
|
/** If enabled and parsed in a navigation mesh baking process the obstacle will discard source geometry inside its [member vertices] defined shape. */
|
|
get affect_navigation_mesh(): boolean
|
|
set affect_navigation_mesh(value: boolean)
|
|
|
|
/** If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).
|
|
* It will still be affected by further postprocessing of the baking process, like edge and polygon simplification.
|
|
* Requires [member affect_navigation_mesh] to be enabled.
|
|
*/
|
|
get carve_navigation_mesh(): boolean
|
|
set carve_navigation_mesh(value: boolean)
|
|
|
|
/** If `true` the obstacle affects avoidance using agents. */
|
|
get avoidance_enabled(): boolean
|
|
set avoidance_enabled(value: boolean)
|
|
|
|
/** Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles [member radius]. Does nothing for the obstacles static vertices. */
|
|
get velocity(): Vector2
|
|
set velocity(value: Vector2)
|
|
|
|
/** A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle. */
|
|
get avoidance_layers(): int64
|
|
set avoidance_layers(value: int64)
|
|
}
|
|
class NavigationObstacle2DEditor<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditor<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NavigationObstacle2DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** 3D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationobstacle3d.html
|
|
*/
|
|
class NavigationObstacle3D<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this obstacle on the [NavigationServer3D]. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this NavigationObstacle node should use and also updates the `obstacle` on the NavigationServer. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the [RID] of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member avoidance_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_avoidance_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member avoidance_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_avoidance_layer_value(layer_number: int64): boolean
|
|
|
|
/** Sets the avoidance radius for the obstacle. */
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** Sets the obstacle height used in 2D avoidance. 2D avoidance using agent's ignore obstacles that are below or above them. */
|
|
get height(): float64
|
|
set height(value: float64)
|
|
|
|
/** The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle. */
|
|
get vertices(): PackedVector3Array
|
|
set vertices(value: PackedVector3Array | Vector3[])
|
|
|
|
/** If enabled and parsed in a navigation mesh baking process the obstacle will discard source geometry inside its [member vertices] and [member height] defined shape. */
|
|
get affect_navigation_mesh(): boolean
|
|
set affect_navigation_mesh(value: boolean)
|
|
|
|
/** If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).
|
|
* It will still be affected by further postprocessing of the baking process, like edge and polygon simplification.
|
|
* Requires [member affect_navigation_mesh] to be enabled.
|
|
*/
|
|
get carve_navigation_mesh(): boolean
|
|
set carve_navigation_mesh(value: boolean)
|
|
|
|
/** If `true` the obstacle affects avoidance using agents. */
|
|
get avoidance_enabled(): boolean
|
|
set avoidance_enabled(value: boolean)
|
|
|
|
/** Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles [member radius]. Does nothing for the obstacles static vertices. */
|
|
get velocity(): Vector3
|
|
set velocity(value: Vector3)
|
|
|
|
/** A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle. */
|
|
get avoidance_layers(): int64
|
|
set avoidance_layers(value: int64)
|
|
|
|
/** If `true` the obstacle affects 3D avoidance using agent's with obstacle [member radius].
|
|
* If `false` the obstacle affects 2D avoidance using agent's with both obstacle [member vertices] as well as obstacle [member radius].
|
|
*/
|
|
get use_3d_avoidance(): boolean
|
|
set use_3d_avoidance(value: boolean)
|
|
}
|
|
class NavigationObstacle3DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NavigationObstacle3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace NavigationPathQueryParameters2D {
|
|
enum PathfindingAlgorithm {
|
|
/** The path query uses the default A* pathfinding algorithm. */
|
|
PATHFINDING_ALGORITHM_ASTAR = 0,
|
|
}
|
|
enum PathPostProcessing {
|
|
/** Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navigation mesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artificial corners with diagonal movement due to a jagged path corridor imposed by the cell shapes. */
|
|
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
|
|
|
|
/** Centers every path position in the middle of the traveled navigation mesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center. */
|
|
PATH_POSTPROCESSING_EDGECENTERED = 1,
|
|
|
|
/** Applies no postprocessing and returns the raw path corridor as found by the pathfinding algorithm. */
|
|
PATH_POSTPROCESSING_NONE = 2,
|
|
}
|
|
enum PathMetadataFlags {
|
|
/** Don't include any additional metadata about the returned path. */
|
|
PATH_METADATA_INCLUDE_NONE = 0,
|
|
|
|
/** Include the type of navigation primitive (region or link) that each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_TYPES = 1,
|
|
|
|
/** Include the [RID]s of the regions and links that each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_RIDS = 2,
|
|
|
|
/** Include the `ObjectID`s of the [Object]s which manage the regions and links each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_OWNERS = 4,
|
|
|
|
/** Include all available metadata about the returned path. */
|
|
PATH_METADATA_INCLUDE_ALL = 7,
|
|
}
|
|
}
|
|
/** Provides parameters for 2D navigation path queries.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationpathqueryparameters2d.html
|
|
*/
|
|
class NavigationPathQueryParameters2D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** The navigation map [RID] used in the path query. */
|
|
get map(): RID
|
|
set map(value: RID)
|
|
|
|
/** The pathfinding start position in global coordinates. */
|
|
get start_position(): Vector2
|
|
set start_position(value: Vector2)
|
|
|
|
/** The pathfinding target position in global coordinates. */
|
|
get target_position(): Vector2
|
|
set target_position(value: Vector2)
|
|
|
|
/** The navigation layers the query will use (as a bitmask). */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** The pathfinding algorithm used in the path query. */
|
|
get pathfinding_algorithm(): int64
|
|
set pathfinding_algorithm(value: int64)
|
|
|
|
/** The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. */
|
|
get path_postprocessing(): int64
|
|
set path_postprocessing(value: int64)
|
|
|
|
/** Additional information to include with the navigation path. */
|
|
get metadata_flags(): int64
|
|
set metadata_flags(value: int64)
|
|
|
|
/** If `true` a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by [member simplify_epsilon]. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
|
|
* Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
|
|
*/
|
|
get simplify_path(): boolean
|
|
set simplify_path(value: boolean)
|
|
|
|
/** The path simplification amount in worlds units. */
|
|
get simplify_epsilon(): float64
|
|
set simplify_epsilon(value: float64)
|
|
}
|
|
namespace NavigationPathQueryParameters3D {
|
|
enum PathfindingAlgorithm {
|
|
/** The path query uses the default A* pathfinding algorithm. */
|
|
PATHFINDING_ALGORITHM_ASTAR = 0,
|
|
}
|
|
enum PathPostProcessing {
|
|
/** Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navigation mesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artificial corners with diagonal movement due to a jagged path corridor imposed by the cell shapes. */
|
|
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
|
|
|
|
/** Centers every path position in the middle of the traveled navigation mesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center. */
|
|
PATH_POSTPROCESSING_EDGECENTERED = 1,
|
|
|
|
/** Applies no postprocessing and returns the raw path corridor as found by the pathfinding algorithm. */
|
|
PATH_POSTPROCESSING_NONE = 2,
|
|
}
|
|
enum PathMetadataFlags {
|
|
/** Don't include any additional metadata about the returned path. */
|
|
PATH_METADATA_INCLUDE_NONE = 0,
|
|
|
|
/** Include the type of navigation primitive (region or link) that each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_TYPES = 1,
|
|
|
|
/** Include the [RID]s of the regions and links that each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_RIDS = 2,
|
|
|
|
/** Include the `ObjectID`s of the [Object]s which manage the regions and links each point of the path goes through. */
|
|
PATH_METADATA_INCLUDE_OWNERS = 4,
|
|
|
|
/** Include all available metadata about the returned path. */
|
|
PATH_METADATA_INCLUDE_ALL = 7,
|
|
}
|
|
}
|
|
/** Provides parameters for 3D navigation path queries.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationpathqueryparameters3d.html
|
|
*/
|
|
class NavigationPathQueryParameters3D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** The navigation map [RID] used in the path query. */
|
|
get map(): RID
|
|
set map(value: RID)
|
|
|
|
/** The pathfinding start position in global coordinates. */
|
|
get start_position(): Vector3
|
|
set start_position(value: Vector3)
|
|
|
|
/** The pathfinding target position in global coordinates. */
|
|
get target_position(): Vector3
|
|
set target_position(value: Vector3)
|
|
|
|
/** The navigation layers the query will use (as a bitmask). */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** The pathfinding algorithm used in the path query. */
|
|
get pathfinding_algorithm(): int64
|
|
set pathfinding_algorithm(value: int64)
|
|
|
|
/** The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. */
|
|
get path_postprocessing(): int64
|
|
set path_postprocessing(value: int64)
|
|
|
|
/** Additional information to include with the navigation path. */
|
|
get metadata_flags(): int64
|
|
set metadata_flags(value: int64)
|
|
|
|
/** If `true` a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by [member simplify_epsilon]. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
|
|
* Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
|
|
*/
|
|
get simplify_path(): boolean
|
|
set simplify_path(value: boolean)
|
|
|
|
/** The path simplification amount in worlds units. */
|
|
get simplify_epsilon(): float64
|
|
set simplify_epsilon(value: float64)
|
|
}
|
|
namespace NavigationPathQueryResult2D {
|
|
enum PathSegmentType {
|
|
/** This segment of the path goes through a region. */
|
|
PATH_SEGMENT_TYPE_REGION = 0,
|
|
|
|
/** This segment of the path goes through a link. */
|
|
PATH_SEGMENT_TYPE_LINK = 1,
|
|
}
|
|
}
|
|
/** Represents the result of a 2D pathfinding query.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationpathqueryresult2d.html
|
|
*/
|
|
class NavigationPathQueryResult2D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Reset the result object to its initial state. This is useful to reuse the object across multiple queries. */
|
|
reset(): void
|
|
|
|
/** The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer2D.map_get_path]. */
|
|
get path(): PackedVector2Array
|
|
set path(value: PackedVector2Array | Vector2[])
|
|
|
|
/** The type of navigation primitive (region or link) that each point of the path goes through. */
|
|
get path_types(): PackedInt32Array
|
|
set path_types(value: PackedInt32Array | int32[])
|
|
|
|
/** The [RID]s of the regions and links that each point of the path goes through. */
|
|
get path_rids(): GArray
|
|
set path_rids(value: GArray)
|
|
|
|
/** The `ObjectID`s of the [Object]s which manage the regions and links each point of the path goes through. */
|
|
get path_owner_ids(): PackedInt64Array
|
|
set path_owner_ids(value: PackedInt64Array | int64[])
|
|
}
|
|
namespace NavigationPathQueryResult3D {
|
|
enum PathSegmentType {
|
|
/** This segment of the path goes through a region. */
|
|
PATH_SEGMENT_TYPE_REGION = 0,
|
|
|
|
/** This segment of the path goes through a link. */
|
|
PATH_SEGMENT_TYPE_LINK = 1,
|
|
}
|
|
}
|
|
/** Represents the result of a 3D pathfinding query.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationpathqueryresult3d.html
|
|
*/
|
|
class NavigationPathQueryResult3D extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Reset the result object to its initial state. This is useful to reuse the object across multiple queries. */
|
|
reset(): void
|
|
|
|
/** The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer3D.map_get_path]. */
|
|
get path(): PackedVector3Array
|
|
set path(value: PackedVector3Array | Vector3[])
|
|
|
|
/** The type of navigation primitive (region or link) that each point of the path goes through. */
|
|
get path_types(): PackedInt32Array
|
|
set path_types(value: PackedInt32Array | int32[])
|
|
|
|
/** The [RID]s of the regions and links that each point of the path goes through. */
|
|
get path_rids(): GArray
|
|
set path_rids(value: GArray)
|
|
|
|
/** The `ObjectID`s of the [Object]s which manage the regions and links each point of the path goes through. */
|
|
get path_owner_ids(): PackedInt64Array
|
|
set path_owner_ids(value: PackedInt64Array | int64[])
|
|
}
|
|
namespace NavigationPolygon {
|
|
enum SamplePartitionType {
|
|
/** Convex partitioning that yields navigation mesh with convex polygons. */
|
|
SAMPLE_PARTITION_CONVEX_PARTITION = 0,
|
|
|
|
/** Triangulation partitioning that yields navigation mesh with triangle polygons. */
|
|
SAMPLE_PARTITION_TRIANGULATE = 1,
|
|
|
|
/** Represents the size of the [enum SamplePartitionType] enum. */
|
|
SAMPLE_PARTITION_MAX = 2,
|
|
}
|
|
enum ParsedGeometryType {
|
|
/** Parses mesh instances as obstruction geometry. This includes [Polygon2D], [MeshInstance2D], [MultiMeshInstance2D], and [TileMap] nodes.
|
|
* Meshes are only parsed when they use a 2D vertices surface format.
|
|
*/
|
|
PARSED_GEOMETRY_MESH_INSTANCES = 0,
|
|
|
|
/** Parses [StaticBody2D] and [TileMap] colliders as obstruction geometry. The collider should be in any of the layers specified by [member parsed_collision_mask]. */
|
|
PARSED_GEOMETRY_STATIC_COLLIDERS = 1,
|
|
|
|
/** Both [constant PARSED_GEOMETRY_MESH_INSTANCES] and [constant PARSED_GEOMETRY_STATIC_COLLIDERS]. */
|
|
PARSED_GEOMETRY_BOTH = 2,
|
|
|
|
/** Represents the size of the [enum ParsedGeometryType] enum. */
|
|
PARSED_GEOMETRY_MAX = 3,
|
|
}
|
|
enum SourceGeometryMode {
|
|
/** Scans the child nodes of the root node recursively for geometry. */
|
|
SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0,
|
|
|
|
/** Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member source_geometry_group_name]. */
|
|
SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN = 1,
|
|
|
|
/** Uses nodes in a group for geometry. The group is specified by [member source_geometry_group_name]. */
|
|
SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2,
|
|
|
|
/** Represents the size of the [enum SourceGeometryMode] enum. */
|
|
SOURCE_GEOMETRY_MAX = 3,
|
|
}
|
|
}
|
|
/** A 2D navigation mesh that describes a traversable surface for pathfinding.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationpolygon.html
|
|
*/
|
|
class NavigationPolygon extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Adds a polygon using the indices of the vertices you get when calling [method get_vertices]. */
|
|
add_polygon(polygon: PackedInt32Array | int32[]): void
|
|
|
|
/** Returns the count of all polygons. */
|
|
get_polygon_count(): int64
|
|
|
|
/** Returns a [PackedInt32Array] containing the indices of the vertices of a created polygon. */
|
|
get_polygon(idx: int64): PackedInt32Array
|
|
|
|
/** Clears the array of polygons, but it doesn't clear the array of outlines and vertices. */
|
|
clear_polygons(): void
|
|
|
|
/** Returns the [NavigationMesh] resulting from this navigation polygon. This navigation mesh can be used to update the navigation mesh of a region with the [method NavigationServer3D.region_set_navigation_mesh] API directly (as 2D uses the 3D server behind the scene). */
|
|
get_navigation_mesh(): NavigationMesh
|
|
|
|
/** Appends a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines. */
|
|
add_outline(outline: PackedVector2Array | Vector2[]): void
|
|
|
|
/** Adds a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. */
|
|
add_outline_at_index(outline: PackedVector2Array | Vector2[], index: int64): void
|
|
|
|
/** Returns the number of outlines that were created in the editor or by script. */
|
|
get_outline_count(): int64
|
|
|
|
/** Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update. */
|
|
set_outline(idx: int64, outline: PackedVector2Array | Vector2[]): void
|
|
|
|
/** Returns a [PackedVector2Array] containing the vertices of an outline that was created in the editor or by script. */
|
|
get_outline(idx: int64): PackedVector2Array
|
|
|
|
/** Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update. */
|
|
remove_outline(idx: int64): void
|
|
|
|
/** Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them. */
|
|
clear_outlines(): void
|
|
|
|
/** Creates polygons from the outlines added in the editor or by script. */
|
|
make_polygons_from_outlines(): void
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member parsed_collision_mask], given a [param layer_number] between 1 and 32. */
|
|
set_parsed_collision_mask_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member parsed_collision_mask] is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_parsed_collision_mask_value(layer_number: int64): boolean
|
|
|
|
/** Clears the internal arrays for vertices and polygon indices. */
|
|
clear(): void
|
|
get vertices(): PackedVector2Array
|
|
set vertices(value: PackedVector2Array | Vector2[])
|
|
get polygons(): GArray
|
|
set polygons(value: GArray)
|
|
get outlines(): GArray
|
|
set outlines(value: GArray)
|
|
|
|
/** Partitioning algorithm for creating the navigation mesh polys. See [enum SamplePartitionType] for possible values. */
|
|
get sample_partition_type(): int64
|
|
set sample_partition_type(value: int64)
|
|
|
|
/** Determines which type of nodes will be parsed as geometry. See [enum ParsedGeometryType] for possible values. */
|
|
get parsed_geometry_type(): int64
|
|
set parsed_geometry_type(value: int64)
|
|
|
|
/** The physics layers to scan for static colliders.
|
|
* Only used when [member parsed_geometry_type] is [constant PARSED_GEOMETRY_STATIC_COLLIDERS] or [constant PARSED_GEOMETRY_BOTH].
|
|
*/
|
|
get parsed_collision_mask(): int64
|
|
set parsed_collision_mask(value: int64)
|
|
|
|
/** The source of the geometry used when baking. See [enum SourceGeometryMode] for possible values. */
|
|
get source_geometry_mode(): int64
|
|
set source_geometry_mode(value: int64)
|
|
|
|
/** The group name of nodes that should be parsed for baking source geometry.
|
|
* Only used when [member source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT].
|
|
*/
|
|
get source_geometry_group_name(): string
|
|
set source_geometry_group_name(value: string)
|
|
|
|
/** The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map. */
|
|
get cell_size(): float64
|
|
set cell_size(value: float64)
|
|
|
|
/** The size of the non-navigable border around the bake bounding area defined by the [member baking_rect] [Rect2].
|
|
* In conjunction with the [member baking_rect] the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by [member agent_radius].
|
|
*/
|
|
get border_size(): float64
|
|
set border_size(value: float64)
|
|
|
|
/** The distance to erode/shrink the walkable surface when baking the navigation mesh. */
|
|
get agent_radius(): float64
|
|
set agent_radius(value: float64)
|
|
|
|
/** If the baking [Rect2] has an area the navigation mesh baking will be restricted to its enclosing area. */
|
|
get baking_rect(): Rect2
|
|
set baking_rect(value: Rect2)
|
|
|
|
/** The position offset applied to the [member baking_rect] [Rect2]. */
|
|
get baking_rect_offset(): Vector2
|
|
set baking_rect_offset(value: Vector2)
|
|
}
|
|
class NavigationPolygonEditor<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditor<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NavigationPolygonEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends AbstractPolygon2DEditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** A traversable 2D region that [NavigationAgent2D]s can use for pathfinding.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationregion2d.html
|
|
*/
|
|
class NavigationRegion2D<Map extends Record<string, Node> = Record<string, Node>> extends Node2D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this region on the [NavigationServer2D]. Combined with [method NavigationServer2D.map_get_closest_point_owner] can be used to identify the [NavigationRegion2D] closest to a point on the merged navigation map. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this region should use. By default the region will automatically join the [World2D] default navigation map so this function is only required to override the default map. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the current navigation map [RID] used by this region. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Returns the [RID] of this region on the [NavigationServer2D]. */
|
|
get_region_rid(): RID
|
|
|
|
/** Bakes the [NavigationPolygon]. If [param on_thread] is set to `true` (default), the baking is done on a separate thread. */
|
|
bake_navigation_polygon(on_thread: boolean = true): void
|
|
|
|
/** Returns `true` when the [NavigationPolygon] is being baked on a background thread. */
|
|
is_baking(): boolean
|
|
_navigation_polygon_changed(): void
|
|
|
|
/** Returns the axis-aligned rectangle for the region's transformed navigation mesh. */
|
|
get_bounds(): Rect2
|
|
|
|
/** The [NavigationPolygon] resource to use. */
|
|
get navigation_polygon(): NavigationPolygon
|
|
set navigation_polygon(value: NavigationPolygon)
|
|
|
|
/** Determines if the [NavigationRegion2D] is enabled or disabled. */
|
|
get enabled(): boolean
|
|
set enabled(value: boolean)
|
|
|
|
/** If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. */
|
|
get use_edge_connections(): boolean
|
|
set use_edge_connections(value: boolean)
|
|
|
|
/** A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with [method NavigationServer2D.map_get_path]. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** When pathfinding enters this region's navigation mesh from another regions navigation mesh the [member enter_cost] value is added to the path distance for determining the shortest path. */
|
|
get enter_cost(): float64
|
|
set enter_cost(value: float64)
|
|
|
|
/** When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with [member travel_cost] for determining the shortest path. */
|
|
get travel_cost(): float64
|
|
set travel_cost(value: float64)
|
|
|
|
/** Emitted when the used navigation polygon is replaced or changes to the internals of the current navigation polygon are committed. */
|
|
readonly navigation_polygon_changed: Signal0
|
|
|
|
/** Emitted when a navigation polygon bake operation is completed. */
|
|
readonly bake_finished: Signal0
|
|
}
|
|
/** A traversable 3D region that [NavigationAgent3D]s can use for pathfinding.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_navigationregion3d.html
|
|
*/
|
|
class NavigationRegion3D<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [RID] of this region on the [NavigationServer3D]. Combined with [method NavigationServer3D.map_get_closest_point_owner] can be used to identify the [NavigationRegion3D] closest to a point on the merged navigation map. */
|
|
get_rid(): RID
|
|
|
|
/** Sets the [RID] of the navigation map this region should use. By default the region will automatically join the [World3D] default navigation map so this function is only required to override the default map. */
|
|
set_navigation_map(navigation_map: RID): void
|
|
|
|
/** Returns the current navigation map [RID] used by this region. */
|
|
get_navigation_map(): RID
|
|
|
|
/** Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. */
|
|
set_navigation_layer_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_navigation_layer_value(layer_number: int64): boolean
|
|
|
|
/** Returns the [RID] of this region on the [NavigationServer3D]. */
|
|
get_region_rid(): RID
|
|
|
|
/** Bakes the [NavigationMesh]. If [param on_thread] is set to `true` (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new [NavigationMesh]. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as Web with threads disabled). */
|
|
bake_navigation_mesh(on_thread: boolean = true): void
|
|
|
|
/** Returns `true` when the [NavigationMesh] is being baked on a background thread. */
|
|
is_baking(): boolean
|
|
|
|
/** Returns the axis-aligned bounding box for the region's transformed navigation mesh. */
|
|
get_bounds(): AABB
|
|
|
|
/** The [NavigationMesh] resource to use. */
|
|
get navigation_mesh(): NavigationMesh
|
|
set navigation_mesh(value: NavigationMesh)
|
|
|
|
/** Determines if the [NavigationRegion3D] is enabled or disabled. */
|
|
get enabled(): boolean
|
|
set enabled(value: boolean)
|
|
|
|
/** If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. */
|
|
get use_edge_connections(): boolean
|
|
set use_edge_connections(value: boolean)
|
|
|
|
/** A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with [method NavigationServer3D.map_get_path]. */
|
|
get navigation_layers(): int64
|
|
set navigation_layers(value: int64)
|
|
|
|
/** When pathfinding enters this region's navigation mesh from another regions navigation mesh the [member enter_cost] value is added to the path distance for determining the shortest path. */
|
|
get enter_cost(): float64
|
|
set enter_cost(value: float64)
|
|
|
|
/** When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with [member travel_cost] for determining the shortest path. */
|
|
get travel_cost(): float64
|
|
set travel_cost(value: float64)
|
|
|
|
/** Notifies when the [NavigationMesh] has changed. */
|
|
readonly navigation_mesh_changed: Signal0
|
|
|
|
/** Notifies when the navigation mesh bake operation is completed. */
|
|
readonly bake_finished: Signal0
|
|
}
|
|
class NavigationRegion3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace NinePatchRect {
|
|
enum AxisStretchMode {
|
|
/** Stretches the center texture across the NinePatchRect. This may cause the texture to be distorted. */
|
|
AXIS_STRETCH_MODE_STRETCH = 0,
|
|
|
|
/** Repeats the center texture across the NinePatchRect. This won't cause any visible distortion. The texture must be seamless for this to work without displaying artifacts between edges. */
|
|
AXIS_STRETCH_MODE_TILE = 1,
|
|
|
|
/** Repeats the center texture across the NinePatchRect, but will also stretch the texture to make sure each tile is visible in full. This may cause the texture to be distorted, but less than [constant AXIS_STRETCH_MODE_STRETCH]. The texture must be seamless for this to work without displaying artifacts between edges. */
|
|
AXIS_STRETCH_MODE_TILE_FIT = 2,
|
|
}
|
|
}
|
|
/** A control that displays a texture by keeping its corners intact, but tiling its edges and center.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_ninepatchrect.html
|
|
*/
|
|
class NinePatchRect<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
/** Sets the size of the margin on the specified [enum Side] to [param value] pixels. */
|
|
set_patch_margin(margin: Side, value: int64): void
|
|
|
|
/** Returns the size of the margin on the specified [enum Side]. */
|
|
get_patch_margin(margin: Side): int64
|
|
|
|
/** The node's texture resource. */
|
|
get texture(): Texture2D
|
|
set texture(value: Texture2D)
|
|
|
|
/** If `true`, draw the panel's center. Else, only draw the 9-slice's borders. */
|
|
get draw_center(): boolean
|
|
set draw_center(value: boolean)
|
|
|
|
/** Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture. */
|
|
get region_rect(): Rect2
|
|
set region_rect(value: Rect2)
|
|
|
|
/** The width of the 9-slice's left column. A margin of 16 means the 9-slice's left corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. */
|
|
get patch_margin_left(): int64
|
|
set patch_margin_left(value: int64)
|
|
|
|
/** The height of the 9-slice's top row. A margin of 16 means the 9-slice's top corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. */
|
|
get patch_margin_top(): int64
|
|
set patch_margin_top(value: int64)
|
|
|
|
/** The width of the 9-slice's right column. A margin of 16 means the 9-slice's right corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. */
|
|
get patch_margin_right(): int64
|
|
set patch_margin_right(value: int64)
|
|
|
|
/** The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders. */
|
|
get patch_margin_bottom(): int64
|
|
set patch_margin_bottom(value: int64)
|
|
|
|
/** The stretch mode to use for horizontal stretching/tiling. See [enum NinePatchRect.AxisStretchMode] for possible values. */
|
|
get axis_stretch_horizontal(): int64
|
|
set axis_stretch_horizontal(value: int64)
|
|
|
|
/** The stretch mode to use for vertical stretching/tiling. See [enum NinePatchRect.AxisStretchMode] for possible values. */
|
|
get axis_stretch_vertical(): int64
|
|
set axis_stretch_vertical(value: int64)
|
|
|
|
/** Emitted when the node's texture changes. */
|
|
readonly texture_changed: Signal0
|
|
}
|
|
namespace Node {
|
|
enum ProcessMode {
|
|
/** Inherits [member process_mode] from the node's parent. This is the default for any newly created node. */
|
|
PROCESS_MODE_INHERIT = 0,
|
|
|
|
/** Stops processing when [member SceneTree.paused] is `true`. This is the inverse of [constant PROCESS_MODE_WHEN_PAUSED], and the default for the root node. */
|
|
PROCESS_MODE_PAUSABLE = 1,
|
|
|
|
/** Process **only** when [member SceneTree.paused] is `true`. This is the inverse of [constant PROCESS_MODE_PAUSABLE]. */
|
|
PROCESS_MODE_WHEN_PAUSED = 2,
|
|
|
|
/** Always process. Keeps processing, ignoring [member SceneTree.paused]. This is the inverse of [constant PROCESS_MODE_DISABLED]. */
|
|
PROCESS_MODE_ALWAYS = 3,
|
|
|
|
/** Never process. Completely disables processing, ignoring [member SceneTree.paused]. This is the inverse of [constant PROCESS_MODE_ALWAYS]. */
|
|
PROCESS_MODE_DISABLED = 4,
|
|
}
|
|
enum ProcessThreadGroup {
|
|
/** Process this node based on the thread group mode of the first parent (or grandparent) node that has a thread group mode that is not inherit. See [member process_thread_group] for more information. */
|
|
PROCESS_THREAD_GROUP_INHERIT = 0,
|
|
|
|
/** Process this node (and child nodes set to inherit) on the main thread. See [member process_thread_group] for more information. */
|
|
PROCESS_THREAD_GROUP_MAIN_THREAD = 1,
|
|
|
|
/** Process this node (and child nodes set to inherit) on a sub-thread. See [member process_thread_group] for more information. */
|
|
PROCESS_THREAD_GROUP_SUB_THREAD = 2,
|
|
}
|
|
enum ProcessThreadMessages {
|
|
/** Allows this node to process threaded messages created with [method call_deferred_thread_group] right before [method _process] is called. */
|
|
FLAG_PROCESS_THREAD_MESSAGES = 1,
|
|
|
|
/** Allows this node to process threaded messages created with [method call_deferred_thread_group] right before [method _physics_process] is called. */
|
|
FLAG_PROCESS_THREAD_MESSAGES_PHYSICS = 2,
|
|
|
|
/** Allows this node to process threaded messages created with [method call_deferred_thread_group] right before either [method _process] or [method _physics_process] are called. */
|
|
FLAG_PROCESS_THREAD_MESSAGES_ALL = 3,
|
|
}
|
|
enum PhysicsInterpolationMode {
|
|
/** Inherits [member physics_interpolation_mode] from the node's parent. This is the default for any newly created node. */
|
|
PHYSICS_INTERPOLATION_MODE_INHERIT = 0,
|
|
|
|
/** Enables physics interpolation for this node and for children set to [constant PHYSICS_INTERPOLATION_MODE_INHERIT]. This is the default for the root node. */
|
|
PHYSICS_INTERPOLATION_MODE_ON = 1,
|
|
|
|
/** Disables physics interpolation for this node and for children set to [constant PHYSICS_INTERPOLATION_MODE_INHERIT]. */
|
|
PHYSICS_INTERPOLATION_MODE_OFF = 2,
|
|
}
|
|
enum DuplicateFlags {
|
|
/** Duplicate the node's signal connections. */
|
|
DUPLICATE_SIGNALS = 1,
|
|
|
|
/** Duplicate the node's groups. */
|
|
DUPLICATE_GROUPS = 2,
|
|
|
|
/** Duplicate the node's script (also overriding the duplicated children's scripts, if combined with [constant DUPLICATE_USE_INSTANTIATION]). */
|
|
DUPLICATE_SCRIPTS = 4,
|
|
|
|
/** Duplicate using [method PackedScene.instantiate]. If the node comes from a scene saved on disk, reuses [method PackedScene.instantiate] as the base for the duplicated node and its children. */
|
|
DUPLICATE_USE_INSTANTIATION = 8,
|
|
}
|
|
enum InternalMode {
|
|
/** The node will not be internal. */
|
|
INTERNAL_MODE_DISABLED = 0,
|
|
|
|
/** The node will be placed at the beginning of the parent's children, before any non-internal sibling. */
|
|
INTERNAL_MODE_FRONT = 1,
|
|
|
|
/** The node will be placed at the end of the parent's children, after any non-internal sibling. */
|
|
INTERNAL_MODE_BACK = 2,
|
|
}
|
|
enum AutoTranslateMode {
|
|
/** Inherits [member auto_translate_mode] from the node's parent. This is the default for any newly created node. */
|
|
AUTO_TRANSLATE_MODE_INHERIT = 0,
|
|
|
|
/** Always automatically translate. This is the inverse of [constant AUTO_TRANSLATE_MODE_DISABLED], and the default for the root node. */
|
|
AUTO_TRANSLATE_MODE_ALWAYS = 1,
|
|
|
|
/** Never automatically translate. This is the inverse of [constant AUTO_TRANSLATE_MODE_ALWAYS].
|
|
* String parsing for POT generation will be skipped for this node and children that are set to [constant AUTO_TRANSLATE_MODE_INHERIT].
|
|
*/
|
|
AUTO_TRANSLATE_MODE_DISABLED = 2,
|
|
}
|
|
}
|
|
/** Base class for all scene objects.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_node.html
|
|
*/
|
|
class Node<Map extends Record<string, Node> = {}> extends Object {
|
|
// TypeScript's inference won't directly match against a generic parameter. The generic parameter has to
|
|
// appear somewhere in the type definition. Consequently, we insert a dummy direct usage of the parameter.
|
|
private __doesnotexist_NodeMap: Map
|
|
/** Notification received when the node enters a [SceneTree]. See [method _enter_tree].
|
|
* This notification is received *before* the related [signal tree_entered] signal.
|
|
*/
|
|
static readonly NOTIFICATION_ENTER_TREE = 10
|
|
|
|
/** Notification received when the node is about to exit a [SceneTree]. See [method _exit_tree].
|
|
* This notification is received *after* the related [signal tree_exiting] signal.
|
|
*/
|
|
static readonly NOTIFICATION_EXIT_TREE = 11
|
|
static readonly NOTIFICATION_MOVED_IN_PARENT = 12
|
|
|
|
/** Notification received when the node is ready. See [method _ready]. */
|
|
static readonly NOTIFICATION_READY = 13
|
|
|
|
/** Notification received when the node is paused. See [member process_mode]. */
|
|
static readonly NOTIFICATION_PAUSED = 14
|
|
|
|
/** Notification received when the node is unpaused. See [member process_mode]. */
|
|
static readonly NOTIFICATION_UNPAUSED = 15
|
|
|
|
/** Notification received from the tree every physics frame when [method is_physics_processing] returns `true`. See [method _physics_process]. */
|
|
static readonly NOTIFICATION_PHYSICS_PROCESS = 16
|
|
|
|
/** Notification received from the tree every rendered frame when [method is_processing] returns `true`. See [method _process]. */
|
|
static readonly NOTIFICATION_PROCESS = 17
|
|
|
|
/** Notification received when the node is set as a child of another node (see [method add_child] and [method add_sibling]).
|
|
*
|
|
* **Note:** This does *not* mean that the node entered the [SceneTree].
|
|
*/
|
|
static readonly NOTIFICATION_PARENTED = 18
|
|
|
|
/** Notification received when the parent node calls [method remove_child] on this node.
|
|
*
|
|
* **Note:** This does *not* mean that the node exited the [SceneTree].
|
|
*/
|
|
static readonly NOTIFICATION_UNPARENTED = 19
|
|
|
|
/** Notification received *only* by the newly instantiated scene root node, when [method PackedScene.instantiate] is completed. */
|
|
static readonly NOTIFICATION_SCENE_INSTANTIATED = 20
|
|
|
|
/** Notification received when a drag operation begins. All nodes receive this notification, not only the dragged one.
|
|
* Can be triggered either by dragging a [Control] that provides drag data (see [method Control._get_drag_data]) or using [method Control.force_drag].
|
|
* Use [method Viewport.gui_get_drag_data] to get the dragged data.
|
|
*/
|
|
static readonly NOTIFICATION_DRAG_BEGIN = 21
|
|
|
|
/** Notification received when a drag operation ends.
|
|
* Use [method Viewport.gui_is_drag_successful] to check if the drag succeeded.
|
|
*/
|
|
static readonly NOTIFICATION_DRAG_END = 22
|
|
|
|
/** Notification received when the node's [member name] or one of its ancestors' [member name] is changed. This notification is *not* received when the node is removed from the [SceneTree]. */
|
|
static readonly NOTIFICATION_PATH_RENAMED = 23
|
|
|
|
/** Notification received when the list of children is changed. This happens when child nodes are added, moved or removed. */
|
|
static readonly NOTIFICATION_CHILD_ORDER_CHANGED = 24
|
|
|
|
/** Notification received from the tree every rendered frame when [method is_processing_internal] returns `true`. */
|
|
static readonly NOTIFICATION_INTERNAL_PROCESS = 25
|
|
|
|
/** Notification received from the tree every physics frame when [method is_physics_processing_internal] returns `true`. */
|
|
static readonly NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26
|
|
|
|
/** Notification received when the node enters the tree, just before [constant NOTIFICATION_READY] may be received. Unlike the latter, it is sent every time the node enters tree, not just once. */
|
|
static readonly NOTIFICATION_POST_ENTER_TREE = 27
|
|
|
|
/** Notification received when the node is disabled. See [constant PROCESS_MODE_DISABLED]. */
|
|
static readonly NOTIFICATION_DISABLED = 28
|
|
|
|
/** Notification received when the node is enabled again after being disabled. See [constant PROCESS_MODE_DISABLED]. */
|
|
static readonly NOTIFICATION_ENABLED = 29
|
|
|
|
/** Notification received when [method reset_physics_interpolation] is called on the node or its ancestors. */
|
|
static readonly NOTIFICATION_RESET_PHYSICS_INTERPOLATION = 2001
|
|
|
|
/** Notification received right before the scene with the node is saved in the editor. This notification is only sent in the Godot editor and will not occur in exported projects. */
|
|
static readonly NOTIFICATION_EDITOR_PRE_SAVE = 9001
|
|
|
|
/** Notification received right after the scene with the node is saved in the editor. This notification is only sent in the Godot editor and will not occur in exported projects. */
|
|
static readonly NOTIFICATION_EDITOR_POST_SAVE = 9002
|
|
|
|
/** Notification received when the mouse enters the window.
|
|
* Implemented for embedded windows and on desktop and web platforms.
|
|
*/
|
|
static readonly NOTIFICATION_WM_MOUSE_ENTER = 1002
|
|
|
|
/** Notification received when the mouse leaves the window.
|
|
* Implemented for embedded windows and on desktop and web platforms.
|
|
*/
|
|
static readonly NOTIFICATION_WM_MOUSE_EXIT = 1003
|
|
|
|
/** Notification received from the OS when the node's [Window] ancestor is focused. This may be a change of focus between two windows of the same engine instance, or from the OS desktop or a third-party application to a window of the game (in which case [constant NOTIFICATION_APPLICATION_FOCUS_IN] is also received).
|
|
* A [Window] node receives this notification when it is focused.
|
|
*/
|
|
static readonly NOTIFICATION_WM_WINDOW_FOCUS_IN = 1004
|
|
|
|
/** Notification received from the OS when the node's [Window] ancestor is defocused. This may be a change of focus between two windows of the same engine instance, or from a window of the game to the OS desktop or a third-party application (in which case [constant NOTIFICATION_APPLICATION_FOCUS_OUT] is also received).
|
|
* A [Window] node receives this notification when it is defocused.
|
|
*/
|
|
static readonly NOTIFICATION_WM_WINDOW_FOCUS_OUT = 1005
|
|
|
|
/** Notification received from the OS when a close request is sent (e.g. closing the window with a "Close" button or [kbd]Alt + F4[/kbd]).
|
|
* Implemented on desktop platforms.
|
|
*/
|
|
static readonly NOTIFICATION_WM_CLOSE_REQUEST = 1006
|
|
|
|
/** Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
|
|
* Implemented only on Android.
|
|
*/
|
|
static readonly NOTIFICATION_WM_GO_BACK_REQUEST = 1007
|
|
|
|
/** Notification received when the window is resized.
|
|
*
|
|
* **Note:** Only the resized [Window] node receives this notification, and it's not propagated to the child nodes.
|
|
*/
|
|
static readonly NOTIFICATION_WM_SIZE_CHANGED = 1008
|
|
|
|
/** Notification received from the OS when the screen's dots per inch (DPI) scale is changed. Only implemented on macOS. */
|
|
static readonly NOTIFICATION_WM_DPI_CHANGE = 1009
|
|
|
|
/** Notification received when the mouse cursor enters the [Viewport]'s visible area, that is not occluded behind other [Control]s or [Window]s, provided its [member Viewport.gui_disable_input] is `false` and regardless if it's currently focused or not. */
|
|
static readonly NOTIFICATION_VP_MOUSE_ENTER = 1010
|
|
|
|
/** Notification received when the mouse cursor leaves the [Viewport]'s visible area, that is not occluded behind other [Control]s or [Window]s, provided its [member Viewport.gui_disable_input] is `false` and regardless if it's currently focused or not. */
|
|
static readonly NOTIFICATION_VP_MOUSE_EXIT = 1011
|
|
|
|
/** Notification received when the window is moved. */
|
|
static readonly NOTIFICATION_WM_POSITION_CHANGED = 1012
|
|
|
|
/** Notification received from the OS when the application is exceeding its allocated memory.
|
|
* Implemented only on iOS.
|
|
*/
|
|
static readonly NOTIFICATION_OS_MEMORY_WARNING = 2009
|
|
|
|
/** Notification received when translations may have changed. Can be triggered by the user changing the locale, changing [member auto_translate_mode] or when the node enters the scene tree. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
|
|
*
|
|
* **Note:** This notification is received alongside [constant NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup translations for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method is_node_ready].
|
|
*
|
|
*/
|
|
static readonly NOTIFICATION_TRANSLATION_CHANGED = 2010
|
|
|
|
/** Notification received from the OS when a request for "About" information is sent.
|
|
* Implemented only on macOS.
|
|
*/
|
|
static readonly NOTIFICATION_WM_ABOUT = 2011
|
|
|
|
/** Notification received from Godot's crash handler when the engine is about to crash.
|
|
* Implemented on desktop platforms, if the crash handler is enabled.
|
|
*/
|
|
static readonly NOTIFICATION_CRASH = 2012
|
|
|
|
/** Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string).
|
|
* Implemented only on macOS.
|
|
*/
|
|
static readonly NOTIFICATION_OS_IME_UPDATE = 2013
|
|
|
|
/** Notification received from the OS when the application is resumed.
|
|
* Specific to the Android and iOS platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_RESUMED = 2014
|
|
|
|
/** Notification received from the OS when the application is paused.
|
|
* Specific to the Android and iOS platforms.
|
|
*
|
|
* **Note:** On iOS, you only have approximately 5 seconds to finish a task started by this signal. If you go over this allotment, iOS will kill the app instead of pausing it.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_PAUSED = 2015
|
|
|
|
/** Notification received from the OS when the application is focused, i.e. when changing the focus from the OS desktop or a thirdparty application to any open window of the Godot instance.
|
|
* Implemented on desktop and mobile platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_FOCUS_IN = 2016
|
|
|
|
/** Notification received from the OS when the application is defocused, i.e. when changing the focus from any open window of the Godot instance to the OS desktop or a thirdparty application.
|
|
* Implemented on desktop and mobile platforms.
|
|
*/
|
|
static readonly NOTIFICATION_APPLICATION_FOCUS_OUT = 2017
|
|
|
|
/** Notification received when the [TextServer] is changed. */
|
|
static readonly NOTIFICATION_TEXT_SERVER_CHANGED = 2018
|
|
constructor(identifier?: any)
|
|
|
|
/** Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the [param delta] time since the previous frame is not constant. [param delta] is in seconds.
|
|
* It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process].
|
|
* Processing happens in order of [member process_priority], lower priority values are called first. Nodes with the same priority are processed in tree order, or top to bottom as seen in the editor (also known as pre-order traversal).
|
|
* Corresponds to the [constant NOTIFICATION_PROCESS] notification in [method Object._notification].
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
|
|
*
|
|
* **Note:** [param delta] will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using [param delta] for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
/* gdvirtual */ _process(delta: float64): void
|
|
|
|
/** Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the [param delta] parameter will *generally* be constant (see exceptions below). [param delta] is in seconds.
|
|
* It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_physics_process].
|
|
* Processing happens in order of [member process_physics_priority], lower priority values are called first. Nodes with the same priority are processed in tree order, or top to bottom as seen in the editor (also known as pre-order traversal).
|
|
* Corresponds to the [constant NOTIFICATION_PHYSICS_PROCESS] notification in [method Object._notification].
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
|
|
*
|
|
* **Note:** [param delta] will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using [param delta] for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
/* gdvirtual */ _physics_process(delta: float64): void
|
|
|
|
/** Called when the node enters the [SceneTree] (e.g. upon instantiating, scene changing, or after calling [method add_child] in a script). If the node has children, its [method _enter_tree] callback will be called first, and then that of the children.
|
|
* Corresponds to the [constant NOTIFICATION_ENTER_TREE] notification in [method Object._notification].
|
|
*/
|
|
/* gdvirtual */ _enter_tree(): void
|
|
|
|
/** Called when the node is about to leave the [SceneTree] (e.g. upon freeing, scene changing, or after calling [method remove_child] in a script). If the node has children, its [method _exit_tree] callback will be called last, after all its children have left the tree.
|
|
* Corresponds to the [constant NOTIFICATION_EXIT_TREE] notification in [method Object._notification] and signal [signal tree_exiting]. To get notified when the node has already left the active tree, connect to the [signal tree_exited].
|
|
*/
|
|
/* gdvirtual */ _exit_tree(): void
|
|
|
|
/** Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their [method _ready] callbacks get triggered first, and the parent node will receive the ready notification afterwards.
|
|
* Corresponds to the [constant NOTIFICATION_READY] notification in [method Object._notification]. See also the `@onready` annotation for variables.
|
|
* Usually used for initialization. For even earlier initialization, [method Object._init] may be used. See also [method _enter_tree].
|
|
*
|
|
* **Note:** This method may be called only once for each node. After removing a node from the scene tree and adding it again, [method _ready] will **not** be called a second time. This can be bypassed by requesting another call with [method request_ready], which may be called anywhere before adding the node again.
|
|
*/
|
|
/* gdvirtual */ _ready(): void
|
|
|
|
/** The elements in the array returned from this method are displayed as warnings in the Scene dock if the script that overrides it is a `tool` script.
|
|
* Returning an empty array produces no warnings.
|
|
* Call [method update_configuration_warnings] when the warnings need to be updated for this node.
|
|
*
|
|
*/
|
|
/* gdvirtual */ _get_configuration_warnings(): PackedStringArray
|
|
|
|
/** Called when there is an input event. The input event propagates up through the node tree until a node consumes it.
|
|
* It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_input].
|
|
* To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
|
|
* For gameplay input, [method _unhandled_input] and [method _unhandled_key_input] are usually a better fit as they allow the GUI to intercept the events first.
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
|
|
*/
|
|
/* gdvirtual */ _input(event: InputEvent): void
|
|
|
|
/** Called when an [InputEventKey], [InputEventShortcut], or [InputEventJoypadButton] hasn't been consumed by [method _input] or any GUI [Control] item. It is called before [method _unhandled_key_input] and [method _unhandled_input]. The input event propagates up through the node tree until a node consumes it.
|
|
* It is only called if shortcut processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_shortcut_input].
|
|
* To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
|
|
* This method can be used to handle shortcuts. For generic GUI events, use [method _input] instead. Gameplay events should usually be handled with either [method _unhandled_input] or [method _unhandled_key_input].
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not orphan).
|
|
*/
|
|
/* gdvirtual */ _shortcut_input(event: InputEvent): void
|
|
|
|
/** Called when an [InputEvent] hasn't been consumed by [method _input] or any GUI [Control] item. It is called after [method _shortcut_input] and after [method _unhandled_key_input]. The input event propagates up through the node tree until a node consumes it.
|
|
* It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_input].
|
|
* To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
|
|
* For gameplay input, this method is usually a better fit than [method _input], as GUI events need a higher priority. For keyboard shortcuts, consider using [method _shortcut_input] instead, as it is called before this method. Finally, to handle keyboard events, consider using [method _unhandled_key_input] for performance reasons.
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
|
|
*/
|
|
/* gdvirtual */ _unhandled_input(event: InputEvent): void
|
|
|
|
/** Called when an [InputEventKey] hasn't been consumed by [method _input] or any GUI [Control] item. It is called after [method _shortcut_input] but before [method _unhandled_input]. The input event propagates up through the node tree until a node consumes it.
|
|
* It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input].
|
|
* To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
|
|
* This method can be used to handle Unicode character input with [kbd]Alt[/kbd], [kbd]Alt + Ctrl[/kbd], and [kbd]Alt + Shift[/kbd] modifiers, after shortcuts were handled.
|
|
* For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input], as GUI events should be handled first. This method also performs better than [method _unhandled_input], since unrelated events such as [InputEventMouseMotion] are automatically filtered. For shortcuts, consider using [method _shortcut_input] instead.
|
|
*
|
|
* **Note:** This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
|
|
*/
|
|
/* gdvirtual */ _unhandled_key_input(event: InputEvent): void
|
|
|
|
/** Prints all orphan nodes (nodes outside the [SceneTree]). Useful for debugging.
|
|
*
|
|
* **Note:** This method only works in debug builds. Does nothing in a project exported in release mode.
|
|
*/
|
|
static print_orphan_nodes(): void
|
|
|
|
/** Adds a [param sibling] node to this node's parent, and moves the added sibling right below this node.
|
|
* If [param force_readable_name] is `true`, improves the readability of the added [param sibling]. If not named, the [param sibling] is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to `false`, which assigns a dummy name featuring `@` in both situations.
|
|
* Use [method add_child] instead of this method if you don't need the child node to be added below a specific node in the list of children.
|
|
*
|
|
* **Note:** If this node is internal, the added sibling will be internal too (see [method add_child]'s `internal` parameter).
|
|
*/
|
|
add_sibling(sibling: Node, force_readable_name: boolean = false): void
|
|
set_name(name: string): void
|
|
get_name(): StringName
|
|
|
|
/** Adds a child [param node]. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.
|
|
* If [param force_readable_name] is `true`, improves the readability of the added [param node]. If not named, the [param node] is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to `false`, which assigns a dummy name featuring `@` in both situations.
|
|
* If [param internal] is different than [constant INTERNAL_MODE_DISABLED], the child will be added as internal node. These nodes are ignored by methods like [method get_children], unless their parameter `include_internal` is `true`. The intended usage is to hide the internal nodes from the user, so the user won't accidentally delete or modify them. Used by some GUI nodes, e.g. [ColorPicker]. See [enum InternalMode] for available modes.
|
|
*
|
|
* **Note:** If [param node] already has a parent, this method will fail. Use [method remove_child] first to remove [param node] from its current parent. For example:
|
|
*
|
|
* If you need the child node to be added below a specific node in the list of children, use [method add_sibling] instead of this method.
|
|
*
|
|
* **Note:** If you want a child to be persisted to a [PackedScene], you must set [member owner] in addition to calling [method add_child]. This is typically relevant for [url=https://docs.godotengine.org/en/4.4/tutorials/plugins/running_code_in_the_editor.html]tool scripts[/url] and [url=https://docs.godotengine.org/en/4.4/tutorials/plugins/editor/index.html]editor plugins[/url]. If [method add_child] is called without setting [member owner], the newly added [Node] will not be visible in the scene tree, though it will be visible in the 2D/3D view.
|
|
*/
|
|
add_child(node: Node, force_readable_name: boolean = false, internal: Node.InternalMode = 0): void
|
|
|
|
/** Removes a child [param node]. The [param node], along with its children, are **not** deleted. To delete a node, see [method queue_free].
|
|
*
|
|
* **Note:** When this node is inside the tree, this method sets the [member owner] of the removed [param node] (or its descendants) to `null`, if their [member owner] is no longer an ancestor (see [method is_ancestor_of]).
|
|
*/
|
|
remove_child(node: Node): void
|
|
|
|
/** Changes the parent of this [Node] to the [param new_parent]. The node needs to already have a parent. The node's [member owner] is preserved if its owner is still reachable from the new location (i.e., the node is still a descendant of the new parent after the operation).
|
|
* If [param keep_global_transform] is `true`, the node's global transform will be preserved if supported. [Node2D], [Node3D] and [Control] support this argument (but [Control] keeps only position).
|
|
*/
|
|
reparent(new_parent: Node, keep_global_transform: boolean = true): void
|
|
|
|
/** Returns the number of children of this node.
|
|
* If [param include_internal] is `false`, internal children are not counted (see [method add_child]'s `internal` parameter).
|
|
*/
|
|
get_child_count(include_internal: boolean = false): int64
|
|
|
|
/** Returns all children of this node inside an [Array].
|
|
* If [param include_internal] is `false`, excludes internal children from the returned array (see [method add_child]'s `internal` parameter).
|
|
*/
|
|
get_children(include_internal: boolean = false): GArray
|
|
|
|
/** Fetches a child node by its index. Each child node has an index relative its siblings (see [method get_index]). The first child is at index 0. Negative values can also be used to start from the end of the list. This method can be used in combination with [method get_child_count] to iterate over this node's children. If no child exists at the given index, this method returns `null` and an error is generated.
|
|
* If [param include_internal] is `false`, internal children are ignored (see [method add_child]'s `internal` parameter).
|
|
*
|
|
*
|
|
* **Note:** To fetch a node by [NodePath], use [method get_node].
|
|
*/
|
|
get_child(idx: int64, include_internal: boolean = false): Node
|
|
|
|
/** Returns `true` if the [param path] points to a valid node. See also [method get_node]. */
|
|
has_node(path: NodePath | string): boolean
|
|
|
|
/** Fetches a node. The [NodePath] can either be a relative path (from this node), or an absolute path (from the [member SceneTree.root]) to a node. If [param path] does not point to a valid node, generates an error and returns `null`. Attempts to access methods on the return value will result in an *"Attempt to call <method> on a null instance."* error.
|
|
*
|
|
* **Note:** Fetching by absolute path only works when the node is inside the scene tree (see [method is_inside_tree]).
|
|
* **Example:** Assume this method is called from the Character node, inside the following tree:
|
|
* [codeblock lang=text]
|
|
* ┖╴root
|
|
* ┠╴Character (you are here!)
|
|
* ┃ ┠╴Sword
|
|
* ┃ ┖╴Backpack
|
|
* ┃ ┖╴Dagger
|
|
* ┠╴MyGame
|
|
* ┖╴Swamp
|
|
* ┠╴Alligator
|
|
* ┠╴Mosquito
|
|
* ┖╴Goblin
|
|
* [/codeblock]
|
|
* The following calls will return a valid node:
|
|
*
|
|
*/
|
|
get_node<Path extends StaticNodePath<Map>>(path: Path): ResolveNodePath<Map, Path>
|
|
get_node(path: NodePath | string): Node
|
|
|
|
/** Fetches a node by [NodePath]. Similar to [method get_node], but does not generate an error if [param path] does not point to a valid node. */
|
|
get_node_or_null<Path extends StaticNodePath<Map>>(path: Path): null | ResolveNodePath<Map, Path>
|
|
get_node_or_null(path: NodePath | string): null | Node
|
|
|
|
/** Returns this node's parent node, or `null` if the node doesn't have a parent. */
|
|
get_parent(): Node
|
|
|
|
/** Finds the first descendant of this node whose [member name] matches [param pattern], returning `null` if no match is found. The matching is done against node names, *not* their paths, through [method String.match]. As such, it is case-sensitive, `"*"` matches zero or more characters, and `"?"` matches any single character.
|
|
* If [param recursive] is `false`, only this node's direct children are checked. Nodes are checked in tree order, so this node's first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see `internal` parameter in [method add_child]).
|
|
* If [param owned] is `true`, only descendants with a valid [member owner] node are checked.
|
|
*
|
|
* **Note:** This method can be very slow. Consider storing a reference to the found node in a variable. Alternatively, use [method get_node] with unique names (see [member unique_name_in_owner]).
|
|
*
|
|
* **Note:** To find all descendant nodes matching a pattern or a class type, see [method find_children].
|
|
*/
|
|
find_child(pattern: string, recursive: boolean = true, owned: boolean = true): Node
|
|
|
|
/** Finds all descendants of this node whose names match [param pattern], returning an empty [Array] if no match is found. The matching is done against node names, *not* their paths, through [method String.match]. As such, it is case-sensitive, `"*"` matches zero or more characters, and `"?"` matches any single character.
|
|
* If [param type] is not empty, only ancestors inheriting from [param type] are included (see [method Object.is_class]).
|
|
* If [param recursive] is `false`, only this node's direct children are checked. Nodes are checked in tree order, so this node's first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see `internal` parameter in [method add_child]).
|
|
* If [param owned] is `true`, only descendants with a valid [member owner] node are checked.
|
|
*
|
|
* **Note:** This method can be very slow. Consider storing references to the found nodes in a variable.
|
|
*
|
|
* **Note:** To find a single descendant node matching a pattern, see [method find_child].
|
|
*/
|
|
find_children(pattern: string, type: string = '', recursive: boolean = true, owned: boolean = true): GArray
|
|
|
|
/** Finds the first ancestor of this node whose [member name] matches [param pattern], returning `null` if no match is found. The matching is done through [method String.match]. As such, it is case-sensitive, `"*"` matches zero or more characters, and `"?"` matches any single character. See also [method find_child] and [method find_children].
|
|
*
|
|
* **Note:** As this method walks upwards in the scene tree, it can be slow in large, deeply nested nodes. Consider storing a reference to the found node in a variable. Alternatively, use [method get_node] with unique names (see [member unique_name_in_owner]).
|
|
*/
|
|
find_parent(pattern: string): Node
|
|
|
|
/** Returns `true` if [param path] points to a valid node and its subnames point to a valid [Resource], e.g. `Area2D/CollisionShape2D:shape`. Properties that are not [Resource] types (such as nodes or other [Variant] types) are not considered. See also [method get_node_and_resource]. */
|
|
has_node_and_resource(path: NodePath | string): boolean
|
|
|
|
/** Fetches a node and its most nested resource as specified by the [NodePath]'s subname. Returns an [Array] of size `3` where:
|
|
* - Element `0` is the [Node], or `null` if not found;
|
|
* - Element `1` is the subname's last nested [Resource], or `null` if not found;
|
|
* - Element `2` is the remaining [NodePath], referring to an existing, non-[Resource] property (see [method Object.get_indexed]).
|
|
* **Example:** Assume that the child's [member Sprite2D.texture] has been assigned a [AtlasTexture]:
|
|
*
|
|
*/
|
|
get_node_and_resource(path: NodePath | string): GArray
|
|
|
|
/** Returns `true` if this node is currently inside a [SceneTree]. See also [method get_tree]. */
|
|
is_inside_tree(): boolean
|
|
|
|
/** Returns `true` if the node is part of the scene currently opened in the editor. */
|
|
is_part_of_edited_scene(): boolean
|
|
|
|
/** Returns `true` if the given [param node] is a direct or indirect child of this node. */
|
|
is_ancestor_of(node: Node): boolean
|
|
|
|
/** Returns `true` if the given [param node] occurs later in the scene hierarchy than this node. A node occurring later is usually processed last. */
|
|
is_greater_than(node: Node): boolean
|
|
|
|
/** Returns the node's absolute path, relative to the [member SceneTree.root]. If the node is not inside the scene tree, this method fails and returns an empty [NodePath]. */
|
|
get_path(): NodePath
|
|
|
|
/** Returns the relative [NodePath] from this node to the specified [param node]. Both nodes must be in the same [SceneTree] or scene hierarchy, otherwise this method fails and returns an empty [NodePath].
|
|
* If [param use_unique_path] is `true`, returns the shortest path accounting for this node's unique name (see [member unique_name_in_owner]).
|
|
*
|
|
* **Note:** If you get a relative path which starts from a unique node, the path may be longer than a normal relative path, due to the addition of the unique node's name.
|
|
*/
|
|
get_path_to(node: Node, use_unique_path: boolean = false): NodePath
|
|
|
|
/** Adds the node to the [param group]. Groups can be helpful to organize a subset of nodes, for example `"enemies"` or `"collectables"`. See notes in the description, and the group methods in [SceneTree].
|
|
* If [param persistent] is `true`, the group will be stored when saved inside a [PackedScene]. All groups created and displayed in the Node dock are persistent.
|
|
*
|
|
* **Note:** To improve performance, the order of group names is *not* guaranteed and may vary between project runs. Therefore, do not rely on the group order.
|
|
*
|
|
* **Note:** [SceneTree]'s group methods will *not* work on this node if not inside the tree (see [method is_inside_tree]).
|
|
*/
|
|
add_to_group(group: StringName, persistent: boolean = false): void
|
|
|
|
/** Removes the node from the given [param group]. Does nothing if the node is not in the [param group]. See also notes in the description, and the [SceneTree]'s group methods. */
|
|
remove_from_group(group: StringName): void
|
|
|
|
/** Returns `true` if this node has been added to the given [param group]. See [method add_to_group] and [method remove_from_group]. See also notes in the description, and the [SceneTree]'s group methods. */
|
|
is_in_group(group: StringName): boolean
|
|
|
|
/** Moves [param child_node] to the given index. A node's index is the order among its siblings. If [param to_index] is negative, the index is counted from the end of the list. See also [method get_child] and [method get_index].
|
|
*
|
|
* **Note:** The processing order of several engine callbacks ([method _ready], [method _process], etc.) and notifications sent through [method propagate_notification] is affected by tree order. [CanvasItem] nodes are also rendered in tree order. See also [member process_priority].
|
|
*/
|
|
move_child(child_node: Node, to_index: int64): void
|
|
|
|
/** Returns an [Array] of group names that the node has been added to.
|
|
*
|
|
* **Note:** To improve performance, the order of group names is *not* guaranteed and may vary between project runs. Therefore, do not rely on the group order.
|
|
*
|
|
* **Note:** This method may also return some group names starting with an underscore (`_`). These are internally used by the engine. To avoid conflicts, do not use custom groups starting with underscores. To exclude internal groups, see the following code snippet:
|
|
*
|
|
*/
|
|
get_groups(): GArray
|
|
|
|
/** Returns this node's order among its siblings. The first node's index is `0`. See also [method get_child].
|
|
* If [param include_internal] is `false`, returns the index ignoring internal children. The first, non-internal child will have an index of `0` (see [method add_child]'s `internal` parameter).
|
|
*/
|
|
get_index(include_internal: boolean = false): int64
|
|
|
|
/** Prints the node and its children to the console, recursively. The node does not have to be inside the tree. This method outputs [NodePath]s relative to this node, and is good for copy/pasting into [method get_node]. See also [method print_tree_pretty].
|
|
* May print, for example:
|
|
* [codeblock lang=text]
|
|
* .
|
|
* Menu
|
|
* Menu/Label
|
|
* Menu/Camera2D
|
|
* SplashScreen
|
|
* SplashScreen/Camera2D
|
|
* [/codeblock]
|
|
*/
|
|
print_tree(): void
|
|
|
|
/** Prints the node and its children to the console, recursively. The node does not have to be inside the tree. Similar to [method print_tree], but the graphical representation looks like what is displayed in the editor's Scene dock. It is useful for inspecting larger trees.
|
|
* May print, for example:
|
|
* [codeblock lang=text]
|
|
* ┖╴TheGame
|
|
* ┠╴Menu
|
|
* ┃ ┠╴Label
|
|
* ┃ ┖╴Camera2D
|
|
* ┖╴SplashScreen
|
|
* ┖╴Camera2D
|
|
* [/codeblock]
|
|
*/
|
|
print_tree_pretty(): void
|
|
|
|
/** Returns the tree as a [String]. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the [method get_node] function. It also can be used in game UI/UX.
|
|
* May print, for example:
|
|
* [codeblock lang=text]
|
|
* TheGame
|
|
* TheGame/Menu
|
|
* TheGame/Menu/Label
|
|
* TheGame/Menu/Camera2D
|
|
* TheGame/SplashScreen
|
|
* TheGame/SplashScreen/Camera2D
|
|
* [/codeblock]
|
|
*/
|
|
get_tree_string(): string
|
|
|
|
/** Similar to [method get_tree_string], this returns the tree as a [String]. This version displays a more graphical representation similar to what is displayed in the Scene Dock. It is useful for inspecting larger trees.
|
|
* May print, for example:
|
|
* [codeblock lang=text]
|
|
* ┖╴TheGame
|
|
* ┠╴Menu
|
|
* ┃ ┠╴Label
|
|
* ┃ ┖╴Camera2D
|
|
* ┖╴SplashScreen
|
|
* ┖╴Camera2D
|
|
* [/codeblock]
|
|
*/
|
|
get_tree_string_pretty(): string
|
|
|
|
/** Calls [method Object.notification] with [param what] on this node and all of its children, recursively. */
|
|
propagate_notification(what: int64): void
|
|
|
|
/** Calls the given [param method] name, passing [param args] as arguments, on this node and all of its children, recursively.
|
|
* If [param parent_first] is `true`, the method is called on this node first, then on all of its children. If `false`, the children's methods are called first.
|
|
*/
|
|
propagate_call(method: StringName, args: GArray = [], parent_first: boolean = false): void
|
|
|
|
/** If set to `true`, enables physics (fixed framerate) processing. When a node is being processed, it will receive a [constant NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine.physics_ticks_per_second] to change) interval (and the [method _physics_process] callback will be called if it exists).
|
|
*
|
|
* **Note:** If [method _physics_process] is overridden, this will be automatically enabled before [method _ready] is called.
|
|
*/
|
|
set_physics_process(enable: boolean): void
|
|
|
|
/** Returns the time elapsed (in seconds) since the last physics callback. This value is identical to [method _physics_process]'s `delta` parameter, and is often consistent at run-time, unless [member Engine.physics_ticks_per_second] is changed. See also [constant NOTIFICATION_PHYSICS_PROCESS].
|
|
*
|
|
* **Note:** The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using `delta` for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
get_physics_process_delta_time(): float64
|
|
|
|
/** Returns `true` if physics processing is enabled (see [method set_physics_process]). */
|
|
is_physics_processing(): boolean
|
|
|
|
/** Returns the time elapsed (in seconds) since the last process callback. This value is identical to [method _process]'s `delta` parameter, and may vary from frame to frame. See also [constant NOTIFICATION_PROCESS].
|
|
*
|
|
* **Note:** The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid "spiral of death" scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both [method _process] and [method _physics_process]. As a result, avoid using `delta` for time measurements in real-world seconds. Use the [Time] singleton's methods for this purpose instead, such as [method Time.get_ticks_usec].
|
|
*/
|
|
get_process_delta_time(): float64
|
|
|
|
/** If set to `true`, enables processing. When a node is being processed, it will receive a [constant NOTIFICATION_PROCESS] on every drawn frame (and the [method _process] callback will be called if it exists).
|
|
*
|
|
* **Note:** If [method _process] is overridden, this will be automatically enabled before [method _ready] is called.
|
|
*
|
|
* **Note:** This method only affects the [method _process] callback, i.e. it has no effect on other callbacks like [method _physics_process]. If you want to disable all processing for the node, set [member process_mode] to [constant PROCESS_MODE_DISABLED].
|
|
*/
|
|
set_process(enable: boolean): void
|
|
|
|
/** Returns `true` if processing is enabled (see [method set_process]). */
|
|
is_processing(): boolean
|
|
|
|
/** If set to `true`, enables input processing.
|
|
*
|
|
* **Note:** If [method _input] is overridden, this will be automatically enabled before [method _ready] is called. Input processing is also already enabled for GUI controls, such as [Button] and [TextEdit].
|
|
*/
|
|
set_process_input(enable: boolean): void
|
|
|
|
/** Returns `true` if the node is processing input (see [method set_process_input]). */
|
|
is_processing_input(): boolean
|
|
|
|
/** If set to `true`, enables shortcut processing for this node.
|
|
*
|
|
* **Note:** If [method _shortcut_input] is overridden, this will be automatically enabled before [method _ready] is called.
|
|
*/
|
|
set_process_shortcut_input(enable: boolean): void
|
|
|
|
/** Returns `true` if the node is processing shortcuts (see [method set_process_shortcut_input]). */
|
|
is_processing_shortcut_input(): boolean
|
|
|
|
/** If set to `true`, enables unhandled input processing. It enables the node to receive all input that was not previously handled (usually by a [Control]).
|
|
*
|
|
* **Note:** If [method _unhandled_input] is overridden, this will be automatically enabled before [method _ready] is called. Unhandled input processing is also already enabled for GUI controls, such as [Button] and [TextEdit].
|
|
*/
|
|
set_process_unhandled_input(enable: boolean): void
|
|
|
|
/** Returns `true` if the node is processing unhandled input (see [method set_process_unhandled_input]). */
|
|
is_processing_unhandled_input(): boolean
|
|
|
|
/** If set to `true`, enables unhandled key input processing.
|
|
*
|
|
* **Note:** If [method _unhandled_key_input] is overridden, this will be automatically enabled before [method _ready] is called.
|
|
*/
|
|
set_process_unhandled_key_input(enable: boolean): void
|
|
|
|
/** Returns `true` if the node is processing unhandled key input (see [method set_process_unhandled_key_input]). */
|
|
is_processing_unhandled_key_input(): boolean
|
|
|
|
/** Returns `true` if the node can receive processing notifications and input callbacks ([constant NOTIFICATION_PROCESS], [method _input], etc.) from the [SceneTree] and [Viewport]. The returned value depends on [member process_mode]:
|
|
* - If set to [constant PROCESS_MODE_PAUSABLE], returns `true` when the game is processing, i.e. [member SceneTree.paused] is `false`;
|
|
* - If set to [constant PROCESS_MODE_WHEN_PAUSED], returns `true` when the game is paused, i.e. [member SceneTree.paused] is `true`;
|
|
* - If set to [constant PROCESS_MODE_ALWAYS], always returns `true`;
|
|
* - If set to [constant PROCESS_MODE_DISABLED], always returns `false`;
|
|
* - If set to [constant PROCESS_MODE_INHERIT], use the parent node's [member process_mode] to determine the result.
|
|
* If the node is not inside the tree, returns `false` no matter the value of [member process_mode].
|
|
*/
|
|
can_process(): boolean
|
|
|
|
/** If set to `true`, the node appears folded in the Scene dock. As a result, all of its children are hidden. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also [method is_displayed_folded]. */
|
|
set_display_folded(fold: boolean): void
|
|
|
|
/** Returns `true` if the node is folded (collapsed) in the Scene dock. This method is intended to be used in editor plugins and tools. See also [method set_display_folded]. */
|
|
is_displayed_folded(): boolean
|
|
|
|
/** If set to `true`, enables internal processing for this node. Internal processing happens in isolation from the normal [method _process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ([method set_process]).
|
|
* **Warning:** Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.
|
|
*/
|
|
set_process_internal(enable: boolean): void
|
|
|
|
/** Returns `true` if internal processing is enabled (see [method set_process_internal]). */
|
|
is_processing_internal(): boolean
|
|
|
|
/** If set to `true`, enables internal physics for this node. Internal physics processing happens in isolation from the normal [method _physics_process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting ([method set_physics_process]).
|
|
* **Warning:** Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.
|
|
*/
|
|
set_physics_process_internal(enable: boolean): void
|
|
|
|
/** Returns `true` if internal physics processing is enabled (see [method set_physics_process_internal]). */
|
|
is_physics_processing_internal(): boolean
|
|
|
|
/** Returns `true` if physics interpolation is enabled for this node (see [member physics_interpolation_mode]).
|
|
*
|
|
* **Note:** Interpolation will only be active if both the flag is set **and** physics interpolation is enabled within the [SceneTree]. This can be tested using [method is_physics_interpolated_and_enabled].
|
|
*/
|
|
is_physics_interpolated(): boolean
|
|
|
|
/** Returns `true` if physics interpolation is enabled (see [member physics_interpolation_mode]) **and** enabled in the [SceneTree].
|
|
* This is a convenience version of [method is_physics_interpolated] that also checks whether physics interpolation is enabled globally.
|
|
* See [member SceneTree.physics_interpolation] and [member ProjectSettings.physics/common/physics_interpolation].
|
|
*/
|
|
is_physics_interpolated_and_enabled(): boolean
|
|
|
|
/** When physics interpolation is active, moving a node to a radically different transform (such as placement within a level) can result in a visible glitch as the object is rendered moving from the old to new position over the physics tick.
|
|
* That glitch can be prevented by calling this method, which temporarily disables interpolation until the physics tick is complete.
|
|
* The notification [constant NOTIFICATION_RESET_PHYSICS_INTERPOLATION] will be received by the node and all children recursively.
|
|
*
|
|
* **Note:** This function should be called **after** moving the node, rather than before.
|
|
*/
|
|
reset_physics_interpolation(): void
|
|
|
|
/** Makes this node inherit the translation domain from its parent node. If this node has no parent, the main translation domain will be used.
|
|
* This is the default behavior for all nodes. Calling [method Object.set_translation_domain] disables this behavior.
|
|
*/
|
|
set_translation_domain_inherited(): void
|
|
|
|
/** Returns the [Window] that contains this node. If the node is in the main window, this is equivalent to getting the root node (`get_tree().get_root()`). */
|
|
get_window(): Window
|
|
|
|
/** Returns the [Window] that contains this node, or the last exclusive child in a chain of windows starting with the one that contains this node. */
|
|
get_last_exclusive_window(): Window
|
|
|
|
/** Returns the [SceneTree] that contains this node. If this node is not inside the tree, generates an error and returns `null`. See also [method is_inside_tree]. */
|
|
get_tree(): SceneTree
|
|
|
|
/** Creates a new [Tween] and binds it to this node.
|
|
* This is the equivalent of doing:
|
|
*
|
|
* The Tween will start automatically on the next process frame or physics frame (depending on [enum Tween.TweenProcessMode]). See [method Tween.bind_node] for more info on Tweens bound to nodes.
|
|
*
|
|
* **Note:** The method can still be used when the node is not inside [SceneTree]. It can fail in an unlikely case of using a custom [MainLoop].
|
|
*/
|
|
create_tween(): Tween
|
|
|
|
/** Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original. The behavior can be tweaked through the [param flags] (see [enum DuplicateFlags]).
|
|
*
|
|
* **Note:** For nodes with a [Script] attached, if [method Object._init] has been defined with required parameters, the duplicated node will not have a [Script].
|
|
*/
|
|
duplicate(flags: int64 = 15): Node
|
|
|
|
/** Replaces this node by the given [param node]. All children of this node are moved to [param node].
|
|
* If [param keep_groups] is `true`, the [param node] is added to the same groups that the replaced node is in (see [method add_to_group]).
|
|
* **Warning:** The replaced node is removed from the tree, but it is **not** deleted. To prevent memory leaks, store a reference to the node in a variable, or use [method Object.free].
|
|
*/
|
|
replace_by(node: Node, keep_groups: boolean = false): void
|
|
|
|
/** If set to `true`, the node becomes a [InstancePlaceholder] when packed and instantiated from a [PackedScene]. See also [method get_scene_instance_load_placeholder]. */
|
|
set_scene_instance_load_placeholder(load_placeholder: boolean): void
|
|
|
|
/** Returns `true` if this node is an instance load placeholder. See [InstancePlaceholder] and [method set_scene_instance_load_placeholder]. */
|
|
get_scene_instance_load_placeholder(): boolean
|
|
|
|
/** Set to `true` to allow all nodes owned by [param node] to be available, and editable, in the Scene dock, even if their [member owner] is not the scene root. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also [method is_editable_instance]. */
|
|
set_editable_instance(node: Node, is_editable: boolean): void
|
|
|
|
/** Returns `true` if [param node] has editable children enabled relative to this node. This method is intended to be used in editor plugins and tools. See also [method set_editable_instance]. */
|
|
is_editable_instance(node: Node): boolean
|
|
|
|
/** Returns the node's closest [Viewport] ancestor, if the node is inside the tree. Otherwise, returns `null`. */
|
|
get_viewport(): Viewport
|
|
|
|
/** Queues this node to be deleted at the end of the current frame. When deleted, all of its children are deleted as well, and all references to the node and its children become invalid.
|
|
* Unlike with [method Object.free], the node is not deleted instantly, and it can still be accessed before deletion. It is also safe to call [method queue_free] multiple times. Use [method Object.is_queued_for_deletion] to check if the node will be deleted at the end of the frame.
|
|
*
|
|
* **Note:** The node will only be freed after all other deferred calls are finished. Using this method is not always the same as calling [method Object.free] through [method Object.call_deferred].
|
|
*/
|
|
queue_free(): void
|
|
|
|
/** Requests [method _ready] to be called again the next time the node enters the tree. Does **not** immediately call [method _ready].
|
|
*
|
|
* **Note:** This method only affects the current node. If the node's children also need to request ready, this method needs to be called for each one of them. When the node and its children enter the tree again, the order of [method _ready] callbacks will be the same as normal.
|
|
*/
|
|
request_ready(): void
|
|
|
|
/** Returns `true` if the node is ready, i.e. it's inside scene tree and all its children are initialized.
|
|
* [method request_ready] resets it back to `false`.
|
|
*/
|
|
is_node_ready(): boolean
|
|
|
|
/** Sets the node's multiplayer authority to the peer with the given peer [param id]. The multiplayer authority is the peer that has authority over the node on the network. Defaults to peer ID 1 (the server). Useful in conjunction with [method rpc_config] and the [MultiplayerAPI].
|
|
* If [param recursive] is `true`, the given peer is recursively set as the authority for all children of this node.
|
|
* **Warning:** This does **not** automatically replicate the new authority to other peers. It is the developer's responsibility to do so. You may replicate the new authority's information using [member MultiplayerSpawner.spawn_function], an RPC, or a [MultiplayerSynchronizer]. Furthermore, the parent's authority does **not** propagate to newly added children.
|
|
*/
|
|
set_multiplayer_authority(id: int64, recursive: boolean = true): void
|
|
|
|
/** Returns the peer ID of the multiplayer authority for this node. See [method set_multiplayer_authority]. */
|
|
get_multiplayer_authority(): int64
|
|
|
|
/** Returns `true` if the local system is the multiplayer authority of this node. */
|
|
is_multiplayer_authority(): boolean
|
|
|
|
/** Changes the RPC configuration for the given [param method]. [param config] should either be `null` to disable the feature (as by default), or a [Dictionary] containing the following entries:
|
|
* - `rpc_mode`: see [enum MultiplayerAPI.RPCMode];
|
|
* - `transfer_mode`: see [enum MultiplayerPeer.TransferMode];
|
|
* - `call_local`: if `true`, the method will also be called locally;
|
|
* - `channel`: an [int] representing the channel to send the RPC on.
|
|
*
|
|
* **Note:** In GDScript, this method corresponds to the [annotation @GDScript.@rpc] annotation, with various parameters passed (`@rpc(any)`, `@rpc(authority)`...). See also the [url=https://docs.godotengine.org/en/4.4/tutorials/networking/high_level_multiplayer.html]high-level multiplayer[/url] tutorial.
|
|
*/
|
|
rpc_config(method: StringName, config: any): void
|
|
|
|
/** Returns a [Dictionary] mapping method names to their RPC configuration defined for this node using [method rpc_config]. */
|
|
get_rpc_config(): any
|
|
|
|
/** Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
|
|
* This method works the same as [method Object.tr], with the addition of respecting the [member auto_translate_mode] state.
|
|
* If [method Object.can_translate_messages] is `false`, or no translation is available, this method returns the [param message] without changes. See [method Object.set_message_translation].
|
|
* For detailed examples, see [url=https://docs.godotengine.org/en/4.4/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
|
|
*/
|
|
atr(message: string, context: StringName = ''): string
|
|
|
|
/** Translates a [param message] or [param plural_message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
|
|
* This method works the same as [method Object.tr_n], with the addition of respecting the [member auto_translate_mode] state.
|
|
* If [method Object.can_translate_messages] is `false`, or no translation is available, this method returns [param message] or [param plural_message], without changes. See [method Object.set_message_translation].
|
|
* The [param n] is the number, or amount, of the message's subject. It is used by the translation system to fetch the correct plural form for the current language.
|
|
* For detailed examples, see [url=https://docs.godotengine.org/en/4.4/tutorials/i18n/localization_using_gettext.html]Localization using gettext[/url].
|
|
*
|
|
* **Note:** Negative and [float] numbers may not properly apply to some countable subjects. It's recommended to handle these cases with [method atr].
|
|
*/
|
|
atr_n(message: string, plural_message: StringName, n: int64, context: StringName = ''): string
|
|
_set_property_pinned(property: string, pinned: boolean): void
|
|
|
|
/** Sends a remote procedure call request for the given [param method] to peers on the network (and locally), sending additional arguments to the method called by the RPC. The call request will only be received by nodes with the same [NodePath], including the exact same [member name]. Behavior depends on the RPC configuration for the given [param method] (see [method rpc_config] and [annotation @GDScript.@rpc]). By default, methods are not exposed to RPCs.
|
|
* May return [constant OK] if the call is successful, [constant ERR_INVALID_PARAMETER] if the arguments passed in the [param method] do not match, [constant ERR_UNCONFIGURED] if the node's [member multiplayer] cannot be fetched (such as when the node is not inside the tree), [constant ERR_CONNECTION_ERROR] if [member multiplayer]'s connection is not available.
|
|
*
|
|
* **Note:** You can only safely use RPCs on clients after you received the [signal MultiplayerAPI.connected_to_server] signal from the [MultiplayerAPI]. You also need to keep track of the connection state, either by the [MultiplayerAPI] signals like [signal MultiplayerAPI.server_disconnected] or by checking (`get_multiplayer().peer.get_connection_status() == CONNECTION_CONNECTED`).
|
|
*/
|
|
rpc(method: StringName, ...vargargs: any[]): GError
|
|
|
|
/** Sends a [method rpc] to a specific peer identified by [param peer_id] (see [method MultiplayerPeer.set_target_peer]).
|
|
* May return [constant OK] if the call is successful, [constant ERR_INVALID_PARAMETER] if the arguments passed in the [param method] do not match, [constant ERR_UNCONFIGURED] if the node's [member multiplayer] cannot be fetched (such as when the node is not inside the tree), [constant ERR_CONNECTION_ERROR] if [member multiplayer]'s connection is not available.
|
|
*/
|
|
rpc_id(peer_id: int64, method: StringName, ...vargargs: any[]): GError
|
|
|
|
/** Refreshes the warnings displayed for this node in the Scene dock. Use [method _get_configuration_warnings] to customize the warning messages to display. */
|
|
update_configuration_warnings(): void
|
|
|
|
/** This function is similar to [method Object.call_deferred] except that the call will take place when the node thread group is processed. If the node thread group processes in sub-threads, then the call will be done on that thread, right before [constant NOTIFICATION_PROCESS] or [constant NOTIFICATION_PHYSICS_PROCESS], the [method _process] or [method _physics_process] or their internal versions are called. */
|
|
call_deferred_thread_group(method: StringName, ...vargargs: any[]): any
|
|
|
|
/** Similar to [method call_deferred_thread_group], but for setting properties. */
|
|
set_deferred_thread_group(property: StringName, value: any): void
|
|
|
|
/** Similar to [method call_deferred_thread_group], but for notifications. */
|
|
notify_deferred_thread_group(what: int64): void
|
|
|
|
/** This function ensures that the calling of this function will succeed, no matter whether it's being done from a thread or not. If called from a thread that is not allowed to call the function, the call will become deferred. Otherwise, the call will go through directly. */
|
|
call_thread_safe(method: StringName, ...vargargs: any[]): any
|
|
|
|
/** Similar to [method call_thread_safe], but for setting properties. */
|
|
set_thread_safe(property: StringName, value: any): void
|
|
|
|
/** Similar to [method call_thread_safe], but for notifications. */
|
|
notify_thread_safe(what: int64): void
|
|
get _import_path(): NodePath
|
|
set _import_path(value: NodePath | string)
|
|
|
|
/** If `true`, the node can be accessed from any node sharing the same [member owner] or from the [member owner] itself, with special `%Name` syntax in [method get_node].
|
|
*
|
|
* **Note:** If another node with the same [member owner] shares the same [member name] as this node, the other node will no longer be accessible as unique.
|
|
*/
|
|
get unique_name_in_owner(): boolean
|
|
set unique_name_in_owner(value: boolean)
|
|
|
|
/** The original scene's file path, if the node has been instantiated from a [PackedScene] file. Only scene root nodes contains this. */
|
|
get scene_file_path(): string
|
|
set scene_file_path(value: string)
|
|
|
|
/** The owner of this node. The owner must be an ancestor of this node. When packing the owner node in a [PackedScene], all the nodes it owns are also saved with it. See also [member unique_name_in_owner].
|
|
*
|
|
* **Note:** In the editor, nodes not owned by the scene root are usually not displayed in the Scene dock, and will **not** be saved. To prevent this, remember to set the owner after calling [method add_child].
|
|
*/
|
|
get owner(): Node
|
|
set owner(value: Node)
|
|
|
|
/** The [MultiplayerAPI] instance associated with this node. See [method SceneTree.get_multiplayer].
|
|
*
|
|
* **Note:** Renaming the node, or moving it in the tree, will not move the [MultiplayerAPI] to the new path, you will have to update this manually.
|
|
*/
|
|
get multiplayer(): MultiplayerAPI
|
|
|
|
/** The node's processing behavior (see [enum ProcessMode]). To check if the node can process in its current mode, use [method can_process]. */
|
|
get process_mode(): int64
|
|
set process_mode(value: int64)
|
|
|
|
/** The node's execution order of the process callbacks ([method _process], [constant NOTIFICATION_PROCESS], and [constant NOTIFICATION_INTERNAL_PROCESS]). Nodes whose priority value is *lower* call their process callbacks first, regardless of tree order. */
|
|
get process_priority(): int64
|
|
set process_priority(value: int64)
|
|
|
|
/** Similar to [member process_priority] but for [constant NOTIFICATION_PHYSICS_PROCESS], [method _physics_process], or [constant NOTIFICATION_INTERNAL_PHYSICS_PROCESS]. */
|
|
get process_physics_priority(): int64
|
|
set process_physics_priority(value: int64)
|
|
|
|
/** Set the process thread group for this node (basically, whether it receives [constant NOTIFICATION_PROCESS], [constant NOTIFICATION_PHYSICS_PROCESS], [method _process] or [method _physics_process] (and the internal versions) on the main thread or in a sub-thread.
|
|
* By default, the thread group is [constant PROCESS_THREAD_GROUP_INHERIT], which means that this node belongs to the same thread group as the parent node. The thread groups means that nodes in a specific thread group will process together, separate to other thread groups (depending on [member process_thread_group_order]). If the value is set is [constant PROCESS_THREAD_GROUP_SUB_THREAD], this thread group will occur on a sub thread (not the main thread), otherwise if set to [constant PROCESS_THREAD_GROUP_MAIN_THREAD] it will process on the main thread. If there is not a parent or grandparent node set to something other than inherit, the node will belong to the *default thread group* . This default group will process on the main thread and its group order is 0.
|
|
* During processing in a sub-thread, accessing most functions in nodes outside the thread group is forbidden (and it will result in an error in debug mode). Use [method Object.call_deferred], [method call_thread_safe], [method call_deferred_thread_group] and the likes in order to communicate from the thread groups to the main thread (or to other thread groups).
|
|
* To better understand process thread groups, the idea is that any node set to any other value than [constant PROCESS_THREAD_GROUP_INHERIT] will include any child (and grandchild) nodes set to inherit into its process thread group. This means that the processing of all the nodes in the group will happen together, at the same time as the node including them.
|
|
*/
|
|
get process_thread_group(): int64
|
|
set process_thread_group(value: int64)
|
|
|
|
/** Change the process thread group order. Groups with a lesser order will process before groups with a greater order. This is useful when a large amount of nodes process in sub thread and, afterwards, another group wants to collect their result in the main thread, as an example. */
|
|
get process_thread_group_order(): int64
|
|
set process_thread_group_order(value: int64)
|
|
|
|
/** Set whether the current thread group will process messages (calls to [method call_deferred_thread_group] on threads), and whether it wants to receive them during regular process or physics process callbacks. */
|
|
get process_thread_messages(): int64
|
|
set process_thread_messages(value: int64)
|
|
|
|
/** Allows enabling or disabling physics interpolation per node, offering a finer grain of control than turning physics interpolation on and off globally. See [member ProjectSettings.physics/common/physics_interpolation] and [member SceneTree.physics_interpolation] for the global setting.
|
|
*
|
|
* **Note:** When teleporting a node to a distant position you should temporarily disable interpolation with [method Node.reset_physics_interpolation].
|
|
*/
|
|
get physics_interpolation_mode(): int64
|
|
set physics_interpolation_mode(value: int64)
|
|
|
|
/** Defines if any text should automatically change to its translated version depending on the current locale (for nodes such as [Label], [RichTextLabel], [Window], etc.). Also decides if the node's strings should be parsed for POT generation.
|
|
*
|
|
* **Note:** For the root node, auto translate mode can also be set via [member ProjectSettings.internationalization/rendering/root_node_auto_translate].
|
|
*/
|
|
get auto_translate_mode(): int64
|
|
set auto_translate_mode(value: int64)
|
|
|
|
/** An optional description to the node. It will be displayed as a tooltip when hovering over the node in the editor's Scene dock. */
|
|
get editor_description(): string
|
|
set editor_description(value: string)
|
|
|
|
/** Emitted when the node is considered ready, after [method _ready] is called. */
|
|
readonly ready: Signal0
|
|
|
|
/** Emitted when the node's [member name] is changed, if the node is inside the tree. */
|
|
readonly renamed: Signal0
|
|
|
|
/** Emitted when the node enters the tree.
|
|
* This signal is emitted *after* the related [constant NOTIFICATION_ENTER_TREE] notification.
|
|
*/
|
|
readonly tree_entered: Signal0
|
|
|
|
/** Emitted when the node is just about to exit the tree. The node is still valid. As such, this is the right place for de-initialization (or a "destructor", if you will).
|
|
* This signal is emitted *after* the node's [method _exit_tree], and *before* the related [constant NOTIFICATION_EXIT_TREE].
|
|
*/
|
|
readonly tree_exiting: Signal0
|
|
|
|
/** Emitted after the node exits the tree and is no longer active.
|
|
* This signal is emitted *after* the related [constant NOTIFICATION_EXIT_TREE] notification.
|
|
*/
|
|
readonly tree_exited: Signal0
|
|
|
|
/** Emitted when the child [param node] enters the [SceneTree], usually because this node entered the tree (see [signal tree_entered]), or [method add_child] has been called.
|
|
* This signal is emitted *after* the child node's own [constant NOTIFICATION_ENTER_TREE] and [signal tree_entered].
|
|
*/
|
|
readonly child_entered_tree: Signal1<Node>
|
|
|
|
/** Emitted when the child [param node] is about to exit the [SceneTree], usually because this node is exiting the tree (see [signal tree_exiting]), or because the child [param node] is being removed or freed.
|
|
* When this signal is received, the child [param node] is still accessible inside the tree. This signal is emitted *after* the child node's own [signal tree_exiting] and [constant NOTIFICATION_EXIT_TREE].
|
|
*/
|
|
readonly child_exiting_tree: Signal1<Node>
|
|
|
|
/** Emitted when the list of children is changed. This happens when child nodes are added, moved or removed. */
|
|
readonly child_order_changed: Signal0
|
|
|
|
/** Emitted when this node is being replaced by the [param node], see [method replace_by].
|
|
* This signal is emitted *after* [param node] has been added as a child of the original parent node, but *before* all original child nodes have been reparented to [param node].
|
|
*/
|
|
readonly replacing_by: Signal1<Node>
|
|
|
|
/** Emitted when the node's editor description field changed. */
|
|
readonly editor_description_changed: Signal1<Node>
|
|
|
|
/** Emitted when an attribute of the node that is relevant to the editor is changed. Only emitted in the editor. */
|
|
readonly editor_state_changed: Signal0
|
|
}
|
|
/** A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and skew.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_node2d.html
|
|
*/
|
|
class Node2D<Map extends Record<string, Node> = Record<string, Node>> extends CanvasItem<Map> {
|
|
constructor(identifier?: any)
|
|
/** Applies a rotation to the node, in radians, starting from its current rotation. */
|
|
rotate(radians: float64): void
|
|
|
|
/** Applies a local translation on the node's X axis based on the [method Node._process]'s [param delta]. If [param scaled] is `false`, normalizes the movement. */
|
|
move_local_x(delta: float64, scaled: boolean = false): void
|
|
|
|
/** Applies a local translation on the node's Y axis based on the [method Node._process]'s [param delta]. If [param scaled] is `false`, normalizes the movement. */
|
|
move_local_y(delta: float64, scaled: boolean = false): void
|
|
|
|
/** Translates the node by the given [param offset] in local coordinates. */
|
|
translate(offset: Vector2): void
|
|
|
|
/** Adds the [param offset] vector to the node's global position. */
|
|
global_translate(offset: Vector2): void
|
|
|
|
/** Multiplies the current scale by the [param ratio] vector. */
|
|
apply_scale(ratio: Vector2): void
|
|
|
|
/** Rotates the node so that its local +X axis points towards the [param point], which is expected to use global coordinates.
|
|
* [param point] should not be the same as the node's position, otherwise the node always looks to the right.
|
|
*/
|
|
look_at(point: Vector2): void
|
|
|
|
/** Returns the angle between the node and the [param point] in radians.
|
|
* [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/node2d_get_angle_to.png]Illustration of the returned angle.[/url]
|
|
*/
|
|
get_angle_to(point: Vector2): float64
|
|
|
|
/** Transforms the provided global position into a position in local coordinate space. The output will be local relative to the [Node2D] it is called on. e.g. It is appropriate for determining the positions of child nodes, but it is not appropriate for determining its own position relative to its parent. */
|
|
to_local(global_point: Vector2): Vector2
|
|
|
|
/** Transforms the provided local position into a position in global coordinate space. The input is expected to be local relative to the [Node2D] it is called on. e.g. Applying this method to the positions of child nodes will correctly transform their positions into the global coordinate space, but applying it to a node's own position will give an incorrect result, as it will incorporate the node's own transformation into its global position. */
|
|
to_global(local_point: Vector2): Vector2
|
|
|
|
/** Returns the [Transform2D] relative to this node's parent. */
|
|
get_relative_transform_to_parent(parent: Node): Transform2D
|
|
|
|
/** Position, relative to the node's parent. See also [member global_position]. */
|
|
get position(): Vector2
|
|
set position(value: Vector2)
|
|
|
|
/** Rotation in radians, relative to the node's parent. See also [member global_rotation].
|
|
*
|
|
* **Note:** This property is edited in the inspector in degrees. If you want to use degrees in a script, use [member rotation_degrees].
|
|
*/
|
|
get rotation(): float64
|
|
set rotation(value: float64)
|
|
|
|
/** Helper property to access [member rotation] in degrees instead of radians. See also [member global_rotation_degrees]. */
|
|
get rotation_degrees(): float64
|
|
set rotation_degrees(value: float64)
|
|
|
|
/** The node's scale, relative to the node's parent. Unscaled value: `(1, 1)`. See also [member global_scale].
|
|
*
|
|
* **Note:** Negative X scales in 2D are not decomposable from the transformation matrix. Due to the way scale is represented with transformation matrices in Godot, negative scales on the X axis will be changed to negative scales on the Y axis and a rotation of 180 degrees when decomposed.
|
|
*/
|
|
get scale(): Vector2
|
|
set scale(value: Vector2)
|
|
|
|
/** If set to a non-zero value, slants the node in one direction or another. This can be used for pseudo-3D effects. See also [member global_skew].
|
|
*
|
|
* **Note:** Skew is performed on the X axis only, and *between* rotation and scaling.
|
|
*
|
|
* **Note:** This property is edited in the inspector in degrees. If you want to use degrees in a script, use `skew = deg_to_rad(value_in_degrees)`.
|
|
*/
|
|
get skew(): float64
|
|
set skew(value: float64)
|
|
|
|
/** The node's [Transform2D], relative to the node's parent. See also [member global_transform]. */
|
|
get transform(): Transform2D
|
|
set transform(value: Transform2D)
|
|
|
|
/** Global position. See also [member position]. */
|
|
get global_position(): Vector2
|
|
set global_position(value: Vector2)
|
|
|
|
/** Global rotation in radians. See also [member rotation]. */
|
|
get global_rotation(): float64
|
|
set global_rotation(value: float64)
|
|
|
|
/** Helper property to access [member global_rotation] in degrees instead of radians. See also [member rotation_degrees]. */
|
|
get global_rotation_degrees(): float64
|
|
set global_rotation_degrees(value: float64)
|
|
|
|
/** Global scale. See also [member scale]. */
|
|
get global_scale(): Vector2
|
|
set global_scale(value: Vector2)
|
|
|
|
/** Global skew in radians. See also [member skew]. */
|
|
get global_skew(): float64
|
|
set global_skew(value: float64)
|
|
|
|
/** Global [Transform2D]. See also [member transform]. */
|
|
get global_transform(): Transform2D
|
|
set global_transform(value: Transform2D)
|
|
}
|
|
namespace Node3D {
|
|
enum RotationEditMode {
|
|
/** The rotation is edited using [Vector3] Euler angles. */
|
|
ROTATION_EDIT_MODE_EULER = 0,
|
|
|
|
/** The rotation is edited using a [Quaternion]. */
|
|
ROTATION_EDIT_MODE_QUATERNION = 1,
|
|
|
|
/** The rotation is edited using a [Basis]. In this mode, [member scale] can't be edited separately. */
|
|
ROTATION_EDIT_MODE_BASIS = 2,
|
|
}
|
|
}
|
|
/** Most basic 3D game object, parent of all 3D-related nodes.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_node3d.html
|
|
*/
|
|
class Node3D<Map extends Record<string, Node> = Record<string, Node>> extends Node<Map> {
|
|
/** [Node3D] nodes receive this notification when their global transform changes. This means that either the current or a parent node changed its transform.
|
|
* In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform]. The notification is also sent if the node is in the editor context and it has at least one valid gizmo.
|
|
*/
|
|
static readonly NOTIFICATION_TRANSFORM_CHANGED = 2000
|
|
|
|
/** [Node3D] nodes receive this notification when they are registered to new [World3D] resource. */
|
|
static readonly NOTIFICATION_ENTER_WORLD = 41
|
|
|
|
/** [Node3D] nodes receive this notification when they are unregistered from current [World3D] resource. */
|
|
static readonly NOTIFICATION_EXIT_WORLD = 42
|
|
|
|
/** [Node3D] nodes receive this notification when their visibility changes. */
|
|
static readonly NOTIFICATION_VISIBILITY_CHANGED = 43
|
|
|
|
/** [Node3D] nodes receive this notification when their local transform changes. This is not received when the transform of a parent node is changed.
|
|
* In order for [constant NOTIFICATION_LOCAL_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_local_transform].
|
|
*/
|
|
static readonly NOTIFICATION_LOCAL_TRANSFORM_CHANGED = 44
|
|
constructor(identifier?: any)
|
|
|
|
/** When using physics interpolation, there will be circumstances in which you want to know the interpolated (displayed) transform of a node rather than the standard transform (which may only be accurate to the most recent physics tick).
|
|
* This is particularly important for frame-based operations that take place in [method Node._process], rather than [method Node._physics_process]. Examples include [Camera3D]s focusing on a node, or finding where to fire lasers from on a frame rather than physics tick.
|
|
*
|
|
* **Note:** This function creates an interpolation pump on the [Node3D] the first time it is called, which can respond to physics interpolation resets. If you get problems with "streaking" when initially following a [Node3D], be sure to call [method get_global_transform_interpolated] at least once *before* resetting the [Node3D] physics interpolation.
|
|
*/
|
|
get_global_transform_interpolated(): Transform3D
|
|
|
|
/** Returns the parent [Node3D], or `null` if no parent exists, the parent is not of type [Node3D], or [member top_level] is `true`.
|
|
*
|
|
* **Note:** Calling this method is not equivalent to `get_parent() as Node3D`, which does not take [member top_level] into account.
|
|
*/
|
|
get_parent_node_3d(): Node3D
|
|
|
|
/** Sets whether the node ignores notification that its transformation (global or local) changed. */
|
|
set_ignore_transform_notification(enabled: boolean): void
|
|
|
|
/** Sets whether the node uses a scale of `(1, 1, 1)` or its local transformation scale. Changes to the local transformation scale are preserved. */
|
|
set_disable_scale(disable: boolean): void
|
|
|
|
/** Returns whether this node uses a scale of `(1, 1, 1)` or its local transformation scale. */
|
|
is_scale_disabled(): boolean
|
|
|
|
/** Returns the current [World3D] resource this [Node3D] node is registered to. */
|
|
get_world_3d(): World3D
|
|
|
|
/** Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations. */
|
|
force_update_transform(): void
|
|
|
|
/** Updates all the [Node3D] gizmos attached to this node. */
|
|
update_gizmos(): void
|
|
|
|
/** Attach an editor gizmo to this [Node3D].
|
|
*
|
|
* **Note:** The gizmo object would typically be an instance of [EditorNode3DGizmo], but the argument type is kept generic to avoid creating a dependency on editor classes in [Node3D].
|
|
*/
|
|
add_gizmo(gizmo: Node3DGizmo): void
|
|
|
|
/** Returns all the gizmos attached to this [Node3D]. */
|
|
get_gizmos(): GArray
|
|
|
|
/** Clear all gizmos attached to this [Node3D]. */
|
|
clear_gizmos(): void
|
|
|
|
/** Set subgizmo selection for this node in the editor.
|
|
*
|
|
* **Note:** The gizmo object would typically be an instance of [EditorNode3DGizmo], but the argument type is kept generic to avoid creating a dependency on editor classes in [Node3D].
|
|
*/
|
|
set_subgizmo_selection(gizmo: Node3DGizmo, id: int64, transform: Transform3D): void
|
|
|
|
/** Clears subgizmo selection for this node in the editor. Useful when subgizmo IDs become invalid after a property change. */
|
|
clear_subgizmo_selection(): void
|
|
|
|
/** Returns `true` if the node is present in the [SceneTree], its [member visible] property is `true` and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree.
|
|
* Visibility is checked only in parent nodes that inherit from [Node3D]. If the parent is of any other type (such as [Node], [AnimationPlayer], or [Node2D]), it is assumed to be visible.
|
|
*
|
|
* **Note:** This method does not take [member VisualInstance3D.layers] into account, so even if this method returns `true`, the node might end up not being rendered.
|
|
*/
|
|
is_visible_in_tree(): boolean
|
|
|
|
/** Enables rendering of this node. Changes [member visible] to `true`. */
|
|
show(): void
|
|
|
|
/** Disables rendering of this node. Changes [member visible] to `false`. */
|
|
hide(): void
|
|
|
|
/** Sets whether the node notifies about its local transformation changes. [Node3D] will not propagate this by default. */
|
|
set_notify_local_transform(enable: boolean): void
|
|
|
|
/** Returns whether node notifies about its local transformation changes. [Node3D] will not propagate this by default. */
|
|
is_local_transform_notification_enabled(): boolean
|
|
|
|
/** Sets whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default, unless it is in the editor context and it has a valid gizmo. */
|
|
set_notify_transform(enable: boolean): void
|
|
|
|
/** Returns whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default. */
|
|
is_transform_notification_enabled(): boolean
|
|
|
|
/** Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians. */
|
|
rotate(axis: Vector3, angle: float64): void
|
|
|
|
/** Rotates the global (world) transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in global coordinate system. */
|
|
global_rotate(axis: Vector3, angle: float64): void
|
|
|
|
/** Scales the global (world) transformation by the given [Vector3] scale factors. */
|
|
global_scale(scale: Vector3): void
|
|
|
|
/** Moves the global (world) transformation by [Vector3] offset. The offset is in global coordinate system. */
|
|
global_translate(offset: Vector3): void
|
|
|
|
/** Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in object-local coordinate system. */
|
|
rotate_object_local(axis: Vector3, angle: float64): void
|
|
|
|
/** Scales the local transformation by given 3D scale factors in object-local coordinate system. */
|
|
scale_object_local(scale: Vector3): void
|
|
|
|
/** Changes the node's position by the given offset [Vector3] in local space. */
|
|
translate_object_local(offset: Vector3): void
|
|
|
|
/** Rotates the local transformation around the X axis by angle in radians. */
|
|
rotate_x(angle: float64): void
|
|
|
|
/** Rotates the local transformation around the Y axis by angle in radians. */
|
|
rotate_y(angle: float64): void
|
|
|
|
/** Rotates the local transformation around the Z axis by angle in radians. */
|
|
rotate_z(angle: float64): void
|
|
|
|
/** Changes the node's position by the given offset [Vector3].
|
|
* Note that the translation [param offset] is affected by the node's scale, so if scaled by e.g. `(10, 1, 1)`, a translation by an offset of `(2, 0, 0)` would actually add 20 (`2 * 10`) to the X coordinate.
|
|
*/
|
|
translate(offset: Vector3): void
|
|
|
|
/** Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node's [Transform3D]. */
|
|
orthonormalize(): void
|
|
|
|
/** Reset all transformations for this node (sets its [Transform3D] to the identity matrix). */
|
|
set_identity(): void
|
|
|
|
/** Rotates the node so that the local forward axis (-Z, [constant Vector3.FORWARD]) points toward the [param target] position.
|
|
* The local up axis (+Y) points as close to the [param up] vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly.
|
|
* The [param target] position cannot be the same as the node's position, the [param up] vector cannot be zero.
|
|
* The [param target] and the [param up] cannot be [constant Vector3.ZERO], and shouldn't be colinear to avoid unintended rotation around local Z axis.
|
|
* Operations take place in global space, which means that the node must be in the scene tree.
|
|
* If [param use_model_front] is `true`, the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the [param target] position. By default, the -Z axis (camera forward) is treated as forward (implies +X is right).
|
|
*/
|
|
look_at(target: Vector3, up: Vector3 = Vector3.ZERO, use_model_front: boolean = false): void
|
|
|
|
/** Moves the node to the specified [param position], and then rotates the node to point toward the [param target] as per [method look_at]. Operations take place in global space. */
|
|
look_at_from_position(position: Vector3, target: Vector3, up: Vector3 = Vector3.ZERO, use_model_front: boolean = false): void
|
|
|
|
/** Transforms [param global_point] from world space to this node's local space. */
|
|
to_local(global_point: Vector3): Vector3
|
|
|
|
/** Transforms [param local_point] from this node's local space to world space. */
|
|
to_global(local_point: Vector3): Vector3
|
|
|
|
/** Local space [Transform3D] of this node, with respect to the parent node. */
|
|
get transform(): Transform3D
|
|
set transform(value: Transform3D)
|
|
|
|
/** World3D space (global) [Transform3D] of this node. */
|
|
get global_transform(): Transform3D
|
|
set global_transform(value: Transform3D)
|
|
|
|
/** Local position or translation of this node relative to the parent. This is equivalent to `transform.origin`. */
|
|
get position(): Vector3
|
|
set position(value: Vector3)
|
|
|
|
/** Rotation part of the local transformation in radians, specified in terms of Euler angles. The angles construct a rotation in the order specified by the [member rotation_order] property.
|
|
*
|
|
* **Note:** In the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three independent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a [Vector3] data structure not because the rotation is a vector, but only because [Vector3] exists as a convenient data-structure to store 3 floating-point numbers. Therefore, applying affine operations on the rotation "vector" is not meaningful.
|
|
*
|
|
* **Note:** This property is edited in the inspector in degrees. If you want to use degrees in a script, use [member rotation_degrees].
|
|
*/
|
|
get rotation(): Vector3
|
|
set rotation(value: Vector3)
|
|
|
|
/** Helper property to access [member rotation] in degrees instead of radians. */
|
|
get rotation_degrees(): Vector3
|
|
set rotation_degrees(value: Vector3)
|
|
|
|
/** Access to the node rotation as a [Quaternion]. This property is ideal for tweening complex rotations. */
|
|
get quaternion(): Quaternion
|
|
set quaternion(value: Quaternion)
|
|
|
|
/** Basis of the [member transform] property. Represents the rotation, scale, and shear of this node. */
|
|
get basis(): Basis
|
|
set basis(value: Basis)
|
|
|
|
/** Scale part of the local transformation.
|
|
*
|
|
* **Note:** Mixed negative scales in 3D are not decomposable from the transformation matrix. Due to the way scale is represented with transformation matrices in Godot, the scale values will either be all positive or all negative.
|
|
*
|
|
* **Note:** Not all nodes are visually scaled by the [member scale] property. For example, [Light3D]s are not visually affected by [member scale].
|
|
*/
|
|
get scale(): Vector3
|
|
set scale(value: Vector3)
|
|
|
|
/** Specify how rotation (and scale) will be presented in the editor. */
|
|
get rotation_edit_mode(): int64
|
|
set rotation_edit_mode(value: int64)
|
|
|
|
/** Specify the axis rotation order of the [member rotation] property. The final orientation is constructed by rotating the Euler angles in the order specified by this property. */
|
|
get rotation_order(): int64
|
|
set rotation_order(value: int64)
|
|
|
|
/** If `true`, the node will not inherit its transformations from its parent. Node transformations are only in global space. */
|
|
get top_level(): boolean
|
|
set top_level(value: boolean)
|
|
|
|
/** Global position of this node. This is equivalent to `global_transform.origin`. */
|
|
get global_position(): Vector3
|
|
set global_position(value: Vector3)
|
|
|
|
/** Global basis of this node. This is equivalent to `global_transform.basis`. */
|
|
get global_basis(): Basis
|
|
set global_basis(value: Basis)
|
|
|
|
/** Rotation part of the global transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).
|
|
*
|
|
* **Note:** In the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three independent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a [Vector3] data structure not because the rotation is a vector, but only because [Vector3] exists as a convenient data-structure to store 3 floating-point numbers. Therefore, applying affine operations on the rotation "vector" is not meaningful.
|
|
*/
|
|
get global_rotation(): Vector3
|
|
set global_rotation(value: Vector3)
|
|
|
|
/** Helper property to access [member global_rotation] in degrees instead of radians. */
|
|
get global_rotation_degrees(): Vector3
|
|
set global_rotation_degrees(value: Vector3)
|
|
|
|
/** If `true`, this node is drawn. The node is only visible if all of its ancestors are visible as well (in other words, [method is_visible_in_tree] must return `true`). */
|
|
get visible(): boolean
|
|
set visible(value: boolean)
|
|
|
|
/** Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependent instances will not take the hidden node or its ancestors into account. */
|
|
get visibility_parent(): NodePath
|
|
set visibility_parent(value: NodePath | string)
|
|
|
|
/** Emitted when node visibility changes. */
|
|
readonly visibility_changed: Signal0
|
|
}
|
|
class Node3DEditor<Map extends Record<string, Node> = Record<string, Node>> extends VBoxContainer<Map> {
|
|
constructor(identifier?: any)
|
|
_get_editor_data(_unnamed_arg0: Object): Object
|
|
_request_gizmo(_unnamed_arg0: Object): void
|
|
_request_gizmo_for_id(_unnamed_arg0: int64): void
|
|
_set_subgizmo_selection(_unnamed_arg0: Object, _unnamed_arg1: Node3DGizmo, _unnamed_arg2: int64, _unnamed_arg3: Transform3D): void
|
|
_clear_subgizmo_selection(_unnamed_arg0: Object): void
|
|
_refresh_menu_icons(): void
|
|
update_all_gizmos(_unnamed_arg0: Node): void
|
|
update_transform_gizmo(): void
|
|
readonly transform_key_request: Signal0
|
|
readonly item_lock_status_changed: Signal0
|
|
readonly item_group_status_changed: Signal0
|
|
}
|
|
class Node3DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
class Node3DEditorSelectedItem extends Object {
|
|
constructor(identifier?: any)
|
|
}
|
|
class Node3DEditorViewport<Map extends Record<string, Node> = Record<string, Node>> extends Control<Map> {
|
|
constructor(identifier?: any)
|
|
readonly toggle_maximize_view: Signal1<Object>
|
|
readonly clicked: Signal0
|
|
}
|
|
class Node3DEditorViewportContainer<Map extends Record<string, Node> = Record<string, Node>> extends Container<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Abstract class to expose editor gizmos for [Node3D].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_node3dgizmo.html
|
|
*/
|
|
class Node3DGizmo extends RefCounted {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NodeDock<Map extends Record<string, Node> = Record<string, Node>> extends VBoxContainer<Map> {
|
|
constructor(identifier?: any)
|
|
_save_layout_to_config(_unnamed_arg0: ConfigFile, _unnamed_arg1: string): void
|
|
_load_layout_from_config(_unnamed_arg0: ConfigFile, _unnamed_arg1: string): void
|
|
}
|
|
/** Abstract base class for noise generators.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_noise.html
|
|
*/
|
|
class Noise extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Returns the 1D noise value at the given (x) coordinate. */
|
|
get_noise_1d(x: float64): float64
|
|
|
|
/** Returns the 2D noise value at the given position. */
|
|
get_noise_2d(x: float64, y: float64): float64
|
|
|
|
/** Returns the 2D noise value at the given position. */
|
|
get_noise_2dv(v: Vector2): float64
|
|
|
|
/** Returns the 3D noise value at the given position. */
|
|
get_noise_3d(x: float64, y: float64, z: float64): float64
|
|
|
|
/** Returns the 3D noise value at the given position. */
|
|
get_noise_3dv(v: Vector3): float64
|
|
|
|
/** Returns an [Image] containing 2D noise values.
|
|
*
|
|
* **Note:** With [param normalize] set to `false`, the default implementation expects the noise generator to return values in the range `-1.0` to `1.0`.
|
|
*/
|
|
get_image(width: int64, height: int64, invert: boolean = false, in_3d_space: boolean = false, normalize: boolean = true): Image
|
|
|
|
/** Returns an [Image] containing seamless 2D noise values.
|
|
*
|
|
* **Note:** With [param normalize] set to `false`, the default implementation expects the noise generator to return values in the range `-1.0` to `1.0`.
|
|
*/
|
|
get_seamless_image(width: int64, height: int64, invert: boolean = false, in_3d_space: boolean = false, skirt: float64 = 0.1, normalize: boolean = true): Image
|
|
|
|
/** Returns an [Array] of [Image]s containing 3D noise values for use with [method ImageTexture3D.create].
|
|
*
|
|
* **Note:** With [param normalize] set to `false`, the default implementation expects the noise generator to return values in the range `-1.0` to `1.0`.
|
|
*/
|
|
get_image_3d(width: int64, height: int64, depth: int64, invert: boolean = false, normalize: boolean = true): GArray
|
|
|
|
/** Returns an [Array] of [Image]s containing seamless 3D noise values for use with [method ImageTexture3D.create].
|
|
*
|
|
* **Note:** With [param normalize] set to `false`, the default implementation expects the noise generator to return values in the range `-1.0` to `1.0`.
|
|
*/
|
|
get_seamless_image_3d(width: int64, height: int64, depth: int64, invert: boolean = false, skirt: float64 = 0.1, normalize: boolean = true): GArray
|
|
}
|
|
class NoiseEditorInspectorPlugin extends EditorInspectorPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
class NoiseEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** A 2D texture filled with noise generated by a [Noise] object.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_noisetexture2d.html
|
|
*/
|
|
class NoiseTexture2D extends Texture2D {
|
|
constructor(identifier?: any)
|
|
/** Width of the generated texture (in pixels). */
|
|
get width(): int64
|
|
set width(value: int64)
|
|
|
|
/** Height of the generated texture (in pixels). */
|
|
get height(): int64
|
|
set height(value: int64)
|
|
|
|
/** If `true`, inverts the noise texture. White becomes black, black becomes white. */
|
|
get invert(): boolean
|
|
set invert(value: boolean)
|
|
|
|
/** Determines whether the noise image is calculated in 3D space. May result in reduced contrast. */
|
|
get in_3d_space(): boolean
|
|
set in_3d_space(value: boolean)
|
|
|
|
/** Determines whether mipmaps are generated for this texture. Enabling this results in less texture aliasing in the distance, at the cost of increasing memory usage by roughly 33% and making the noise texture generation take longer.
|
|
*
|
|
* **Note:** [member generate_mipmaps] requires mipmap filtering to be enabled on the material using the [NoiseTexture2D] to have an effect.
|
|
*/
|
|
get generate_mipmaps(): boolean
|
|
set generate_mipmaps(value: boolean)
|
|
|
|
/** If `true`, a seamless texture is requested from the [Noise] resource.
|
|
*
|
|
* **Note:** Seamless noise textures may take longer to generate and/or can have a lower contrast compared to non-seamless noise depending on the used [Noise] resource. This is because some implementations use higher dimensions for generating seamless noise.
|
|
*
|
|
* **Note:** The default [FastNoiseLite] implementation uses the fallback path for seamless generation. If using a [member width] or [member height] lower than the default, you may need to increase [member seamless_blend_skirt] to make seamless blending more effective.
|
|
*/
|
|
get seamless(): boolean
|
|
set seamless(value: boolean)
|
|
|
|
/** Used for the default/fallback implementation of the seamless texture generation. It determines the distance over which the seams are blended. High values may result in less details and contrast. See [Noise] for further details.
|
|
*
|
|
* **Note:** If using a [member width] or [member height] lower than the default, you may need to increase [member seamless_blend_skirt] to make seamless blending more effective.
|
|
*/
|
|
get seamless_blend_skirt(): float64
|
|
set seamless_blend_skirt(value: float64)
|
|
|
|
/** If `true`, the resulting texture contains a normal map created from the original noise interpreted as a bump map. */
|
|
get as_normal_map(): boolean
|
|
set as_normal_map(value: boolean)
|
|
|
|
/** Strength of the bump maps used in this texture. A higher value will make the bump maps appear larger while a lower value will make them appear softer. */
|
|
get bump_strength(): float64
|
|
set bump_strength(value: float64)
|
|
|
|
/** If `true`, the noise image coming from the noise generator is normalized to the range `0.0` to `1.0`.
|
|
* Turning normalization off can affect the contrast and allows you to generate non repeating tileable noise textures.
|
|
*/
|
|
get normalize(): boolean
|
|
set normalize(value: boolean)
|
|
|
|
/** A [Gradient] which is used to map the luminance of each pixel to a color value. */
|
|
get color_ramp(): Gradient
|
|
set color_ramp(value: Gradient)
|
|
|
|
/** The instance of the [Noise] object. */
|
|
get noise(): Noise
|
|
set noise(value: Noise)
|
|
}
|
|
/** A 3D texture filled with noise generated by a [Noise] object.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_noisetexture3d.html
|
|
*/
|
|
class NoiseTexture3D extends Texture3D {
|
|
constructor(identifier?: any)
|
|
/** Width of the generated texture (in pixels). */
|
|
get width(): int64
|
|
set width(value: int64)
|
|
|
|
/** Height of the generated texture (in pixels). */
|
|
get height(): int64
|
|
set height(value: int64)
|
|
|
|
/** Depth of the generated texture (in pixels). */
|
|
get depth(): int64
|
|
set depth(value: int64)
|
|
|
|
/** If `true`, inverts the noise texture. White becomes black, black becomes white. */
|
|
get invert(): boolean
|
|
set invert(value: boolean)
|
|
|
|
/** If `true`, a seamless texture is requested from the [Noise] resource.
|
|
*
|
|
* **Note:** Seamless noise textures may take longer to generate and/or can have a lower contrast compared to non-seamless noise depending on the used [Noise] resource. This is because some implementations use higher dimensions for generating seamless noise.
|
|
*
|
|
* **Note:** The default [FastNoiseLite] implementation uses the fallback path for seamless generation. If using a [member width], [member height] or [member depth] lower than the default, you may need to increase [member seamless_blend_skirt] to make seamless blending more effective.
|
|
*/
|
|
get seamless(): boolean
|
|
set seamless(value: boolean)
|
|
|
|
/** Used for the default/fallback implementation of the seamless texture generation. It determines the distance over which the seams are blended. High values may result in less details and contrast. See [Noise] for further details.
|
|
*
|
|
* **Note:** If using a [member width], [member height] or [member depth] lower than the default, you may need to increase [member seamless_blend_skirt] to make seamless blending more effective.
|
|
*/
|
|
get seamless_blend_skirt(): float64
|
|
set seamless_blend_skirt(value: float64)
|
|
|
|
/** If `true`, the noise image coming from the noise generator is normalized to the range `0.0` to `1.0`.
|
|
* Turning normalization off can affect the contrast and allows you to generate non repeating tileable noise textures.
|
|
*/
|
|
get normalize(): boolean
|
|
set normalize(value: boolean)
|
|
|
|
/** A [Gradient] which is used to map the luminance of each pixel to a color value. */
|
|
get color_ramp(): Gradient
|
|
set color_ramp(value: Gradient)
|
|
|
|
/** The instance of the [Noise] object. */
|
|
get noise(): Noise
|
|
set noise(value: Noise)
|
|
}
|
|
/** A PBR (Physically Based Rendering) material to be used on 3D objects. Uses an ORM texture.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_ormmaterial3d.html
|
|
*/
|
|
class ORMMaterial3D extends BaseMaterial3D {
|
|
constructor(identifier?: any)
|
|
}
|
|
class ORMMaterial3DConversionPlugin extends EditorResourceConversionPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace Object {
|
|
enum ConnectFlags {
|
|
/** Deferred connections trigger their [Callable]s on idle time (at the end of the frame), rather than instantly. */
|
|
CONNECT_DEFERRED = 1,
|
|
|
|
/** Persisting connections are stored when the object is serialized (such as when using [method PackedScene.pack]). In the editor, connections created through the Node dock are always persisting. */
|
|
CONNECT_PERSIST = 2,
|
|
|
|
/** One-shot connections disconnect themselves after emission. */
|
|
CONNECT_ONE_SHOT = 4,
|
|
|
|
/** Reference-counted connections can be assigned to the same [Callable] multiple times. Each disconnection decreases the internal counter. The signal fully disconnects only when the counter reaches 0. */
|
|
CONNECT_REFERENCE_COUNTED = 8,
|
|
}
|
|
}
|
|
/** Base class for all other classes in the engine.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_object.html
|
|
*/
|
|
class Object {
|
|
/** Notification received when the object is initialized, before its script is attached. Used internally. */
|
|
static readonly NOTIFICATION_POSTINITIALIZE = 0
|
|
|
|
/** Notification received when the object is about to be deleted. Can be used like destructors in object-oriented programming languages. */
|
|
static readonly NOTIFICATION_PREDELETE = 1
|
|
|
|
/** Notification received when the object finishes hot reloading. This notification is only sent for extensions classes and derived. */
|
|
static readonly NOTIFICATION_EXTENSION_RELOADED = 2
|
|
constructor(identifier?: any)
|
|
|
|
/** Deletes the object from memory. Pre-existing references to the object become invalid, and any attempt to access them will result in a run-time error. Checking the references with [method @GlobalScope.is_instance_valid] will return `false`. */
|
|
/* gdvirtual */ free(): void
|
|
|
|
/** Called when the object's script is instantiated, oftentimes after the object is initialized in memory (through `Object.new()` in GDScript, or `new GodotObject` in C#). It can be also defined to take in parameters. This method is similar to a constructor in most programming languages.
|
|
*
|
|
* **Note:** If [method _init] is defined with *required* parameters, the Object with script may only be created directly. If any other means (such as [method PackedScene.instantiate] or [method Node.duplicate]) are used, the script's initialization will fail.
|
|
*/
|
|
/* gdvirtual */ _init(): void
|
|
|
|
/** Override this method to customize the return value of [method to_string], and therefore the object's representation as a [String].
|
|
*
|
|
*/
|
|
/* gdvirtual */ _to_string(): string
|
|
|
|
/** Called when the object receives a notification, which can be identified in [param what] by comparing it with a constant. See also [method notification].
|
|
*
|
|
*
|
|
* **Note:** The base [Object] defines a few notifications ([constant NOTIFICATION_POSTINITIALIZE] and [constant NOTIFICATION_PREDELETE]). Inheriting classes such as [Node] define a lot more notifications, which are also received by this method.
|
|
*/
|
|
/* gdvirtual */ _notification(what: int64): void
|
|
|
|
/** Override this method to customize the behavior of [method set]. Should set the [param property] to [param value] and return `true`, or `false` if the [param property] should be handled normally. The *exact* way to set the [param property] is up to this method's implementation.
|
|
* Combined with [method _get] and [method _get_property_list], this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property *must* be present in [method get_property_list], otherwise this method will not be called.
|
|
*
|
|
*/
|
|
/* gdvirtual */ _set(property: StringName, value: any): boolean
|
|
|
|
/** Override this method to customize the behavior of [method get]. Should return the given [param property]'s value, or `null` if the [param property] should be handled normally.
|
|
* Combined with [method _set] and [method _get_property_list], this method allows defining custom properties, which is particularly useful for editor plugins. Note that a property must be present in [method get_property_list], otherwise this method will not be called.
|
|
*
|
|
*/
|
|
/* gdvirtual */ _get(property: StringName): any
|
|
|
|
/** Override this method to provide a custom list of additional properties to handle by the engine.
|
|
* Should return a property list, as an [Array] of dictionaries. The result is added to the array of [method get_property_list], and should be formatted in the same way. Each [Dictionary] must at least contain the `name` and `type` entries.
|
|
* You can use [method _property_can_revert] and [method _property_get_revert] to customize the default values of the properties added by this method.
|
|
* The example below displays a list of numbers shown as words going from `ZERO` to `FIVE`, with `number_count` controlling the size of the list:
|
|
*
|
|
*
|
|
* **Note:** This method is intended for advanced purposes. For most common use cases, the scripting languages offer easier ways to handle properties. See [annotation @GDScript.@export], [annotation @GDScript.@export_enum], [annotation @GDScript.@export_group], etc. If you want to customize exported properties, use [method _validate_property].
|
|
*
|
|
* **Note:** If the object's script is not [annotation @GDScript.@tool], this method will not be called in the editor.
|
|
*/
|
|
/* gdvirtual */ _get_property_list(): GArray
|
|
|
|
/** Override this method to customize existing properties. Every property info goes through this method, except properties added with [method _get_property_list]. The dictionary contents is the same as in [method _get_property_list].
|
|
*
|
|
*/
|
|
/* gdvirtual */ _validate_property(property: GDictionary): void
|
|
|
|
/** Override this method to customize the given [param property]'s revert behavior. Should return `true` if the [param property] has a custom default value and is revertible in the Inspector dock. Use [method _property_get_revert] to specify the [param property]'s default value.
|
|
*
|
|
* **Note:** This method must return consistently, regardless of the current value of the [param property].
|
|
*/
|
|
/* gdvirtual */ _property_can_revert(property: StringName): boolean
|
|
|
|
/** Override this method to customize the given [param property]'s revert behavior. Should return the default value for the [param property]. If the default value differs from the [param property]'s current value, a revert icon is displayed in the Inspector dock.
|
|
*
|
|
* **Note:** [method _property_can_revert] must also be overridden for this method to be called.
|
|
*/
|
|
/* gdvirtual */ _property_get_revert(property: StringName): any
|
|
|
|
/** Initializes the iterator. [param iter] stores the iteration state. Since GDScript does not support passing arguments by reference, a single-element array is used as a wrapper. Returns `true` so long as the iterator has not reached the end.
|
|
* Example:
|
|
*
|
|
*
|
|
* **Note:** Alternatively, you can ignore [param iter] and use the object's state instead, see [url=https://docs.godotengine.org/en/4.4/tutorials/scripting/gdscript/gdscript_advanced.html#custom-iterators]online docs[/url] for an example. Note that in this case you will not be able to reuse the same iterator instance in nested loops. Also, make sure you reset the iterator state in this method if you want to reuse the same instance multiple times.
|
|
*/
|
|
/* gdvirtual */ _iter_init(iter: GArray): boolean
|
|
|
|
/** Moves the iterator to the next iteration. [param iter] stores the iteration state. Since GDScript does not support passing arguments by reference, a single-element array is used as a wrapper. Returns `true` so long as the iterator has not reached the end. */
|
|
/* gdvirtual */ _iter_next(iter: GArray): boolean
|
|
|
|
/** Returns the current iterable value. [param iter] stores the iteration state, but unlike [method _iter_init] and [method _iter_next] the state is supposed to be read-only, so there is no [Array] wrapper. */
|
|
/* gdvirtual */ _iter_get(iter: any): any
|
|
|
|
/** Returns the object's built-in class name, as a [String]. See also [method is_class].
|
|
*
|
|
* **Note:** This method ignores `class_name` declarations. If this object's script has defined a `class_name`, the base, built-in class name is returned instead.
|
|
*/
|
|
get_class(): string
|
|
|
|
/** Returns `true` if the object inherits from the given [param class]. See also [method get_class].
|
|
*
|
|
*
|
|
* **Note:** This method ignores `class_name` declarations in the object's script.
|
|
*/
|
|
is_class(class_: string): boolean
|
|
|
|
/** Assigns [param value] to the given [param property]. If the property does not exist or the given [param value]'s type doesn't match, nothing happens.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
set(property: StringName, value: any): void
|
|
|
|
/** Returns the [Variant] value of the given [param property]. If the [param property] does not exist, this method returns `null`.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
get(property: StringName): any
|
|
|
|
/** Assigns a new [param value] to the property identified by the [param property_path]. The path should be a [NodePath] relative to this object, and can use the colon character (`:`) to access nested properties.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
set_indexed(property_path: NodePath | string, value: any): void
|
|
|
|
/** Gets the object's property indexed by the given [param property_path]. The path should be a [NodePath] relative to the current object and can use the colon character (`:`) to access nested properties.
|
|
* **Examples:** `"position:x"` or `"material:next_pass:blend_mode"`.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call.
|
|
*
|
|
* **Note:** This method does not support actual paths to nodes in the [SceneTree], only sub-property paths. In the context of nodes, use [method Node.get_node_and_resource] instead.
|
|
*/
|
|
get_indexed(property_path: NodePath | string): any
|
|
|
|
/** Returns the object's property list as an [Array] of dictionaries. Each [Dictionary] contains the following entries:
|
|
* - `name` is the property's name, as a [String];
|
|
* - `class_name` is an empty [StringName], unless the property is [constant TYPE_OBJECT] and it inherits from a class;
|
|
* - `type` is the property's type, as an [int] (see [enum Variant.Type]);
|
|
* - `hint` is *how* the property is meant to be edited (see [enum PropertyHint]);
|
|
* - `hint_string` depends on the hint (see [enum PropertyHint]);
|
|
* - `usage` is a combination of [enum PropertyUsageFlags].
|
|
*
|
|
* **Note:** In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.
|
|
*/
|
|
get_property_list(): GArray
|
|
|
|
/** Returns this object's methods and their signatures as an [Array] of dictionaries. Each [Dictionary] contains the following entries:
|
|
* - `name` is the name of the method, as a [String];
|
|
* - `args` is an [Array] of dictionaries representing the arguments;
|
|
* - `default_args` is the default arguments as an [Array] of variants;
|
|
* - `flags` is a combination of [enum MethodFlags];
|
|
* - `id` is the method's internal identifier [int];
|
|
* - `return` is the returned value, as a [Dictionary];
|
|
*
|
|
* **Note:** The dictionaries of `args` and `return` are formatted identically to the results of [method get_property_list], although not all entries are used.
|
|
*/
|
|
get_method_list(): GArray
|
|
|
|
/** Returns `true` if the given [param property] has a custom default value. Use [method property_get_revert] to get the [param property]'s default value.
|
|
*
|
|
* **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns `false`.
|
|
*/
|
|
property_can_revert(property: StringName): boolean
|
|
|
|
/** Returns the custom default value of the given [param property]. Use [method property_can_revert] to check if the [param property] has a custom default value.
|
|
*
|
|
* **Note:** This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns `null`.
|
|
*/
|
|
property_get_revert(property: StringName): any
|
|
|
|
/** Sends the given [param what] notification to all classes inherited by the object, triggering calls to [method _notification], starting from the highest ancestor (the [Object] class) and going down to the object's script.
|
|
* If [param reversed] is `true`, the call order is reversed.
|
|
*
|
|
*/
|
|
notification(what: int64, reversed: boolean = false): void
|
|
|
|
/** Returns a [String] representing the object. Defaults to `"<ClassName#RID>"`. Override [method _to_string] to customize the string representation of the object. */
|
|
to_string(): string
|
|
|
|
/** Returns the object's unique instance ID. This ID can be saved in [EncodedObjectAsID], and can be used to retrieve this object instance with [method @GlobalScope.instance_from_id].
|
|
*
|
|
* **Note:** This ID is only useful during the current session. It won't correspond to a similar object if the ID is sent over a network, or loaded from a file at a later time.
|
|
*/
|
|
get_instance_id(): int64
|
|
|
|
/** Attaches [param script] to the object, and instantiates it. As a result, the script's [method _init] is called. A [Script] is used to extend the object's functionality.
|
|
* If a script already exists, its instance is detached, and its property values and state are lost. Built-in property values are still kept.
|
|
*/
|
|
set_script(script: any): void
|
|
|
|
/** Returns the object's [Script] instance, or `null` if no script is attached. */
|
|
get_script(): any
|
|
|
|
/** Adds or changes the entry [param name] inside the object's metadata. The metadata [param value] can be any [Variant], although some types cannot be serialized correctly.
|
|
* If [param value] is `null`, the entry is removed. This is the equivalent of using [method remove_meta]. See also [method has_meta] and [method get_meta].
|
|
*
|
|
* **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method.
|
|
*
|
|
* **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
*/
|
|
set_meta(name: StringName, value: any): void
|
|
|
|
/** Removes the given entry [param name] from the object's metadata. See also [method has_meta], [method get_meta] and [method set_meta].
|
|
*
|
|
* **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method.
|
|
*
|
|
* **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
*/
|
|
remove_meta(name: StringName): void
|
|
|
|
/** Returns the object's metadata value for the given entry [param name]. If the entry does not exist, returns [param default]. If [param default] is `null`, an error is also generated.
|
|
*
|
|
* **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method.
|
|
*
|
|
* **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
*/
|
|
get_meta(name: StringName, default_: any = <any> {}): any
|
|
|
|
/** Returns `true` if a metadata entry is found with the given [param name]. See also [method get_meta], [method set_meta] and [method remove_meta].
|
|
*
|
|
* **Note:** A metadata's name must be a valid identifier as per [method StringName.is_valid_identifier] method.
|
|
*
|
|
* **Note:** Metadata that has a name starting with an underscore (`_`) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
|
|
*/
|
|
has_meta(name: StringName): boolean
|
|
|
|
/** Returns the object's metadata entry names as an [Array] of [StringName]s. */
|
|
get_meta_list(): GArray
|
|
|
|
/** Adds a user-defined signal named [param signal]. Optional arguments for the signal can be added as an [Array] of dictionaries, each defining a `name` [String] and a `type` [int] (see [enum Variant.Type]). See also [method has_user_signal] and [method remove_user_signal].
|
|
*
|
|
*/
|
|
add_user_signal(signal: string, arguments_: GArray = []): void
|
|
|
|
/** Returns `true` if the given user-defined [param signal] name exists. Only signals added with [method add_user_signal] are included. See also [method remove_user_signal]. */
|
|
has_user_signal(signal: StringName): boolean
|
|
|
|
/** Removes the given user signal [param signal] from the object. See also [method add_user_signal] and [method has_user_signal]. */
|
|
remove_user_signal(signal: StringName): void
|
|
|
|
/** Emits the given [param signal] by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see [method add_user_signal]). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
|
|
* Returns [constant ERR_UNAVAILABLE] if [param signal] does not exist or the parameters are invalid.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
emit_signal(signal: StringName, ...vargargs: any[]): GError
|
|
|
|
/** Calls the [param method] on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
|
|
*
|
|
*
|
|
* **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
call(method: StringName, ...vargargs: any[]): any
|
|
|
|
/** Calls the [param method] on the object during idle time. Always returns `null`, **not** the method's result.
|
|
* Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
|
|
* This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
|
|
*
|
|
* See also [method Callable.call_deferred].
|
|
*
|
|
* **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call.
|
|
*
|
|
* **Note:** If you're looking to delay the function call by a frame, refer to the [signal SceneTree.process_frame] and [signal SceneTree.physics_frame] signals.
|
|
*
|
|
*/
|
|
call_deferred(method: StringName, ...vargargs: any[]): any
|
|
|
|
/** Assigns [param value] to the given [param property], at the end of the current frame. This is equivalent to calling [method set] through [method call_deferred].
|
|
*
|
|
*
|
|
* **Note:** In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the `PropertyName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
set_deferred(property: StringName, value: any): void
|
|
|
|
/** Calls the [param method] on the object and returns the result. Unlike [method call], this method expects all parameters to be contained inside [param arg_array].
|
|
*
|
|
*
|
|
* **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
callv(method: StringName, arg_array: GArray): any
|
|
|
|
/** Returns `true` if the given [param method] name exists in the object.
|
|
*
|
|
* **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
has_method(method: StringName): boolean
|
|
|
|
/** Returns the number of arguments of the given [param method] by name.
|
|
*
|
|
* **Note:** In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `MethodName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
get_method_argument_count(method: StringName): int64
|
|
|
|
/** Returns `true` if the given [param signal] name exists in the object.
|
|
*
|
|
* **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
has_signal(signal: StringName): boolean
|
|
|
|
/** Returns the list of existing signals as an [Array] of dictionaries.
|
|
*
|
|
* **Note:** Due of the implementation, each [Dictionary] is formatted very similarly to the returned values of [method get_method_list].
|
|
*/
|
|
get_signal_list(): GArray
|
|
|
|
/** Returns an [Array] of connections for the given [param signal] name. Each connection is represented as a [Dictionary] that contains three entries:
|
|
* - [code skip-lint]signal` is a reference to the [Signal];
|
|
* - `callable` is a reference to the connected [Callable];
|
|
* - `flags` is a combination of [enum ConnectFlags].
|
|
*/
|
|
get_signal_connection_list(signal: StringName): GArray
|
|
|
|
/** Returns an [Array] of signal connections received by this object. Each connection is represented as a [Dictionary] that contains three entries:
|
|
* - `signal` is a reference to the [Signal];
|
|
* - `callable` is a reference to the [Callable];
|
|
* - `flags` is a combination of [enum ConnectFlags].
|
|
*/
|
|
get_incoming_connections(): GArray
|
|
|
|
/** Connects a [param signal] by name to a [param callable]. Optional [param flags] can be also added to configure the connection's behavior (see [enum ConnectFlags] constants).
|
|
* A signal can only be connected once to the same [Callable]. If the signal is already connected, this method returns [constant ERR_INVALID_PARAMETER] and pushes an error message, unless the signal is connected with [constant CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first to check for existing connections.
|
|
* If the [param callable]'s object is freed, the connection will be lost.
|
|
* **Examples with recommended syntax:**
|
|
* Connecting signals is one of the most common operations in Godot and the API gives many options to do so, which are described further down. The code block below shows the recommended approach.
|
|
*
|
|
* **[code skip-lint]Object.connect()` or [code skip-lint]Signal.connect()`?**
|
|
* As seen above, the recommended method to connect signals is not [method Object.connect]. The code block below shows the four options for connecting signals, using either this legacy method or the recommended [method Signal.connect], and using either an implicit [Callable] or a manually defined one.
|
|
*
|
|
* While all options have the same outcome (`button`'s [signal BaseButton.button_down] signal will be connected to `_on_button_down`), **option 3** offers the best validation: it will print a compile-time error if either the `button_down` [Signal] or the `_on_button_down` [Callable] are not defined. On the other hand, **option 2** only relies on string names and will only be able to validate either names at runtime: it will print a runtime error if `"button_down"` doesn't correspond to a signal, or if `"_on_button_down"` is not a registered method in the object `self`. The main reason for using options 1, 2, or 4 would be if you actually need to use strings (e.g. to connect signals programmatically based on strings read from a configuration file). Otherwise, option 3 is the recommended (and fastest) method.
|
|
* **Binding and passing parameters:**
|
|
* The syntax to bind parameters is through [method Callable.bind], which returns a copy of the [Callable] with its parameters bound.
|
|
* When calling [method emit_signal] or [method Signal.emit], the signal parameters can be also passed. The examples below show the relationship between these signal parameters and bound parameters.
|
|
*
|
|
*/
|
|
connect(signal: StringName, callable: Callable, flags: int64 = 0): GError
|
|
|
|
/** Disconnects a [param signal] by name from a given [param callable]. If the connection does not exist, generates an error. Use [method is_connected] to make sure that the connection exists. */
|
|
disconnect(signal: StringName, callable: Callable): void
|
|
|
|
/** Returns `true` if a connection exists between the given [param signal] name and [param callable].
|
|
*
|
|
* **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
is_connected(signal: StringName, callable: Callable): boolean
|
|
|
|
/** Returns `true` if any connection exists on the given [param signal] name.
|
|
*
|
|
* **Note:** In C#, [param signal] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the `SignalName` class to avoid allocating a new [StringName] on each call.
|
|
*/
|
|
has_connections(signal: StringName): boolean
|
|
|
|
/** If set to `true`, the object becomes unable to emit signals. As such, [method emit_signal] and signal connections will not work, until it is set to `false`. */
|
|
set_block_signals(enable: boolean): void
|
|
|
|
/** Returns `true` if the object is blocking its signals from being emitted. See [method set_block_signals]. */
|
|
is_blocking_signals(): boolean
|
|
|
|
/** Emits the [signal property_list_changed] signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated. */
|
|
notify_property_list_changed(): void
|
|
|
|
/** If set to `true`, allows the object to translate messages with [method tr] and [method tr_n]. Enabled by default. See also [method can_translate_messages]. */
|
|
set_message_translation(enable: boolean): void
|
|
|
|
/** Returns `true` if the object is allowed to translate messages with [method tr] and [method tr_n]. See also [method set_message_translation]. */
|
|
can_translate_messages(): boolean
|
|
|
|
/** Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
|
|
* If [method can_translate_messages] is `false`, or no translation is available, this method returns the [param message] without changes. See [method set_message_translation].
|
|
* For detailed examples, see [url=https://docs.godotengine.org/en/4.4/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
|
|
*
|
|
* **Note:** This method can't be used without an [Object] instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate].
|
|
*/
|
|
tr(message: StringName, context: StringName = ''): string
|
|
|
|
/** Translates a [param message] or [param plural_message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
|
|
* If [method can_translate_messages] is `false`, or no translation is available, this method returns [param message] or [param plural_message], without changes. See [method set_message_translation].
|
|
* The [param n] is the number, or amount, of the message's subject. It is used by the translation system to fetch the correct plural form for the current language.
|
|
* For detailed examples, see [url=https://docs.godotengine.org/en/4.4/tutorials/i18n/localization_using_gettext.html]Localization using gettext[/url].
|
|
*
|
|
* **Note:** Negative and [float] numbers may not properly apply to some countable subjects. It's recommended to handle these cases with [method tr].
|
|
*
|
|
* **Note:** This method can't be used without an [Object] instance, as it requires the [method can_translate_messages] method. To translate strings in a static context, use [method TranslationServer.translate_plural].
|
|
*/
|
|
tr_n(message: StringName, plural_message: StringName, n: int64, context: StringName = ''): string
|
|
|
|
/** Returns the name of the translation domain used by [method tr] and [method tr_n]. See also [TranslationServer]. */
|
|
get_translation_domain(): StringName
|
|
|
|
/** Sets the name of the translation domain used by [method tr] and [method tr_n]. See also [TranslationServer]. */
|
|
set_translation_domain(domain: StringName): void
|
|
|
|
/** Returns `true` if the [method Node.queue_free] method was called for the object. */
|
|
is_queued_for_deletion(): boolean
|
|
|
|
/** If this method is called during [constant NOTIFICATION_PREDELETE], this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to. */
|
|
cancel_free(): void
|
|
|
|
/** Emitted when the object's script is changed.
|
|
*
|
|
* **Note:** When this signal is emitted, the new script is not initialized yet. If you need to access the new script, defer connections to this signal with [constant CONNECT_DEFERRED].
|
|
*/
|
|
readonly script_changed: Signal0
|
|
|
|
/** Emitted when [method notify_property_list_changed] is called. */
|
|
readonly property_list_changed: Signal0
|
|
}
|
|
/** Occluder shape resource for use with occlusion culling in [OccluderInstance3D].
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_occluder3d.html
|
|
*/
|
|
class Occluder3D extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Returns the occluder shape's vertex positions. */
|
|
get_vertices(): PackedVector3Array
|
|
|
|
/** Returns the occluder shape's vertex indices. */
|
|
get_indices(): PackedInt32Array
|
|
}
|
|
/** Provides occlusion culling for 3D nodes, which improves performance in closed areas.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_occluderinstance3d.html
|
|
*/
|
|
class OccluderInstance3D<Map extends Record<string, Node> = Record<string, Node>> extends VisualInstance3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Based on [param value], enables or disables the specified layer in the [member bake_mask], given a [param layer_number] between 1 and 32. */
|
|
set_bake_mask_value(layer_number: int64, value: boolean): void
|
|
|
|
/** Returns whether or not the specified layer of the [member bake_mask] is enabled, given a [param layer_number] between 1 and 32. */
|
|
get_bake_mask_value(layer_number: int64): boolean
|
|
_is_editable_3d_polygon(): boolean
|
|
_get_editable_3d_polygon_resource(): Resource
|
|
|
|
/** The occluder resource for this [OccluderInstance3D]. You can generate an occluder resource by selecting an [OccluderInstance3D] node then using the **Bake Occluders** button at the top of the editor.
|
|
* You can also draw your own 2D occluder polygon by adding a new [PolygonOccluder3D] resource to the [member occluder] property in the Inspector.
|
|
* Alternatively, you can select a primitive occluder to use: [QuadOccluder3D], [BoxOccluder3D] or [SphereOccluder3D].
|
|
*/
|
|
get occluder(): Occluder3D
|
|
set occluder(value: Occluder3D)
|
|
|
|
/** The visual layers to account for when baking for occluders. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member bake_mask] will be included in the generated occluder mesh. By default, all objects with *opaque* materials are taken into account for the occluder baking.
|
|
* To improve performance and avoid artifacts, it is recommended to exclude dynamic objects, small objects and fixtures from the baking process by moving them to a separate visual layer and excluding this layer in [member bake_mask].
|
|
*/
|
|
get bake_mask(): int64
|
|
set bake_mask(value: int64)
|
|
|
|
/** The simplification distance to use for simplifying the generated occluder polygon (in 3D units). Higher values result in a less detailed occluder mesh, which improves performance but reduces culling accuracy.
|
|
* The occluder geometry is rendered on the CPU, so it is important to keep its geometry as simple as possible. Since the buffer is rendered at a low resolution, less detailed occluder meshes generally still work well. The default value is fairly aggressive, so you may have to decrease it if you run into false negatives (objects being occluded even though they are visible by the camera). A value of `0.01` will act conservatively, and will keep geometry *perceptually* unaffected in the occlusion culling buffer. Depending on the scene, a value of `0.01` may still simplify the mesh noticeably compared to disabling simplification entirely.
|
|
* Setting this to `0.0` disables simplification entirely, but vertices in the exact same position will still be merged. The mesh will also be re-indexed to reduce both the number of vertices and indices.
|
|
*
|
|
* **Note:** This uses the [url=https://meshoptimizer.org/]meshoptimizer[/url] library under the hood, similar to LOD generation.
|
|
*/
|
|
get bake_simplification_distance(): float64
|
|
set bake_simplification_distance(value: float64)
|
|
}
|
|
class OccluderInstance3DEditorPlugin<Map extends Record<string, Node> = Record<string, Node>> extends EditorPlugin<Map> {
|
|
constructor(identifier?: any)
|
|
_bake(): void
|
|
}
|
|
class OccluderInstance3DGizmoPlugin extends EditorNode3DGizmoPlugin {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace OccluderPolygon2D {
|
|
enum CullMode {
|
|
/** Culling is disabled. See [member cull_mode]. */
|
|
CULL_DISABLED = 0,
|
|
|
|
/** Culling is performed in the clockwise direction. See [member cull_mode]. */
|
|
CULL_CLOCKWISE = 1,
|
|
|
|
/** Culling is performed in the counterclockwise direction. See [member cull_mode]. */
|
|
CULL_COUNTER_CLOCKWISE = 2,
|
|
}
|
|
}
|
|
/** Defines a 2D polygon for LightOccluder2D.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_occluderpolygon2d.html
|
|
*/
|
|
class OccluderPolygon2D extends Resource {
|
|
constructor(identifier?: any)
|
|
/** If `true`, closes the polygon. A closed OccluderPolygon2D occludes the light coming from any direction. An opened OccluderPolygon2D occludes the light only at its outline's direction. */
|
|
get closed(): boolean
|
|
set closed(value: boolean)
|
|
|
|
/** The culling mode to use. */
|
|
get cull_mode(): int64
|
|
set cull_mode(value: int64)
|
|
|
|
/** A [Vector2] array with the index for polygon's vertices positions. */
|
|
get polygon(): PackedVector2Array
|
|
set polygon(value: PackedVector2Array | Vector2[])
|
|
}
|
|
/** A [MultiplayerPeer] which is always connected and acts as a server.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_offlinemultiplayerpeer.html
|
|
*/
|
|
class OfflineMultiplayerPeer extends MultiplayerPeer {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** A sequence of Ogg packets.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_oggpacketsequence.html
|
|
*/
|
|
class OggPacketSequence extends Resource {
|
|
constructor(identifier?: any)
|
|
/** The length of this stream, in seconds. */
|
|
get_length(): float64
|
|
|
|
/** Contains the raw packets that make up this OggPacketSequence. */
|
|
get packet_data(): GArray
|
|
set packet_data(value: GArray)
|
|
|
|
/** Contains the granule positions for each page in this packet sequence. */
|
|
get granule_positions(): PackedInt64Array
|
|
set granule_positions(value: PackedInt64Array | int64[])
|
|
|
|
/** Holds sample rate information about this sequence. Must be set by another class that actually understands the codec. */
|
|
get sampling_rate(): float64
|
|
set sampling_rate(value: float64)
|
|
}
|
|
/** @link https://docs.godotengine.org/en/4.4/classes/class_oggpacketsequenceplayback.html */
|
|
class OggPacketSequencePlayback extends RefCounted {
|
|
constructor(identifier?: any)
|
|
}
|
|
namespace OmniLight3D {
|
|
enum ShadowMode {
|
|
/** Shadows are rendered to a dual-paraboloid texture. Faster than [constant SHADOW_CUBE], but lower-quality. */
|
|
SHADOW_DUAL_PARABOLOID = 0,
|
|
|
|
/** Shadows are rendered to a cubemap. Slower than [constant SHADOW_DUAL_PARABOLOID], but higher-quality. */
|
|
SHADOW_CUBE = 1,
|
|
}
|
|
}
|
|
/** Omnidirectional light, such as a light bulb or a candle.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_omnilight3d.html
|
|
*/
|
|
class OmniLight3D<Map extends Record<string, Node> = Record<string, Node>> extends Light3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** The light's radius. Note that the effectively lit area may appear to be smaller depending on the [member omni_attenuation] in use. No matter the [member omni_attenuation] in use, the light will never reach anything outside this radius.
|
|
*
|
|
* **Note:** [member omni_range] is not affected by [member Node3D.scale] (the light's scale or its parent's scale).
|
|
*/
|
|
get omni_range(): float64
|
|
set omni_range(value: float64)
|
|
|
|
/** Controls the distance attenuation function for omnilights.
|
|
* A value of `0.0` will maintain a constant brightness through most of the range, but smoothly attenuate the light at the edge of the range. Use a value of `2.0` for physically accurate lights as it results in the proper inverse square attenutation.
|
|
*
|
|
* **Note:** Setting attenuation to `2.0` or higher may result in distant objects receiving minimal light, even within range. For example, with a range of `4096`, an object at `100` units is attenuated by a factor of `0.0001`. With a default brightness of `1`, the light would not be visible at that distance.
|
|
*
|
|
* **Note:** Using negative or values higher than `10.0` may lead to unexpected results.
|
|
*/
|
|
get omni_attenuation(): float64
|
|
set omni_attenuation(value: float64)
|
|
|
|
/** See [enum ShadowMode]. */
|
|
get omni_shadow_mode(): int64
|
|
set omni_shadow_mode(value: int64)
|
|
}
|
|
namespace OpenXRAPIExtension {
|
|
enum OpenXRAlphaBlendModeSupport {
|
|
/** Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] isn't supported at all. */
|
|
OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE = 0,
|
|
|
|
/** Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is really supported. */
|
|
OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL = 1,
|
|
|
|
/** Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is emulated. */
|
|
OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING = 2,
|
|
}
|
|
}
|
|
/** Makes the OpenXR API available for GDExtension.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrapiextension.html
|
|
*/
|
|
class OpenXRAPIExtension extends RefCounted {
|
|
constructor(identifier?: any)
|
|
/** Returns the [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html]XrInstance[/url] created during the initialization of the OpenXR API. */
|
|
get_instance(): int64
|
|
|
|
/** Returns the id of the system, which is a [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html]XrSystemId[/url] cast to an integer. */
|
|
get_system_id(): int64
|
|
|
|
/** Returns the OpenXR session, which is an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html]XrSession[/url] cast to an integer. */
|
|
get_session(): int64
|
|
|
|
/** Creates a [Transform3D] from an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html]XrPosef[/url]. */
|
|
transform_from_pose(pose: int64): Transform3D
|
|
|
|
/** Returns `true` if the provided [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url] (cast to an integer) is successful. Otherwise returns `false` and prints the [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url] converted to a string, with the specified additional information. */
|
|
xr_result(result: int64, format: string, args: GArray): boolean
|
|
|
|
/** Returns `true` if OpenXR is enabled. */
|
|
static openxr_is_enabled(check_run_in_editor: boolean): boolean
|
|
|
|
/** Returns the function pointer of the OpenXR function with the specified name, cast to an integer. If the function with the given name does not exist, the method returns `0`.
|
|
*
|
|
* **Note:** `openxr/util.h` contains utility macros for acquiring OpenXR functions, e.g. `GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction)`.
|
|
*/
|
|
get_instance_proc_addr(name: string): int64
|
|
|
|
/** Returns an error string for the given [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url]. */
|
|
get_error_string(result: int64): string
|
|
|
|
/** Returns the name of the specified swapchain format. */
|
|
get_swapchain_format_name(swapchain_format: int64): string
|
|
|
|
/** Set the object name of an OpenXR object, used for debug output. [param object_type] must be a valid OpenXR `XrObjectType` enum and [param object_handle] must be a valid OpenXR object handle. */
|
|
set_object_name(object_type: int64, object_handle: int64, object_name: string): void
|
|
|
|
/** Begins a new debug label region, this label will be reported in debug messages for any calls following this until [method end_debug_label_region] is called. Debug labels can be stacked. */
|
|
begin_debug_label_region(label_name: string): void
|
|
|
|
/** Marks the end of a debug label region. Removes the latest debug label region added by calling [method begin_debug_label_region]. */
|
|
end_debug_label_region(): void
|
|
|
|
/** Inserts a debug label, this label is reported in any debug message resulting from the OpenXR calls that follows, until any of [method begin_debug_label_region], [method end_debug_label_region], or [method insert_debug_label] is called. */
|
|
insert_debug_label(label_name: string): void
|
|
|
|
/** Returns `true` if OpenXR is initialized. */
|
|
is_initialized(): boolean
|
|
|
|
/** Returns `true` if OpenXR is running ([url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html]xrBeginSession[/url] was successfully called and the swapchains were created). */
|
|
is_running(): boolean
|
|
|
|
/** Returns the play space, which is an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html]XrSpace[/url] cast to an integer. */
|
|
get_play_space(): int64
|
|
|
|
/** Returns the predicted display timing for the current frame. */
|
|
get_predicted_display_time(): int64
|
|
|
|
/** Returns the predicted display timing for the next frame. */
|
|
get_next_frame_time(): int64
|
|
|
|
/** Returns `true` if OpenXR is initialized for rendering with an XR viewport. */
|
|
can_render(): boolean
|
|
|
|
/** Returns the [RID] corresponding to an `Action` of a matching name, optionally limited to a specified action set. */
|
|
find_action(name: string, action_set: RID): RID
|
|
|
|
/** Returns the corresponding `XrAction` OpenXR handle for the given action RID. */
|
|
action_get_handle(action: RID): int64
|
|
|
|
/** Returns the corresponding `XRHandTrackerEXT` handle for the given hand index value. */
|
|
get_hand_tracker(hand_index: int64): int64
|
|
|
|
/** Registers the given extension as a composition layer provider. */
|
|
register_composition_layer_provider(extension: OpenXRExtensionWrapperExtension): void
|
|
|
|
/** Unregisters the given extension as a composition layer provider. */
|
|
unregister_composition_layer_provider(extension: OpenXRExtensionWrapperExtension): void
|
|
|
|
/** Registers the given extension as a provider of additional data structures to projections views. */
|
|
register_projection_views_extension(extension: OpenXRExtensionWrapperExtension): void
|
|
|
|
/** Unregisters the given extension as a provider of additional data structures to projections views. */
|
|
unregister_projection_views_extension(extension: OpenXRExtensionWrapperExtension): void
|
|
|
|
/** Returns the near boundary value of the camera frustum.
|
|
*
|
|
* **Note:** This is only accessible in the render thread.
|
|
*/
|
|
get_render_state_z_near(): float64
|
|
|
|
/** Returns the far boundary value of the camera frustum.
|
|
*
|
|
* **Note:** This is only accessible in the render thread.
|
|
*/
|
|
get_render_state_z_far(): float64
|
|
|
|
/** Sets the render target of the velocity texture. */
|
|
set_velocity_texture(render_target: RID): void
|
|
|
|
/** Sets the render target of the velocity depth texture. */
|
|
set_velocity_depth_texture(render_target: RID): void
|
|
|
|
/** Sets the target size of the velocity and velocity depth textures. */
|
|
set_velocity_target_size(target_size: Vector2i): void
|
|
|
|
/** Returns an array of supported swapchain formats. */
|
|
get_supported_swapchain_formats(): PackedInt64Array
|
|
|
|
/** Returns a pointer to a new swapchain created using the provided parameters. */
|
|
openxr_swapchain_create(create_flags: int64, usage_flags: int64, swapchain_format: int64, width: int64, height: int64, sample_count: int64, array_size: int64): int64
|
|
|
|
/** Destroys the provided swapchain and frees it from memory. */
|
|
openxr_swapchain_free(swapchain: int64): void
|
|
|
|
/** Returns the `XrSwapchain` handle of the provided swapchain. */
|
|
openxr_swapchain_get_swapchain(swapchain: int64): int64
|
|
|
|
/** Acquires the image of the provided swapchain. */
|
|
openxr_swapchain_acquire(swapchain: int64): void
|
|
|
|
/** Returns the RID of the provided swapchain's image. */
|
|
openxr_swapchain_get_image(swapchain: int64): RID
|
|
|
|
/** Releases the image of the provided swapchain. */
|
|
openxr_swapchain_release(swapchain: int64): void
|
|
|
|
/** Returns a pointer to the render state's `XrCompositionLayerProjection` struct.
|
|
*
|
|
* **Note:** This method should only be called from the rendering thread.
|
|
*/
|
|
get_projection_layer(): int64
|
|
|
|
/** Sets the render region to [param render_region], overriding the normal render target's rect. */
|
|
set_render_region(render_region: Rect2i): void
|
|
|
|
/** If set to `true`, an OpenXR extension is loaded which is capable of emulating the [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] blend mode. */
|
|
set_emulate_environment_blend_mode_alpha_blend(enabled: boolean): void
|
|
|
|
/** Returns [enum OpenXRAPIExtension.OpenXRAlphaBlendModeSupport] denoting if [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is really supported, emulated or not supported at all. */
|
|
is_environment_blend_mode_alpha_supported(): OpenXRAPIExtension.OpenXRAlphaBlendModeSupport
|
|
}
|
|
namespace OpenXRAction {
|
|
enum ActionType {
|
|
/** This action provides a boolean value. */
|
|
OPENXR_ACTION_BOOL = 0,
|
|
|
|
/** This action provides a float value between `0.0` and `1.0` for any analog input such as triggers. */
|
|
OPENXR_ACTION_FLOAT = 1,
|
|
|
|
/** This action provides a [Vector2] value and can be bound to embedded trackpads and joysticks. */
|
|
OPENXR_ACTION_VECTOR2 = 2,
|
|
OPENXR_ACTION_POSE = 3,
|
|
}
|
|
}
|
|
/** An OpenXR action.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxraction.html
|
|
*/
|
|
class OpenXRAction extends Resource {
|
|
constructor(identifier?: any)
|
|
/** The localized description of this action. */
|
|
get localized_name(): string
|
|
set localized_name(value: string)
|
|
|
|
/** The type of action. */
|
|
get action_type(): int64
|
|
set action_type(value: int64)
|
|
|
|
/** A collections of toplevel paths to which this action can be bound. */
|
|
get toplevel_paths(): PackedStringArray
|
|
set toplevel_paths(value: PackedStringArray | string[])
|
|
}
|
|
/** Binding modifier that applies on individual actions related to an interaction profile.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxractionbindingmodifier.html
|
|
*/
|
|
class OpenXRActionBindingModifier extends OpenXRBindingModifier {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Collection of [OpenXRActionSet] and [OpenXRInteractionProfile] resources for the OpenXR module.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxractionmap.html
|
|
*/
|
|
class OpenXRActionMap extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Retrieve the number of actions sets in our action map. */
|
|
get_action_set_count(): int64
|
|
|
|
/** Retrieve an action set by name. */
|
|
find_action_set(name: string): OpenXRActionSet
|
|
|
|
/** Retrieve the action set at this index. */
|
|
get_action_set(idx: int64): OpenXRActionSet
|
|
|
|
/** Add an action set. */
|
|
add_action_set(action_set: OpenXRActionSet): void
|
|
|
|
/** Remove an action set. */
|
|
remove_action_set(action_set: OpenXRActionSet): void
|
|
|
|
/** Retrieve the number of interaction profiles in our action map. */
|
|
get_interaction_profile_count(): int64
|
|
|
|
/** Find an interaction profile by its name (path). */
|
|
find_interaction_profile(name: string): OpenXRInteractionProfile
|
|
|
|
/** Get the interaction profile at this index. */
|
|
get_interaction_profile(idx: int64): OpenXRInteractionProfile
|
|
|
|
/** Add an interaction profile. */
|
|
add_interaction_profile(interaction_profile: OpenXRInteractionProfile): void
|
|
|
|
/** Remove an interaction profile. */
|
|
remove_interaction_profile(interaction_profile: OpenXRInteractionProfile): void
|
|
|
|
/** Setup this action set with our default actions. */
|
|
create_default_action_sets(): void
|
|
|
|
/** Collection of [OpenXRActionSet]s that are part of this action map. */
|
|
get action_sets(): OpenXRActionSet
|
|
set action_sets(value: OpenXRActionSet)
|
|
|
|
/** Collection of [OpenXRInteractionProfile]s that are part of this action map. */
|
|
get interaction_profiles(): OpenXRInteractionProfile
|
|
set interaction_profiles(value: OpenXRInteractionProfile)
|
|
}
|
|
/** Collection of [OpenXRAction] resources that make up an action set.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxractionset.html
|
|
*/
|
|
class OpenXRActionSet extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Retrieve the number of actions in our action set. */
|
|
get_action_count(): int64
|
|
|
|
/** Add an action to this action set. */
|
|
add_action(action: OpenXRAction): void
|
|
|
|
/** Remove an action from this action set. */
|
|
remove_action(action: OpenXRAction): void
|
|
|
|
/** The localized name of this action set. */
|
|
get localized_name(): string
|
|
set localized_name(value: string)
|
|
|
|
/** The priority for this action set. */
|
|
get priority(): int64
|
|
set priority(value: int64)
|
|
|
|
/** Collection of actions for this action set. */
|
|
get actions(): OpenXRAction
|
|
set actions(value: OpenXRAction)
|
|
}
|
|
/** The analog threshold binding modifier can modify a float input to a boolean input with specified thresholds.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxranalogthresholdmodifier.html
|
|
*/
|
|
class OpenXRAnalogThresholdModifier extends OpenXRActionBindingModifier {
|
|
constructor(identifier?: any)
|
|
/** When our input value is equal or larger than this value, our output becomes true. It stays true until it falls under the [member off_threshold] value. */
|
|
get on_threshold(): float64
|
|
set on_threshold(value: float64)
|
|
|
|
/** When our input value falls below this, our output becomes false. */
|
|
get off_threshold(): float64
|
|
set off_threshold(value: float64)
|
|
|
|
/** Haptic pulse to emit when the user presses the input. */
|
|
get on_haptic(): OpenXRHapticBase
|
|
set on_haptic(value: OpenXRHapticBase)
|
|
|
|
/** Haptic pulse to emit when the user releases the input. */
|
|
get off_haptic(): OpenXRHapticBase
|
|
set off_haptic(value: OpenXRHapticBase)
|
|
}
|
|
/** Binding modifier base class.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrbindingmodifier.html
|
|
*/
|
|
class OpenXRBindingModifier extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Return the description of this class that is used for the title bar of the binding modifier editor. */
|
|
/* gdvirtual */ _get_description(): string
|
|
|
|
/** Returns the data that is sent to OpenXR when submitting the suggested interacting bindings this modifier is a part of.
|
|
*
|
|
* **Note:** This must be data compatible with a `XrBindingModificationBaseHeaderKHR` structure.
|
|
*/
|
|
/* gdvirtual */ _get_ip_modification(): PackedByteArray
|
|
}
|
|
/** Binding modifier editor.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrbindingmodifiereditor.html
|
|
*/
|
|
class OpenXRBindingModifierEditor<Map extends Record<string, Node> = Record<string, Node>> extends PanelContainer<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns the [OpenXRBindingModifier] currently being edited. */
|
|
get_binding_modifier(): OpenXRBindingModifier
|
|
|
|
/** Setup this editor for the provided [param action_map] and [param binding_modifier]. */
|
|
setup(action_map: OpenXRActionMap, binding_modifier: OpenXRBindingModifier): void
|
|
|
|
/** Signal emitted when the user presses the delete binding modifier button for this modifier. */
|
|
readonly binding_modifier_removed: Signal1<Object>
|
|
}
|
|
/** The parent class of all OpenXR composition layer nodes.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrcompositionlayer.html
|
|
*/
|
|
class OpenXRCompositionLayer<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Returns a [JavaObject] representing an `android.view.Surface` if [member use_android_surface] is enabled and OpenXR has created the surface. Otherwise, this will return `null`.
|
|
*
|
|
* **Note:** The surface can only be created during an active OpenXR session. So, if [member use_android_surface] is enabled outside of an OpenXR session, it won't be created until a new session fully starts.
|
|
*/
|
|
get_android_surface(): JavaObject
|
|
|
|
/** Returns `true` if the OpenXR runtime natively supports this composition layer type.
|
|
*
|
|
* **Note:** This will only return an accurate result after the OpenXR session has started.
|
|
*/
|
|
is_natively_supported(): boolean
|
|
|
|
/** Returns UV coordinates where the given ray intersects with the composition layer. [param origin] and [param direction] must be in global space.
|
|
* Returns `Vector2(-1.0, -1.0)` if the ray doesn't intersect.
|
|
*/
|
|
intersects_ray(origin: Vector3, direction: Vector3): Vector2
|
|
|
|
/** The [SubViewport] to render on the composition layer. */
|
|
get layer_viewport(): Object
|
|
set layer_viewport(value: Object)
|
|
|
|
/** If enabled, an Android surface will be created (with the dimensions from [member android_surface_size]) which will provide the 2D content for the composition layer, rather than using [member layer_viewport].
|
|
* See [method get_android_surface] for information about how to get the surface so that your application can draw to it.
|
|
*
|
|
* **Note:** This will only work in Android builds.
|
|
*/
|
|
get use_android_surface(): boolean
|
|
set use_android_surface(value: boolean)
|
|
|
|
/** The size of the Android surface to create if [member use_android_surface] is enabled. */
|
|
get android_surface_size(): Vector2i
|
|
set android_surface_size(value: Vector2i)
|
|
|
|
/** The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.
|
|
*
|
|
* **Note:** This will have no effect if a fallback mesh is being used.
|
|
*/
|
|
get sort_order(): int64
|
|
set sort_order(value: int64)
|
|
|
|
/** Enables the blending the layer using its alpha channel.
|
|
* Can be combined with [member Viewport.transparent_bg] to give the layer a transparent background.
|
|
*/
|
|
get alpha_blend(): boolean
|
|
set alpha_blend(value: boolean)
|
|
|
|
/** Enables a technique called "hole punching", which allows putting the composition layer behind the main projection layer (i.e. setting [member sort_order] to a negative value) while "punching a hole" through everything rendered by Godot so that the layer is still visible.
|
|
* This can be used to create the illusion that the composition layer exists in the same 3D space as everything rendered by Godot, allowing objects to appear to pass both behind or in front of the composition layer.
|
|
*/
|
|
get enable_hole_punch(): boolean
|
|
set enable_hole_punch(value: boolean)
|
|
}
|
|
/** An OpenXR composition layer that is rendered as an internal slice of a cylinder.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrcompositionlayercylinder.html
|
|
*/
|
|
class OpenXRCompositionLayerCylinder<Map extends Record<string, Node> = Record<string, Node>> extends OpenXRCompositionLayer<Map> {
|
|
constructor(identifier?: any)
|
|
/** The radius of the cylinder. */
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** The aspect ratio of the slice. Used to set the height relative to the width. */
|
|
get aspect_ratio(): float64
|
|
set aspect_ratio(value: float64)
|
|
|
|
/** The central angle of the cylinder. Used to set the width. */
|
|
get central_angle(): float64
|
|
set central_angle(value: float64)
|
|
|
|
/** The number of segments to use in the fallback mesh. */
|
|
get fallback_segments(): int64
|
|
set fallback_segments(value: int64)
|
|
}
|
|
/** An OpenXR composition layer that is rendered as an internal slice of a sphere.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrcompositionlayerequirect.html
|
|
*/
|
|
class OpenXRCompositionLayerEquirect<Map extends Record<string, Node> = Record<string, Node>> extends OpenXRCompositionLayer<Map> {
|
|
constructor(identifier?: any)
|
|
/** The radius of the sphere. */
|
|
get radius(): float64
|
|
set radius(value: float64)
|
|
|
|
/** The central horizontal angle of the sphere. Used to set the width. */
|
|
get central_horizontal_angle(): float64
|
|
set central_horizontal_angle(value: float64)
|
|
|
|
/** The upper vertical angle of the sphere. Used (together with [member lower_vertical_angle]) to set the height. */
|
|
get upper_vertical_angle(): float64
|
|
set upper_vertical_angle(value: float64)
|
|
|
|
/** The lower vertical angle of the sphere. Used (together with [member upper_vertical_angle]) to set the height. */
|
|
get lower_vertical_angle(): float64
|
|
set lower_vertical_angle(value: float64)
|
|
|
|
/** The number of segments to use in the fallback mesh. */
|
|
get fallback_segments(): int64
|
|
set fallback_segments(value: int64)
|
|
}
|
|
/** An OpenXR composition layer that is rendered as a quad.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrcompositionlayerquad.html
|
|
*/
|
|
class OpenXRCompositionLayerQuad<Map extends Record<string, Node> = Record<string, Node>> extends OpenXRCompositionLayer<Map> {
|
|
constructor(identifier?: any)
|
|
/** The dimensions of the quad. */
|
|
get quad_size(): Vector2
|
|
set quad_size(value: Vector2)
|
|
}
|
|
/** The DPad binding modifier converts an axis input to a dpad output.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrdpadbindingmodifier.html
|
|
*/
|
|
class OpenXRDpadBindingModifier extends OpenXRIPBindingModifier {
|
|
constructor(identifier?: any)
|
|
/** Action set for which this dpad binding modifier is active. */
|
|
get action_set(): OpenXRActionSet
|
|
set action_set(value: OpenXRActionSet)
|
|
|
|
/** Input path for this dpad binding modifier. */
|
|
get input_path(): string
|
|
set input_path(value: string)
|
|
|
|
/** When our input value is equal or larger than this value, our dpad in that direction becomes true. It stays true until it falls under the [member threshold_released] value. */
|
|
get threshold(): float64
|
|
set threshold(value: float64)
|
|
|
|
/** When our input value falls below this, our output becomes false. */
|
|
get threshold_released(): float64
|
|
set threshold_released(value: float64)
|
|
|
|
/** Center region in which our center position of our dpad return `true`. */
|
|
get center_region(): float64
|
|
set center_region(value: float64)
|
|
|
|
/** The angle of each wedge that identifies the 4 directions of the emulated dpad. */
|
|
get wedge_angle(): float64
|
|
set wedge_angle(value: float64)
|
|
|
|
/** If `false`, when the joystick enters a new dpad zone this becomes true.
|
|
* If `true`, when the joystick remains in active dpad zone, this remains true even if we overlap with another zone.
|
|
*/
|
|
get is_sticky(): boolean
|
|
set is_sticky(value: boolean)
|
|
|
|
/** Haptic pulse to emit when the user presses the input. */
|
|
get on_haptic(): OpenXRHapticBase
|
|
set on_haptic(value: OpenXRHapticBase)
|
|
|
|
/** Haptic pulse to emit when the user releases the input. */
|
|
get off_haptic(): OpenXRHapticBase
|
|
set off_haptic(value: OpenXRHapticBase)
|
|
}
|
|
/** Allows clients to implement OpenXR extensions with GDExtension.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrextensionwrapperextension.html
|
|
*/
|
|
class OpenXRExtensionWrapperExtension extends Object {
|
|
constructor(identifier?: any)
|
|
/** Returns a [Dictionary] of OpenXR extensions related to this extension. The [Dictionary] should contain the name of the extension, mapped to a `bool *` cast to an integer:
|
|
* - If the `bool *` is a `nullptr` this extension is mandatory.
|
|
* - If the `bool *` points to a boolean, the boolean will be updated to `true` if the extension is enabled.
|
|
*/
|
|
/* gdvirtual */ _get_requested_extensions(): GDictionary
|
|
|
|
/** Adds additional data structures when querying OpenXR system abilities. */
|
|
/* gdvirtual */ _set_system_properties_and_get_next_pointer(next_pointer: int64): int64
|
|
|
|
/** Adds additional data structures when the OpenXR instance is created. */
|
|
/* gdvirtual */ _set_instance_create_info_and_get_next_pointer(next_pointer: int64): int64
|
|
|
|
/** Adds additional data structures when the OpenXR session is created. */
|
|
/* gdvirtual */ _set_session_create_and_get_next_pointer(next_pointer: int64): int64
|
|
|
|
/** Adds additional data structures when creating OpenXR swapchains. */
|
|
/* gdvirtual */ _set_swapchain_create_info_and_get_next_pointer(next_pointer: int64): int64
|
|
|
|
/** Adds additional data structures when each hand tracker is created. */
|
|
/* gdvirtual */ _set_hand_joint_locations_and_get_next_pointer(hand_index: int64, next_pointer: int64): int64
|
|
|
|
/** Adds additional data structures to the projection view of the given [param view_index]. */
|
|
/* gdvirtual */ _set_projection_views_and_get_next_pointer(view_index: int64, next_pointer: int64): int64
|
|
|
|
/** Returns the number of composition layers this extension wrapper provides via [method _get_composition_layer].
|
|
* This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
|
*/
|
|
/* gdvirtual */ _get_composition_layer_count(): int64
|
|
|
|
/** Returns a pointer to an `XrCompositionLayerBaseHeader` struct to provide the given composition layer.
|
|
* This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
|
*/
|
|
/* gdvirtual */ _get_composition_layer(index: int64): int64
|
|
|
|
/** Returns an integer that will be used to sort the given composition layer provided via [method _get_composition_layer]. Lower numbers will move the layer to the front of the list, and higher numbers to the end. The default projection layer has an order of `0`, so layers provided by this method should probably be above or below (but not exactly) `0`.
|
|
* This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
|
*/
|
|
/* gdvirtual */ _get_composition_layer_order(index: int64): int64
|
|
|
|
/** Returns a [PackedStringArray] of positional tracker names that are used within the extension wrapper. */
|
|
/* gdvirtual */ _get_suggested_tracker_names(): PackedStringArray
|
|
|
|
/** Allows extensions to register additional controller metadata. This function is called even when the OpenXR API is not constructed as the metadata needs to be available to the editor.
|
|
* Extensions should also provide metadata regardless of whether they are supported on the host system. The controller data is used to setup action maps for users who may have access to the relevant hardware.
|
|
*/
|
|
/* gdvirtual */ _on_register_metadata(): void
|
|
|
|
/** Called before the OpenXR instance is created. */
|
|
/* gdvirtual */ _on_before_instance_created(): void
|
|
|
|
/** Called right after the OpenXR instance is created. */
|
|
/* gdvirtual */ _on_instance_created(instance: int64): void
|
|
|
|
/** Called right before the OpenXR instance is destroyed. */
|
|
/* gdvirtual */ _on_instance_destroyed(): void
|
|
|
|
/** Called right after the OpenXR session is created. */
|
|
/* gdvirtual */ _on_session_created(session: int64): void
|
|
|
|
/** Called as part of the OpenXR process handling. This happens right before general and physics processing steps of the main loop. During this step controller data is queried and made available to game logic. */
|
|
/* gdvirtual */ _on_process(): void
|
|
|
|
/** Called right before the XR viewports begin their rendering step. */
|
|
/* gdvirtual */ _on_pre_render(): void
|
|
|
|
/** Called right after the main swapchains are (re)created. */
|
|
/* gdvirtual */ _on_main_swapchains_created(): void
|
|
|
|
/** Called right before the given viewport is rendered. */
|
|
/* gdvirtual */ _on_pre_draw_viewport(viewport: RID): void
|
|
|
|
/** Called right after the given viewport is rendered.
|
|
*
|
|
* **Note:** The draw commands might only be queued at this point, not executed.
|
|
*/
|
|
/* gdvirtual */ _on_post_draw_viewport(viewport: RID): void
|
|
|
|
/** Called right before the OpenXR session is destroyed. */
|
|
/* gdvirtual */ _on_session_destroyed(): void
|
|
|
|
/** Called when the OpenXR session state is changed to idle. */
|
|
/* gdvirtual */ _on_state_idle(): void
|
|
|
|
/** Called when the OpenXR session state is changed to ready. This means OpenXR is ready to set up the session. */
|
|
/* gdvirtual */ _on_state_ready(): void
|
|
|
|
/** Called when the OpenXR session state is changed to synchronized. OpenXR also returns to this state when the application loses focus. */
|
|
/* gdvirtual */ _on_state_synchronized(): void
|
|
|
|
/** Called when the OpenXR session state is changed to visible. This means OpenXR is now ready to receive frames. */
|
|
/* gdvirtual */ _on_state_visible(): void
|
|
|
|
/** Called when the OpenXR session state is changed to focused. This state is the active state when the game runs. */
|
|
/* gdvirtual */ _on_state_focused(): void
|
|
|
|
/** Called when the OpenXR session state is changed to stopping. */
|
|
/* gdvirtual */ _on_state_stopping(): void
|
|
|
|
/** Called when the OpenXR session state is changed to loss pending. */
|
|
/* gdvirtual */ _on_state_loss_pending(): void
|
|
|
|
/** Called when the OpenXR session state is changed to exiting. */
|
|
/* gdvirtual */ _on_state_exiting(): void
|
|
|
|
/** Called when there is an OpenXR event to process. When implementing, return `true` if the event was handled, return `false` otherwise. */
|
|
/* gdvirtual */ _on_event_polled(event: int64): boolean
|
|
|
|
/** Adds additional data structures to composition layers created by [OpenXRCompositionLayer].
|
|
* [param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
|
* [param layer] is a pointer to an `XrCompositionLayerBaseHeader` struct.
|
|
*/
|
|
/* gdvirtual */ _set_viewport_composition_layer_and_get_next_pointer(layer: int64, property_values: GDictionary, next_pointer: int64): int64
|
|
|
|
/** Gets an array of [Dictionary]s that represent properties, just like [method Object._get_property_list], that will be added to [OpenXRCompositionLayer] nodes. */
|
|
/* gdvirtual */ _get_viewport_composition_layer_extension_properties(): GArray
|
|
|
|
/** Gets a [Dictionary] containing the default values for the properties returned by [method _get_viewport_composition_layer_extension_properties]. */
|
|
/* gdvirtual */ _get_viewport_composition_layer_extension_property_defaults(): GDictionary
|
|
|
|
/** Called when a composition layer created via [OpenXRCompositionLayer] is destroyed.
|
|
* [param layer] is a pointer to an `XrCompositionLayerBaseHeader` struct.
|
|
*/
|
|
/* gdvirtual */ _on_viewport_composition_layer_destroyed(layer: int64): void
|
|
|
|
/** Adds additional data structures to Android surface swapchains created by [OpenXRCompositionLayer].
|
|
* [param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
|
*/
|
|
/* gdvirtual */ _set_android_surface_swapchain_create_info_and_get_next_pointer(property_values: GDictionary, next_pointer: int64): int64
|
|
|
|
/** Returns the created [OpenXRAPIExtension], which can be used to access the OpenXR API. */
|
|
get_openxr_api(): OpenXRAPIExtension
|
|
|
|
/** Registers the extension. This should happen at core module initialization level. */
|
|
register_extension_wrapper(): void
|
|
}
|
|
namespace OpenXRHand {
|
|
enum Hands {
|
|
/** Tracking the player's left hand. */
|
|
HAND_LEFT = 0,
|
|
|
|
/** Tracking the player's right hand. */
|
|
HAND_RIGHT = 1,
|
|
|
|
/** Maximum supported hands. */
|
|
HAND_MAX = 2,
|
|
}
|
|
enum MotionRange {
|
|
/** When player grips, hand skeleton will form a full fist. */
|
|
MOTION_RANGE_UNOBSTRUCTED = 0,
|
|
|
|
/** When player grips, hand skeleton conforms to the controller the player is holding. */
|
|
MOTION_RANGE_CONFORM_TO_CONTROLLER = 1,
|
|
|
|
/** Maximum supported motion ranges. */
|
|
MOTION_RANGE_MAX = 2,
|
|
}
|
|
enum SkeletonRig {
|
|
/** An OpenXR compliant skeleton. */
|
|
SKELETON_RIG_OPENXR = 0,
|
|
|
|
/** A [SkeletonProfileHumanoid] compliant skeleton. */
|
|
SKELETON_RIG_HUMANOID = 1,
|
|
|
|
/** Maximum supported hands. */
|
|
SKELETON_RIG_MAX = 2,
|
|
}
|
|
enum BoneUpdate {
|
|
/** The skeletons bones are fully updated (both position and rotation) to match the tracked bones. */
|
|
BONE_UPDATE_FULL = 0,
|
|
|
|
/** The skeletons bones are only rotated to align with the tracked bones, preserving bone length. */
|
|
BONE_UPDATE_ROTATION_ONLY = 1,
|
|
|
|
/** Maximum supported bone update mode. */
|
|
BONE_UPDATE_MAX = 2,
|
|
}
|
|
}
|
|
/** Node supporting hand and finger tracking in OpenXR.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrhand.html
|
|
*/
|
|
class OpenXRHand<Map extends Record<string, Node> = Record<string, Node>> extends Node3D<Map> {
|
|
constructor(identifier?: any)
|
|
/** Specifies whether this node tracks the left or right hand of the player. */
|
|
get hand(): int64
|
|
set hand(value: int64)
|
|
|
|
/** Set the motion range (if supported) limiting the hand motion. */
|
|
get motion_range(): int64
|
|
set motion_range(value: int64)
|
|
|
|
/** Set a [Skeleton3D] node for which the pose positions will be updated. */
|
|
get hand_skeleton(): NodePath
|
|
set hand_skeleton(value: NodePath | string)
|
|
|
|
/** Set the type of skeleton rig the [member hand_skeleton] is compliant with. */
|
|
get skeleton_rig(): int64
|
|
set skeleton_rig(value: int64)
|
|
|
|
/** Specify the type of updates to perform on the bone. */
|
|
get bone_update(): int64
|
|
set bone_update(value: int64)
|
|
}
|
|
/** OpenXR Haptic feedback base class.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrhapticbase.html
|
|
*/
|
|
class OpenXRHapticBase extends Resource {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Vibration haptic feedback.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrhapticvibration.html
|
|
*/
|
|
class OpenXRHapticVibration extends OpenXRHapticBase {
|
|
constructor(identifier?: any)
|
|
/** The duration of the pulse in nanoseconds. Use `-1` for a minimum duration pulse for the current XR runtime. */
|
|
get duration(): int64
|
|
set duration(value: int64)
|
|
|
|
/** The frequency of the pulse in Hz. `0.0` will let the XR runtime chose an optimal frequency for the device used. */
|
|
get frequency(): float64
|
|
set frequency(value: float64)
|
|
|
|
/** The amplitude of the pulse between `0.0` and `1.0`. */
|
|
get amplitude(): float64
|
|
set amplitude(value: float64)
|
|
}
|
|
/** Defines a binding between an [OpenXRAction] and an XR input or output.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxripbinding.html
|
|
*/
|
|
class OpenXRIPBinding extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Get the number of binding modifiers for this binding. */
|
|
get_binding_modifier_count(): int64
|
|
|
|
/** Get the [OpenXRBindingModifier] at this index. */
|
|
get_binding_modifier(index: int64): OpenXRActionBindingModifier
|
|
|
|
/** Get the number of input/output paths in this binding. */
|
|
get_path_count(): int64
|
|
|
|
/** Returns `true` if this input/output path is part of this binding. */
|
|
has_path(path: string): boolean
|
|
|
|
/** Add an input/output path to this binding. */
|
|
add_path(path: string): void
|
|
|
|
/** Removes this input/output path from this binding. */
|
|
remove_path(path: string): void
|
|
|
|
/** [OpenXRAction] that is bound to [member binding_path]. */
|
|
get action(): OpenXRAction
|
|
set action(value: OpenXRAction)
|
|
|
|
/** Binding path that defines the input or output bound to [member action].
|
|
*
|
|
* **Note:** Binding paths are suggestions, an XR runtime may choose to bind the action to a different input or output emulating this input or output.
|
|
*/
|
|
get binding_path(): string
|
|
set binding_path(value: string)
|
|
|
|
/** Binding modifiers for this binding. */
|
|
get binding_modifiers(): OpenXRActionBindingModifier
|
|
set binding_modifiers(value: OpenXRActionBindingModifier)
|
|
|
|
/** Paths that define the inputs or outputs bound on the device. */
|
|
get paths(): PackedStringArray
|
|
set paths(value: PackedStringArray | string[])
|
|
}
|
|
/** Binding modifier that applies directly on an interaction profile.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxripbindingmodifier.html
|
|
*/
|
|
class OpenXRIPBindingModifier extends OpenXRBindingModifier {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Suggested bindings object for OpenXR.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrinteractionprofile.html
|
|
*/
|
|
class OpenXRInteractionProfile extends Resource {
|
|
constructor(identifier?: any)
|
|
/** Get the number of bindings in this interaction profile. */
|
|
get_binding_count(): int64
|
|
|
|
/** Retrieve the binding at this index. */
|
|
get_binding(index: int64): OpenXRIPBinding
|
|
|
|
/** Get the number of binding modifiers in this interaction profile. */
|
|
get_binding_modifier_count(): int64
|
|
|
|
/** Get the [OpenXRBindingModifier] at this index. */
|
|
get_binding_modifier(index: int64): OpenXRIPBindingModifier
|
|
|
|
/** The interaction profile path identifying the XR device. */
|
|
get interaction_profile_path(): string
|
|
set interaction_profile_path(value: string)
|
|
|
|
/** Action bindings for this interaction profile. */
|
|
get bindings(): OpenXRIPBinding
|
|
set bindings(value: OpenXRIPBinding)
|
|
|
|
/** Binding modifiers for this interaction profile. */
|
|
get binding_modifiers(): OpenXRIPBindingModifier
|
|
set binding_modifiers(value: OpenXRIPBindingModifier)
|
|
}
|
|
/** Default OpenXR interaction profile editor.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrinteractionprofileeditor.html
|
|
*/
|
|
class OpenXRInteractionProfileEditor<Map extends Record<string, Node> = Record<string, Node>> extends OpenXRInteractionProfileEditorBase<Map> {
|
|
constructor(identifier?: any)
|
|
}
|
|
/** Base class for editing interaction profiles.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrinteractionprofileeditorbase.html
|
|
*/
|
|
class OpenXRInteractionProfileEditorBase<Map extends Record<string, Node> = Record<string, Node>> extends HBoxContainer<Map> {
|
|
constructor(identifier?: any)
|
|
/** Setup this editor for the provided [param action_map] and [param interaction_profile]. */
|
|
setup(action_map: OpenXRActionMap, interaction_profile: OpenXRInteractionProfile): void
|
|
_add_binding(action: string, path: string): void
|
|
_remove_binding(action: string, path: string): void
|
|
}
|
|
/** Meta class registering supported devices in OpenXR.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrinteractionprofilemetadata.html
|
|
*/
|
|
class OpenXRInteractionProfileMetadata extends Object {
|
|
constructor(identifier?: any)
|
|
/** Allows for renaming old interaction profile paths to new paths to maintain backwards compatibility with older action maps. */
|
|
register_profile_rename(old_name: string, new_name: string): void
|
|
|
|
/** Registers a top level path to which profiles can be bound. For instance `/user/hand/left` refers to the bind point for the player's left hand. Extensions can register additional top level paths, for instance a haptic vest extension might register `/user/body/vest`.
|
|
* [param display_name] is the name shown to the user. [param openxr_path] is the top level path being registered. [param openxr_extension_name] is optional and ensures the top level path is only used if the specified extension is available/enabled.
|
|
* When a top level path ends up being bound by OpenXR, a [XRPositionalTracker] is instantiated to manage the state of the device.
|
|
*/
|
|
register_top_level_path(display_name: string, openxr_path: string, openxr_extension_name: string): void
|
|
|
|
/** Registers an interaction profile using its OpenXR designation (e.g. `/interaction_profiles/khr/simple_controller` is the profile for OpenXR's simple controller profile).
|
|
* [param display_name] is the description shown to the user. [param openxr_path] is the interaction profile path being registered. [param openxr_extension_name] optionally restricts this profile to the given extension being enabled/available. If the extension is not available, the profile and all related entries used in an action map are filtered out.
|
|
*/
|
|
register_interaction_profile(display_name: string, openxr_path: string, openxr_extension_name: string): void
|
|
|
|
/** Registers an input/output path for the given [param interaction_profile]. The profile should previously have been registered using [method register_interaction_profile]. [param display_name] is the description shown to the user. [param toplevel_path] specifies the bind path this input/output can be bound to (e.g. `/user/hand/left` or `/user/hand/right`). [param openxr_path] is the action input/output being registered (e.g. `/user/hand/left/input/aim/pose`). [param openxr_extension_name] restricts this input/output to an enabled/available extension, this doesn't need to repeat the extension on the profile but relates to overlapping extension (e.g. `XR_EXT_palm_pose` that introduces `…/input/palm_ext/pose` input paths). [param action_type] defines the type of input or output provided by OpenXR. */
|
|
register_io_path(interaction_profile: string, display_name: string, toplevel_path: string, openxr_path: string, openxr_extension_name: string, action_type: OpenXRAction.ActionType): void
|
|
}
|
|
namespace OpenXRInterface {
|
|
enum Hand {
|
|
/** Left hand. */
|
|
HAND_LEFT = 0,
|
|
|
|
/** Right hand. */
|
|
HAND_RIGHT = 1,
|
|
|
|
/** Maximum value for the hand enum. */
|
|
HAND_MAX = 2,
|
|
}
|
|
enum HandMotionRange {
|
|
/** Full hand range, if user closes their hands, we make a full fist. */
|
|
HAND_MOTION_RANGE_UNOBSTRUCTED = 0,
|
|
|
|
/** Conform to controller, if user closes their hands, the tracked data conforms to the shape of the controller. */
|
|
HAND_MOTION_RANGE_CONFORM_TO_CONTROLLER = 1,
|
|
|
|
/** Maximum value for the motion range enum. */
|
|
HAND_MOTION_RANGE_MAX = 2,
|
|
}
|
|
enum HandTrackedSource {
|
|
/** The source of hand tracking data is unknown (the extension is likely unsupported). */
|
|
HAND_TRACKED_SOURCE_UNKNOWN = 0,
|
|
|
|
/** The source of hand tracking is unobstructed, this means that an accurate method of hand tracking is used, e.g. optical hand tracking, data gloves, etc. */
|
|
HAND_TRACKED_SOURCE_UNOBSTRUCTED = 1,
|
|
|
|
/** The source of hand tracking is a controller, bone positions are inferred from controller inputs. */
|
|
HAND_TRACKED_SOURCE_CONTROLLER = 2,
|
|
|
|
/** Maximum value for the hand tracked source enum. */
|
|
HAND_TRACKED_SOURCE_MAX = 3,
|
|
}
|
|
enum HandJoints {
|
|
/** Palm joint. */
|
|
HAND_JOINT_PALM = 0,
|
|
|
|
/** Wrist joint. */
|
|
HAND_JOINT_WRIST = 1,
|
|
|
|
/** Thumb metacarpal joint. */
|
|
HAND_JOINT_THUMB_METACARPAL = 2,
|
|
|
|
/** Thumb proximal joint. */
|
|
HAND_JOINT_THUMB_PROXIMAL = 3,
|
|
|
|
/** Thumb distal joint. */
|
|
HAND_JOINT_THUMB_DISTAL = 4,
|
|
|
|
/** Thumb tip joint. */
|
|
HAND_JOINT_THUMB_TIP = 5,
|
|
|
|
/** Index metacarpal joint. */
|
|
HAND_JOINT_INDEX_METACARPAL = 6,
|
|
|
|
/** Index proximal joint. */
|
|
HAND_JOINT_INDEX_PROXIMAL = 7,
|
|
|
|
/** Index intermediate joint. */
|
|
HAND_JOINT_INDEX_INTERMEDIATE = 8,
|
|
|
|
/** Index distal joint. */
|
|
HAND_JOINT_INDEX_DISTAL = 9,
|
|
|
|
/** Index tip joint. */
|
|
HAND_JOINT_INDEX_TIP = 10,
|
|
|
|
/** Middle metacarpal joint. */
|
|
HAND_JOINT_MIDDLE_METACARPAL = 11,
|
|
|
|
/** Middle proximal joint. */
|
|
HAND_JOINT_MIDDLE_PROXIMAL = 12,
|
|
|
|
/** Middle intermediate joint. */
|
|
HAND_JOINT_MIDDLE_INTERMEDIATE = 13,
|
|
|
|
/** Middle distal joint. */
|
|
HAND_JOINT_MIDDLE_DISTAL = 14,
|
|
|
|
/** Middle tip joint. */
|
|
HAND_JOINT_MIDDLE_TIP = 15,
|
|
|
|
/** Ring metacarpal joint. */
|
|
HAND_JOINT_RING_METACARPAL = 16,
|
|
|
|
/** Ring proximal joint. */
|
|
HAND_JOINT_RING_PROXIMAL = 17,
|
|
|
|
/** Ring intermediate joint. */
|
|
HAND_JOINT_RING_INTERMEDIATE = 18,
|
|
|
|
/** Ring distal joint. */
|
|
HAND_JOINT_RING_DISTAL = 19,
|
|
|
|
/** Ring tip joint. */
|
|
HAND_JOINT_RING_TIP = 20,
|
|
|
|
/** Little metacarpal joint. */
|
|
HAND_JOINT_LITTLE_METACARPAL = 21,
|
|
|
|
/** Little proximal joint. */
|
|
HAND_JOINT_LITTLE_PROXIMAL = 22,
|
|
|
|
/** Little intermediate joint. */
|
|
HAND_JOINT_LITTLE_INTERMEDIATE = 23,
|
|
|
|
/** Little distal joint. */
|
|
HAND_JOINT_LITTLE_DISTAL = 24,
|
|
|
|
/** Little tip joint. */
|
|
HAND_JOINT_LITTLE_TIP = 25,
|
|
|
|
/** Maximum value for the hand joint enum. */
|
|
HAND_JOINT_MAX = 26,
|
|
}
|
|
enum HandJointFlags {
|
|
/** No flags are set. */
|
|
HAND_JOINT_NONE = 0,
|
|
|
|
/** If set, the orientation data is valid, otherwise, the orientation data is unreliable and should not be used. */
|
|
HAND_JOINT_ORIENTATION_VALID = 1,
|
|
|
|
/** If set, the orientation data comes from tracking data, otherwise, the orientation data contains predicted data. */
|
|
HAND_JOINT_ORIENTATION_TRACKED = 2,
|
|
|
|
/** If set, the positional data is valid, otherwise, the positional data is unreliable and should not be used. */
|
|
HAND_JOINT_POSITION_VALID = 4,
|
|
|
|
/** If set, the positional data comes from tracking data, otherwise, the positional data contains predicted data. */
|
|
HAND_JOINT_POSITION_TRACKED = 8,
|
|
|
|
/** If set, our linear velocity data is valid, otherwise, the linear velocity data is unreliable and should not be used. */
|
|
HAND_JOINT_LINEAR_VELOCITY_VALID = 16,
|
|
|
|
/** If set, our angular velocity data is valid, otherwise, the angular velocity data is unreliable and should not be used. */
|
|
HAND_JOINT_ANGULAR_VELOCITY_VALID = 32,
|
|
}
|
|
}
|
|
/** Our OpenXR interface.
|
|
*
|
|
* @link https://docs.godotengine.org/en/4.4/classes/class_openxrinterface.html
|
|
*/
|
|
class OpenXRInterface extends XRInterface {
|
|
constructor(identifier?: any)
|
|
/** Returns `true` if OpenXR's foveation extension is supported, the interface must be initialized before this returns a valid value.
|
|
*
|
|
* **Note:** This feature is only available on the compatibility renderer and currently only available on some stand alone headsets. For Vulkan set [member Viewport.vrs_mode] to `VRS_XR` on desktop.
|
|
*/
|
|
is_foveation_supported(): boolean
|
|
|
|
/** Returns `true` if the given action set is active. */
|
|
is_action_set_active(name: string): boolean
|
|
|
|
/** Sets the given action set as active or inactive. */
|
|
set_action_set_active(name: string, active: boolean): void
|
|
|
|
/** Returns a list of action sets registered with Godot (loaded from the action map at runtime). */
|
|
get_action_sets(): GArray
|
|
|
|
/** Returns display refresh rates supported by the current HMD. Only returned if this feature is supported by the OpenXR runtime and after the interface has been initialized. */
|
|
get_available_display_refresh_rates(): GArray
|
|
|
|
/** If handtracking is enabled and motion range is supported, sets the currently configured motion range for [param hand] to [param motion_range]. */
|
|
set_motion_range(hand: OpenXRInterface.Hand, motion_range: OpenXRInterface.HandMotionRange): void
|
|
|
|
/** If handtracking is enabled and motion range is supported, gets the currently configured motion range for [param hand]. */
|
|
get_motion_range(hand: OpenXRInterface.Hand): OpenXRInterface.HandMotionRange
|
|
|
|
/** If handtracking is enabled and hand tracking source is supported, gets the source of the hand tracking data for [param hand]. */
|
|
get_hand_tracking_source(hand: OpenXRInterface.Hand): OpenXRInterface.HandTrackedSource
|
|
|
|
/** If handtracking is enabled, returns flags that inform us of the validity of the tracking data. */
|
|
get_hand_joint_flags(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): OpenXRInterface.HandJointFlags
|
|
|
|
/** If handtracking is enabled, returns the rotation of a joint ([param joint]) of a hand ([param hand]) as provided by OpenXR. */
|
|
get_hand_joint_rotation(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): Quaternion
|
|
|
|
/** If handtracking is enabled, returns the position of a joint ([param joint]) of a hand ([param hand]) as provided by OpenXR. This is relative to [XROrigin3D] without worldscale applied! */
|
|
get_hand_joint_position(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): Vector3
|
|
|
|
/** If handtracking is enabled, returns the radius of a joint ([param joint]) of a hand ([param hand]) as provided by OpenXR. This is without worldscale applied! */
|
|
get_hand_joint_radius(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): float64
|
|
|
|
/** If handtracking is enabled, returns the linear velocity of a joint ([param joint]) of a hand ([param hand]) as provided by OpenXR. This is relative to [XROrigin3D] without worldscale applied! */
|
|
get_hand_joint_linear_velocity(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): Vector3
|
|
|
|
/** If handtracking is enabled, returns the angular velocity of a joint ([param joint]) of a hand ([param hand]) as provided by OpenXR. This is relative to [XROrigin3D]! */
|
|
get_hand_joint_angular_velocity(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints): Vector3
|
|
|
|
/** Returns `true` if OpenXR's hand tracking is supported and enabled.
|
|
*
|
|
* **Note:** This only returns a valid value after OpenXR has been initialized.
|
|
*/
|
|
is_hand_tracking_supported(): boolean
|
|
|
|
/** Returns `true` if OpenXR's hand interaction profile is supported and enabled.
|
|
*
|
|
* **Note:** This only returns a valid value after OpenXR has been initialized.
|
|
*/
|
|
is_hand_interaction_supported(): boolean
|
|
|
|
/** Returns the capabilities of the eye gaze interaction extension.
|
|
*
|
|
* **Note:** This only returns a valid value after OpenXR has been initialized.
|
|
*/
|
|
is_eye_gaze_interaction_supported(): boolean
|
|
|
|
/** The display refresh rate for the current HMD. Only functional if this feature is supported by the OpenXR runtime and after the interface has been initialized. */
|
|
get display_refresh_rate(): float64
|
|
set display_refresh_rate(value: float64)
|
|
|
|
/** The render size multiplier for the current HMD. Must be set before the interface has been initialized. */
|
|
get render_target_size_multiplier(): float64
|
|
set render_target_size_multiplier(value: float64)
|
|
|
|
/** Set foveation level from 0 (off) to 3 (high), the interface must be initialized before this is accessible.
|
|
*
|
|
* **Note:** Only works on compatibility renderer.
|
|
*/
|
|
get foveation_level(): int64
|
|
set foveation_level(value: int64)
|
|
|
|
/** Enable dynamic foveation adjustment, the interface must be initialized before this is accessible. If enabled foveation will automatically adjusted between low and [member foveation_level].
|
|
*
|
|
* **Note:** Only works on compatibility renderer.
|
|
*/
|
|
get foveation_dynamic(): boolean
|
|
set foveation_dynamic(value: boolean)
|
|
|
|
/** The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.
|
|
*
|
|
* **Note:** Mobile and Forward+ renderers only. Requires [member Viewport.vrs_mode] to be set to [constant Viewport.VRS_XR].
|
|
*/
|
|
get vrs_min_radius(): float64
|
|
set vrs_min_radius(value: float64)
|
|
|
|
/** The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.
|
|
*
|
|
* **Note:** Mobile and Forward+ renderers only. Requires [member Viewport.vrs_mode] to be set to [constant Viewport.VRS_XR].
|
|
*/
|
|
get vrs_strength(): float64
|
|
set vrs_strength(value: float64)
|
|
|
|
/** Informs our OpenXR session has been started. */
|
|
readonly session_begun: Signal0
|
|
|
|
/** Informs our OpenXR session is stopping. */
|
|
readonly session_stopping: Signal0
|
|
|
|
/** Informs our OpenXR session now has focus. */
|
|
readonly session_focussed: Signal0
|
|
|
|
/** Informs our OpenXR session is now visible (output is being sent to the HMD). */
|
|
readonly session_visible: Signal0
|
|
|
|
/** Informs our OpenXR session is in the process of being lost. */
|
|
readonly session_loss_pending: Signal0
|
|
|
|
/** Informs our OpenXR instance is exiting. */
|
|
readonly instance_exiting: Signal0
|
|
|
|
/** Informs the user queued a recenter of the player position. */
|
|
readonly pose_recentered: Signal0
|
|
|
|
/** Informs the user the HMD refresh rate has changed.
|
|
*
|
|
* **Note:** Only emitted if XR runtime supports the refresh rate extension.
|
|
*/
|
|
readonly refresh_rate_changed: Signal1<float64>
|
|
}
|
|
}
|