diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/concave_polygon_shape_2d.cpp | 2 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 2 | ||||
-rw-r--r-- | scene/resources/multimesh.cpp | 8 | ||||
-rw-r--r-- | scene/resources/particles_material.cpp | 3 | ||||
-rw-r--r-- | scene/resources/primitive_meshes.cpp | 2 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 4 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 10 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 1 | ||||
-rw-r--r-- | scene/resources/visual_shader_nodes.h | 8 |
9 files changed, 24 insertions, 16 deletions
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 51dd91fff5..de853f0c30 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -104,4 +104,6 @@ void ConcavePolygonShape2D::_bind_methods() { ConcavePolygonShape2D::ConcavePolygonShape2D() : Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) { + PoolVector<Vector2> empty; + set_segments(empty); } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 2c5dfc375c..4e2fe1f9b2 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -398,6 +398,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "LineEdit", control_font_color); theme->set_color("font_color_selected", "LineEdit", Color(0, 0, 0)); + theme->set_color("font_color_uneditable", "LineEdit", Color(control_font_color.r, control_font_color.g, control_font_color.b, 0.5f)); theme->set_color("cursor_color", "LineEdit", control_font_color_hover); theme->set_color("selection_color", "LineEdit", font_color_selection); theme->set_color("clear_button_color", "LineEdit", control_font_color); @@ -439,6 +440,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa")); theme->set_color("font_color", "TextEdit", control_font_color); theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0)); + theme->set_color("font_color_readonly", "TextEdit", Color(control_font_color.r, control_font_color.g, control_font_color.b, 0.5f)); theme->set_color("selection_color", "TextEdit", font_color_selection); theme->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4)); theme->set_color("bookmark_color", "TextEdit", Color(0.08, 0.49, 0.98)); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 5d8adc0c8d..99a17fb5b9 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -35,7 +35,7 @@ void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) { if (transform_format != TRANSFORM_3D) return; - PoolVector<Vector3> xforms = p_array; + const PoolVector<Vector3> &xforms = p_array; int len = xforms.size(); ERR_FAIL_COND((len / 4) != instance_count); if (len == 0) @@ -85,7 +85,7 @@ void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) { if (transform_format != TRANSFORM_2D) return; - PoolVector<Vector2> xforms = p_array; + const PoolVector<Vector2> &xforms = p_array; int len = xforms.size(); ERR_FAIL_COND((len / 3) != instance_count); if (len == 0) @@ -130,7 +130,7 @@ PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const { void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) { - PoolVector<Color> colors = p_array; + const PoolVector<Color> &colors = p_array; int len = colors.size(); if (len == 0) return; @@ -162,7 +162,7 @@ PoolVector<Color> MultiMesh::_get_color_array() const { void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) { - PoolVector<Color> custom_datas = p_array; + const PoolVector<Color> &custom_datas = p_array; int len = custom_datas.size(); if (len == 0) return; diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index a80a57a09c..691d73c181 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -184,7 +184,8 @@ void ParticlesMaterial::_update_shader() { } break; case EMISSION_SHAPE_DIRECTED_POINTS: { code += "uniform sampler2D emission_texture_normal : hint_black;\n"; - } //fallthrough + FALLTHROUGH; + } case EMISSION_SHAPE_POINTS: { code += "uniform sampler2D emission_texture_points : hint_black;\n"; code += "uniform int emission_texture_point_count;\n"; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 04d13c8869..74a493d3b5 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -743,8 +743,6 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const { int i, j, prevrow, thisrow, point; float x, y, z, u, v, radius; - radius = bottom_radius > top_radius ? bottom_radius : top_radius; - PoolVector<Vector3> points; PoolVector<Vector3> normals; PoolVector<float> tangents; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index efc1082a6b..339f008a3d 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1324,7 +1324,7 @@ Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN); Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText); - String path = p_src_path; + const String &path = p_src_path; ria->local_path = ProjectSettings::get_singleton()->localize_path(path); ria->res_path = ria->local_path; //ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) ); @@ -1441,7 +1441,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant, int len = varray.size(); for (int i = 0; i < len; i++) { - Variant v = varray.get(i); + const Variant &v = varray.get(i); _find_resources(v); } diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index a3813f8fc6..7265c9b457 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -257,7 +257,7 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po VisualShaderNode::PortType from_port_type = g->nodes[p_from_node].node->get_output_port_type(p_from_port); VisualShaderNode::PortType to_port_type = g->nodes[p_to_node].node->get_input_port_type(p_to_port); - if (MAX(0, from_port_type - 2) != (MAX(0, to_port_type - 2))) { + if (!is_port_types_compatible(from_port_type, to_port_type)) { return false; } @@ -271,6 +271,10 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po return true; } +bool VisualShader::is_port_types_compatible(int p_a, int p_b) const { + return MAX(0, p_a - 2) == (MAX(0, p_b - 2)); +} + void VisualShader::connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) { ERR_FAIL_INDEX(p_type, TYPE_MAX); Graph *g = &graph[p_type]; @@ -295,8 +299,8 @@ Error VisualShader::connect_nodes(Type p_type, int p_from_node, int p_from_port, VisualShaderNode::PortType from_port_type = g->nodes[p_from_node].node->get_output_port_type(p_from_port); VisualShaderNode::PortType to_port_type = g->nodes[p_to_node].node->get_input_port_type(p_to_port); - if (MAX(0, from_port_type - 2) != (MAX(0, to_port_type - 2))) { - ERR_EXPLAIN("Incompatible port types (scalar/vec/bool with transform"); + if (!is_port_types_compatible(from_port_type, to_port_type)) { + ERR_EXPLAIN("Incompatible port types (scalar/vec/bool) with transform"); ERR_FAIL_V(ERR_INVALID_PARAMETER); return ERR_INVALID_PARAMETER; } diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index a36776e701..83db51b1b0 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -138,6 +138,7 @@ public: Error connect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port); void disconnect_nodes(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port); void connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port); + bool is_port_types_compatible(int p_a, int p_b) const; void rebuild(); void get_node_connections(Type p_type, List<Connection> *r_connections) const; diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h index df753276e4..ef64b50711 100644 --- a/scene/resources/visual_shader_nodes.h +++ b/scene/resources/visual_shader_nodes.h @@ -699,7 +699,7 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty - void set_function(Function p_op); + void set_function(Function p_func); Function get_function() const; virtual Vector<StringName> get_editable_properties() const; @@ -740,7 +740,7 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty - void set_function(Function p_op); + void set_function(Function p_func); Function get_function() const; virtual Vector<StringName> get_editable_properties() const; @@ -895,7 +895,7 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty - void set_function(Function p_op); + void set_function(Function p_func); Function get_function() const; virtual Vector<StringName> get_editable_properties() const; @@ -935,7 +935,7 @@ public: virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const; //if no output is connected, the output var passed will be empty. if no input is connected and input is NIL, the input var passed will be empty - void set_function(Function p_op); + void set_function(Function p_func); Function get_function() const; virtual Vector<StringName> get_editable_properties() const; |