@@ -52,7 +52,7 @@ Resources and nodes can be exported.
5252 @export var resource: Resource
5353 @export var node: Node
5454
55- Grouping Exports
55+ Grouping exports
5656----------------
5757
5858It is possible to group your exported properties inside the Inspector
@@ -160,18 +160,68 @@ Allow floats from -10 to 20 and snap the value to multiples of 0.2.
160160
161161 @export_range(-10, 20, 0.2) var k: float
162162
163- The limits can be only for the slider if you add the hints "or_greater" and/or "or_less".
163+ The limits can be made to affect only the slider if you add the hints ``"or_less" ``
164+ and/or ``"or_greater" ``. If either these hints are used, it will be possible for
165+ the user to enter any value or drag the value with the mouse when not using
166+ the slider, even if outside the specified range.
164167
165168::
166169
167- @export_range(0, 100, 0. 1, "or_greater ", "or_less ") var l
170+ @export_range(0, 100, 1, "or_less ", "or_greater ") var l: int
168171
169- .. TODO: Document other hint strings usable with export_range.
172+ The ``"exp" `` hint can be used to make a value have an exponential slider
173+ instead of a linear slider. This means that when dragging the slider towards
174+ the right, changes will become progressively faster when dragging the mouse.
175+ This is useful to make editing values that can be either very small or very large
176+ easier, at the cost of being less intuitive.
177+
178+ ::
179+
180+ @export_range(0, 100000, 0.01, "exp") var exponential: float
181+
182+ For values that are meant to represent an easing factor, use
183+ :ref: `doc_gdscript_exports_floats_with_easing_hint ` instead.
184+
185+ The ``"hide_slider" `` hint can be used to hide the horizontal bar that
186+ appears below ``float `` properties, or the up/down arrows that appear besides
187+ ``int `` properties:
188+
189+ ::
190+
191+ @export_range(0, 1000, 0.01, "hide_slider") var no_slider: float
192+
193+ Adding suffixes and handling degrees/radians
194+ --------------------------------------------
195+
196+ A suffix can also be defined to make the value more self-explanatory in the
197+ inspector. For example, to define a value that is meant to be configured as
198+ "meters" (``m ``) by the user:
199+
200+ ::
201+
202+ @export_range(0, 100, 1, "suffix:m") var m: int
203+
204+ For angles that are stored in radians but displayed as degrees to the user, use
205+ the `"radians_as_degrees" ` hint:
206+
207+ ::
208+
209+ @export_range(0, 360, 0.1, "radians_as_degrees") var angle: float
210+
211+ This performs automatic conversion when the value is displayed or modified in
212+ the inspector and also displays a degree (``° ``) suffix. This approach is used
213+ by Godot's own `rotation ` properties throughout the editor.
214+
215+ If the angle is stored in degrees instead, use the `"degrees" ` hint to display
216+ the degree symbol while disabling the automatic degrees-to-radians conversion
217+ when the value is modified from the inspector.
218+
219+ .. _doc_gdscript_exports_floats_with_easing_hint :
170220
171221Floats with easing hint
172222-----------------------
173223
174- Display a visual representation of the ' ease()' function
224+ Display a visual representation of the `` ease() `` function
175225when editing.
176226
177227::
@@ -372,7 +422,7 @@ Other export variants can also be used when exporting arrays:
372422
373423::
374424
375- @export_range(-360, 360, 0.001, "radians ") var laser_angles: Array[float] = []
425+ @export_range(-360, 360, 0.001, "degrees ") var laser_angles: Array[float] = []
376426 @export_file("*.json") var skill_trees: Array[String] = []
377427 @export_color_no_alpha var hair_colors = PackedColorArray()
378428 @export_enum("Espresso", "Mocha", "Latte", "Capuccino") var barista_suggestions: Array[String] = []
@@ -399,6 +449,32 @@ or :ref:`Node.duplicate() <class_Node_method_duplicate>` is called, unlike non-e
399449 @export_storage var b # Stored in the file, not displayed in the editor.
400450 @export var c: int # Stored in the file, displayed in the editor.
401451
452+ ``@export_custom ``
453+ ------------------
454+
455+ If you need more control than what's exposed with the built-in ``@export ``
456+ annotations, you can use ``@export_custom `` instead. This allows defining any
457+ property hint, hint string and usage flags, with a syntax similar to the one
458+ used by the editor for built-in nodes.
459+
460+ For example, this exposes the ``altitude `` property with no range limits but a
461+ ``m `` (meter) suffix defined:
462+
463+ ::
464+
465+ @export_custom(PROPERTY_HINT_NONE, "altitude:m") var altitude: Vector3
466+
467+ The above is normally not feasible with the standard ``@export_range `` syntax,
468+ since it requires defining a range.
469+
470+ See the :ref: `class reference <class_@GDScript_annotation_@export_custom >`
471+ for a list of parameters and their allowed values.
472+
473+ .. warning ::
474+
475+ When using ``@export_custom ``, GDScript does not perform any validation on
476+ the syntax. Invalid syntax may have unexpected behavior in the inspector.
477+
402478Setting exported variables from a tool script
403479---------------------------------------------
404480
0 commit comments