From 4296f0a7712d00f46e4b32988c5f4e8431951e53 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 20 Oct 2023 02:39:06 +0200 Subject: [PATCH] Fill remaining global scope constant descriptions --- core/object/object.h | 8 ++--- core/object/script_language.cpp | 3 -- doc/classes/@GlobalScope.xml | 33 ++++++++++++++++--- editor/editor_properties.cpp | 3 -- scene/2d/skeleton_2d.cpp | 2 +- scene/3d/mesh_instance_3d.cpp | 2 +- scene/3d/visual_instance_3d.cpp | 4 +-- .../skeleton_modification_stack_2d.cpp | 2 +- 8 files changed, 38 insertions(+), 19 deletions(-) diff --git a/core/object/object.h b/core/object/object.h index f3c387594ba..7b53fcaa416 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -72,12 +72,12 @@ enum PropertyHint { PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color PROPERTY_HINT_OBJECT_ID, PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose - PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts) + PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, // Deprecated. PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send PROPERTY_HINT_NODE_PATH_VALID_TYPES, PROPERTY_HINT_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog PROPERTY_HINT_GLOBAL_SAVE_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,". This opens a save dialog - PROPERTY_HINT_INT_IS_OBJECTID, + PROPERTY_HINT_INT_IS_OBJECTID, // Deprecated. PROPERTY_HINT_INT_IS_POINTER, PROPERTY_HINT_ARRAY_TYPE, PROPERTY_HINT_LOCALE_ID, @@ -105,7 +105,7 @@ enum PropertyUsageFlags { PROPERTY_USAGE_SCRIPT_VARIABLE = 1 << 12, PROPERTY_USAGE_STORE_IF_NULL = 1 << 13, PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 1 << 14, - PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 15, + PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 1 << 15, // Deprecated. PROPERTY_USAGE_CLASS_IS_ENUM = 1 << 16, PROPERTY_USAGE_NIL_IS_VARIANT = 1 << 17, PROPERTY_USAGE_ARRAY = 1 << 18, // Used in the inspector to group properties as elements of an array. @@ -115,7 +115,7 @@ enum PropertyUsageFlags { PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 22, PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 23, PROPERTY_USAGE_KEYING_INCREMENTS = 1 << 24, // Used in inspector to increment property when keyed in animation player. - PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, // when loading, the resource for this property can be set at the end of loading. + PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 1 << 25, // Deprecated. PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 1 << 26, // For Object properties, instantiate them when creating in editor. PROPERTY_USAGE_EDITOR_BASIC_SETTING = 1 << 27, //for project or editor settings, show when basic settings are selected. PROPERTY_USAGE_READ_ONLY = 1 << 28, // Mark a property as read-only in the inspector. diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 2bdbfb5ad17..5f53975bf6d 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -558,9 +558,6 @@ void PlaceHolderScriptInstance::get_property_list(List *p_properti } else { for (const PropertyInfo &E : properties) { PropertyInfo pinfo = E; - if (!values.has(pinfo.name)) { - pinfo.usage |= PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE; - } p_properties->push_back(E); } } diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 1ae3674f65a..193284896aa 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2823,6 +2823,7 @@ Hints that a [Color] property should be edited without affecting its transparency ([member Color.a] is not editable). + Hints that the property's value is an object encoded as object ID, with its type specified in the hint string. Used by the debugger. If a property is [String], hints that the property represents a particular type (class). This allows to select a type from the create dialog. The property will store the selected type as a string. @@ -2881,21 +2882,30 @@ [/codeblocks] [b]Note:[/b] The trailing colon is required for properly detecting built-in types. - + + [i]Deprecated.[/i] This hint is not used anywhere and will be removed in the future. + Hints that an object is too big to be sent via the debugger. + Hints that the hint string specifies valid node types for property of type [NodePath]. + Hints that a [String] property is a path to a file. Editing it will show a file dialog for picking the path for the file to be saved at. The dialog has access to the project's directory. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. See also [member FileDialog.filters]. + Hints that a [String] property is a path to a file. Editing it will show a file dialog for picking the path for the file to be saved at. The dialog has access to the entire filesystem. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. See also [member FileDialog.filters]. - + + Hints that an [int] property is an object ID. + [i]Deprecated.[/i] This hint is not used anywhere and will be removed in the future. + Hints that an [int] property is a pointer. Used by GDExtension. + Hints that a property is an [Array] with the stored type specified in the hint string. Hints that a string property is a locale code. Editing it will show a locale dialog for picking language and country. @@ -2904,6 +2914,7 @@ Hints that a dictionary property is string translation map. Dictionary keys are locale codes and, values are translated strings. + Hints that a property is an instance of a [Node]-derived type, optionally specified via the hint string (e.g. [code]"Node2D"[/code]). Editing it will show a dialog for picking a node from the scene. Hints that a quaternion property should disable the temporary euler editor. @@ -2942,6 +2953,7 @@ Used to group properties together in the editor in a subgroup (under a group). See [EditorInspector]. + The property is a bitfield, i.e. it contains multiple flags represented as bits. The property does not save its state in [PackedScene]. @@ -2953,14 +2965,20 @@ The property is a script variable which should be serialized and saved in the scene file. + The property value of type [Object] will be stored even if its value is [code]null[/code]. + If this property is modified, all inspector fields will be refreshed. - + + Signifies a default value from a placeholder script instance. + [i]Deprecated.[/i] This hint is not used anywhere and will be removed in the future. + The property is an enum, i.e. it only takes named integer constants from its associated enumeration. + If property has [code]nil[/code] as default value, its type will be [Variant]. The property is an array. @@ -2975,16 +2993,23 @@ The property is only shown in the editor if modern renderers are supported (the Compatibility rendering method is excluded). + The [NodePath] property will always be relative to the scene's root. Mostly useful for local resources. + Use when a resource is created on the fly, i.e. the getter will always return a different instance. [ResourceSaver] needs this information to properly save such resources. + Inserting an animation key frame of this property will automatically increment the value, allowing to easily keyframe multiple values in a row. - + + When loading, the resource for this property can be set at the end of loading. + [i]Deprecated.[/i] This hint is not used anywhere and will be removed in the future. + When this property is a [Resource] and base object is a [Node], a resource instance will be automatically created whenever the node is created in the editor. + The property is considered a basic setting and will appear even when advanced mode is disabled. Used for project settings. The property is read-only in the [EditorInspector]. diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index b37710724ec..2d35d4e9ace 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3866,9 +3866,6 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ } break; case Variant::NODE_PATH: { EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath); - if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && !p_hint_text.is_empty()) { - editor->setup(p_hint_text, Vector(), (p_usage & PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT)); - } if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && !p_hint_text.is_empty()) { Vector types = p_hint_text.split(",", false); Vector sn = Variant(types); //convert via variant diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 9e811fb5685..527bbaf9565 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -546,7 +546,7 @@ void Skeleton2D::_get_property_list(List *p_list) const { PropertyInfo(Variant::OBJECT, PNAME("modification_stack"), PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModificationStack2D", - PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE)); + PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE)); } void Skeleton2D::_make_bone_setup_dirty() { diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 78b02d74d55..d83d55d1213 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -99,7 +99,7 @@ void MeshInstance3D::_get_property_list(List *p_list) const { if (mesh.is_valid()) { for (int i = 0; i < mesh->get_surface_count(); i++) { - p_list->push_back(PropertyInfo(Variant::OBJECT, vformat("%s/%d", PNAME("surface_material_override"), i), PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE)); + p_list->push_back(PropertyInfo(Variant::OBJECT, vformat("%s/%d", PNAME("surface_material_override"), i), PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT)); } } } diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp index 8026b12c2bc..3b1faca17ee 100644 --- a/scene/3d/visual_instance_3d.cpp +++ b/scene/3d/visual_instance_3d.cpp @@ -501,8 +501,8 @@ void GeometryInstance3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance3D::get_aabb); ADD_GROUP("Geometry", ""); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE), "set_material_override", "get_material_override"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_overlay", PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE), "set_material_overlay", "get_material_overlay"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT), "set_material_override", "get_material_override"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_overlay", PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial", PROPERTY_USAGE_DEFAULT), "set_material_overlay", "get_material_overlay"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "transparency", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_transparency", "get_transparency"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0.01,suffix:m"), "set_extra_cull_margin", "get_extra_cull_margin"); diff --git a/scene/resources/skeleton_modification_stack_2d.cpp b/scene/resources/skeleton_modification_stack_2d.cpp index 5703185374e..dcc69d4831e 100644 --- a/scene/resources/skeleton_modification_stack_2d.cpp +++ b/scene/resources/skeleton_modification_stack_2d.cpp @@ -37,7 +37,7 @@ void SkeletonModificationStack2D::_get_property_list(List *p_list) PropertyInfo(Variant::OBJECT, "modifications/" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModification2D", - PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE)); + PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE)); } }