godotengine / godotengine/godot-docs

Add mentions of export_custom to GDScript exports tutorial

Open
#9,925 0 comments 0 reactions 0 assignees View on GitHub
area:manual enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** 4.3

**Issue description:**

In the [GDscript exported properties](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html) page there is no mention of `@export_custom`. I think users interested in exported properties should at least be pointed out to its existence so that they can explore all the useful built-in [property hints](https://docs.godotengine.org/en/latest/classes/class_%40globalscope.html#enum-globalscope-propertyhint) that are available.

For example, I was looking for a way to make a multiline string input that uses a monospace font, and spent a long time looking for such an option, I then even considered creating an EditorInspectorPlugin to add this functionality... And that's when I learn that `@export_custom(PROPERTY_HINT_EXPRESSION, "")` not only uses a monospace font but also highlights it which is exactly what I was looking for.

While I think it's enough to point users towards exploring the rest of the documentation on their own, I think there's a couple of `export_custom` variations that would be nice to have in the GDScipt exported properties tutorial, like the hint expression and hint link.

One last thing, in the GDScript exported properties tutorial, it says that
```
# Nested typed arrays such as `Array[Array[float]]` are not supported yet.
@export var two_dimensional: Array[Array] = [[1.0, 2.0], [3.0, 4.0]]
```
Which, while `Array[Array[float]]` is not supported in GDScript at the moment, it seems to be supported as an inspector property with `PROPERTY_HINT_TYPE_STRING` as seen [here](https://docs.godotengine.org/en/latest/classes/class_%40globalscope.html#class-globalscope-constant-property-hint-type-string), with a working example here:
```
@export_custom(PROPERTY_HINT_TYPE_STRING,"28:3:")
var array_of_array_of_floats: Array
```

So, while I think it's useful to remind users that `Array[Array[float]]` types are not yet supported internally by Godot, it would still be useful to let them know how they can use property type hints to make the editor's inspector make their `Array`s behave like `Array[Array[float]]`, as this can ensure values entered in the Inspector are of the right type.

**URL to the documentation page (if already existing):**
GDScript exported properties
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_exports.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.