mirror of https://github.com/godotengine/godot
Merge 747cf9e7a7 into 15ff450680
This commit is contained in:
commit
3f7e77b56e
|
|
@ -90,6 +90,7 @@ enum PropertyHint {
|
|||
PROPERTY_HINT_TOOL_BUTTON,
|
||||
PROPERTY_HINT_ONESHOT, ///< the property will be changed by self after setting, such as AudioStreamPlayer.playing, Particles.emitting.
|
||||
PROPERTY_HINT_NO_NODEPATH, /// < this property will not contain a NodePath, regardless of type (Array, Dictionary, List, etc.). Needed for SceneTreeDock.
|
||||
PROPERTY_HINT_RES_FROM_DIR, /// hint_text is a directory path. The property lists all relevant resource files in hint_text.
|
||||
PROPERTY_HINT_MAX,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2954,7 +2954,10 @@
|
|||
<constant name="PROPERTY_HINT_ONESHOT" value="40" enum="PropertyHint">
|
||||
Hints that a property will be changed on its own after setting, such as [member AudioStreamPlayer.playing] or [member GPUParticles3D.emitting].
|
||||
</constant>
|
||||
<constant name="PROPERTY_HINT_MAX" value="42" enum="PropertyHint">
|
||||
<constant name="PROPERTY_HINT_RES_FROM_DIR" value="41" enum="PropertyHint">
|
||||
Hints a directory for the [Resource] property to list the resource files from.
|
||||
</constant>
|
||||
<constant name="PROPERTY_HINT_MAX" value="43" enum="PropertyHint">
|
||||
Represents the size of the [enum PropertyHint] enum.
|
||||
</constant>
|
||||
<constant name="PROPERTY_USAGE_NONE" value="0" enum="PropertyUsageFlags" is_bitfield="true">
|
||||
|
|
|
|||
|
|
@ -530,6 +530,13 @@
|
|||
[/codeblock]
|
||||
</description>
|
||||
</annotation>
|
||||
<annotation name="@export_from_dir" qualifiers="vararg">
|
||||
<return type="void" />
|
||||
<param index="0" name="directory" type="String" default=""res://"" />
|
||||
<description>
|
||||
Export a [Resource] property as a list of resource files in a [param directory].
|
||||
</description>
|
||||
</annotation>
|
||||
<annotation name="@export_global_dir">
|
||||
<return type="void" />
|
||||
<description>
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ GDScriptParser::GDScriptParser() {
|
|||
register_annotation(MethodInfo("@export_flags_3d_physics"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_LAYERS_3D_PHYSICS, Variant::INT>);
|
||||
register_annotation(MethodInfo("@export_flags_3d_navigation"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_LAYERS_3D_NAVIGATION, Variant::INT>);
|
||||
register_annotation(MethodInfo("@export_flags_avoidance"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_LAYERS_AVOIDANCE, Variant::INT>);
|
||||
register_annotation(MethodInfo("@export_from_dir", PropertyInfo(Variant::STRING, "directory")), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_RES_FROM_DIR, Variant::OBJECT>, varray("res://"), true);
|
||||
register_annotation(MethodInfo("@export_storage"), AnnotationInfo::VARIABLE, &GDScriptParser::export_storage_annotation);
|
||||
register_annotation(MethodInfo("@export_custom", PropertyInfo(Variant::INT, "hint", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CLASS_IS_ENUM, "PropertyHint"), PropertyInfo(Variant::STRING, "hint_string"), PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CLASS_IS_BITFIELD, "PropertyUsageFlags")), AnnotationInfo::VARIABLE, &GDScriptParser::export_custom_annotation, varray(PROPERTY_USAGE_DEFAULT));
|
||||
register_annotation(MethodInfo("@export_tool_button", PropertyInfo(Variant::STRING, "text"), PropertyInfo(Variant::STRING, "icon")), AnnotationInfo::VARIABLE, &GDScriptParser::export_tool_button_annotation, varray(""));
|
||||
|
|
@ -4525,6 +4526,13 @@ bool GDScriptParser::export_annotations(AnnotationNode *p_annotation, Node *p_ta
|
|||
if (export_type.builtin_type == Variant::DICTIONARY) {
|
||||
variable->export_info.type = Variant::DICTIONARY;
|
||||
}
|
||||
} else if (p_annotation->name == SNAME("@export_from_dir")) {
|
||||
use_default_variable_type_check = false;
|
||||
|
||||
if (!ClassDB::is_parent_class(export_type.native_type, SNAME("Resource"))) {
|
||||
push_error(R"(Export type can only be a resource.)", p_annotation);
|
||||
return false;
|
||||
}
|
||||
} else if (p_annotation->name == SNAME("@export")) {
|
||||
use_default_variable_type_check = false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue