mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
classref: Sync with current master branch (42c7f14)
This commit is contained in:
+23
-22
@@ -133,27 +133,27 @@ Mark the following property as exported (editable in the Inspector dock and save
|
||||
::
|
||||
|
||||
extends Node
|
||||
|
||||
|
||||
enum Direction {LEFT, RIGHT, UP, DOWN}
|
||||
|
||||
|
||||
# Built-in types.
|
||||
@export var string = ""
|
||||
@export var int_number = 5
|
||||
@export var float_number: float = 5
|
||||
|
||||
|
||||
# Enums.
|
||||
@export var type: Variant.Type
|
||||
@export var format: Image.Format
|
||||
@export var direction: Direction
|
||||
|
||||
|
||||
# Resources.
|
||||
@export var image: Image
|
||||
@export var custom_resource: CustomResource
|
||||
|
||||
|
||||
# Nodes.
|
||||
@export var node: Node
|
||||
@export var custom_node: CustomNode
|
||||
|
||||
|
||||
# Typed arrays.
|
||||
@export var int_array: Array[int]
|
||||
@export var direction_array: Array[Direction]
|
||||
@@ -261,7 +261,7 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_ENUM<class_@GlobalScope_constant_PROPE
|
||||
@export_enum("Warrior", "Magician", "Thief") var character_class: int
|
||||
@export_enum("Slow:30", "Average:60", "Very Fast:200") var character_speed: int
|
||||
@export_enum("Rebecca", "Mary", "Leah") var character_name: String
|
||||
|
||||
|
||||
@export_enum("Sword", "Spear", "Mace") var character_items: Array[int]
|
||||
@export_enum("double_jump", "climb", "dash") var character_skills: Array[String]
|
||||
|
||||
@@ -277,7 +277,7 @@ If you want to use named GDScript enums, then use :ref:`@export<class_@GDScript_
|
||||
|
||||
enum CharacterName {REBECCA, MARY, LEAH}
|
||||
@export var character_name: CharacterName
|
||||
|
||||
|
||||
enum CharacterItem {SWORD, SPEAR, MACE}
|
||||
@export var character_items: Array[CharacterItem]
|
||||
|
||||
@@ -566,11 +566,11 @@ See also :ref:`@GlobalScope.PROPERTY_USAGE_GROUP<class_@GlobalScope_constant_PRO
|
||||
@export_group("Racer Properties")
|
||||
@export var nickname = "Nick"
|
||||
@export var age = 26
|
||||
|
||||
|
||||
@export_group("Car Properties", "car_")
|
||||
@export var car_label = "Speedy"
|
||||
@export var car_number = 3
|
||||
|
||||
|
||||
@export_group("", "")
|
||||
@export var ungrouped_number = 3
|
||||
|
||||
@@ -657,10 +657,10 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_RANGE<class_@GlobalScope_constant_PROP
|
||||
@export_range(-10, 20) var number
|
||||
@export_range(-10, 20, 0.2) var number: float
|
||||
@export_range(0, 20) var numbers: Array[float]
|
||||
|
||||
|
||||
@export_range(0, 100, 1, "or_greater") var power_percent
|
||||
@export_range(0, 100, 1, "or_greater", "or_less") var health_delta
|
||||
|
||||
|
||||
@export_range(-180, 180, 0.001, "radians_as_degrees") var angle_radians
|
||||
@export_range(0, 360, 1, "degrees") var angle_degrees
|
||||
@export_range(-8, 8, 2, "suffix:px") var target_offset
|
||||
@@ -702,7 +702,7 @@ See also :ref:`@GlobalScope.PROPERTY_USAGE_SUBGROUP<class_@GlobalScope_constant_
|
||||
@export_group("Racer Properties")
|
||||
@export var nickname = "Nick"
|
||||
@export var age = 26
|
||||
|
||||
|
||||
@export_subgroup("Car Properties", "car_")
|
||||
@export var car_label = "Speedy"
|
||||
@export var car_number = 3
|
||||
@@ -744,14 +744,14 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_TOOL_BUTTON<class_@GlobalScope_constan
|
||||
|
||||
@tool
|
||||
extends Sprite2D
|
||||
|
||||
|
||||
@export_tool_button("Hello") var hello_action = hello
|
||||
@export_tool_button("Randomize the color!", "ColorRect")
|
||||
var randomize_color_action = randomize_color
|
||||
|
||||
|
||||
func hello():
|
||||
print("Hello world!")
|
||||
|
||||
|
||||
func randomize_color():
|
||||
var undo_redo = EditorInterface.get_editor_undo_redo()
|
||||
undo_redo.create_action("Randomized Sprite2D Color")
|
||||
@@ -833,10 +833,10 @@ The order of ``mode``, ``sync`` and ``transfer_mode`` does not matter, but value
|
||||
|
||||
@rpc
|
||||
func fn(): pass
|
||||
|
||||
|
||||
@rpc("any_peer", "unreliable_ordered")
|
||||
func fn_update_pos(): pass
|
||||
|
||||
|
||||
@rpc("authority", "call_remote", "unreliable", 0) # Equivalent to @rpc
|
||||
func fn_default(): pass
|
||||
|
||||
@@ -1027,7 +1027,7 @@ Converts ``what`` to ``type`` in the best way possible. The ``type`` uses the :r
|
||||
|
||||
var a = [4, 2.5, 1.2]
|
||||
print(a is Array) # Prints true
|
||||
|
||||
|
||||
var b = convert(a, TYPE_PACKED_BYTE_ARRAY)
|
||||
print(b) # Prints [4, 2, 1]
|
||||
print(b is Array) # Prints false
|
||||
@@ -1062,10 +1062,10 @@ Returns an array of dictionaries representing the current call stack. See also :
|
||||
|
||||
func _ready():
|
||||
foo()
|
||||
|
||||
|
||||
func foo():
|
||||
bar()
|
||||
|
||||
|
||||
func bar():
|
||||
print(get_stack())
|
||||
|
||||
@@ -1161,7 +1161,7 @@ Returns the length of the given Variant ``var``. The length can be the character
|
||||
|
||||
var a = [1, 2, 3, 4]
|
||||
len(a) # Returns 4
|
||||
|
||||
|
||||
var b = "Hello!"
|
||||
len(b) # Returns 6
|
||||
|
||||
@@ -1336,6 +1336,7 @@ Returns ``true`` if the given :ref:`Object<class_Object>`-derived class exists i
|
||||
type_exists("NonExistentClass") # Returns false
|
||||
|
||||
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
||||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||||
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
||||
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
||||
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
||||
|
||||
Reference in New Issue
Block a user