PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE"
This commit is contained in:
parent
fab9926a95
commit
2bc0bcbd26
14 changed files with 15 additions and 15 deletions
|
@ -586,7 +586,7 @@ void register_global_constants() {
|
|||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_ENUM);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NIL_IS_VARIANT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ARRAY);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ALWAYS_DUPLICATE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_HIGH_END_GFX);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT);
|
||||
|
|
|
@ -262,7 +262,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
|
|||
|
||||
if ((p.get_type() == Variant::DICTIONARY || p.get_type() == Variant::ARRAY)) {
|
||||
r->set(E.name, p.duplicate(p_subresources));
|
||||
} else if (p.get_type() == Variant::OBJECT && (p_subresources || (E.usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE))) {
|
||||
} else if (p.get_type() == Variant::OBJECT && (p_subresources || (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE))) {
|
||||
Ref<Resource> sr = p;
|
||||
if (sr.is_valid()) {
|
||||
r->set(E.name, sr->duplicate(p_subresources));
|
||||
|
|
|
@ -109,7 +109,7 @@ enum PropertyUsageFlags {
|
|||
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.
|
||||
PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE = 1 << 19, // If the object is duplicated also this property will be duplicated.
|
||||
PROPERTY_USAGE_ALWAYS_DUPLICATE = 1 << 19, // When duplicating a resource, always duplicate, even with subresource duplication disabled.
|
||||
PROPERTY_USAGE_HIGH_END_GFX = 1 << 20,
|
||||
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 1 << 21,
|
||||
PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 1 << 22,
|
||||
|
|
|
@ -2664,8 +2664,8 @@
|
|||
<constant name="PROPERTY_USAGE_ARRAY" value="262144" enum="PropertyUsageFlags" is_bitfield="true">
|
||||
The property is an array.
|
||||
</constant>
|
||||
<constant name="PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true">
|
||||
If the property is a [Resource], a new copy of it is always created when calling [method Node.duplicate] or [method Resource.duplicate].
|
||||
<constant name="PROPERTY_USAGE_ALWAYS_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true">
|
||||
When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should always be duplicated, regardless of the [code]subresources[/code] bool parameter.
|
||||
</constant>
|
||||
<constant name="PROPERTY_USAGE_HIGH_END_GFX" value="1048576" enum="PropertyUsageFlags" is_bitfield="true">
|
||||
The property is only shown in the editor if modern renderers are supported (GLES3 is excluded).
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<param index="0" name="subresources" type="bool" default="false" />
|
||||
<description>
|
||||
Duplicates this resource, returning a new resource with its [code]export[/code]ed or [constant PROPERTY_USAGE_STORAGE] properties copied from the original.
|
||||
If [param subresources] is [code]false[/code], a shallow copy is returned. Nested resources within subresources are not duplicated and are shared from the original resource. This behavior can be overridden by the [constant PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE] flag.
|
||||
If [param subresources] is [code]false[/code], a shallow copy is returned. Nested resources within subresources are not duplicated and are shared from the original resource. This behavior can be overridden by the [constant PROPERTY_USAGE_ALWAYS_DUPLICATE] flag.
|
||||
[b]Note:[/b] For custom resources, this method will fail if [method Object._init] has been defined with required parameters.
|
||||
</description>
|
||||
</method>
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace Godot.SourceGenerators
|
|||
ClassIsEnum = 65536,
|
||||
NilIsVariant = 131072,
|
||||
Array = 262144,
|
||||
DoNotShareOnDuplicate = 524288,
|
||||
AlwaysDuplicate = 524288,
|
||||
HighEndGfx = 1048576,
|
||||
NodePathFromSceneRoot = 2097152,
|
||||
ResourceNotPersistent = 4194304,
|
||||
|
|
|
@ -562,7 +562,7 @@ void Skeleton2D::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
PropertyInfo(Variant::OBJECT, PNAME("modification_stack"),
|
||||
PROPERTY_HINT_RESOURCE_TYPE,
|
||||
"SkeletonModificationStack2D",
|
||||
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
|
||||
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE));
|
||||
}
|
||||
|
||||
void Skeleton2D::_make_bone_setup_dirty() {
|
||||
|
|
|
@ -502,7 +502,7 @@ void VoxelGI::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents", PROPERTY_HINT_NONE, "suffix:m"), "set_extents", "get_extents");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_attributes", PROPERTY_HINT_RESOURCE_TYPE, "CameraAttributesPractical,CameraAttributesPhysical"), "set_camera_attributes", "get_camera_attributes");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "VoxelGIData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_probe_data", "get_probe_data");
|
||||
|
||||
BIND_ENUM_CONSTANT(SUBDIV_64);
|
||||
BIND_ENUM_CONSTANT(SUBDIV_128);
|
||||
|
|
|
@ -716,7 +716,7 @@ AnimationNodeStateMachinePlayback::AnimationNodeStateMachinePlayback() {
|
|||
///////////////////////////////////////////////////////
|
||||
|
||||
void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) const {
|
||||
r_list->push_back(PropertyInfo(Variant::OBJECT, playback, PROPERTY_HINT_RESOURCE_TYPE, "AnimationNodeStateMachinePlayback", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
|
||||
r_list->push_back(PropertyInfo(Variant::OBJECT, playback, PROPERTY_HINT_RESOURCE_TYPE, "AnimationNodeStateMachinePlayback", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE));
|
||||
List<StringName> advance_conditions;
|
||||
for (int i = 0; i < transitions.size(); i++) {
|
||||
StringName ac = transitions[i].transition->get_advance_condition_name();
|
||||
|
|
|
@ -6374,7 +6374,7 @@ void TextEdit::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_tabs"), "set_draw_tabs", "is_drawing_tabs");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_spaces"), "set_draw_spaces", "is_drawing_spaces");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "syntax_highlighter", PROPERTY_HINT_RESOURCE_TYPE, "SyntaxHighlighter", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_syntax_highlighter", "get_syntax_highlighter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "syntax_highlighter", PROPERTY_HINT_RESOURCE_TYPE, "SyntaxHighlighter", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE), "set_syntax_highlighter", "get_syntax_highlighter");
|
||||
|
||||
ADD_GROUP("Scroll", "scroll_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_smooth"), "set_smooth_scroll_enabled", "is_smooth_scroll_enabled");
|
||||
|
|
|
@ -2213,7 +2213,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
|||
|
||||
Variant value = N->get()->get(name).duplicate(true);
|
||||
|
||||
if (E.usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
|
||||
if (E.usage & PROPERTY_USAGE_ALWAYS_DUPLICATE) {
|
||||
Resource *res = Object::cast_to<Resource>(value);
|
||||
if (res) { // Duplicate only if it's a resource
|
||||
current_node->set(name, res->duplicate());
|
||||
|
|
|
@ -64,7 +64,7 @@ bool SkeletonModification2DStackHolder::_get(const StringName &p_path, Variant &
|
|||
}
|
||||
|
||||
void SkeletonModification2DStackHolder::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "held_modification_stack", PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModificationStack2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "held_modification_stack", PROPERTY_HINT_RESOURCE_TYPE, "SkeletonModificationStack2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ALWAYS_DUPLICATE));
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
|
|
|
@ -37,7 +37,7 @@ void SkeletonModificationStack2D::_get_property_list(List<PropertyInfo> *p_list)
|
|||
PropertyInfo(Variant::OBJECT, "modifications/" + itos(i),
|
||||
PROPERTY_HINT_RESOURCE_TYPE,
|
||||
"SkeletonModification2D",
|
||||
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
|
||||
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DEFERRED_SET_RESOURCE | PROPERTY_USAGE_ALWAYS_DUPLICATE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1561,7 +1561,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
prop_name += "/" + itos(E.key);
|
||||
|
||||
if (E.key != NODE_ID_OUTPUT) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "VisualShaderNode", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_ALWAYS_DUPLICATE));
|
||||
}
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
|
||||
|
||||
|
|
Loading…
Reference in a new issue