summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/static_checks.yml2
-rw-r--r--core/core_builders.py1
-rw-r--r--core/io/file_access_pack.cpp7
-rw-r--r--core/io/file_access_pack.h5
-rw-r--r--core/io/pck_packer.cpp4
-rw-r--r--core/math/convex_hull.cpp4
-rw-r--r--core/object/make_virtuals.py2
-rw-r--r--doc/classes/@GlobalScope.xml63
-rw-r--r--doc/classes/Array.xml1
-rw-r--r--doc/classes/Node.xml2
-rwxr-xr-xdoc/tools/make_rst.py1
-rw-r--r--editor/editor_builders.py3
-rw-r--r--editor/gui/scene_tree_editor.cpp37
-rw-r--r--editor/icons/editor_icons_builders.py4
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp6
-rw-r--r--editor/project_converter_3_to_4.cpp14
-rw-r--r--gles3_builders.py7
-rw-r--r--glsl_builders.py2
-rw-r--r--methods.py9
-rw-r--r--modules/denoise/resource_to_cpp.py2
-rw-r--r--modules/gdscript/gdscript_disassembler.cpp73
-rw-r--r--modules/gridmap/editor/grid_map_editor_plugin.cpp9
-rw-r--r--modules/navigation/godot_navigation_server.cpp6
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp4
-rw-r--r--platform/macos/display_server_macos.mm4
-rw-r--r--platform/uwp/detect.py1
-rw-r--r--platform/windows/display_server_windows.cpp4
-rw-r--r--platform_methods.py1
-rw-r--r--scene/3d/skeleton_ik_3d.cpp20
-rw-r--r--scene/3d/skeleton_ik_3d.h6
-rw-r--r--scene/resources/default_theme/default_theme_icons_builders.py3
-rw-r--r--scene/resources/importer_mesh.cpp4
-rw-r--r--scene/resources/packed_scene.cpp58
-rw-r--r--scene/resources/packed_scene.h2
-rw-r--r--scene/resources/visual_shader.h8
-rw-r--r--scu_builders.py4
36 files changed, 195 insertions, 188 deletions
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index c6ec244b7d..6133780688 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -23,7 +23,7 @@ jobs:
- name: Install Python dependencies and general setup
run: |
- pip3 install black==22.3.0 pytest==7.1.2 mypy==0.971
+ pip3 install black==23.3.0 pytest==7.1.2 mypy==0.971
git config diff.wsErrorHighlight all
- name: Get changed files
diff --git a/core/core_builders.py b/core/core_builders.py
index b0a3b85d58..e40ebbb14d 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -239,7 +239,6 @@ def make_license_header(target, source, env):
data_list += part["Copyright"]
with open(dst, "w", encoding="utf-8") as f:
-
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
f.write("#ifndef LICENSE_GEN_H\n")
f.write("#define LICENSE_GEN_H\n")
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 88a906a38e..74c5c1c191 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -48,7 +48,8 @@ Error PackedData::add_pack(const String &p_path, bool p_replace_files, uint64_t
}
void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted) {
- PathMD5 pmd5(p_path.md5_buffer());
+ String simplified_path = p_path.simplify_path();
+ PathMD5 pmd5(simplified_path.md5_buffer());
bool exists = files.has(pmd5);
@@ -68,7 +69,7 @@ void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64
if (!exists) {
//search for dir
- String p = p_path.replace_first("res://", "");
+ String p = simplified_path.replace_first("res://", "");
PackedDir *cd = root;
if (p.contains("/")) { //in a subdir
@@ -87,7 +88,7 @@ void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64
}
}
}
- String filename = p_path.get_file();
+ String filename = simplified_path.get_file();
// Don't add as a file if the path points to a directory
if (!filename.is_empty()) {
cd->files.insert(filename);
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 8bfabc9529..1538b302c2 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -184,7 +184,8 @@ public:
};
Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
- PathMD5 pmd5(p_path.md5_buffer());
+ String simplified_path = p_path.simplify_path();
+ PathMD5 pmd5(simplified_path.md5_buffer());
HashMap<PathMD5, PackedFile, PathMD5>::Iterator E = files.find(pmd5);
if (!E) {
return nullptr; //not found
@@ -197,7 +198,7 @@ Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
}
bool PackedData::has_path(const String &p_path) {
- return files.has(PathMD5(p_path.md5_buffer()));
+ return files.has(PathMD5(p_path.simplify_path().md5_buffer()));
}
bool PackedData::has_directory(const String &p_path) {
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index e7f4980e94..9b49cc3d8c 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -115,7 +115,9 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src, bool p_encr
}
File pf;
- pf.path = p_file;
+ // Simplify path here and on every 'files' access so that paths that have extra '/'
+ // symbols in them still match to the MD5 hash for the saved path.
+ pf.path = p_file.simplify_path();
pf.src_path = p_src;
pf.ofs = ofs;
pf.size = f->get_length();
diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp
index 76b3062944..f8456ec998 100644
--- a/core/math/convex_hull.cpp
+++ b/core/math/convex_hull.cpp
@@ -658,7 +658,7 @@ private:
Vector3 get_gd_normal(Face *p_face);
- bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack);
+ bool shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack);
public:
~ConvexHullInternal() {
@@ -1775,7 +1775,7 @@ real_t ConvexHullInternal::shrink(real_t p_amount, real_t p_clamp_amount) {
return p_amount;
}
-bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> p_stack) {
+bool ConvexHullInternal::shift_face(Face *p_face, real_t p_amount, LocalVector<Vertex *> &p_stack) {
Vector3 orig_shift = get_gd_normal(p_face) * -p_amount;
if (scaling[0] != 0) {
orig_shift[0] /= scaling[0];
diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py
index 18f27ae4a4..5be9650b32 100644
--- a/core/object/make_virtuals.py
+++ b/core/object/make_virtuals.py
@@ -154,7 +154,6 @@ def generate_version(argcount, const=False, returns=False):
def run(target, source, env):
-
max_versions = 12
txt = """
@@ -165,7 +164,6 @@ def run(target, source, env):
"""
for i in range(max_versions + 1):
-
txt += "/* " + str(i) + " Arguments */\n\n"
txt += generate_version(i, False, False)
txt += generate_version(i, False, True)
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 57094bfdd2..ab2200e796 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -2729,14 +2729,61 @@
<constant name="PROPERTY_HINT_OBJECT_ID" value="22" enum="PropertyHint">
</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 integers.
- 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 for properly detecting built-in types.
+ 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.
+ If a property is [Array], hints the editor how to show elements. The [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code].
+ [codeblocks]
+ [gdscript]
+ # Array of elem_type.
+ hint_string = "%d:" % [elem_type]
+ hint_string = "%d/%d:%s" % [elem_type, elem_hint, elem_hint_string]
+ # Two-dimensional array of elem_type (array of arrays of elem_type).
+ hint_string = "%d:%d:" % [TYPE_ARRAY, elem_type]
+ hint_string = "%d:%d/%d:%s" % [TYPE_ARRAY, elem_type, elem_hint, elem_hint_string]
+ # Three-dimensional array of elem_type (array of arrays of arrays of elem_type).
+ hint_string = "%d:%d:%d:" % [TYPE_ARRAY, TYPE_ARRAY, elem_type]
+ hint_string = "%d:%d:%d/%d:%s" % [TYPE_ARRAY, TYPE_ARRAY, elem_type, elem_hint, elem_hint_string]
+ [/gdscript]
+ [csharp]
+ // Array of elemType.
+ hintString = $"{elemType:D}:";
+ hintString = $"{elemType:}/{elemHint:D}:{elemHintString}";
+ // Two-dimensional array of elemType (array of arrays of elemType).
+ hintString = $"{Variant.Type.Array:D}:{elemType:D}:";
+ hintString = $"{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}";
+ // Three-dimensional array of elemType (array of arrays of arrays of elemType).
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}:";
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.Array:D}:{elemType:D}/{elemHint:D}:{elemHintString}";
+ [/csharp]
+ [/codeblocks]
+ Examples:
+ [codeblocks]
+ [gdscript]
+ hint_string = "%d:" % [TYPE_INT] # Array of integers.
+ hint_string = "%d/%d:1,10,1" % [TYPE_INT, PROPERTY_HINT_RANGE] # Array of integers (in range from 1 to 10).
+ hint_string = "%d/%d:Zero,One,Two" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum).
+ hint_string = "%d/%d:Zero,One,Three:3,Six:6" % [TYPE_INT, PROPERTY_HINT_ENUM] # Array of integers (an enum).
+ hint_string = "%d/%d:*.png" % [TYPE_STRING, PROPERTY_HINT_FILE] # Array of strings (file paths).
+ hint_string = "%d/%d:Texture2D" % [TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Array of textures.
+
+ hint_string = "%d:%d:" % [TYPE_ARRAY, TYPE_FLOAT] # Two-dimensional array of floats.
+ hint_string = "%d:%d/%d:" % [TYPE_ARRAY, TYPE_STRING, PROPERTY_HINT_MULTILINE_TEXT] # Two-dimensional array of multiline strings.
+ hint_string = "%d:%d/%d:-1,1,0.1" % [TYPE_ARRAY, TYPE_FLOAT, PROPERTY_HINT_RANGE] # Two-dimensional array of floats (in range from -1 to 1).
+ hint_string = "%d:%d/%d:Texture2D" % [TYPE_ARRAY, TYPE_OBJECT, PROPERTY_HINT_RESOURCE_TYPE] # Two-dimensional array of textures.
+ [/gdscript]
+ [csharp]
+ hintString = $"{Variant.Type.Int:D}/{PropertyHint.Range:D}:1,10,1"; // Array of integers (in range from 1 to 10).
+ hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Two"; // Array of integers (an enum).
+ hintString = $"{Variant.Type.Int:D}/{PropertyHint.Enum:D}:Zero,One,Three:3,Six:6"; // Array of integers (an enum).
+ hintString = $"{Variant.Type.String:D}/{PropertyHint.File:D}:*.png"; // Array of strings (file paths).
+ hintString = $"{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Array of textures.
+
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}:"; // Two-dimensional array of floats.
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.String:D}/{PropertyHint.MultilineText:D}:"; // Two-dimensional array of multiline strings.
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.Float:D}/{PropertyHint.Range:D}:-1,1,0.1"; // Two-dimensional array of floats (in range from -1 to 1).
+ hintString = $"{Variant.Type.Array:D}:{Variant.Type.Object:D}/{PropertyHint.ResourceType:D}:Texture2D"; // Two-dimensional array of textures.
+ [/csharp]
+ [/codeblocks]
+ [b]Note:[/b] The trailing colon is required for properly detecting built-in types.
</constant>
<constant name="PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE" value="24" enum="PropertyHint">
</constant>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index cdfc04c62f..bed9768603 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -536,6 +536,7 @@
Removes an element from the array by index. If the index does not exist in the array, nothing happens. To remove an element by searching for its value, use [method erase] instead.
[b]Note:[/b] This method acts in-place and doesn't return a value.
[b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
+ [b]Note:[/b] [param position] cannot be negative. To remove an element relative to the end of the array, use [code]arr.remove_at(arr.size() - (i + 1))[/code]. To remove the last element from the array without returning the value, use [code]arr.resize(arr.size() - 1)[/code].
</description>
</method>
<method name="resize">
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index b6bd82eacc..5f1ae424fa 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -716,7 +716,7 @@
[codeblock]
{
rpc_mode = MultiplayerAPI.RPCMode,
- transfer_mode = MultiplayerPeer.TranferMode,
+ transfer_mode = MultiplayerPeer.TransferMode,
call_local = false,
channel = 0,
}
diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py
index 7cc05087b7..0649a0bb62 100755
--- a/doc/tools/make_rst.py
+++ b/doc/tools/make_rst.py
@@ -1466,7 +1466,6 @@ def make_link(url: str, title: str) -> str:
def make_rst_index(grouped_classes: Dict[str, List[str]], dry_run: bool, output_dir: str) -> None:
-
if dry_run:
f = open(os.devnull, "w", encoding="utf-8")
else:
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index ce6abeb07a..90ecccbf30 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -14,7 +14,6 @@ from platform_methods import subprocess_main
def make_doc_header(target, source, env):
-
dst = target[0]
g = open(dst, "w", encoding="utf-8")
buf = ""
@@ -51,7 +50,6 @@ def make_doc_header(target, source, env):
def make_fonts_header(target, source, env):
-
dst = target[0]
g = open(dst, "w", encoding="utf-8")
@@ -80,7 +78,6 @@ def make_fonts_header(target, source, env):
def make_translations_header(target, source, env, category):
-
dst = target[0]
g = open(dst, "w", encoding="utf-8")
diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp
index 520cf42687..d1756df66c 100644
--- a/editor/gui/scene_tree_editor.cpp
+++ b/editor/gui/scene_tree_editor.cpp
@@ -357,33 +357,22 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
}
}
- // Display the node name in all tooltips so that long node names can be previewed
- // without having to rename them.
- if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
- item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
-
- String tooltip = String(p_node->get_name()) + "\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class();
- if (!p_node->get_editor_description().is_empty()) {
- tooltip += "\n\n" + p_node->get_editor_description();
- }
-
- item->set_tooltip_text(0, tooltip);
- } else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) {
- item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
-
- String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_scene_file_path() + "\n" + TTR("Type:") + " " + p_node->get_class();
- if (!p_node->get_editor_description().is_empty()) {
- tooltip += "\n\n" + p_node->get_editor_description();
+ {
+ // Display the node name in all tooltips so that long node names can be previewed
+ // without having to rename them.
+ String tooltip = String(p_node->get_name());
+
+ if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
+ item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
+ tooltip += String("\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path());
+ } else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) {
+ item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
+ tooltip += String("\n" + TTR("Instance:") + " " + p_node->get_scene_file_path());
}
- item->set_tooltip_text(0, tooltip);
- } else {
- StringName type = EditorNode::get_singleton()->get_object_custom_type_name(p_node);
- if (type == StringName()) {
- type = p_node->get_class();
- }
+ StringName custom_type = EditorNode::get_singleton()->get_object_custom_type_name(p_node);
+ tooltip += String("\n" + TTR("Type:") + " " + (custom_type != StringName() ? String(custom_type) : p_node->get_class()));
- String tooltip = String(p_node->get_name()) + "\n" + TTR("Type:") + " " + type;
if (!p_node->get_editor_description().is_empty()) {
tooltip += "\n\n" + p_node->get_editor_description();
}
diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py
index 2b621071ce..ae25072a9e 100644
--- a/editor/icons/editor_icons_builders.py
+++ b/editor/icons/editor_icons_builders.py
@@ -8,16 +8,15 @@ import os
from io import StringIO
from platform_methods import subprocess_main
+
# See also `scene/resources/default_theme/default_theme_icons_builders.py`.
def make_editor_icons_action(target, source, env):
-
dst = target[0]
svg_icons = source
icons_string = StringIO()
for f in svg_icons:
-
fname = str(f)
icons_string.write('\t"')
@@ -48,7 +47,6 @@ def make_editor_icons_action(target, source, env):
thumb_big_indices = []
index = 0
for f in svg_icons:
-
fname = str(f)
# Trim the `.svg` extension from the string.
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 8fbbd81e1d..c9651e634f 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -362,8 +362,7 @@ bool VisualShaderGraphPlugin::is_node_has_parameter_instances_relatively(VisualS
}
}
- LocalVector<int> prev_connected_nodes;
- visual_shader->get_prev_connected_nodes(p_type, p_node, prev_connected_nodes);
+ const LocalVector<int> &prev_connected_nodes = visual_shader->get_prev_connected_nodes(p_type, p_node);
for (const int &E : prev_connected_nodes) {
result = is_node_has_parameter_instances_relatively(p_type, E);
@@ -5038,8 +5037,7 @@ void VisualShaderEditor::_update_next_previews(int p_node_id) {
}
void VisualShaderEditor::_get_next_nodes_recursively(VisualShader::Type p_type, int p_node_id, LocalVector<int> &r_nodes) const {
- LocalVector<int> next_connections;
- visual_shader->get_next_connected_nodes(p_type, p_node_id, next_connections);
+ const LocalVector<int> &next_connections = visual_shader->get_next_connected_nodes(p_type, p_node_id);
for (int node_id : next_connections) {
r_nodes.push_back(node_id);
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index c5c2c9db51..9008b6a600 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -1274,14 +1274,17 @@ Vector<String> ProjectConverter3To4::parse_arguments(const String &line) {
for (int current_index = 0; current_index < string_size; current_index++) {
char32_t character = line.get(current_index);
switch (character) {
- case '(': {
+ case '(':
+ case '[':
+ case '{': {
parts_counter++;
if (parts_counter == 1 && !is_inside_string) {
start_part = current_index;
}
break;
};
- case ')': {
+ case ')':
+ case '}': {
parts_counter--;
if (parts_counter == 0 && !is_inside_string) {
parts.append(line.substr(start_part + 1, current_index - start_part - 1));
@@ -1289,13 +1292,6 @@ Vector<String> ProjectConverter3To4::parse_arguments(const String &line) {
}
break;
};
- case '[': {
- parts_counter++;
- if (parts_counter == 1 && !is_inside_string) {
- start_part = current_index;
- }
- break;
- };
case ']': {
parts_counter--;
if (parts_counter == 0 && !is_inside_string) {
diff --git a/gles3_builders.py b/gles3_builders.py
index 6b5a53221c..0b6a3c2542 100644
--- a/gles3_builders.py
+++ b/gles3_builders.py
@@ -40,7 +40,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
line = fs.readline()
while line:
-
if line.find("=") != -1 and header_data.reading == "":
# Mode
eqpos = line.find("=")
@@ -121,7 +120,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
-
x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
@@ -143,7 +141,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace("{", "").strip()
lines = uline.split(",")
for x in lines:
-
x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
@@ -159,7 +156,6 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
uline = uline.replace(";", "")
lines = uline.split(",")
for x in lines:
-
x = x.strip()
x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
@@ -486,7 +482,6 @@ def build_gles3_header(
fd.write("\tvirtual void _init() override {\n\n")
if header_data.uniforms:
-
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if header_data.uniforms:
for x in header_data.uniforms:
@@ -497,7 +492,6 @@ def build_gles3_header(
variant_count = 1
if len(header_data.variant_defines) > 0:
-
fd.write("\t\tstatic const char* _variant_defines[]={\n")
for x in header_data.variant_defines:
fd.write('\t\t\t"' + x + '",\n')
@@ -542,7 +536,6 @@ def build_gles3_header(
feedback_count = 0
if header_data.feedbacks:
-
fd.write("\t\tstatic const Feedback _feedbacks[]={\n")
for x in header_data.feedbacks:
name = x[0]
diff --git a/glsl_builders.py b/glsl_builders.py
index 1dcae2fd75..706b50636e 100644
--- a/glsl_builders.py
+++ b/glsl_builders.py
@@ -47,7 +47,6 @@ def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth:
line = fs.readline()
while line:
-
index = line.find("//")
if index != -1:
line = line[:index]
@@ -184,7 +183,6 @@ def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, dept
line = fs.readline()
while line:
-
while line.find("#include ") != -1:
includeline = line.replace("#include ", "").strip()[1:-1]
diff --git a/methods.py b/methods.py
index 18b4ceb74f..4c1357c688 100644
--- a/methods.py
+++ b/methods.py
@@ -259,14 +259,11 @@ const char *const VERSION_HASH = "{git_hash}";
def parse_cg_file(fname, uniforms, sizes, conditionals):
-
fs = open(fname, "r")
line = fs.readline()
while line:
-
if re.match(r"^\s*uniform", line):
-
res = re.match(r"uniform ([\d\w]*) ([\d\w]*)")
type = res.groups(1)
name = res.groups(2)
@@ -507,7 +504,6 @@ def sort_module_list(env):
def use_windows_spawn_fix(self, platform=None):
-
if os.name != "nt":
return # not needed, only for windows
@@ -522,7 +518,6 @@ def use_windows_spawn_fix(self, platform=None):
self.Replace(ARFLAGS="q")
def mySubProcess(cmdline, env):
-
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
popen_args = {
@@ -545,7 +540,6 @@ def use_windows_spawn_fix(self, platform=None):
return rv
def mySpawn(sh, escape, cmd, args, env):
-
newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs
@@ -566,7 +560,6 @@ def use_windows_spawn_fix(self, platform=None):
def save_active_platforms(apnames, ap):
-
for x in ap:
svg_names = []
if os.path.isfile(x + "/logo.svg"):
@@ -594,7 +587,6 @@ def save_active_platforms(apnames, ap):
def no_verbose(sys, env):
-
colors = {}
# Colors are disabled in non-TTY environments such as pipes. This means
@@ -708,7 +700,6 @@ def detect_visual_c_compiler_version(tools_env):
# and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
if "VCTOOLSINSTALLDIR" in tools_env:
-
# Newer versions have a different path available
vc_amd64_compiler_detection_index = (
tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X64;")
diff --git a/modules/denoise/resource_to_cpp.py b/modules/denoise/resource_to_cpp.py
index 6c83277355..a89eda9117 100644
--- a/modules/denoise/resource_to_cpp.py
+++ b/modules/denoise/resource_to_cpp.py
@@ -19,9 +19,9 @@
import os
from array import array
+
# Generates a C++ file from the specified binary resource file
def generate(in_path, out_path):
-
namespace = "oidn::weights"
scopes = namespace.split("::")
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp
index 0438bd8903..c66439fd9d 100644
--- a/modules/gdscript/gdscript_disassembler.cpp
+++ b/modules/gdscript/gdscript_disassembler.cpp
@@ -35,6 +35,22 @@
#include "core/string/string_builder.h"
+static String _get_script_name(const Ref<Script> &p_script) {
+ if (p_script.is_valid()) {
+ if (p_script->get_global_name() != StringName()) {
+ return p_script->get_global_name();
+ }
+ GDScript *gdscript = Object::cast_to<GDScript>(p_script.ptr());
+ if (gdscript) {
+ return gdscript->get_fully_qualified_name().get_file();
+ }
+ if (!p_script->get_path().is_empty()) {
+ return p_script->get_path().get_file();
+ }
+ }
+ return "<unknown script>";
+}
+
static String _get_variant_string(const Variant &p_variant) {
String txt;
if (p_variant.get_type() == Variant::STRING) {
@@ -50,12 +66,17 @@ static String _get_variant_string(const Variant &p_variant) {
} else {
GDScriptNativeClass *cls = Object::cast_to<GDScriptNativeClass>(obj);
if (cls) {
- txt += cls->get_name();
- txt += " (class)";
+ txt = "class(" + cls->get_name() + ")";
} else {
- txt = obj->get_class();
- if (obj->get_script_instance()) {
- txt += "(" + obj->get_script_instance()->get_script()->get_path() + ")";
+ Script *script = Object::cast_to<Script>(obj);
+ if (script) {
+ txt = "script(" + _get_script_name(script) + ")";
+ } else {
+ txt = "object(" + obj->get_class();
+ if (obj->get_script_instance()) {
+ txt += ", " + _get_script_name(obj->get_script_instance()->get_script());
+ }
+ txt += ")";
}
}
}
@@ -69,12 +90,6 @@ static String _disassemble_address(const GDScript *p_script, const GDScriptFunct
int addr = p_address & GDScriptFunction::ADDR_MASK;
switch (p_address >> GDScriptFunction::ADDR_BITS) {
- case GDScriptFunction::ADDR_TYPE_MEMBER: {
- return "member(" + p_script->debug_get_member_by_index(addr) + ")";
- } break;
- case GDScriptFunction::ADDR_TYPE_CONSTANT: {
- return "const(" + _get_variant_string(p_function.get_constant(addr)) + ")";
- } break;
case GDScriptFunction::ADDR_TYPE_STACK: {
switch (addr) {
case GDScriptFunction::ADDR_STACK_SELF:
@@ -87,6 +102,12 @@ static String _disassemble_address(const GDScript *p_script, const GDScriptFunct
return "stack(" + itos(addr) + ")";
}
} break;
+ case GDScriptFunction::ADDR_TYPE_CONSTANT: {
+ return "const(" + _get_variant_string(p_function.get_constant(addr)) + ")";
+ } break;
+ case GDScriptFunction::ADDR_TYPE_MEMBER: {
+ return "member(" + p_script->debug_get_member_by_index(addr) + ")";
+ } break;
}
return "<err>";
@@ -152,12 +173,14 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += DADDR(2);
text += " is Array[";
- Ref<Script> script_type = get_constant(_code_ptr[ip + 3] & GDScriptFunction::ADDR_MASK);
+ Ref<Script> script_type = get_constant(_code_ptr[ip + 3] & ADDR_MASK);
Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + 4];
StringName native_type = get_global_name(_code_ptr[ip + 5]);
if (script_type.is_valid() && script_type->is_valid()) {
- text += script_type->get_path();
+ text += "script(";
+ text += _get_script_name(script_type);
+ text += ")";
} else if (native_type != StringName()) {
text += native_type;
} else {
@@ -313,9 +336,10 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 3;
} break;
case OPCODE_SET_STATIC_VARIABLE: {
+ Ref<GDScript> gdscript = get_constant(_code_ptr[ip + 2] & ADDR_MASK);
+
text += "set_static_variable script(";
- Ref<GDScript> gdscript = get_constant(_code_ptr[ip + 2] & GDScriptFunction::ADDR_MASK);
- text += gdscript.is_valid() ? gdscript->get_fully_qualified_name().get_file() : "<unknown script>";
+ text += _get_script_name(gdscript);
text += ")";
if (gdscript.is_valid()) {
text += "[\"" + gdscript->debug_get_static_var_by_index(_code_ptr[ip + 3]) + "\"]";
@@ -328,11 +352,12 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_GET_STATIC_VARIABLE: {
+ Ref<GDScript> gdscript = get_constant(_code_ptr[ip + 2] & ADDR_MASK);
+
text += "get_static_variable ";
text += DADDR(1);
text += " = script(";
- Ref<GDScript> gdscript = get_constant(_code_ptr[ip + 2] & GDScriptFunction::ADDR_MASK);
- text += gdscript.is_valid() ? gdscript->get_fully_qualified_name().get_file() : "<unknown script>";
+ text += _get_script_name(gdscript);
text += ")";
if (gdscript.is_valid()) {
text += "[\"" + gdscript->debug_get_static_var_by_index(_code_ptr[ip + 3]) + "\"]";
@@ -393,11 +418,10 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_ASSIGN_TYPED_SCRIPT: {
- Variant script = _constants_ptr[_code_ptr[ip + 3]];
- Script *sc = Object::cast_to<Script>(script.operator Object *());
+ Ref<Script> script = get_constant(_code_ptr[ip + 3] & ADDR_MASK);
text += "assign typed script (";
- text += sc->get_path();
+ text += _get_script_name(script);
text += ") ";
text += DADDR(1);
text += " = ";
@@ -497,13 +521,13 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
int instr_var_args = _code_ptr[++ip];
int argc = _code_ptr[ip + 1 + instr_var_args];
- Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2] & GDScriptFunction::ADDR_MASK);
+ Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2] & ADDR_MASK);
Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + argc + 4];
StringName native_type = get_global_name(_code_ptr[ip + argc + 5]);
String type_name;
if (script_type.is_valid() && script_type->is_valid()) {
- type_name = script_type->get_path();
+ type_name = "script(" + _get_script_name(script_type) + ")";
} else if (native_type != StringName()) {
type_name = native_type;
} else {
@@ -967,11 +991,10 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 3;
} break;
case OPCODE_RETURN_TYPED_SCRIPT: {
- Variant script = _constants_ptr[_code_ptr[ip + 2]];
- Script *sc = Object::cast_to<Script>(script.operator Object *());
+ Ref<Script> script = get_constant(_code_ptr[ip + 2] & ADDR_MASK);
text += "return typed script (";
- text += sc->get_path();
+ text += _get_script_name(script);
text += ") ";
text += DADDR(1);
diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp
index 14f7b9b502..de04d376a0 100644
--- a/modules/gridmap/editor/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp
@@ -704,6 +704,9 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
+ // Update the grid, to check if the grid needs to be moved to a tile cursor.
+ update_grid();
+
if (do_input_action(p_camera, mm->get_position(), false)) {
return EditorPlugin::AFTER_GUI_INPUT_STOP;
}
@@ -951,7 +954,8 @@ void GridMapEditor::update_grid() {
grid_ofs[edit_axis] = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
- edit_grid_xform.origin = grid_ofs;
+ // If there's a valid tile cursor, offset the grid, otherwise move it back to the node.
+ edit_grid_xform.origin = cursor_instance.is_valid() ? grid_ofs : Vector3();
edit_grid_xform.basis = Basis();
for (int i = 0; i < 3; i++) {
@@ -1076,6 +1080,9 @@ void GridMapEditor::_notification(int p_what) {
Ref<MeshLibrary> cgmt = node->get_mesh_library();
if (cgmt.operator->() != last_mesh_library) {
update_palette();
+ // Update the cursor and grid in case the library is changed or removed.
+ _update_cursor_instance();
+ update_grid();
}
} break;
diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp
index cfd0cc6d46..c0efa8fefb 100644
--- a/modules/navigation/godot_navigation_server.cpp
+++ b/modules/navigation/godot_navigation_server.cpp
@@ -262,7 +262,7 @@ TypedArray<RID> GodotNavigationServer::map_get_links(RID p_map) const {
const NavMap *map = map_owner.get_or_null(p_map);
ERR_FAIL_COND_V(map == nullptr, link_rids);
- const LocalVector<NavLink *> links = map->get_links();
+ const LocalVector<NavLink *> &links = map->get_links();
link_rids.resize(links.size());
for (uint32_t i = 0; i < links.size(); i++) {
@@ -276,7 +276,7 @@ TypedArray<RID> GodotNavigationServer::map_get_regions(RID p_map) const {
const NavMap *map = map_owner.get_or_null(p_map);
ERR_FAIL_COND_V(map == nullptr, regions_rids);
- const LocalVector<NavRegion *> regions = map->get_regions();
+ const LocalVector<NavRegion *> &regions = map->get_regions();
regions_rids.resize(regions.size());
for (uint32_t i = 0; i < regions.size(); i++) {
@@ -290,7 +290,7 @@ TypedArray<RID> GodotNavigationServer::map_get_agents(RID p_map) const {
const NavMap *map = map_owner.get_or_null(p_map);
ERR_FAIL_COND_V(map == nullptr, agents_rids);
- const LocalVector<NavAgent *> agents = map->get_agents();
+ const LocalVector<NavAgent *> &agents = map->get_agents();
agents_rids.resize(agents.size());
for (uint32_t i = 0; i < agents.size(); i++) {
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index a607e26ac5..8724bc871a 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2856,11 +2856,11 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_img[p_shape]);
}
+ cursors_cache.erase(p_shape);
+
CursorShape c = current_cursor;
current_cursor = CURSOR_MAX;
cursor_set_shape(c);
-
- cursors_cache.erase(p_shape);
}
}
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index a0a851b7dc..973925a003 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -3415,9 +3415,9 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor,
cursors[p_shape] = nullptr;
}
- cursor_update_shape();
-
cursors_cache.erase(p_shape);
+
+ cursor_update_shape();
}
}
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 64fe5bc4a2..03c4fd547e 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -21,7 +21,6 @@ def can_build():
if os.name == "nt":
# building natively on windows!
if os.getenv("VSINSTALLDIR"):
-
if os.getenv("ANGLE_SRC_PATH") is None:
return False
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index ea93c47ec5..4c89e56910 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1907,11 +1907,11 @@ void DisplayServerWindows::cursor_set_custom_image(const Ref<Resource> &p_cursor
}
cursors[p_shape] = nullptr;
+ cursors_cache.erase(p_shape);
+
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
cursor_set_shape(c);
-
- cursors_cache.erase(p_shape);
}
}
diff --git a/platform_methods.py b/platform_methods.py
index 1a2520794c..ed0ab980d0 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -14,7 +14,6 @@ JSON_SERIALIZABLE_TYPES = (bool, int, float, str)
def run_in_subprocess(builder_function):
@functools.wraps(builder_function)
def wrapper(target, source, env):
-
# Convert SCons Node instances to absolute paths
target = [node.srcnode().abspath for node in target]
source = [node.srcnode().abspath for node in source]
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index b82620de80..c835b87b7f 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -330,6 +330,7 @@ void FabrikInverseKinematic::_update_chain(const Skeleton3D *p_sk, ChainItem *p_
void SkeletonIK3D::_validate_property(PropertyInfo &p_property) const {
if (p_property.name == "root_bone" || p_property.name == "tip_bone") {
+ Skeleton3D *skeleton = get_parent_skeleton();
if (skeleton) {
String names("--,");
for (int i = 0; i < skeleton->get_bone_count(); i++) {
@@ -400,13 +401,13 @@ void SkeletonIK3D::_bind_methods() {
void SkeletonIK3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- skeleton = Object::cast_to<Skeleton3D>(get_parent());
+ skeleton_ref = Object::cast_to<Skeleton3D>(get_parent());
set_process_priority(1);
reload_chain();
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
- if (target_node_override) {
+ if (target_node_override_ref) {
reload_goal();
}
_solve_chain();
@@ -463,7 +464,7 @@ const Transform3D &SkeletonIK3D::get_target_transform() const {
void SkeletonIK3D::set_target_node(const NodePath &p_node) {
target_node_path_override = p_node;
- target_node_override = nullptr;
+ target_node_override_ref = Variant();
reload_goal();
}
@@ -503,6 +504,10 @@ void SkeletonIK3D::set_max_iterations(int p_iterations) {
max_iterations = p_iterations;
}
+Skeleton3D *SkeletonIK3D::get_parent_skeleton() const {
+ return cast_to<Skeleton3D>(skeleton_ref.get_validated_object());
+}
+
bool SkeletonIK3D::is_running() {
return is_processing_internal();
}
@@ -511,7 +516,7 @@ void SkeletonIK3D::start(bool p_one_time) {
if (p_one_time) {
set_process_internal(false);
- if (target_node_override) {
+ if (target_node_override_ref) {
reload_goal();
}
@@ -523,16 +528,18 @@ void SkeletonIK3D::start(bool p_one_time) {
void SkeletonIK3D::stop() {
set_process_internal(false);
+ Skeleton3D *skeleton = get_parent_skeleton();
if (skeleton) {
skeleton->clear_bones_global_pose_override();
}
}
Transform3D SkeletonIK3D::_get_target_transform() {
- if (!target_node_override && !target_node_path_override.is_empty()) {
- target_node_override = Object::cast_to<Node3D>(get_node(target_node_path_override));
+ if (!target_node_override_ref && !target_node_path_override.is_empty()) {
+ target_node_override_ref = Object::cast_to<Node3D>(get_node(target_node_path_override));
}
+ Node3D *target_node_override = cast_to<Node3D>(target_node_override_ref.get_validated_object());
if (target_node_override && target_node_override->is_inside_tree()) {
return target_node_override->get_global_transform();
} else {
@@ -544,6 +551,7 @@ void SkeletonIK3D::reload_chain() {
FabrikInverseKinematic::free_task(task);
task = nullptr;
+ Skeleton3D *skeleton = get_parent_skeleton();
if (!skeleton) {
return;
}
diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h
index e77234021e..0a03e96905 100644
--- a/scene/3d/skeleton_ik_3d.h
+++ b/scene/3d/skeleton_ik_3d.h
@@ -132,8 +132,8 @@ class SkeletonIK3D : public Node {
real_t min_distance = 0.01;
int max_iterations = 10;
- Skeleton3D *skeleton = nullptr;
- Node3D *target_node_override = nullptr;
+ Variant skeleton_ref = Variant();
+ Variant target_node_override_ref = Variant();
FabrikInverseKinematic::Task *task = nullptr;
protected:
@@ -176,7 +176,7 @@ public:
void set_max_iterations(int p_iterations);
int get_max_iterations() const { return max_iterations; }
- Skeleton3D *get_parent_skeleton() const { return skeleton; }
+ Skeleton3D *get_parent_skeleton() const;
bool is_running();
diff --git a/scene/resources/default_theme/default_theme_icons_builders.py b/scene/resources/default_theme/default_theme_icons_builders.py
index 4dd5819a23..c4d132294c 100644
--- a/scene/resources/default_theme/default_theme_icons_builders.py
+++ b/scene/resources/default_theme/default_theme_icons_builders.py
@@ -11,14 +11,12 @@ from platform_methods import subprocess_main
# See also `editor/icons/editor_icons_builders.py`.
def make_default_theme_icons_action(target, source, env):
-
dst = target[0]
svg_icons = source
icons_string = StringIO()
for f in svg_icons:
-
fname = str(f)
icons_string.write('\t"')
@@ -49,7 +47,6 @@ def make_default_theme_icons_action(target, source, env):
index = 0
for f in svg_icons:
-
fname = str(f)
# Trim the `.svg` extension from the string.
diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp
index 24e8bf7ae7..a65a75d878 100644
--- a/scene/resources/importer_mesh.cpp
+++ b/scene/resources/importer_mesh.cpp
@@ -620,9 +620,7 @@ void ImporterMesh::generate_lods(float p_normal_merge_angle, float p_normal_spli
}
if (!found) {
- LocalVector<int> new_group;
- new_group.push_back(corner_idx);
- normal_group_indices.push_back(new_group);
+ normal_group_indices.push_back({ corner_idx });
normal_group_averages.push_back(ray_normal);
}
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 23942658cc..359c4765a2 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -244,35 +244,11 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1);
ERR_FAIL_UNSIGNED_INDEX_V(name_idx, (uint32_t)sname_count, nullptr);
- const StringName &prop_name = snames[name_idx];
- const Variant &prop_variant = props[nprops[j].value];
-
- if (prop_variant.get_type() == Variant::ARRAY) {
- const Array &array = prop_variant;
- if (Engine::get_singleton()->is_editor_hint()) {
- if (array.get_typed_builtin() == Variant::NODE_PATH) {
- // If editor, simply set the original array of NodePaths.
- node->set(prop_name, prop_variant);
- continue;
- }
- }
- for (int k = 0; k < array.size(); k++) {
- DeferredNodePathProperties dnp;
- dnp.path = array[k];
- dnp.base = node;
- // Use special property name to signify an array. This is only used in deferred_node_paths.
- dnp.property = String(prop_name) + "/indices/" + itos(k);
- deferred_node_paths.push_back(dnp);
- }
-
- } else {
- // Do an actual deferred set of the property path.
- DeferredNodePathProperties dnp;
- dnp.path = prop_variant;
- dnp.base = node;
- dnp.property = prop_name;
- deferred_node_paths.push_back(dnp);
- }
+ DeferredNodePathProperties dnp;
+ dnp.value = props[nprops[j].value];
+ dnp.base = node;
+ dnp.property = snames[name_idx];
+ deferred_node_paths.push_back(dnp);
continue;
}
@@ -465,27 +441,21 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
for (const DeferredNodePathProperties &dnp : deferred_node_paths) {
// Replace properties stored as NodePaths with actual Nodes.
- Node *other = dnp.base->get_node_or_null(dnp.path);
-
- const String string_property = dnp.property;
- if (string_property.contains("/indices/")) {
- // For properties with "/indices/", the replacement takes place inside an Array.
- const String base_property = string_property.get_slice("/", 0);
- const int index = string_property.get_slice("/", 2).to_int();
+ if (dnp.value.get_type() == Variant::ARRAY) {
+ Array paths = dnp.value;
bool valid;
- Array array = dnp.base->get(base_property, &valid);
+ Array array = dnp.base->get(dnp.property, &valid);
ERR_CONTINUE(!valid);
+ array = array.duplicate();
- if (array.size() >= index) {
- array.push_back(other);
- } else {
- array.set(index, other);
+ array.resize(paths.size());
+ for (int i = 0; i < array.size(); i++) {
+ array.set(i, dnp.base->get_node_or_null(paths[i]));
}
-
- dnp.base->set(base_property, array);
+ dnp.base->set(dnp.property, array);
} else {
- dnp.base->set(dnp.property, other);
+ dnp.base->set(dnp.property, dnp.base->get_node_or_null(dnp.value));
}
}
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 29df382c1f..35799dc1ee 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -72,7 +72,7 @@ class SceneState : public RefCounted {
struct DeferredNodePathProperties {
Node *base = nullptr;
StringName property;
- NodePath path;
+ Variant value;
};
Vector<NodeData> nodes;
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 38d51dba9c..61418b680e 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -203,11 +203,11 @@ public: // internal methods
_FORCE_INLINE_ Ref<VisualShaderNode> get_node_unchecked(Type p_type, int p_id) const {
return graph[p_type].nodes[p_id].node;
}
- _FORCE_INLINE_ void get_next_connected_nodes(Type p_type, int p_id, LocalVector<int> &r_list) const {
- r_list = graph[p_type].nodes[p_id].next_connected_nodes;
+ _FORCE_INLINE_ const LocalVector<int> &get_next_connected_nodes(Type p_type, int p_id) const {
+ return graph[p_type].nodes[p_id].next_connected_nodes;
}
- _FORCE_INLINE_ void get_prev_connected_nodes(Type p_type, int p_id, LocalVector<int> &r_list) const {
- r_list = graph[p_type].nodes[p_id].prev_connected_nodes;
+ _FORCE_INLINE_ const LocalVector<int> &get_prev_connected_nodes(Type p_type, int p_id) const {
+ return graph[p_type].nodes[p_id].prev_connected_nodes;
}
Vector<int> get_node_list(Type p_type) const;
diff --git a/scu_builders.py b/scu_builders.py
index b26cfc77c0..5f7821655b 100644
--- a/scu_builders.py
+++ b/scu_builders.py
@@ -45,7 +45,6 @@ def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exc
sub_folder_slashed = sub_folder + "/"
for file in glob.glob("*." + extension):
-
simple_name = Path(file).stem
if file.endswith(".gen.cpp"):
@@ -62,7 +61,6 @@ def find_files_in_folder(folder, sub_folder, include_list, extension, sought_exc
def write_output_file(file_count, include_list, start_line, end_line, output_folder, output_filename_prefix, extension):
-
output_folder = os.path.abspath(output_folder)
if not os.path.isdir(output_folder):
@@ -160,6 +158,7 @@ def find_section_name(sub_folder):
# which is slow like a normal build, but prevents the naming conflicts.
# Ideally in these situations, the source code should be changed to prevent naming conflicts.
+
# "extension" will usually be cpp, but can also be set to c (for e.g. third party libraries that use c)
def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension="cpp"):
if len(folders) == 0:
@@ -243,7 +242,6 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
def generate_scu_files(verbose, is_release_build):
-
print("=============================")
print("Single Compilation Unit Build")
print("=============================")