diff options
-rw-r--r-- | .github/workflows/linux_builds.yml | 3 | ||||
-rw-r--r-- | doc/classes/BaseMaterial3D.xml | 2 | ||||
-rw-r--r-- | doc/classes/Bone2D.xml | 13 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 3 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 2 | ||||
-rw-r--r-- | editor/renames_map_3_to_4.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_vm.cpp | 32 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.gd | 15 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.out | 7 | ||||
-rw-r--r-- | platform/macos/export/export_plugin.cpp | 2 | ||||
-rw-r--r-- | scene/2d/skeleton_2d.cpp | 13 | ||||
-rw-r--r-- | scene/2d/skeleton_2d.h | 3 | ||||
-rw-r--r-- | scene/resources/material.cpp | 15 | ||||
-rw-r--r-- | scene/resources/visual_shader_nodes.cpp | 7 |
14 files changed, 64 insertions, 57 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 0000a061d7..2c2ab9b6fb 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -36,7 +36,8 @@ jobs: cache-name: linux-editor-double-sanitizers target: editor tests: true - sconsflags: dev_build=yes precision=double use_asan=yes use_ubsan=yes linker=gold + # Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners. + sconsflags: dev_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold proj-test: true # Can be turned off for PRs that intentionally break compat with godot-cpp, # until both the upstream PR and the matching godot-cpp changes are merged. diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml index e72aa373f7..6cd8c44269 100644 --- a/doc/classes/BaseMaterial3D.xml +++ b/doc/classes/BaseMaterial3D.xml @@ -121,7 +121,7 @@ Texture used to control the backlight effect per-pixel. Added to [member backlight]. </member> <member name="billboard_keep_scale" type="bool" setter="set_flag" getter="get_flag" default="false"> - If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise, the scale is lost when billboarding. Only applies when [member billboard_mode] is [constant BILLBOARD_ENABLED]. + If [code]true[/code], the shader will keep the scale set for the mesh. Otherwise, the scale is lost when billboarding. Only applies when [member billboard_mode] is not [constant BILLBOARD_DISABLED]. </member> <member name="billboard_mode" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="BaseMaterial3D.BillboardMode" default="0"> Controls how the object faces the camera. See [enum BillboardMode]. diff --git a/doc/classes/Bone2D.xml b/doc/classes/Bone2D.xml index 81999cebab..c421fe1543 100644 --- a/doc/classes/Bone2D.xml +++ b/doc/classes/Bone2D.xml @@ -31,12 +31,6 @@ [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node. </description> </method> - <method name="get_default_length" qualifiers="const"> - <return type="float" /> - <description> - Deprecated. Please use [method get_length] instead. - </description> - </method> <method name="get_index_in_skeleton" qualifiers="const"> <return type="int" /> <description> @@ -70,13 +64,6 @@ [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node. </description> </method> - <method name="set_default_length"> - <return type="void" /> - <param index="0" name="default_length" type="float" /> - <description> - Deprecated. Please use [method set_length] instead. - </description> - </method> <method name="set_length"> <return type="void" /> <param index="0" name="length" type="float" /> diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 2a524e8c3a..aadc71c5b8 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1951,11 +1951,12 @@ void RasterizerCanvasGLES3::occluder_polygon_set_shape(RID p_occluder, const Vec glBufferData(GL_ELEMENT_ARRAY_BUFFER, 3 * lc * sizeof(uint16_t), indices.ptr(), GL_STATIC_DRAW); glBindVertexArray(0); } else { - glBindVertexArray(oc->vertex_array); glBindBuffer(GL_ARRAY_BUFFER, oc->vertex_buffer); glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(float), geometry.ptr(), GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, oc->index_buffer); glBufferData(GL_ELEMENT_ARRAY_BUFFER, 3 * lc * sizeof(uint16_t), indices.ptr(), GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } } diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 8a595be6e6..b37d12e5ee 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1560,7 +1560,7 @@ void EditorFileSystem::_update_script_classes() { ScriptServer::add_global_class(efd->files[index]->script_class_name, efd->files[index]->script_class_extends, lang, path); EditorNode::get_editor_data().script_class_set_icon_path(efd->files[index]->script_class_name, efd->files[index]->script_class_icon_path); - EditorNode::get_editor_data().script_class_set_name(efd->files[index]->file, efd->files[index]->script_class_name); + EditorNode::get_editor_data().script_class_set_name(path, efd->files[index]->script_class_name); } } diff --git a/editor/renames_map_3_to_4.cpp b/editor/renames_map_3_to_4.cpp index 4df6092558..277df4e66c 100644 --- a/editor/renames_map_3_to_4.cpp +++ b/editor/renames_map_3_to_4.cpp @@ -291,6 +291,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "get_cull_mask_bit", "get_cull_mask_value" }, // Camera3D { "get_cursor_position", "get_caret_column" }, // LineEdit { "get_d", "get_distance" }, // LineShape2D + { "get_default_length", "get_length" }, // Bone2D { "get_depth_bias_enable", "get_depth_bias_enabled" }, // RDPipelineRasterizationState { "get_device", "get_output_device" }, // AudioServer { "get_device_list", "get_output_device_list" }, // AudioServer @@ -490,6 +491,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "set_cull_mask_bit", "set_cull_mask_value" }, // Camera3D { "set_cursor_position", "set_caret_column" }, // LineEdit { "set_d", "set_distance" }, // WorldMarginShape2D + { "set_default_length", "set_length" }, // Bone2D { "set_depth_bias_enable", "set_depth_bias_enabled" }, // RDPipelineRasterizationState { "set_device", "set_output_device" }, // AudioServer { "set_doubleclick", "set_double_click" }, // InputEventMouseButton @@ -749,6 +751,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "GetCullMaskBit", "GetCullMaskValue" }, // Camera3D { "GetCursorPosition", "GetCaretColumn" }, // LineEdit { "GetD", "GetDistance" }, // LineShape2D + { "GetDefaultLength", "GetLength" }, // Bone2D { "GetDepthBiasEnable", "GetDepthBiasEnabled" }, // RDPipelineRasterizationState { "GetDevice", "GetOutputDevice" }, // AudioServer { "GetDeviceList", "GetOutputDeviceList" }, // AudioServer @@ -938,6 +941,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "SetCullMaskBit", "SetCullMaskValue" }, // Camera3D { "SetCursorPosition", "SetCaretColumn" }, // LineEdit { "SetD", "SetDistance" }, // WorldMarginShape2D + { "SetDefaultLength", "SetLength" }, // Bone2D { "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState { "SetDevice", "SetOutputDevice" }, // AudioServer { "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index fd8875d8b1..9f7d27d841 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -1275,21 +1275,19 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } - bool was_freed = false; - Object *src_obj = src->get_validated_object_with_check(was_freed); - if (!src_obj) { - if (was_freed) { + if (src->get_type() == Variant::OBJECT) { + bool was_freed = false; + Object *src_obj = src->get_validated_object_with_check(was_freed); + if (!src_obj && was_freed) { err_text = "Trying to assign invalid previously freed instance."; - } else { - err_text = "Trying to assign invalid null variable."; + OPCODE_BREAK; } - OPCODE_BREAK; - } - if (src_obj && !ClassDB::is_parent_class(src_obj->get_class_name(), nc->get_name())) { - err_text = "Trying to assign value of type '" + src_obj->get_class_name() + - "' to a variable of type '" + nc->get_name() + "'."; - OPCODE_BREAK; + if (src_obj && !ClassDB::is_parent_class(src_obj->get_class_name(), nc->get_name())) { + err_text = "Trying to assign value of type '" + src_obj->get_class_name() + + "' to a variable of type '" + nc->get_name() + "'."; + OPCODE_BREAK; + } } #endif // DEBUG_ENABLED *dst = *src; @@ -1314,15 +1312,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } - if (src->get_type() != Variant::NIL) { + if (src->get_type() == Variant::OBJECT) { bool was_freed = false; Object *val_obj = src->get_validated_object_with_check(was_freed); - if (!val_obj) { - if (was_freed) { - err_text = "Trying to assign invalid previously freed instance."; - } else { - err_text = "Trying to assign invalid null variable."; - } + if (!val_obj && was_freed) { + err_text = "Trying to assign invalid previously freed instance."; OPCODE_BREAK; } diff --git a/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.gd b/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.gd new file mode 100644 index 0000000000..c197062d9f --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.gd @@ -0,0 +1,15 @@ +extends Node + +func test(): + var typed: Variant = get_node_or_null("does_not_exist") + var untyped = null + var node_1: Node = typed + var node_2: Node = untyped + var node_3 = typed + var node_4 = untyped + print(typed) + print(untyped) + print(node_1) + print(node_2) + print(node_3) + print(node_4) diff --git a/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.out b/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.out new file mode 100644 index 0000000000..d66b72f5c3 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/native_typed_assign_null.out @@ -0,0 +1,7 @@ +GDTEST_OK +<Object#null> +<null> +<Object#null> +<null> +<Object#null> +<null> diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index bb96308a75..5a097adf39 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -137,7 +137,7 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "application/copyright_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary())); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "display/high_res"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "display/high_res"), true)); #ifdef MACOS_ENABLED r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/codesign", PROPERTY_HINT_ENUM, "Disabled,Built-in (ad-hoc only),rcodesign,Xcode codesign"), 3, true)); diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 96711bbe72..4fdc7b3584 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -378,9 +378,6 @@ void Bone2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_skeleton_rest"), &Bone2D::get_skeleton_rest); ClassDB::bind_method(D_METHOD("get_index_in_skeleton"), &Bone2D::get_index_in_skeleton); - ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length); - ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length); - ClassDB::bind_method(D_METHOD("set_autocalculate_length_and_angle", "auto_calculate"), &Bone2D::set_autocalculate_length_and_angle); ClassDB::bind_method(D_METHOD("get_autocalculate_length_and_angle"), &Bone2D::get_autocalculate_length_and_angle); ClassDB::bind_method(D_METHOD("set_length", "length"), &Bone2D::set_length); @@ -416,16 +413,6 @@ void Bone2D::apply_rest() { set_transform(rest); } -void Bone2D::set_default_length(real_t p_length) { - WARN_DEPRECATED_MSG("set_default_length is deprecated. Please use set_length instead!"); - set_length(p_length); -} - -real_t Bone2D::get_default_length() const { - WARN_DEPRECATED_MSG("get_default_length is deprecated. Please use get_length instead!"); - return get_length(); -} - int Bone2D::get_index_in_skeleton() const { ERR_FAIL_COND_V(!skeleton, -1); skeleton->_update_bone_setup(); diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index 149ab64306..6a36a31552 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -80,9 +80,6 @@ public: PackedStringArray get_configuration_warnings() const override; - void set_default_length(real_t p_length); - real_t get_default_length() const; - void set_autocalculate_length_and_angle(bool p_autocalculate); bool get_autocalculate_length_and_angle() const; void set_length(real_t p_length); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 7e84814ab3..2627898f5f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -369,7 +369,15 @@ void ShaderMaterial::set_shader_parameter(const StringName &p_param, const Varia param_cache.erase(p_param); RS::get_singleton()->material_set_param(_get_material(), p_param, Variant()); } else { - param_cache[p_param] = p_value; + Variant *v = param_cache.getptr(p_param); + if (!v) { + // Never assigned, also update the remap cache. + remap_cache["shader_parameter/" + p_param.operator String()] = p_param; + param_cache.insert(p_param, p_value); + } else { + *v = p_value; + } + if (p_value.get_type() == Variant::OBJECT) { RID tex_rid = p_value; if (tex_rid == RID()) { @@ -955,11 +963,14 @@ void BaseMaterial3D::_update_shader() { } break; case BILLBOARD_PARTICLES: { //make billboard - code += " mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]),normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; + code += " mat4 mat_world = mat4(normalize(INV_VIEW_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) ,normalize(INV_VIEW_MATRIX[2]), MODEL_MATRIX[3]);\n"; //rotate by rotation code += " mat_world = mat_world * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; //set modelview code += " MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;\n"; + if (flags[FLAG_BILLBOARD_KEEP_SCALE]) { + code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + } //set modelview normal code += " MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);\n"; diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 7550f598f8..9f5a64597a 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -7606,8 +7606,11 @@ String VisualShaderNodeBillboard::generate_code(Shader::Mode p_mode, VisualShade break; case BILLBOARD_TYPE_PARTICLES: code += " {\n"; - code += " mat4 __wm = mat4(normalize(INV_VIEW_MATRIX[0]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]) * length(MODEL_MATRIX[0]), normalize(INV_VIEW_MATRIX[2]) * length(MODEL_MATRIX[2]), MODEL_MATRIX[3]);\n"; + code += " mat4 __wm = mat4(normalize(INV_VIEW_MATRIX[0]), normalize(INV_VIEW_MATRIX[1]), normalize(INV_VIEW_MATRIX[2]), MODEL_MATRIX[3]);\n"; code += " __wm = __wm * mat4(vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + if (keep_scale) { + code += " __wm = __wm * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n"; + } code += " " + p_output_vars[0] + " = VIEW_MATRIX * __wm;\n"; code += " }\n"; break; @@ -7650,7 +7653,7 @@ bool VisualShaderNodeBillboard::is_keep_scale_enabled() const { Vector<StringName> VisualShaderNodeBillboard::get_editable_properties() const { Vector<StringName> props; props.push_back("billboard_type"); - if (billboard_type == BILLBOARD_TYPE_ENABLED || billboard_type == BILLBOARD_TYPE_FIXED_Y) { + if (billboard_type == BILLBOARD_TYPE_ENABLED || billboard_type == BILLBOARD_TYPE_FIXED_Y || billboard_type == BILLBOARD_TYPE_PARTICLES) { props.push_back("keep_scale"); } return props; |