summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/csg/csg_shape.cpp7
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp68
-rw-r--r--modules/gdscript/gdscript_analyzer.h2
-rw-r--r--modules/gdscript/gdscript_editor.cpp6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.gd10
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd17
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out3
-rw-r--r--modules/gdscript/tests/scripts/parser/features/class_inheritance_access.gd40
-rw-r--r--modules/gdscript/tests/scripts/parser/features/class_inheritance_access.out16
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp4
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.cpp68
-rw-r--r--modules/mono/csharp_script.cpp4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs9
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs9
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs10
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs10
25 files changed, 283 insertions, 50 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 39e4751be3..3bb2bc3a4d 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -955,6 +955,10 @@ CSGBrush *CSGSphere3D::_build_brush() {
double u0 = double(j) / radial_segments;
double longitude1 = longitude_step * (j + 1);
+ if (j == radial_segments - 1) {
+ longitude1 = 0;
+ }
+
double x1 = Math::sin(longitude1);
double z1 = Math::cos(longitude1);
double u1 = double(j + 1) / radial_segments;
@@ -1271,6 +1275,9 @@ CSGBrush *CSGCylinder3D::_build_brush() {
for (int i = 0; i < sides; i++) {
float inc = float(i) / sides;
float inc_n = float((i + 1)) / sides;
+ if (i == sides - 1) {
+ inc_n = 0;
+ }
float ang = inc * Math_TAU;
float ang_n = inc_n * Math_TAU;
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 3ff8b2b91a..547fd1cfd5 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -1139,7 +1139,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
#endif // TOOLS_ENABLED
}
- if (p_function->identifier->name == "_init") {
+ if (p_function->identifier->name == GDScriptLanguage::get_singleton()->strings._init) {
// Constructor.
GDScriptParser::DataType return_type = parser->current_class->get_datatype();
return_type.is_meta_type = false;
@@ -1153,6 +1153,57 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
} else {
GDScriptParser::DataType return_type = resolve_datatype(p_function->return_type);
p_function->set_datatype(return_type);
+
+#ifdef DEBUG_ENABLED
+ // Check if the function signature matches the parent. If not it's an error since it breaks polymorphism.
+ // Not for the constructor which can vary in signature.
+ GDScriptParser::DataType base_type = parser->current_class->base_type;
+ GDScriptParser::DataType parent_return_type;
+ List<GDScriptParser::DataType> parameters_types;
+ int default_par_count = 0;
+ bool is_static = false;
+ bool is_vararg = false;
+ if (get_function_signature(p_function, false, base_type, p_function->identifier->name, parent_return_type, parameters_types, default_par_count, is_static, is_vararg)) {
+ bool valid = p_function->is_static == is_static;
+ valid = valid && parent_return_type == p_function->get_datatype();
+
+ int par_count_diff = p_function->parameters.size() - parameters_types.size();
+ valid = valid && par_count_diff >= 0;
+ valid = valid && p_function->default_arg_values.size() >= default_par_count + par_count_diff;
+
+ int i = 0;
+ for (const GDScriptParser::DataType &par_type : parameters_types) {
+ valid = valid && par_type == p_function->parameters[i++]->get_datatype();
+ }
+
+ if (!valid) {
+ // Compute parent signature as a string to show in the error message.
+ String parent_signature = parent_return_type.is_hard_type() ? parent_return_type.to_string() : "Variant";
+ if (parent_signature == "null") {
+ parent_signature = "void";
+ }
+ parent_signature += " " + p_function->identifier->name.operator String() + "(";
+ int j = 0;
+ for (const GDScriptParser::DataType &par_type : parameters_types) {
+ if (j > 0) {
+ parent_signature += ", ";
+ }
+ String parameter = par_type.to_string();
+ if (parameter == "null") {
+ parameter = "Variant";
+ }
+ parent_signature += parameter;
+ if (j == parameters_types.size() - default_par_count) {
+ parent_signature += " = default";
+ }
+
+ j++;
+ }
+ parent_signature += ")";
+ push_error(vformat(R"(The function signature doesn't match the parent. Parent signature is "%s".)", parent_signature), p_function);
+ }
+ }
+#endif
}
parser->current_function = previous_function;
@@ -2416,7 +2467,9 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
GDScriptParser::DataType return_type;
List<GDScriptParser::DataType> par_types;
- if (get_function_signature(p_call, base_type, p_call->function_name, return_type, par_types, default_arg_count, is_static, is_vararg)) {
+ bool is_constructor = (base_type.is_meta_type || (p_call->callee && p_call->callee->type == GDScriptParser::Node::IDENTIFIER)) && p_call->function_name == SNAME("new");
+
+ if (get_function_signature(p_call, is_constructor, base_type, p_call->function_name, return_type, par_types, default_arg_count, is_static, is_vararg)) {
// If the function require typed arrays we must make literals be typed.
for (const KeyValue<int, GDScriptParser::ArrayNode *> &E : arrays) {
int index = E.key;
@@ -3576,7 +3629,7 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_property(const PropertyInfo
return result;
}
-bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source, GDScriptParser::DataType p_base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg) {
+bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bool p_is_constructor, GDScriptParser::DataType p_base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg) {
r_static = false;
r_vararg = false;
r_default_arg_count = 0;
@@ -3616,8 +3669,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source
return false;
}
- bool is_constructor = (p_base_type.is_meta_type || (p_source->callee && p_source->callee->type == GDScriptParser::Node::IDENTIFIER)) && p_function == StaticCString::create("new");
- if (is_constructor) {
+ if (p_is_constructor) {
function_name = "_init";
r_static = true;
}
@@ -3638,7 +3690,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source
}
if (found_function != nullptr) {
- r_static = is_constructor || found_function->is_static;
+ r_static = p_is_constructor || found_function->is_static;
for (int i = 0; i < found_function->parameters.size(); i++) {
r_par_types.push_back(found_function->parameters[i]->get_datatype());
if (found_function->parameters[i]->default_value != nullptr) {
@@ -3664,7 +3716,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source
}
// If the base is a script, it might be trying to access members of the Script class itself.
- if (p_base_type.is_meta_type && !is_constructor && (p_base_type.kind == GDScriptParser::DataType::SCRIPT || p_base_type.kind == GDScriptParser::DataType::CLASS)) {
+ if (p_base_type.is_meta_type && !p_is_constructor && (p_base_type.kind == GDScriptParser::DataType::SCRIPT || p_base_type.kind == GDScriptParser::DataType::CLASS)) {
MethodInfo info;
StringName script_class = p_base_type.kind == GDScriptParser::DataType::SCRIPT ? p_base_type.script_type->get_class_name() : StringName(GDScript::get_class_static());
@@ -3684,7 +3736,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::CallNode *p_source
}
#endif
- if (is_constructor) {
+ if (p_is_constructor) {
// Native types always have a default constructor.
r_return_type = p_base_type;
r_return_type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h
index 2697a6ec2b..7b8883e1d3 100644
--- a/modules/gdscript/gdscript_analyzer.h
+++ b/modules/gdscript/gdscript_analyzer.h
@@ -105,7 +105,7 @@ class GDScriptAnalyzer {
GDScriptParser::DataType type_from_metatype(const GDScriptParser::DataType &p_meta_type) const;
GDScriptParser::DataType type_from_property(const PropertyInfo &p_property) const;
GDScriptParser::DataType make_global_class_meta_type(const StringName &p_class_name, const GDScriptParser::Node *p_source);
- bool get_function_signature(GDScriptParser::CallNode *p_source, GDScriptParser::DataType base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg);
+ bool get_function_signature(GDScriptParser::Node *p_source, bool p_is_constructor, GDScriptParser::DataType base_type, const StringName &p_function, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg);
bool function_signature_from_info(const MethodInfo &p_info, GDScriptParser::DataType &r_return_type, List<GDScriptParser::DataType> &r_par_types, int &r_default_arg_count, bool &r_static, bool &r_vararg);
bool validate_call_arg(const List<GDScriptParser::DataType> &p_par_types, int p_default_args_count, bool p_is_vararg, const GDScriptParser::CallNode *p_call);
bool validate_call_arg(const MethodInfo &p_method, const GDScriptParser::CallNode *p_call);
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 6fb95d32ca..350962ba1b 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -65,7 +65,7 @@ Ref<Script> GDScriptLanguage::make_template(const String &p_template, const Stri
script.instantiate();
String processed_template = p_template;
#ifdef TOOLS_ENABLED
- if (!EDITOR_DEF("text_editor/completion/add_type_hints", false)) {
+ if (!EDITOR_GET("text_editor/completion/add_type_hints")) {
processed_template = processed_template.replace(": int", "")
.replace(": String", "")
.replace(": float", "")
@@ -2771,10 +2771,10 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
String GDScriptLanguage::_get_indentation() const {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
- bool use_space_indentation = EDITOR_DEF("text_editor/behavior/indent/type", false);
+ bool use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type");
if (use_space_indentation) {
- int indent_size = EDITOR_DEF("text_editor/behavior/indent/size", 4);
+ int indent_size = EDITOR_GET("text_editor/behavior/indent/size");
String space_indent = "";
for (int i = 0; i < indent_size; i++) {
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.gd b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.gd
new file mode 100644
index 0000000000..435711fcaf
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.gd
@@ -0,0 +1,10 @@
+func test():
+ print("Shouldn't reach this")
+
+class Parent:
+ func my_function(_par1: int) -> int:
+ return 0
+
+class Child extends Parent:
+ func my_function() -> int:
+ return 0
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out
new file mode 100644
index 0000000000..3baeb17066
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_less.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+The function signature doesn't match the parent. Parent signature is "int my_function(int)".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.gd b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.gd
new file mode 100644
index 0000000000..2bd392e8f8
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.gd
@@ -0,0 +1,10 @@
+func test():
+ print("Shouldn't reach this")
+
+class Parent:
+ func my_function(_par1: int) -> int:
+ return 0
+
+class Child extends Parent:
+ func my_function(_pary1: int, _par2: int) -> int:
+ return 0
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out
new file mode 100644
index 0000000000..3baeb17066
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_count_more.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+The function signature doesn't match the parent. Parent signature is "int my_function(int)".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.gd b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.gd
new file mode 100644
index 0000000000..49ec82ce2d
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.gd
@@ -0,0 +1,10 @@
+func test():
+ print("Shouldn't reach this")
+
+class Parent:
+ func my_function(_par1: int = 0) -> int:
+ return 0
+
+class Child extends Parent:
+ func my_function(_par1: int) -> int:
+ return 0
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out
new file mode 100644
index 0000000000..665c229339
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_default_values.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+The function signature doesn't match the parent. Parent signature is "int my_function(int = default)".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.gd
new file mode 100644
index 0000000000..4a17a7831f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.gd
@@ -0,0 +1,10 @@
+func test():
+ print("Shouldn't reach this")
+
+class Parent:
+ func my_function(_par1: int) -> int:
+ return 0
+
+class Child extends Parent:
+ func my_function(_par1: Vector2) -> int:
+ return 0
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out
new file mode 100644
index 0000000000..3baeb17066
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_parameter_type.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+The function signature doesn't match the parent. Parent signature is "int my_function(int)".
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.gd
new file mode 100644
index 0000000000..b205ec96ef
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.gd
@@ -0,0 +1,10 @@
+func test():
+ print("Shouldn't reach this")
+
+class Parent:
+ func my_function() -> int:
+ return 0
+
+class Child extends Parent:
+ func my_function() -> Vector2:
+ return Vector2()
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out
new file mode 100644
index 0000000000..5b22739a93
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/function_dont_match_parent_signature_return_type.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+The function signature doesn't match the parent. Parent signature is "int my_function()".
diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd
new file mode 100644
index 0000000000..d678f3acfc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd
@@ -0,0 +1,17 @@
+func test():
+ var instance := Parent.new()
+ var result := instance.my_function(1)
+ print(result)
+ assert(result == 1)
+ instance = Child.new()
+ result = instance.my_function(2)
+ print(result)
+ assert(result == 0)
+
+class Parent:
+ func my_function(par1: int) -> int:
+ return par1
+
+class Child extends Parent:
+ func my_function(_par1: int, par2: int = 0) -> int:
+ return par2
diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out
new file mode 100644
index 0000000000..fc5315a501
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out
@@ -0,0 +1,3 @@
+GDTEST_OK
+1
+0
diff --git a/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.gd b/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.gd
new file mode 100644
index 0000000000..eb392672eb
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.gd
@@ -0,0 +1,40 @@
+# Test access visibility of parent elements in nested class architectures.
+class Parent:
+ const parent_const := 1
+
+ var parent_variable := 2
+
+ signal parent_signal
+
+ var parent_attribute: int:
+ get:
+ return 3
+
+ func parent_func():
+ return 4
+
+ class Nested:
+ const nested_const := 5
+
+
+class Child extends Parent:
+ func child_test():
+ print(parent_const)
+ print(self.parent_const)
+ print(parent_variable)
+ print(self.parent_variable)
+ print(parent_signal.get_name())
+ print(self.parent_signal.get_name())
+ print(parent_attribute)
+ print(self.parent_attribute)
+ print(parent_func.get_method())
+ print(self.parent_func.get_method())
+ print(parent_func())
+ print(self.parent_func())
+ print(Nested.nested_const)
+ print(self.Nested.nested_const)
+ print(Parent.Nested.nested_const)
+
+
+func test():
+ Child.new().child_test()
diff --git a/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.out b/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.out
new file mode 100644
index 0000000000..09e87bccfa
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/class_inheritance_access.out
@@ -0,0 +1,16 @@
+GDTEST_OK
+1
+1
+2
+2
+parent_signal
+parent_signal
+3
+3
+parent_func
+parent_func
+4
+4
+5
+5
+5
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index a05905cbc3..e8e096d52b 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -823,7 +823,7 @@ void GridMapEditor::_icon_size_changed(float p_value) {
void GridMapEditor::update_palette() {
int selected = mesh_library_palette->get_current();
- float min_size = EDITOR_DEF("editors/grid_map/preview_size", 64);
+ float min_size = EDITOR_GET("editors/grid_map/preview_size");
min_size *= EDSCALE;
mesh_library_palette->clear();
@@ -1207,7 +1207,7 @@ GridMapEditor::GridMapEditor() {
settings_pick_distance->set_max(10000.0f);
settings_pick_distance->set_min(500.0f);
settings_pick_distance->set_step(1.0f);
- settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
+ settings_pick_distance->set_value(EDITOR_GET("editors/grid_map/pick_distance"));
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
options->get_popup()->connect("id_pressed", callable_mp(this, &GridMapEditor::_menu_option));
diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp
index 11715040c2..a4b3bfdbd0 100644
--- a/modules/lightmapper_rd/lightmapper_rd.cpp
+++ b/modules/lightmapper_rd/lightmapper_rd.cpp
@@ -618,14 +618,14 @@ LightmapperRD::BakeError LightmapperRD::_dilate(RenderingDevice *rd, Ref<RDShade
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 0;
- u.ids.push_back(dest_light_tex);
+ u.append_id(dest_light_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1;
- u.ids.push_back(source_light_tex);
+ u.append_id(source_light_tex);
uniforms.push_back(u);
}
}
@@ -856,70 +856,70 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 1;
- u.ids.push_back(vertex_buffer);
+ u.append_id(vertex_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 2;
- u.ids.push_back(triangle_buffer);
+ u.append_id(triangle_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 3;
- u.ids.push_back(triangle_cell_indices_buffer);
+ u.append_id(triangle_cell_indices_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 4;
- u.ids.push_back(lights_buffer);
+ u.append_id(lights_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 5;
- u.ids.push_back(seams_buffer);
+ u.append_id(seams_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 6;
- u.ids.push_back(probe_positions_buffer);
+ u.append_id(probe_positions_buffer);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 7;
- u.ids.push_back(grid_texture);
+ u.append_id(grid_texture);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 8;
- u.ids.push_back(albedo_array_tex);
+ u.append_id(albedo_array_tex);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 9;
- u.ids.push_back(emission_array_tex);
+ u.append_id(emission_array_tex);
base_uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_SAMPLER;
u.binding = 10;
- u.ids.push_back(sampler);
+ u.append_id(sampler);
base_uniforms.push_back(u);
}
}
@@ -1057,14 +1057,14 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 0;
- u.ids.push_back(position_tex);
+ u.append_id(position_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 1;
- u.ids.push_back(unocclude_tex); //will be unused
+ u.append_id(unocclude_tex); //will be unused
uniforms.push_back(u);
}
}
@@ -1097,42 +1097,42 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 0;
- u.ids.push_back(light_source_tex);
+ u.append_id(light_source_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1;
- u.ids.push_back(light_dest_tex); //will be unused
+ u.append_id(light_dest_tex); //will be unused
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2;
- u.ids.push_back(position_tex);
+ u.append_id(position_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 3;
- u.ids.push_back(normal_tex);
+ u.append_id(normal_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 4;
- u.ids.push_back(light_accum_tex);
+ u.append_id(light_accum_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 5;
- u.ids.push_back(light_primary_dynamic_tex);
+ u.append_id(light_primary_dynamic_tex);
uniforms.push_back(u);
}
}
@@ -1176,57 +1176,57 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 0;
- u.ids.push_back(light_dest_tex);
+ u.append_id(light_dest_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1;
- u.ids.push_back(light_source_tex);
+ u.append_id(light_source_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2;
- u.ids.push_back(position_tex);
+ u.append_id(position_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 3;
- u.ids.push_back(normal_tex);
+ u.append_id(normal_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 4;
- u.ids.push_back(light_accum_tex);
+ u.append_id(light_accum_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
u.binding = 5;
- u.ids.push_back(unocclude_tex); //reuse unocclude tex
+ u.append_id(unocclude_tex); //reuse unocclude tex
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 6;
- u.ids.push_back(light_environment_tex);
+ u.append_id(light_environment_tex);
uniforms.push_back(u);
}
}
RID secondary_uniform_set[2];
secondary_uniform_set[0] = rd->uniform_set_create(uniforms, compute_shader_secondary, 1);
- uniforms.write[0].ids.write[0] = light_source_tex;
- uniforms.write[1].ids.write[0] = light_dest_tex;
+ uniforms.write[0].set_id(0, light_source_tex);
+ uniforms.write[1].set_id(0, light_dest_tex);
secondary_uniform_set[1] = rd->uniform_set_create(uniforms, compute_shader_secondary, 1);
switch (p_quality) {
@@ -1332,28 +1332,28 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
u.binding = 0;
- u.ids.push_back(light_probe_buffer);
+ u.append_id(light_probe_buffer);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 1;
- u.ids.push_back(light_dest_tex);
+ u.append_id(light_dest_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 2;
- u.ids.push_back(light_primary_dynamic_tex);
+ u.append_id(light_primary_dynamic_tex);
uniforms.push_back(u);
}
{
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 3;
- u.ids.push_back(light_environment_tex);
+ u.append_id(light_environment_tex);
uniforms.push_back(u);
}
}
@@ -1531,7 +1531,7 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
RD::Uniform u;
u.uniform_type = RD::UNIFORM_TYPE_TEXTURE;
u.binding = 0;
- u.ids.push_back(light_accum_tex2);
+ u.append_id(light_accum_tex2);
uniforms.push_back(u);
}
}
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 085ab9a467..c0b0d63600 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -527,10 +527,10 @@ String CSharpLanguage::make_function(const String &, const String &, const Packe
String CSharpLanguage::_get_indentation() const {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
- bool use_space_indentation = EDITOR_DEF("text_editor/behavior/indent/type", 0);
+ bool use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type");
if (use_space_indentation) {
- int indent_size = EDITOR_DEF("text_editor/behavior/indent/size", 4);
+ int indent_size = EDITOR_GET("text_editor/behavior/indent/size");
String space_indent = "";
for (int i = 0; i < indent_size; i++) {
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index 8679f28132..ee218cb1f8 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -81,6 +81,15 @@ namespace Godot
}
}
+ /// <summary>
+ /// Helper method for deconstruction into a tuple.
+ /// </summary>
+ public void Deconstruct(out real_t x, out real_t y)
+ {
+ x = this.x;
+ y = this.y;
+ }
+
internal void Normalize()
{
real_t lengthsq = LengthSquared();
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
index 9b51de5c8c..412a885daa 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
@@ -82,6 +82,15 @@ namespace Godot
}
/// <summary>
+ /// Helper method for deconstruction into a tuple.
+ /// </summary>
+ public void Deconstruct(out int x, out int y)
+ {
+ x = this.x;
+ y = this.y;
+ }
+
+ /// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index 1e60fb9523..45e5287610 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -96,6 +96,16 @@ namespace Godot
}
}
+ /// <summary>
+ /// Helper method for deconstruction into a tuple.
+ /// </summary>
+ public void Deconstruct(out real_t x, out real_t y, out real_t z)
+ {
+ x = this.x;
+ y = this.y;
+ z = this.z;
+ }
+
internal void Normalize()
{
real_t lengthsq = LengthSquared();
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
index eb06d2b87e..abfd2ae720 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
@@ -97,6 +97,16 @@ namespace Godot
}
/// <summary>
+ /// Helper method for deconstruction into a tuple.
+ /// </summary>
+ public void Deconstruct(out int x, out int y, out int z)
+ {
+ x = this.x;
+ y = this.y;
+ z = this.z;
+ }
+
+ /// <summary>
/// Returns a new vector with all components in absolute values (i.e. positive).
/// </summary>
/// <returns>A vector with <see cref="Mathf.Abs(int)"/> called on each component.</returns>