diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-11-09 18:12:04 +0200 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2020-11-09 18:12:04 +0200 |
commit | 1e6b684d4407a7f3fff63ef59a6993992d11ac92 (patch) | |
tree | 4f89c718b723813e3ccbe5c471aaac3a48ea0a83 | |
parent | 593e35346ab182c36068c3dcfc741eeb7311a19e (diff) |
Expose `PROPERTY_HINT_TYPE_STRING` to scripting
-rw-r--r-- | core/core_constants.cpp | 1 | ||||
-rw-r--r-- | doc/classes/@GlobalScope.xml | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 41fa188c5b..e925ae737a 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -557,6 +557,7 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA); BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSY); BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS); + BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_TYPE_STRING); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_STORAGE); BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_EDITOR); diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 2b1770f12b..e2d918f098 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1375,6 +1375,16 @@ <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="21" enum="PropertyHint"> Hints that an image is compressed using lossless compression. </constant> + <constant name="PROPERTY_HINT_TYPE_STRING" value="23" enum="PropertyHint"> + Hint that a property represents a particular type. If a property is [constant TYPE_STRING], allows to set a type from the create dialog. If you need to create an [Array] to contain elements of a specific type, the [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code] for specifying [Resource] types. For instance: + [codeblock] + hint_string = "%s:" % [TYPE_INT] # Array of inteters. + hint_string = "%s:%s:" % [TYPE_ARRAY, TYPE_REAL] # Two-dimensional array of floats. + hint_string = "%s/%s:Resource" % [TYPE_OBJECT, TYPE_OBJECT] # Array of resources. + hint_string = "%s:%s/%s:Resource" % [TYPE_ARRAY, TYPE_OBJECT, TYPE_OBJECT] # Two-dimensional array of resources. + [/codeblock] + [b]Note:[/b] the final colon is required to specify for properly detecting built-in types. + </constant> <constant name="PROPERTY_USAGE_STORAGE" value="1" enum="PropertyUsageFlags"> The property is serialized and saved in the scene file (default). </constant> |