summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/animation.cpp38
-rw-r--r--scene/resources/audio_stream_wav.cpp4
-rw-r--r--scene/resources/capsule_shape_3d.cpp10
-rw-r--r--scene/resources/convex_polygon_shape_3d.cpp12
-rw-r--r--scene/resources/curve.cpp8
-rw-r--r--scene/resources/cylinder_shape_3d.cpp10
-rw-r--r--scene/resources/default_theme/default_theme.cpp9
-rw-r--r--scene/resources/default_theme/picker_shape_circle.svg1
-rw-r--r--scene/resources/default_theme/picker_shape_rectangle.svg1
-rw-r--r--scene/resources/default_theme/picker_shape_rectangle_wheel.svg58
-rw-r--r--scene/resources/font.cpp36
-rw-r--r--scene/resources/importer_mesh.cpp6
-rw-r--r--scene/resources/material.cpp6
-rw-r--r--scene/resources/material.h2
-rw-r--r--scene/resources/mesh.cpp47
-rw-r--r--scene/resources/mesh_library.cpp30
-rw-r--r--scene/resources/navigation_mesh.cpp26
-rw-r--r--scene/resources/packed_scene.cpp10
-rw-r--r--scene/resources/particle_process_material.cpp46
-rw-r--r--scene/resources/particle_process_material.h11
-rw-r--r--scene/resources/polygon_path_finder.cpp8
-rw-r--r--scene/resources/primitive_meshes.cpp13
-rw-r--r--scene/resources/resource_format_text.cpp35
-rw-r--r--scene/resources/skeleton_modification_2d.cpp2
-rw-r--r--scene/resources/skeleton_modification_3d.cpp2
-rw-r--r--scene/resources/skeleton_modification_3d_ccdik.cpp2
-rw-r--r--scene/resources/skeleton_modification_3d_lookat.cpp2
-rw-r--r--scene/resources/skin.cpp20
-rw-r--r--scene/resources/sprite_frames.cpp6
-rw-r--r--scene/resources/surface_tool.cpp2
-rw-r--r--scene/resources/texture.cpp16
-rw-r--r--scene/resources/texture.h10
-rw-r--r--scene/resources/theme.cpp34
-rw-r--r--scene/resources/tile_set.cpp9
-rw-r--r--scene/resources/visual_shader.cpp387
-rw-r--r--scene/resources/visual_shader.h2
-rw-r--r--scene/resources/visual_shader_particle_nodes.cpp20
37 files changed, 519 insertions, 422 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index f2ac1c2e58..dfd9c6eb2f 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -35,7 +35,7 @@
#include "scene/scene_string_names.h"
bool Animation::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
+ String prop_name = p_name;
if (p_name == SNAME("_compression")) {
ERR_FAIL_COND_V(tracks.size() > 0, false); //can only set compression if no tracks exist
@@ -63,9 +63,9 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
}
compression.enabled = true;
return true;
- } else if (name.begins_with("tracks/")) {
- int track = name.get_slicec('/', 1).to_int();
- String what = name.get_slicec('/', 2);
+ } else if (prop_name.begins_with("tracks/")) {
+ int track = prop_name.get_slicec('/', 1).to_int();
+ String what = prop_name.get_slicec('/', 2);
if (tracks.size() == track && what == "type") {
String type = p_value;
@@ -431,7 +431,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
}
bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
+ String prop_name = p_name;
if (p_name == SNAME("_compression")) {
ERR_FAIL_COND_V(!compression.enabled, false);
@@ -456,15 +456,15 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = comp;
return true;
- } else if (name == "length") {
+ } else if (prop_name == "length") {
r_ret = length;
- } else if (name == "loop_mode") {
+ } else if (prop_name == "loop_mode") {
r_ret = loop_mode;
- } else if (name == "step") {
+ } else if (prop_name == "step") {
r_ret = step;
- } else if (name.begins_with("tracks/")) {
- int track = name.get_slicec('/', 1).to_int();
- String what = name.get_slicec('/', 2);
+ } else if (prop_name.begins_with("tracks/")) {
+ int track = prop_name.get_slicec('/', 1).to_int();
+ String what = prop_name.get_slicec('/', 2);
ERR_FAIL_INDEX_V(track, tracks.size(), false);
if (what == "type") {
switch (track_get_type(track)) {
@@ -5239,9 +5239,7 @@ bool Animation::_fetch_compressed(uint32_t p_compressed_track, double p_time, Ve
double page_base_time = compression.pages[page_index].time_offset;
const uint8_t *page_data = compression.pages[page_index].data.ptr();
-#ifndef _MSC_VER
-#warning Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported
-#endif
+ // Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
uint32_t time_key_count = indices[p_compressed_track * 3 + 1];
@@ -5384,9 +5382,7 @@ void Animation::_get_compressed_key_indices_in_range(uint32_t p_compressed_track
double page_base_time = compression.pages[page_index].time_offset;
const uint8_t *page_data = compression.pages[page_index].data.ptr();
-#ifndef _MSC_VER
-#warning Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported
-#endif
+ // Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
uint32_t time_key_count = indices[p_compressed_track * 3 + 1];
@@ -5456,9 +5452,7 @@ int Animation::_get_compressed_key_count(uint32_t p_compressed_track) const {
for (uint32_t i = 0; i < compression.pages.size(); i++) {
const uint8_t *page_data = compression.pages[i].data.ptr();
-#ifndef _MSC_VER
-#warning Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported
-#endif
+ // Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
uint32_t time_key_count = indices[p_compressed_track * 3 + 1];
@@ -5492,9 +5486,7 @@ bool Animation::_fetch_compressed_by_index(uint32_t p_compressed_track, int p_in
for (uint32_t i = 0; i < compression.pages.size(); i++) {
const uint8_t *page_data = compression.pages[i].data.ptr();
-#ifndef _MSC_VER
-#warning Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported
-#endif
+ // Little endian assumed. No major big endian hardware exists any longer, but in case it does it will need to be supported.
const uint32_t *indices = (const uint32_t *)page_data;
const uint16_t *time_keys = (const uint16_t *)&page_data[indices[p_compressed_track * 3 + 0]];
uint32_t time_key_count = indices[p_compressed_track * 3 + 1];
diff --git a/scene/resources/audio_stream_wav.cpp b/scene/resources/audio_stream_wav.cpp
index 26204583ef..ce68936370 100644
--- a/scene/resources/audio_stream_wav.cpp
+++ b/scene/resources/audio_stream_wav.cpp
@@ -580,8 +580,8 @@ Error AudioStreamWAV::save_to_wav(const String &p_path) {
file->store_32(sub_chunk_2_size); //Subchunk2Size
// Add data
- Vector<uint8_t> data = get_data();
- const uint8_t *read_data = data.ptr();
+ Vector<uint8_t> stream_data = get_data();
+ const uint8_t *read_data = stream_data.ptr();
switch (format) {
case AudioStreamWAV::FORMAT_8_BITS:
for (unsigned int i = 0; i < data_bytes; i++) {
diff --git a/scene/resources/capsule_shape_3d.cpp b/scene/resources/capsule_shape_3d.cpp
index b0454004a0..f7ed8d98cb 100644
--- a/scene/resources/capsule_shape_3d.cpp
+++ b/scene/resources/capsule_shape_3d.cpp
@@ -33,17 +33,17 @@
#include "servers/physics_server_3d.h"
Vector<Vector3> CapsuleShape3D::get_debug_mesh_lines() const {
- float radius = get_radius();
- float height = get_height();
+ float c_radius = get_radius();
+ float c_height = get_height();
Vector<Vector3> points;
- Vector3 d(0, height * 0.5 - radius, 0);
+ Vector3 d(0, c_height * 0.5 - c_radius, 0);
for (int i = 0; i < 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
- Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
- Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
+ Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * c_radius;
+ Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * c_radius;
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(b.x, 0, b.y) + d);
diff --git a/scene/resources/convex_polygon_shape_3d.cpp b/scene/resources/convex_polygon_shape_3d.cpp
index e7960f1ba4..5bcefcd0e4 100644
--- a/scene/resources/convex_polygon_shape_3d.cpp
+++ b/scene/resources/convex_polygon_shape_3d.cpp
@@ -33,18 +33,18 @@
#include "servers/physics_server_3d.h"
Vector<Vector3> ConvexPolygonShape3D::get_debug_mesh_lines() const {
- Vector<Vector3> points = get_points();
+ Vector<Vector3> poly_points = get_points();
- if (points.size() > 3) {
- Vector<Vector3> varr = Variant(points);
+ if (poly_points.size() > 3) {
+ Vector<Vector3> varr = Variant(poly_points);
Geometry3D::MeshData md;
Error err = ConvexHullComputer::convex_hull(varr, md);
if (err == OK) {
Vector<Vector3> lines;
lines.resize(md.edges.size() * 2);
- for (int i = 0; i < md.edges.size(); i++) {
- lines.write[i * 2 + 0] = md.vertices[md.edges[i].a];
- lines.write[i * 2 + 1] = md.vertices[md.edges[i].b];
+ for (uint32_t i = 0; i < md.edges.size(); i++) {
+ lines.write[i * 2 + 0] = md.vertices[md.edges[i].vertex_a];
+ lines.write[i * 2 + 1] = md.vertices[md.edges[i].vertex_b];
}
return lines;
}
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 0ea5264935..49b78a091d 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -1667,6 +1667,10 @@ Vector3 Curve3D::sample_baked_up_vector(real_t p_offset, bool p_apply_tilt) cons
idx = (end + start) / 2;
}
+ if (idx == count - 1) {
+ return p_apply_tilt ? r[idx].rotated((rp[idx] - rp[idx - 1]).normalized(), rt[idx]) : r[idx];
+ }
+
real_t offset_begin = baked_dist_cache[idx];
real_t offset_end = baked_dist_cache[idx + 1];
@@ -1675,10 +1679,6 @@ Vector3 Curve3D::sample_baked_up_vector(real_t p_offset, bool p_apply_tilt) cons
real_t frac = (p_offset - offset_begin) / idx_interval;
- if (idx == count - 1) {
- return p_apply_tilt ? r[idx].rotated((rp[idx] - rp[idx - 1]).normalized(), rt[idx]) : r[idx];
- }
-
Vector3 forward = (rp[idx + 1] - rp[idx]).normalized();
Vector3 up = r[idx];
Vector3 up1 = r[idx + 1];
diff --git a/scene/resources/cylinder_shape_3d.cpp b/scene/resources/cylinder_shape_3d.cpp
index a5951db8ea..e5f417cbcc 100644
--- a/scene/resources/cylinder_shape_3d.cpp
+++ b/scene/resources/cylinder_shape_3d.cpp
@@ -33,17 +33,17 @@
#include "servers/physics_server_3d.h"
Vector<Vector3> CylinderShape3D::get_debug_mesh_lines() const {
- float radius = get_radius();
- float height = get_height();
+ float c_radius = get_radius();
+ float c_height = get_height();
Vector<Vector3> points;
- Vector3 d(0, height * 0.5, 0);
+ Vector3 d(0, c_height * 0.5, 0);
for (int i = 0; i < 360; i++) {
float ra = Math::deg_to_rad((float)i);
float rb = Math::deg_to_rad((float)i + 1);
- Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius;
- Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius;
+ Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * c_radius;
+ Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * c_radius;
points.push_back(Vector3(a.x, 0, a.y) + d);
points.push_back(Vector3(b.x, 0, b.y) + d);
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index f03e3813cc..c9d92cea3f 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -553,6 +553,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("grabber_disabled", "HSlider", icons["slider_grabber_disabled"]);
theme->set_icon("tick", "HSlider", icons["hslider_tick"]);
+ theme->set_constant("grabber_offset", "HSlider", 0);
+
// VSlider
theme->set_stylebox("slider", "VSlider", style_slider);
@@ -564,6 +566,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("grabber_disabled", "VSlider", icons["slider_grabber_disabled"]);
theme->set_icon("tick", "VSlider", icons["vslider_tick"]);
+ theme->set_constant("grabber_offset", "VSlider", 0);
+
// SpinBox
theme->set_icon("updown", "SpinBox", icons["updown"]);
@@ -876,7 +880,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("h_width", "ColorPicker", 30 * scale);
theme->set_constant("label_width", "ColorPicker", 10 * scale);
+ theme->set_icon("folded_arrow", "ColorPicker", icons["arrow_right"]);
+ theme->set_icon("expanded_arrow", "ColorPicker", icons["arrow_down"]);
theme->set_icon("screen_picker", "ColorPicker", icons["color_picker_pipette"]);
+ theme->set_icon("shape_circle", "ColorPicker", icons["picker_shape_circle"]);
+ theme->set_icon("shape_rect", "ColorPicker", icons["picker_shape_rectangle"]);
+ theme->set_icon("shape_rect_wheel", "ColorPicker", icons["picker_shape_rectangle_wheel"]);
theme->set_icon("add_preset", "ColorPicker", icons["add"]);
theme->set_icon("color_hue", "ColorPicker", icons["color_picker_hue"]);
theme->set_icon("sample_bg", "ColorPicker", icons["mini_checkerboard"]);
diff --git a/scene/resources/default_theme/picker_shape_circle.svg b/scene/resources/default_theme/picker_shape_circle.svg
new file mode 100644
index 0000000000..8e7fb7f06e
--- /dev/null
+++ b/scene/resources/default_theme/picker_shape_circle.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h16v16h-16z"/></clipPath><g clip-path="url(#a)" fill="#eaeaea"><rect height="11" rx="5.5" transform="translate(1 2)" width="11"/><path d="m0 0h2v11h-2z" transform="translate(13 2)"/></g></svg>
diff --git a/scene/resources/default_theme/picker_shape_rectangle.svg b/scene/resources/default_theme/picker_shape_rectangle.svg
new file mode 100644
index 0000000000..3c7dd46884
--- /dev/null
+++ b/scene/resources/default_theme/picker_shape_rectangle.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="a"><path d="m0 0h16v16h-16z"/></clipPath><g clip-path="url(#a)" fill="#eaeaea"><path d="m0 0h11v11h-11z" transform="translate(1 2)"/><path d="m0 0h2v11h-2z" transform="translate(13 2)"/></g></svg>
diff --git a/scene/resources/default_theme/picker_shape_rectangle_wheel.svg b/scene/resources/default_theme/picker_shape_rectangle_wheel.svg
new file mode 100644
index 0000000000..e85665a8f2
--- /dev/null
+++ b/scene/resources/default_theme/picker_shape_rectangle_wheel.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ height="16"
+ viewBox="0 0 16 16"
+ width="16"
+ version="1.1"
+ id="svg11"
+ sodipodi:docname="PickerShapeRectangleWheel.svg"
+ inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs15" />
+ <sodipodi:namedview
+ id="namedview13"
+ pagecolor="#505050"
+ bordercolor="#ffffff"
+ borderopacity="1"
+ inkscape:pageshadow="0"
+ inkscape:pageopacity="0"
+ inkscape:pagecheckerboard="1"
+ showgrid="true"
+ inkscape:zoom="16"
+ inkscape:cx="0.53125"
+ inkscape:cy="5.28125"
+ inkscape:window-width="1920"
+ inkscape:window-height="1001"
+ inkscape:window-x="-9"
+ inkscape:window-y="-9"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg11">
+ <inkscape:grid
+ type="xygrid"
+ id="grid944" />
+ </sodipodi:namedview>
+ <clipPath
+ id="a">
+ <path
+ d="m0 0h16v16h-16z"
+ id="path2" />
+ </clipPath>
+ <g
+ clip-path="url(#a)"
+ fill="#eaeaea"
+ id="g9"
+ transform="matrix(0.85714286,0,0,0.85714286,1.1428571,1.1428571)">
+ <path
+ d="M 7,2 A 5,5 0 1 0 12,7 5.006,5.006 0 0 0 7,2 M 7,0 A 7,7 0 1 1 0,7 7,7 0 0 1 7,0 Z"
+ transform="translate(1,1)"
+ id="path5" />
+ <path
+ d="M 0,0 H 7 V 7 H 0 Z"
+ transform="translate(4.5,4.5)"
+ id="path7" />
+ </g>
+</svg>
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 6a278f1f39..cbecab62b3 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -1065,12 +1065,12 @@ bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
}
int chars = len / 9;
for (int i = 0; i < chars; i++) {
- const int32_t *data = &arr[i * 9];
- char32_t c = data[0];
- set_glyph_texture_idx(0, Vector2i(16, 0), c, data[1]);
- set_glyph_uv_rect(0, Vector2i(16, 0), c, Rect2(data[2], data[3], data[4], data[5]));
- set_glyph_offset(0, Vector2i(16, 0), c, Size2(data[6], data[7]));
- set_glyph_advance(0, 16, c, Vector2(data[8], 0));
+ const int32_t *char_data = &arr[i * 9];
+ char32_t c = char_data[0];
+ set_glyph_texture_idx(0, Vector2i(16, 0), c, char_data[1]);
+ set_glyph_uv_rect(0, Vector2i(16, 0), c, Rect2(char_data[2], char_data[3], char_data[4], char_data[5]));
+ set_glyph_offset(0, Vector2i(16, 0), c, Size2(char_data[6], char_data[7]));
+ set_glyph_advance(0, 16, c, Vector2(char_data[8], 0));
}
} else if (tokens.size() == 1 && tokens[0] == "kernings") {
// Compatibility, BitmapFont.
@@ -1082,8 +1082,8 @@ bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
return false;
}
for (int i = 0; i < len / 3; i++) {
- const int32_t *data = &arr[i * 3];
- set_kerning(0, 16, Vector2i(data[0], data[1]), Vector2(data[2], 0));
+ const int32_t *kern_data = &arr[i * 3];
+ set_kerning(0, 16, Vector2i(kern_data[0], kern_data[1]), Vector2(kern_data[2], 0));
}
} else if (tokens.size() == 1 && tokens[0] == "height") {
// Compatibility, BitmapFont.
@@ -1108,12 +1108,12 @@ bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
#endif // DISABLE_DEPRECATED
if (tokens.size() == 2 && tokens[0] == "language_support_override") {
- String lang = tokens[1];
- set_language_support_override(lang, p_value);
+ String lang_code = tokens[1];
+ set_language_support_override(lang_code, p_value);
return true;
} else if (tokens.size() == 2 && tokens[0] == "script_support_override") {
- String script = tokens[1];
- set_script_support_override(script, p_value);
+ String script_code = tokens[1];
+ set_script_support_override(script_code, p_value);
return true;
} else if (tokens.size() >= 3 && tokens[0] == "cache") {
int cache_index = tokens[1].to_int();
@@ -1187,12 +1187,12 @@ bool FontFile::_set(const StringName &p_name, const Variant &p_value) {
bool FontFile::_get(const StringName &p_name, Variant &r_ret) const {
Vector<String> tokens = p_name.operator String().split("/");
if (tokens.size() == 2 && tokens[0] == "language_support_override") {
- String lang = tokens[1];
- r_ret = get_language_support_override(lang);
+ String lang_code = tokens[1];
+ r_ret = get_language_support_override(lang_code);
return true;
} else if (tokens.size() == 2 && tokens[0] == "script_support_override") {
- String script = tokens[1];
- r_ret = get_script_support_override(script);
+ String script_code = tokens[1];
+ r_ret = get_script_support_override(script_code);
return true;
} else if (tokens.size() >= 3 && tokens[0] == "cache") {
int cache_index = tokens[1].to_int();
@@ -1813,8 +1813,8 @@ Error FontFile::load_bitmap_font(const String &p_path) {
Error FontFile::load_dynamic_font(const String &p_path) {
reset_state();
- Vector<uint8_t> data = FileAccess::get_file_as_array(p_path);
- set_data(data);
+ Vector<uint8_t> font_data = FileAccess::get_file_as_array(p_path);
+ set_data(font_data);
return OK;
}
diff --git a/scene/resources/importer_mesh.cpp b/scene/resources/importer_mesh.cpp
index de3d502102..b728c24e0d 100644
--- a/scene/resources/importer_mesh.cpp
+++ b/scene/resources/importer_mesh.cpp
@@ -829,9 +829,9 @@ void ImporterMesh::_set_data(const Dictionary &p_data) {
ERR_CONTINUE(prim >= Mesh::PRIMITIVE_MAX);
Array arr = s["arrays"];
Dictionary lods;
- String name;
+ String surf_name;
if (s.has("name")) {
- name = s["name"];
+ surf_name = s["name"];
}
if (s.has("lods")) {
lods = s["lods"];
@@ -848,7 +848,7 @@ void ImporterMesh::_set_data(const Dictionary &p_data) {
if (s.has("flags")) {
flags = s["flags"];
}
- add_surface(prim, arr, b_shapes, lods, material, name, flags);
+ add_surface(prim, arr, b_shapes, lods, material, surf_name, flags);
}
}
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 838927e34f..8ae217dd1f 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -2348,7 +2348,7 @@ void BaseMaterial3D::set_on_top_of_alpha() {
set_flag(FLAG_DISABLE_DEPTH_TEST, true);
}
-void BaseMaterial3D::set_proximity_fade(bool p_enable) {
+void BaseMaterial3D::set_proximity_fade_enabled(bool p_enable) {
proximity_fade_enabled = p_enable;
_queue_shader_change();
notify_property_list_changed();
@@ -2624,7 +2624,7 @@ void BaseMaterial3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_refraction_texture_channel", "channel"), &BaseMaterial3D::set_refraction_texture_channel);
ClassDB::bind_method(D_METHOD("get_refraction_texture_channel"), &BaseMaterial3D::get_refraction_texture_channel);
- ClassDB::bind_method(D_METHOD("set_proximity_fade", "enabled"), &BaseMaterial3D::set_proximity_fade);
+ ClassDB::bind_method(D_METHOD("set_proximity_fade_enabled", "enabled"), &BaseMaterial3D::set_proximity_fade_enabled);
ClassDB::bind_method(D_METHOD("is_proximity_fade_enabled"), &BaseMaterial3D::is_proximity_fade_enabled);
ClassDB::bind_method(D_METHOD("set_proximity_fade_distance", "distance"), &BaseMaterial3D::set_proximity_fade_distance);
@@ -2808,7 +2808,7 @@ void BaseMaterial3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "point_size", PROPERTY_HINT_RANGE, "0.1,128,0.1,suffix:px"), "set_point_size", "get_point_size");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_particle_trails"), "set_flag", "get_flag", FLAG_PARTICLE_TRAILS_MODE);
ADD_GROUP("Proximity Fade", "proximity_fade_");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "proximity_fade_enable"), "set_proximity_fade", "is_proximity_fade_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "proximity_fade_enabled"), "set_proximity_fade_enabled", "is_proximity_fade_enabled");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "proximity_fade_distance", PROPERTY_HINT_RANGE, "0,4096,0.01,suffix:m"), "set_proximity_fade_distance", "get_proximity_fade_distance");
ADD_GROUP("MSDF", "msdf_");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "msdf_pixel_range", PROPERTY_HINT_RANGE, "1,100,1"), "set_msdf_pixel_range", "get_msdf_pixel_range");
diff --git a/scene/resources/material.h b/scene/resources/material.h
index dd9589c577..b3c2159e70 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -719,7 +719,7 @@ public:
void set_on_top_of_alpha();
- void set_proximity_fade(bool p_enable);
+ void set_proximity_fade_enabled(bool p_enable);
bool is_proximity_fade_enabled() const;
void set_proximity_fade_distance(float p_distance);
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index b42e65c8df..706db3af16 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -313,11 +313,11 @@ Ref<TriangleMesh> Mesh::generate_surface_triangle_mesh(int p_surface) const {
}
}
- Ref<TriangleMesh> triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
- triangle_mesh->create(faces);
- surface_triangle_meshes.set(p_surface, triangle_mesh);
+ Ref<TriangleMesh> tr_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
+ tr_mesh->create(faces);
+ surface_triangle_meshes.set(p_surface, tr_mesh);
- return triangle_mesh;
+ return tr_mesh;
}
void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) {
@@ -1251,7 +1251,7 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
index_count = d["index_count"];
}
- Vector<uint8_t> blend_shapes;
+ Vector<uint8_t> blend_shapes_new;
if (d.has("blend_shape_data")) {
Array blend_shape_data = d["blend_shape_data"];
@@ -1263,7 +1263,7 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
Vector<uint8_t> shape = blend_shape_data[i];
_fix_array_compatibility(shape, old_format, new_format, vertex_count, blend_vertex_array, blend_attribute_array, blend_skin_array);
- blend_shapes.append_array(blend_vertex_array);
+ blend_shapes_new.append_array(blend_vertex_array);
}
}
@@ -1273,7 +1273,7 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
print_verbose("Mesh format post-conversion: " + itos(new_format));
ERR_FAIL_COND_V(!d.has("aabb"), false);
- AABB aabb = d["aabb"];
+ AABB aabb_new = d["aabb"];
Vector<AABB> bone_aabb;
if (d.has("skeleton_aabb")) {
@@ -1285,7 +1285,7 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
}
}
- add_surface(new_format, PrimitiveType(primitive), vertex_array, attribute_array, skin_array, vertex_count, array_index_data, index_count, aabb, blend_shapes, bone_aabb);
+ add_surface(new_format, PrimitiveType(primitive), vertex_array, attribute_array, skin_array, vertex_count, array_index_data, index_count, aabb_new, blend_shapes_new, bone_aabb);
} else {
ERR_FAIL_V(false);
@@ -1462,9 +1462,9 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
}
}
- String name;
+ String surf_name;
if (d.has("name")) {
- name = d["name"];
+ surf_name = d["name"];
}
bool _2d = false;
@@ -1474,7 +1474,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) {
surface_data.push_back(surface);
surface_materials.push_back(material);
- surface_names.push_back(name);
+ surface_names.push_back(surf_name);
surface_2d.push_back(_2d);
}
@@ -1576,9 +1576,8 @@ void ArrayMesh::_recompute_aabb() {
}
}
}
-#ifndef _MSC_VER
-#warning need to add binding to add_surface using future MeshSurfaceData object
-#endif
+
+// TODO: Need to add binding to add_surface using future MeshSurfaceData object.
void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, const Vector<uint8_t> &p_attribute_array, const Vector<uint8_t> &p_skin_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<uint8_t> &p_blend_shape_data, const Vector<AABB> &p_bone_aabbs, const Vector<RS::SurfaceData::LOD> &p_lods) {
_create_if_empty();
@@ -1657,17 +1656,17 @@ int ArrayMesh::get_surface_count() const {
void ArrayMesh::add_blend_shape(const StringName &p_name) {
ERR_FAIL_COND_MSG(surfaces.size(), "Can't add a shape key count if surfaces are already created.");
- StringName name = p_name;
+ StringName shape_name = p_name;
- if (blend_shapes.has(name)) {
+ if (blend_shapes.has(shape_name)) {
int count = 2;
do {
- name = String(p_name) + " " + itos(count);
+ shape_name = String(p_name) + " " + itos(count);
count++;
- } while (blend_shapes.has(name));
+ } while (blend_shapes.has(shape_name));
}
- blend_shapes.push_back(name);
+ blend_shapes.push_back(shape_name);
if (mesh.is_valid()) {
RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size());
@@ -1686,17 +1685,17 @@ StringName ArrayMesh::get_blend_shape_name(int p_index) const {
void ArrayMesh::set_blend_shape_name(int p_index, const StringName &p_name) {
ERR_FAIL_INDEX(p_index, blend_shapes.size());
- StringName name = p_name;
- int found = blend_shapes.find(name);
+ StringName shape_name = p_name;
+ int found = blend_shapes.find(shape_name);
if (found != -1 && found != p_index) {
int count = 2;
do {
- name = String(p_name) + " " + itos(count);
+ shape_name = String(p_name) + " " + itos(count);
count++;
- } while (blend_shapes.find(name) != -1);
+ } while (blend_shapes.find(shape_name) != -1);
}
- blend_shapes.write[p_index] = name;
+ blend_shapes.write[p_index] = shape_name;
}
void ArrayMesh::clear_blend_shapes() {
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp
index 2d3f9d9afc..7c78b757c7 100644
--- a/scene/resources/mesh_library.cpp
+++ b/scene/resources/mesh_library.cpp
@@ -33,10 +33,10 @@
#include "box_shape_3d.h"
bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name.begins_with("item/")) {
- int idx = name.get_slicec('/', 1).to_int();
- String what = name.get_slicec('/', 2);
+ String prop_name = p_name;
+ if (prop_name.begins_with("item/")) {
+ int idx = prop_name.get_slicec('/', 1).to_int();
+ String what = prop_name.get_slicec('/', 2);
if (!item_map.has(idx)) {
create_item(idx);
}
@@ -72,10 +72,10 @@ bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) {
}
bool MeshLibrary::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- int idx = name.get_slicec('/', 1).to_int();
+ String prop_name = p_name;
+ int idx = prop_name.get_slicec('/', 1).to_int();
ERR_FAIL_COND_V(!item_map.has(idx), false);
- String what = name.get_slicec('/', 2);
+ String what = prop_name.get_slicec('/', 2);
if (what == "name") {
r_ret = get_item_name(idx);
@@ -100,14 +100,14 @@ bool MeshLibrary::_get(const StringName &p_name, Variant &r_ret) const {
void MeshLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
for (const KeyValue<int, Item> &E : item_map) {
- String name = vformat("%s/%d/", PNAME("item"), E.key);
- p_list->push_back(PropertyInfo(Variant::STRING, name + PNAME("name")));
- p_list->push_back(PropertyInfo(Variant::OBJECT, name + PNAME("mesh"), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"));
- p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, name + PNAME("mesh_transform"), PROPERTY_HINT_NONE, "suffix:m"));
- p_list->push_back(PropertyInfo(Variant::ARRAY, name + PNAME("shapes")));
- p_list->push_back(PropertyInfo(Variant::OBJECT, name + PNAME("navmesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"));
- p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, name + PNAME("navmesh_transform"), PROPERTY_HINT_NONE, "suffix:m"));
- p_list->push_back(PropertyInfo(Variant::OBJECT, name + PNAME("preview"), PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT));
+ String prop_name = vformat("%s/%d/", PNAME("item"), E.key);
+ p_list->push_back(PropertyInfo(Variant::STRING, prop_name + PNAME("name")));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("mesh"), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"));
+ p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prop_name + PNAME("mesh_transform"), PROPERTY_HINT_NONE, "suffix:m"));
+ p_list->push_back(PropertyInfo(Variant::ARRAY, prop_name + PNAME("shapes")));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("navmesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"));
+ p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prop_name + PNAME("navmesh_transform"), PROPERTY_HINT_NONE, "suffix:m"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("preview"), PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT));
}
}
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index 90ea879012..de97498674 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -527,7 +527,7 @@ void NavigationMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type");
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
ADD_PROPERTY_DEFAULT("geometry_collision_mask", 0xFFFFFFFF);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "NavMesh Children, Group With Children, Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "NavMesh Children,Group With Children,Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry_source_group_name"), "set_source_group_name", "get_source_group_name");
ADD_PROPERTY_DEFAULT("geometry_source_group_name", StringName("navmesh"));
ADD_GROUP("Cells", "cell_");
@@ -590,16 +590,16 @@ void NavigationMesh::_validate_property(PropertyInfo &p_property) const {
#ifndef DISABLE_DEPRECATED
bool NavigationMesh::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name.find("/") != -1) {
+ String prop_name = p_name;
+ if (prop_name.find("/") != -1) {
// Compatibility with pre-3.5 "category/path" property names.
- name = name.replace("/", "_");
- if (name == "sample_partition_type_sample_partition_type") {
+ prop_name = prop_name.replace("/", "_");
+ if (prop_name == "sample_partition_type_sample_partition_type") {
set("sample_partition_type", p_value);
- } else if (name == "filter_filter_walkable_low_height_spans") {
+ } else if (prop_name == "filter_filter_walkable_low_height_spans") {
set("filter_walkable_low_height_spans", p_value);
} else {
- set(name, p_value);
+ set(prop_name, p_value);
}
return true;
@@ -608,16 +608,16 @@ bool NavigationMesh::_set(const StringName &p_name, const Variant &p_value) {
}
bool NavigationMesh::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name.find("/") != -1) {
+ String prop_name = p_name;
+ if (prop_name.find("/") != -1) {
// Compatibility with pre-3.5 "category/path" property names.
- name = name.replace("/", "_");
- if (name == "sample_partition_type_sample_partition_type") {
+ prop_name = prop_name.replace("/", "_");
+ if (prop_name == "sample_partition_type_sample_partition_type") {
r_ret = get("sample_partition_type");
- } else if (name == "filter_filter_walkable_low_height_spans") {
+ } else if (prop_name == "filter_filter_walkable_low_height_spans") {
r_ret = get("filter_walkable_low_height_spans");
} else {
- r_ret = get(name);
+ r_ret = get(prop_name);
}
return true;
}
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 85a207b34e..1c99fa5554 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -150,15 +150,15 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
} else if (n.instance >= 0) {
//instance a scene into this node
if (n.instance & FLAG_INSTANCE_IS_PLACEHOLDER) {
- String path = props[n.instance & FLAG_MASK];
+ String scene_path = props[n.instance & FLAG_MASK];
if (disable_placeholders) {
- Ref<PackedScene> sdata = ResourceLoader::load(path, "PackedScene");
+ Ref<PackedScene> sdata = ResourceLoader::load(scene_path, "PackedScene");
ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
node = sdata->instantiate(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE);
ERR_FAIL_COND_V(!node, nullptr);
} else {
InstancePlaceholder *ip = memnew(InstancePlaceholder);
- ip->set_instance_path(path);
+ ip->set_instance_path(scene_path);
node = ip;
}
node->set_scene_instance_load_placeholder(true);
@@ -938,8 +938,8 @@ Error SceneState::pack(Node *p_scene) {
// If using scene inheritance, pack the scene it inherits from.
if (scene->get_scene_inherited_state().is_valid()) {
- String path = scene->get_scene_inherited_state()->get_path();
- Ref<PackedScene> instance = ResourceLoader::load(path);
+ String scene_path = scene->get_scene_inherited_state()->get_path();
+ Ref<PackedScene> instance = ResourceLoader::load(scene_path);
if (instance.is_valid()) {
base_scene_idx = _vm_get_variant(instance, variant_map);
}
diff --git a/scene/resources/particle_process_material.cpp b/scene/resources/particle_process_material.cpp
index e51c786786..b77430c154 100644
--- a/scene/resources/particle_process_material.cpp
+++ b/scene/resources/particle_process_material.cpp
@@ -115,6 +115,7 @@ void ParticleProcessMaterial::init_shaders() {
shader_names->sub_emitter_frequency = "sub_emitter_frequency";
shader_names->sub_emitter_amount_at_end = "sub_emitter_amount_at_end";
+ shader_names->sub_emitter_amount_at_collision = "sub_emitter_amount_at_collision";
shader_names->sub_emitter_keep_velocity = "sub_emitter_keep_velocity";
shader_names->collision_friction = "collision_friction";
@@ -235,6 +236,9 @@ void ParticleProcessMaterial::_update_shader() {
if (sub_emitter_mode == SUB_EMITTER_AT_END) {
code += "uniform int sub_emitter_amount_at_end;\n";
}
+ if (sub_emitter_mode == SUB_EMITTER_AT_COLLISION) {
+ code += "uniform int sub_emitter_amount_at_collision;\n";
+ }
code += "uniform bool sub_emitter_keep_velocity;\n";
}
@@ -830,6 +834,13 @@ void ParticleProcessMaterial::_update_shader() {
code += " TRANSFORM[3].z = 0.0;\n";
}
+ // scale by scale
+ code += " float base_scale = mix(scale_min, scale_max, scale_rand);\n";
+ code += " base_scale = sign(base_scale) * max(abs(base_scale), 0.001);\n";
+ code += " TRANSFORM[0].xyz *= base_scale * sign(tex_scale.r) * max(abs(tex_scale.r), 0.001);\n";
+ code += " TRANSFORM[1].xyz *= base_scale * sign(tex_scale.g) * max(abs(tex_scale.g), 0.001);\n";
+ code += " TRANSFORM[2].xyz *= base_scale * sign(tex_scale.b) * max(abs(tex_scale.b), 0.001);\n";
+
if (collision_mode == COLLISION_RIGID) {
code += " if (COLLIDED) {\n";
code += " if (length(VELOCITY) > 3.0) {\n";
@@ -844,21 +855,6 @@ void ParticleProcessMaterial::_update_shader() {
}
code += " }\n";
code += " }\n";
- }
-
- // scale by scale
- code += " float base_scale = mix(scale_min, scale_max, scale_rand);\n";
- code += " base_scale = sign(base_scale) * max(abs(base_scale), 0.001);\n";
- code += " TRANSFORM[0].xyz *= base_scale * sign(tex_scale.r) * max(abs(tex_scale.r), 0.001);\n";
- code += " TRANSFORM[1].xyz *= base_scale * sign(tex_scale.g) * max(abs(tex_scale.g), 0.001);\n";
- code += " TRANSFORM[2].xyz *= base_scale * sign(tex_scale.b) * max(abs(tex_scale.b), 0.001);\n";
-
- if (collision_mode == COLLISION_RIGID) {
- code += " if (COLLIDED) {\n";
- code += " TRANSFORM[3].xyz+=COLLISION_NORMAL * COLLISION_DEPTH;\n";
- code += " VELOCITY -= COLLISION_NORMAL * dot(COLLISION_NORMAL, VELOCITY) * (1.0 + collision_bounce);\n";
- code += " VELOCITY = mix(VELOCITY,vec3(0.0),collision_friction * DELTA * 100.0);\n";
- code += " }\n";
} else if (collision_mode == COLLISION_HIDE_ON_CONTACT) {
code += " if (COLLIDED) {\n";
code += " ACTIVE = false;\n";
@@ -874,7 +870,7 @@ void ParticleProcessMaterial::_update_shader() {
code += " if (DELTA >= interval_rem) emit_count = 1;\n";
} break;
case SUB_EMITTER_AT_COLLISION: {
- code += " if (COLLIDED) emit_count = 1;\n";
+ code += " if (COLLIDED) emit_count = sub_emitter_amount_at_collision;\n";
} break;
case SUB_EMITTER_AT_END: {
code += " float unit_delta = DELTA/LIFETIME;\n";
@@ -1433,6 +1429,10 @@ void ParticleProcessMaterial::_validate_property(PropertyInfo &p_property) const
p_property.usage = PROPERTY_USAGE_NONE;
}
+ if (p_property.name == "sub_emitter_amount_at_collision" && sub_emitter_mode != SUB_EMITTER_AT_COLLISION) {
+ p_property.usage = PROPERTY_USAGE_NONE;
+ }
+
if (p_property.name.begins_with("orbit_") && !particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
p_property.usage = PROPERTY_USAGE_NONE;
}
@@ -1488,6 +1488,15 @@ int ParticleProcessMaterial::get_sub_emitter_amount_at_end() const {
return sub_emitter_amount_at_end;
}
+void ParticleProcessMaterial::set_sub_emitter_amount_at_collision(int p_amount) {
+ sub_emitter_amount_at_collision = p_amount;
+ RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->sub_emitter_amount_at_collision, p_amount);
+}
+
+int ParticleProcessMaterial::get_sub_emitter_amount_at_collision() const {
+ return sub_emitter_amount_at_collision;
+}
+
void ParticleProcessMaterial::set_sub_emitter_keep_velocity(bool p_enable) {
sub_emitter_keep_velocity = p_enable;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->sub_emitter_keep_velocity, p_enable);
@@ -1640,6 +1649,9 @@ void ParticleProcessMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_sub_emitter_amount_at_end"), &ParticleProcessMaterial::get_sub_emitter_amount_at_end);
ClassDB::bind_method(D_METHOD("set_sub_emitter_amount_at_end", "amount"), &ParticleProcessMaterial::set_sub_emitter_amount_at_end);
+ ClassDB::bind_method(D_METHOD("get_sub_emitter_amount_at_collision"), &ParticleProcessMaterial::get_sub_emitter_amount_at_collision);
+ ClassDB::bind_method(D_METHOD("set_sub_emitter_amount_at_collision", "amount"), &ParticleProcessMaterial::set_sub_emitter_amount_at_collision);
+
ClassDB::bind_method(D_METHOD("get_sub_emitter_keep_velocity"), &ParticleProcessMaterial::get_sub_emitter_keep_velocity);
ClassDB::bind_method(D_METHOD("set_sub_emitter_keep_velocity", "enable"), &ParticleProcessMaterial::set_sub_emitter_keep_velocity);
@@ -1752,6 +1764,7 @@ void ParticleProcessMaterial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "sub_emitter_mode", PROPERTY_HINT_ENUM, "Disabled,Constant,At End,At Collision"), "set_sub_emitter_mode", "get_sub_emitter_mode");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sub_emitter_frequency", PROPERTY_HINT_RANGE, "0.01,100,0.01,suffix:Hz"), "set_sub_emitter_frequency", "get_sub_emitter_frequency");
ADD_PROPERTY(PropertyInfo(Variant::INT, "sub_emitter_amount_at_end", PROPERTY_HINT_RANGE, "1,32,1"), "set_sub_emitter_amount_at_end", "get_sub_emitter_amount_at_end");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "sub_emitter_amount_at_collision", PROPERTY_HINT_RANGE, "1,32,1"), "set_sub_emitter_amount_at_collision", "get_sub_emitter_amount_at_collision");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sub_emitter_keep_velocity"), "set_sub_emitter_keep_velocity", "get_sub_emitter_keep_velocity");
ADD_GROUP("Attractor Interaction", "attractor_interaction_");
@@ -1859,6 +1872,7 @@ ParticleProcessMaterial::ParticleProcessMaterial() :
set_sub_emitter_mode(SUB_EMITTER_DISABLED);
set_sub_emitter_frequency(4);
set_sub_emitter_amount_at_end(1);
+ set_sub_emitter_amount_at_collision(1);
set_sub_emitter_keep_velocity(false);
set_attractor_interaction_enabled(true);
diff --git a/scene/resources/particle_process_material.h b/scene/resources/particle_process_material.h
index 9430e5797d..64d828b3e7 100644
--- a/scene/resources/particle_process_material.h
+++ b/scene/resources/particle_process_material.h
@@ -246,6 +246,7 @@ private:
StringName sub_emitter_frequency;
StringName sub_emitter_amount_at_end;
+ StringName sub_emitter_amount_at_collision;
StringName sub_emitter_keep_velocity;
StringName collision_friction;
@@ -265,9 +266,9 @@ private:
float spread = 0.0f;
float flatness = 0.0f;
- float params_min[PARAM_MAX];
- float params_max[PARAM_MAX];
- float params[PARAM_MAX];
+ float params_min[PARAM_MAX] = {};
+ float params_max[PARAM_MAX] = {};
+ float params[PARAM_MAX] = {};
Ref<Texture2D> tex_parameters[PARAM_MAX];
Color color;
@@ -304,6 +305,7 @@ private:
SubEmitterMode sub_emitter_mode;
double sub_emitter_frequency = 0.0;
int sub_emitter_amount_at_end = 0;
+ int sub_emitter_amount_at_collision = 0;
bool sub_emitter_keep_velocity = false;
//do not save emission points here
@@ -418,6 +420,9 @@ public:
void set_sub_emitter_amount_at_end(int p_amount);
int get_sub_emitter_amount_at_end() const;
+ void set_sub_emitter_amount_at_collision(int p_amount);
+ int get_sub_emitter_amount_at_collision() const;
+
void set_sub_emitter_keep_velocity(bool p_enable);
bool get_sub_emitter_keep_velocity() const;
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 5e18671c11..2c80e234e9 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -441,9 +441,9 @@ Dictionary PolygonPathFinder::_get_data() const {
Dictionary d;
Vector<Vector2> p;
Vector<int> ind;
- Array connections;
+ Array path_connections;
p.resize(MAX(0, points.size() - 2));
- connections.resize(MAX(0, points.size() - 2));
+ path_connections.resize(MAX(0, points.size() - 2));
ind.resize(edges.size() * 2);
Vector<real_t> penalties;
penalties.resize(MAX(0, points.size() - 2));
@@ -463,7 +463,7 @@ Dictionary PolygonPathFinder::_get_data() const {
cw[idx++] = E;
}
}
- connections[i] = c;
+ path_connections[i] = c;
}
}
{
@@ -478,7 +478,7 @@ Dictionary PolygonPathFinder::_get_data() const {
d["bounds"] = bounds;
d["points"] = p;
d["penalties"] = penalties;
- d["connections"] = connections;
+ d["connections"] = path_connections;
d["segments"] = ind;
return d;
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index c017c90370..eb83a37c7b 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -771,6 +771,7 @@ void CylinderMesh::create_mesh_array(Array &p_arr, float top_radius, float botto
thisrow = 0;
prevrow = 0;
+ const real_t side_normal_y = (bottom_radius - top_radius) / height;
for (j = 0; j <= (rings + 1); j++) {
v = j;
v /= (rings + 1);
@@ -789,7 +790,7 @@ void CylinderMesh::create_mesh_array(Array &p_arr, float top_radius, float botto
Vector3 p = Vector3(x * radius, y, z * radius);
points.push_back(p);
- normals.push_back(Vector3(x, 0.0, z));
+ normals.push_back(Vector3(x, side_normal_y, z).normalized());
ADD_TANGENT(z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u, v * 0.5));
point++;
@@ -1078,7 +1079,7 @@ void PlaneMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_width", "get_subdivide_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_depth", "get_subdivide_depth");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "center_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_center_offset", "get_center_offset");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "orientation", PROPERTY_HINT_ENUM, "Face X, Face Y, Face Z"), "set_orientation", "get_orientation");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "orientation", PROPERTY_HINT_ENUM, "Face X,Face Y,Face Z"), "set_orientation", "get_orientation");
BIND_ENUM_CONSTANT(FACE_X)
BIND_ENUM_CONSTANT(FACE_Y)
@@ -2443,17 +2444,17 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
TS->shaped_text_clear(text_rid);
TS->shaped_text_set_direction(text_rid, text_direction);
- String text = (uppercase) ? TS->string_to_upper(xl_text, language) : xl_text;
- TS->shaped_text_add_string(text_rid, text, font->get_rids(), font_size, font->get_opentype_features(), language);
+ String txt = (uppercase) ? TS->string_to_upper(xl_text, language) : xl_text;
+ TS->shaped_text_add_string(text_rid, txt, font->get_rids(), font_size, font->get_opentype_features(), language);
for (int i = 0; i < TextServer::SPACING_MAX; i++) {
TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i)));
}
Array stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) {
- GDVIRTUAL_CALL(_structured_text_parser, st_args, text, stt);
+ GDVIRTUAL_CALL(_structured_text_parser, st_args, txt, stt);
} else {
- stt = TS->parse_structured_text(st_parser, st_args, text);
+ stt = TS->parse_structured_text(st_parser, st_args, txt);
}
TS->shaped_text_set_bidi_override(text_rid, stt);
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 0d798d2e27..85b538b1d9 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -445,7 +445,14 @@ Error ResourceLoaderText::load() {
// If a UID is found and the path is valid, it will be used, otherwise, it falls back to the path.
path = ResourceUID::get_singleton()->get_id_path(uid);
} else {
+#ifdef TOOLS_ENABLED
+ // Silence a warning that can happen during the initial filesystem scan due to cache being regenerated.
+ if (ResourceLoader::get_resource_uid(path) != uid) {
+ WARN_PRINT(String(res_path + ":" + itos(lines) + " - ext_resource, invalid UUID: " + uidt + " - using text path instead: " + path).utf8().get_data());
+ }
+#else
WARN_PRINT(String(res_path + ":" + itos(lines) + " - ext_resource, invalid UUID: " + uidt + " - using text path instead: " + path).utf8().get_data());
+#endif
}
}
@@ -1114,10 +1121,10 @@ Error ResourceLoaderText::save_as_binary(const String &p_path) {
//go with external resources
DummyReadData dummy_read;
- VariantParser::ResourceParser rp;
- rp.ext_func = _parse_ext_resource_dummys;
- rp.sub_func = _parse_sub_resource_dummys;
- rp.userdata = &dummy_read;
+ VariantParser::ResourceParser rp_new;
+ rp_new.ext_func = _parse_ext_resource_dummys;
+ rp_new.sub_func = _parse_sub_resource_dummys;
+ rp_new.userdata = &dummy_read;
while (next_tag.name == "ext_resource") {
if (!next_tag.fields.has("path")) {
@@ -1161,7 +1168,7 @@ Error ResourceLoaderText::save_as_binary(const String &p_path) {
dummy_read.external_resources[dr] = lindex;
dummy_read.rev_external_resources[id] = dr;
- error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp);
+ error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp_new);
if (error) {
_printerr();
@@ -1244,7 +1251,7 @@ Error ResourceLoaderText::save_as_binary(const String &p_path) {
String assign;
Variant value;
- error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp);
+ error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new);
if (error) {
if (main_res && error == ERR_FILE_EOF) {
@@ -1288,7 +1295,7 @@ Error ResourceLoaderText::save_as_binary(const String &p_path) {
return error;
}
- Ref<PackedScene> packed_scene = _parse_node_tag(rp);
+ Ref<PackedScene> packed_scene = _parse_node_tag(rp_new);
if (!packed_scene.is_valid()) {
return error;
@@ -1363,13 +1370,13 @@ Error ResourceLoaderText::get_classes_used(HashSet<StringName> *r_classes) {
DummyReadData dummy_read;
dummy_read.no_placeholders = true;
- VariantParser::ResourceParser rp;
- rp.ext_func = _parse_ext_resource_dummys;
- rp.sub_func = _parse_sub_resource_dummys;
- rp.userdata = &dummy_read;
+ VariantParser::ResourceParser rp_new;
+ rp_new.ext_func = _parse_ext_resource_dummys;
+ rp_new.sub_func = _parse_sub_resource_dummys;
+ rp_new.userdata = &dummy_read;
while (next_tag.name == "ext_resource") {
- error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp);
+ error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp_new);
if (error) {
_printerr();
@@ -1396,7 +1403,7 @@ Error ResourceLoaderText::get_classes_used(HashSet<StringName> *r_classes) {
String assign;
Variant value;
- error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp);
+ error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new);
if (error) {
if (error == ERR_FILE_EOF) {
@@ -1444,7 +1451,7 @@ Error ResourceLoaderText::get_classes_used(HashSet<StringName> *r_classes) {
String assign;
Variant value;
- error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp);
+ error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new);
if (error) {
if (error == ERR_FILE_MISSING_DEPENDENCIES) {
diff --git a/scene/resources/skeleton_modification_2d.cpp b/scene/resources/skeleton_modification_2d.cpp
index 885cf0f1b8..0ae0e31120 100644
--- a/scene/resources/skeleton_modification_2d.cpp
+++ b/scene/resources/skeleton_modification_2d.cpp
@@ -230,7 +230,7 @@ void SkeletonModification2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_editor_draw_gizmo"), &SkeletonModification2D::get_editor_draw_gizmo);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "get_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "execution_mode", PROPERTY_HINT_ENUM, "process, physics_process"), "set_execution_mode", "get_execution_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "execution_mode", PROPERTY_HINT_ENUM, "process,physics_process"), "set_execution_mode", "get_execution_mode");
}
SkeletonModification2D::SkeletonModification2D() {
diff --git a/scene/resources/skeleton_modification_3d.cpp b/scene/resources/skeleton_modification_3d.cpp
index 2c0f6e779e..fa487cb061 100644
--- a/scene/resources/skeleton_modification_3d.cpp
+++ b/scene/resources/skeleton_modification_3d.cpp
@@ -142,7 +142,7 @@ void SkeletonModification3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("clamp_angle", "angle", "min", "max", "invert"), &SkeletonModification3D::clamp_angle);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "get_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "execution_mode", PROPERTY_HINT_ENUM, "process, physics_process"), "set_execution_mode", "get_execution_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "execution_mode", PROPERTY_HINT_ENUM, "process,physics_process"), "set_execution_mode", "get_execution_mode");
}
SkeletonModification3D::SkeletonModification3D() {
diff --git a/scene/resources/skeleton_modification_3d_ccdik.cpp b/scene/resources/skeleton_modification_3d_ccdik.cpp
index 3251ee4189..82dc30ec5f 100644
--- a/scene/resources/skeleton_modification_3d_ccdik.cpp
+++ b/scene/resources/skeleton_modification_3d_ccdik.cpp
@@ -98,7 +98,7 @@ void SkeletonModification3DCCDIK::_get_property_list(List<PropertyInfo> *p_list)
p_list->push_back(PropertyInfo(Variant::INT, base_string + "bone_index", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
p_list->push_back(PropertyInfo(Variant::INT, base_string + "ccdik_axis",
- PROPERTY_HINT_ENUM, "X Axis, Y Axis, Z Axis", PROPERTY_USAGE_DEFAULT));
+ PROPERTY_HINT_ENUM, "X Axis,Y Axis,Z Axis", PROPERTY_USAGE_DEFAULT));
p_list->push_back(PropertyInfo(Variant::BOOL, base_string + "enable_joint_constraint", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
if (ccdik_data_chain[i].enable_constraint) {
diff --git a/scene/resources/skeleton_modification_3d_lookat.cpp b/scene/resources/skeleton_modification_3d_lookat.cpp
index 69167cb308..8ada7d0a5b 100644
--- a/scene/resources/skeleton_modification_3d_lookat.cpp
+++ b/scene/resources/skeleton_modification_3d_lookat.cpp
@@ -67,7 +67,7 @@ bool SkeletonModification3DLookAt::_get(const StringName &p_path, Variant &r_ret
void SkeletonModification3DLookAt::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::BOOL, "lock_rotation_to_plane", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
if (lock_rotation_to_plane) {
- p_list->push_back(PropertyInfo(Variant::INT, "lock_rotation_plane", PROPERTY_HINT_ENUM, "X plane, Y plane, Z plane", PROPERTY_USAGE_DEFAULT));
+ p_list->push_back(PropertyInfo(Variant::INT, "lock_rotation_plane", PROPERTY_HINT_ENUM, "X plane,Y plane,Z plane", PROPERTY_USAGE_DEFAULT));
}
p_list->push_back(PropertyInfo(Variant::VECTOR3, "additional_rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT));
}
diff --git a/scene/resources/skin.cpp b/scene/resources/skin.cpp
index 1c04ba0cd4..9d320e0b2c 100644
--- a/scene/resources/skin.cpp
+++ b/scene/resources/skin.cpp
@@ -86,13 +86,13 @@ void Skin::reset_state() {
}
bool Skin::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name == "bind_count") {
+ String prop_name = p_name;
+ if (prop_name == "bind_count") {
set_bind_count(p_value);
return true;
- } else if (name.begins_with("bind/")) {
- int index = name.get_slicec('/', 1).to_int();
- String what = name.get_slicec('/', 2);
+ } else if (prop_name.begins_with("bind/")) {
+ int index = prop_name.get_slicec('/', 1).to_int();
+ String what = prop_name.get_slicec('/', 2);
if (what == "bone") {
set_bind_bone(index, p_value);
return true;
@@ -108,13 +108,13 @@ bool Skin::_set(const StringName &p_name, const Variant &p_value) {
}
bool Skin::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name == "bind_count") {
+ String prop_name = p_name;
+ if (prop_name == "bind_count") {
r_ret = get_bind_count();
return true;
- } else if (name.begins_with("bind/")) {
- int index = name.get_slicec('/', 1).to_int();
- String what = name.get_slicec('/', 2);
+ } else if (prop_name.begins_with("bind/")) {
+ int index = prop_name.get_slicec('/', 1).to_int();
+ String what = prop_name.get_slicec('/', 2);
if (what == "bone") {
r_ret = get_bind_bone(index);
return true;
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index 3533e86c3a..838566f696 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -143,10 +143,10 @@ Array SpriteFrames::_get_animations() const {
get_animation_list(&sorted_names);
sorted_names.sort_custom<StringName::AlphCompare>();
- for (const StringName &name : sorted_names) {
- const Anim &anim = animations[name];
+ for (const StringName &anim_name : sorted_names) {
+ const Anim &anim = animations[anim_name];
Dictionary d;
- d["name"] = name;
+ d["name"] = anim_name;
d["speed"] = anim.speed;
d["loop"] = anim.loop;
Array frames;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 9829c7e86b..94967352c8 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -986,7 +986,7 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const
format = 0;
}
- uint32_t nformat;
+ uint32_t nformat = 0;
LocalVector<Vertex> nvertices;
LocalVector<int> nindices;
_create_list(p_existing, p_surface, &nvertices, &nindices, nformat);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 15678c9281..4085aa8ec2 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1209,6 +1209,8 @@ Error ImageTexture3D::create(Image::Format p_format, int p_width, int p_height,
if (texture.is_valid()) {
RenderingServer::get_singleton()->texture_replace(texture, tex);
+ } else {
+ texture = tex;
}
return OK;
@@ -1286,15 +1288,15 @@ Error CompressedTexture3D::_load_data(const String &p_path, Vector<Ref<Image>> &
f->get_32(); // ignored (data format)
f->get_32(); //ignored
- int mipmaps = f->get_32();
+ int mipmap_count = f->get_32();
f->get_32(); //ignored
f->get_32(); //ignored
- r_mipmaps = mipmaps != 0;
+ r_mipmaps = mipmap_count != 0;
r_data.clear();
- for (int i = 0; i < (r_depth + mipmaps); i++) {
+ for (int i = 0; i < (r_depth + mipmap_count); i++) {
Ref<Image> image = CompressedTexture2D::load_image_from_file(f, 0);
ERR_FAIL_COND_V(image.is_null() || image->is_empty(), ERR_CANT_OPEN);
if (i == 0) {
@@ -1489,7 +1491,15 @@ void AtlasTexture::set_atlas(const Ref<Texture2D> &p_atlas) {
if (atlas == p_atlas) {
return;
}
+ // Support recursive AtlasTextures.
+ if (Ref<AtlasTexture>(atlas).is_valid()) {
+ atlas->disconnect(CoreStringNames::get_singleton()->changed, callable_mp((Resource *)this, &AtlasTexture::emit_changed));
+ }
atlas = p_atlas;
+ if (Ref<AtlasTexture>(atlas).is_valid()) {
+ atlas->connect(CoreStringNames::get_singleton()->changed, callable_mp((Resource *)this, &AtlasTexture::emit_changed));
+ }
+
emit_changed();
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 4e529de8ee..9a9f0ad1af 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -238,7 +238,7 @@ private:
Error _load_data(const String &p_path, int &r_width, int &r_height, Ref<Image> &image, bool &r_request_3d, bool &r_request_normal, bool &r_request_roughness, int &mipmap_limit, int p_size_limit = 0);
String path_to_file;
mutable RID texture;
- Image::Format format = Image::FORMAT_MAX;
+ Image::Format format = Image::FORMAT_L8;
int w = 0;
int h = 0;
mutable Ref<BitMap> alpha_cache;
@@ -415,7 +415,7 @@ class ImageTextureLayered : public TextureLayered {
LayeredType layered_type;
mutable RID texture;
- Image::Format format = Image::FORMAT_MAX;
+ Image::Format format = Image::FORMAT_L8;
int width = 0;
int height = 0;
@@ -495,7 +495,7 @@ private:
Error _load_data(const String &p_path, Vector<Ref<Image>> &images, int &mipmap_limit, int p_size_limit = 0);
String path_to_file;
mutable RID texture;
- Image::Format format = Image::FORMAT_MAX;
+ Image::Format format = Image::FORMAT_L8;
int w = 0;
int h = 0;
int layers = 0;
@@ -587,7 +587,7 @@ class ImageTexture3D : public Texture3D {
mutable RID texture;
- Image::Format format = Image::FORMAT_MAX;
+ Image::Format format = Image::FORMAT_L8;
int width = 1;
int height = 1;
int depth = 1;
@@ -641,7 +641,7 @@ private:
Error _load_data(const String &p_path, Vector<Ref<Image>> &r_data, Image::Format &r_format, int &r_width, int &r_height, int &r_depth, bool &r_mipmaps);
String path_to_file;
mutable RID texture;
- Image::Format format = Image::FORMAT_MAX;
+ Image::Format format = Image::FORMAT_L8;
int w = 0;
int h = 0;
int d = 0;
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 3321392821..ed0d5ee688 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -40,20 +40,20 @@ bool Theme::_set(const StringName &p_name, const Variant &p_value) {
if (sname.contains("/")) {
String type = sname.get_slicec('/', 1);
String theme_type = sname.get_slicec('/', 0);
- String name = sname.get_slicec('/', 2);
+ String prop_name = sname.get_slicec('/', 2);
if (type == "icons") {
- set_icon(name, theme_type, p_value);
+ set_icon(prop_name, theme_type, p_value);
} else if (type == "styles") {
- set_stylebox(name, theme_type, p_value);
+ set_stylebox(prop_name, theme_type, p_value);
} else if (type == "fonts") {
- set_font(name, theme_type, p_value);
+ set_font(prop_name, theme_type, p_value);
} else if (type == "font_sizes") {
- set_font_size(name, theme_type, p_value);
+ set_font_size(prop_name, theme_type, p_value);
} else if (type == "colors") {
- set_color(name, theme_type, p_value);
+ set_color(prop_name, theme_type, p_value);
} else if (type == "constants") {
- set_constant(name, theme_type, p_value);
+ set_constant(prop_name, theme_type, p_value);
} else if (type == "base_type") {
set_type_variation(theme_type, p_value);
} else {
@@ -72,32 +72,32 @@ bool Theme::_get(const StringName &p_name, Variant &r_ret) const {
if (sname.contains("/")) {
String type = sname.get_slicec('/', 1);
String theme_type = sname.get_slicec('/', 0);
- String name = sname.get_slicec('/', 2);
+ String prop_name = sname.get_slicec('/', 2);
if (type == "icons") {
- if (!has_icon(name, theme_type)) {
+ if (!has_icon(prop_name, theme_type)) {
r_ret = Ref<Texture2D>();
} else {
- r_ret = get_icon(name, theme_type);
+ r_ret = get_icon(prop_name, theme_type);
}
} else if (type == "styles") {
- if (!has_stylebox(name, theme_type)) {
+ if (!has_stylebox(prop_name, theme_type)) {
r_ret = Ref<StyleBox>();
} else {
- r_ret = get_stylebox(name, theme_type);
+ r_ret = get_stylebox(prop_name, theme_type);
}
} else if (type == "fonts") {
- if (!has_font(name, theme_type)) {
+ if (!has_font(prop_name, theme_type)) {
r_ret = Ref<Font>();
} else {
- r_ret = get_font(name, theme_type);
+ r_ret = get_font(prop_name, theme_type);
}
} else if (type == "font_sizes") {
- r_ret = get_font_size(name, theme_type);
+ r_ret = get_font_size(prop_name, theme_type);
} else if (type == "colors") {
- r_ret = get_color(name, theme_type);
+ r_ret = get_color(prop_name, theme_type);
} else if (type == "constants") {
- r_ret = get_constant(name, theme_type);
+ r_ret = get_constant(prop_name, theme_type);
} else if (type == "base_type") {
r_ret = get_type_variation_base(theme_type);
} else {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index ae83e2136f..d7d7b5fe31 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -3779,14 +3779,14 @@ bool TileSetAtlasSource::get_use_texture_padding() const {
}
Vector2i TileSetAtlasSource::get_atlas_grid_size() const {
- Ref<Texture2D> texture = get_texture();
- if (!texture.is_valid()) {
+ Ref<Texture2D> txt = get_texture();
+ if (!txt.is_valid()) {
return Vector2i();
}
ERR_FAIL_COND_V(texture_region_size.x <= 0 || texture_region_size.y <= 0, Vector2i());
- Size2i valid_area = texture->get_size() - margins;
+ Size2i valid_area = txt->get_size() - margins;
// Compute the number of valid tiles in the tiles atlas
Size2i grid_size = Size2i();
@@ -5017,7 +5017,7 @@ void TileData::add_custom_data_layer(int p_to_pos) {
void TileData::move_custom_data_layer(int p_from_index, int p_to_pos) {
ERR_FAIL_INDEX(p_from_index, custom_data.size());
ERR_FAIL_INDEX(p_to_pos, custom_data.size() + 1);
- custom_data.insert(p_to_pos, navigation[p_from_index]);
+ custom_data.insert(p_to_pos, custom_data[p_from_index]);
custom_data.remove_at(p_to_pos < p_from_index ? p_from_index + 1 : p_from_index);
}
@@ -5275,6 +5275,7 @@ void TileData::set_terrain_set(int p_terrain_set) {
}
if (tile_set) {
ERR_FAIL_COND(p_terrain_set >= tile_set->get_terrain_sets_count());
+ terrain = -1;
for (int i = 0; i < 16; i++) {
terrain_peering_bits[i] = -1;
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 320889679d..640f6dfcb7 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -955,7 +955,7 @@ bool VisualShader::can_connect_nodes(Type p_type, int p_from_node, int p_from_po
}
bool VisualShader::is_port_types_compatible(int p_a, int p_b) const {
- return MAX(0, p_a - 4) == (MAX(0, p_b - 4));
+ return MAX(0, p_a - 5) == (MAX(0, p_b - 5));
}
void VisualShader::connect_nodes_forced(Type p_type, int p_from_node, int p_from_port, int p_to_node, int p_to_port) {
@@ -1148,7 +1148,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
StringBuilder global_code;
StringBuilder global_code_per_node;
HashMap<Type, StringBuilder> global_code_per_func;
- StringBuilder code;
+ StringBuilder shader_code;
HashSet<StringName> classes;
global_code += String() + "shader_type canvas_item;\n";
@@ -1189,69 +1189,69 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port
input_connections.insert(to_key, E);
}
- code += "\nvoid fragment() {\n";
+ shader_code += "\nvoid fragment() {\n";
HashSet<int> processed;
- Error err = _write_node(p_type, &global_code, &global_code_per_node, &global_code_per_func, code, default_tex_params, input_connections, output_connections, p_node, processed, true, classes);
+ Error err = _write_node(p_type, &global_code, &global_code_per_node, &global_code_per_func, shader_code, default_tex_params, input_connections, output_connections, p_node, processed, true, classes);
ERR_FAIL_COND_V(err != OK, String());
switch (node->get_output_port_type(p_port)) {
case VisualShaderNode::PORT_TYPE_SCALAR: {
- code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + ");\n";
+ shader_code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + ");\n";
} break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT: {
- code += " COLOR.rgb = vec3(float(n_out" + itos(p_node) + "p" + itos(p_port) + "));\n";
+ shader_code += " COLOR.rgb = vec3(float(n_out" + itos(p_node) + "p" + itos(p_port) + "));\n";
} break;
case VisualShaderNode::PORT_TYPE_BOOLEAN: {
- code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + " ? 1.0 : 0.0);\n";
+ shader_code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + " ? 1.0 : 0.0);\n";
} break;
case VisualShaderNode::PORT_TYPE_VECTOR_2D: {
- code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + ", 0.0);\n";
+ shader_code += " COLOR.rgb = vec3(n_out" + itos(p_node) + "p" + itos(p_port) + ", 0.0);\n";
} break;
case VisualShaderNode::PORT_TYPE_VECTOR_3D: {
- code += " COLOR.rgb = n_out" + itos(p_node) + "p" + itos(p_port) + ";\n";
+ shader_code += " COLOR.rgb = n_out" + itos(p_node) + "p" + itos(p_port) + ";\n";
} break;
case VisualShaderNode::PORT_TYPE_VECTOR_4D: {
- code += " COLOR.rgb = n_out" + itos(p_node) + "p" + itos(p_port) + ".xyz;\n";
+ shader_code += " COLOR.rgb = n_out" + itos(p_node) + "p" + itos(p_port) + ".xyz;\n";
} break;
default: {
- code += " COLOR.rgb = vec3(0.0);\n";
+ shader_code += " COLOR.rgb = vec3(0.0);\n";
} break;
}
- code += "}\n";
+ shader_code += "}\n";
//set code secretly
global_code += "\n\n";
String final_code = global_code;
final_code += global_code_per_node;
- final_code += code;
+ final_code += shader_code;
return final_code;
}
String VisualShader::validate_port_name(const String &p_port_name, VisualShaderNode *p_node, int p_port_id, bool p_output) const {
- String name = p_port_name;
+ String port_name = p_port_name;
- if (name.is_empty()) {
+ if (port_name.is_empty()) {
return String();
}
- while (name.length() && !is_ascii_char(name[0])) {
- name = name.substr(1, name.length() - 1);
+ while (port_name.length() && !is_ascii_char(port_name[0])) {
+ port_name = port_name.substr(1, port_name.length() - 1);
}
- if (!name.is_empty()) {
+ if (!port_name.is_empty()) {
String valid_name;
- for (int i = 0; i < name.length(); i++) {
- if (is_ascii_identifier_char(name[i])) {
- valid_name += String::chr(name[i]);
- } else if (name[i] == ' ') {
+ for (int i = 0; i < port_name.length(); i++) {
+ if (is_ascii_identifier_char(port_name[i])) {
+ valid_name += String::chr(port_name[i]);
+ } else if (port_name[i] == ' ') {
valid_name += "_";
}
}
- name = valid_name;
+ port_name = valid_name;
} else {
return String();
}
@@ -1263,7 +1263,7 @@ String VisualShader::validate_port_name(const String &p_port_name, VisualShaderN
if (!p_output && i == p_port_id) {
continue;
}
- if (name == p_node->get_input_port_name(i)) {
+ if (port_name == p_node->get_input_port_name(i)) {
return String();
}
}
@@ -1271,35 +1271,35 @@ String VisualShader::validate_port_name(const String &p_port_name, VisualShaderN
if (p_output && i == p_port_id) {
continue;
}
- if (name == p_node->get_output_port_name(i)) {
+ if (port_name == p_node->get_output_port_name(i)) {
return String();
}
}
- return name;
+ return port_name;
}
String VisualShader::validate_parameter_name(const String &p_name, const Ref<VisualShaderNodeParameter> &p_parameter) const {
- String name = p_name; //validate name first
- while (name.length() && !is_ascii_char(name[0])) {
- name = name.substr(1, name.length() - 1);
+ String param_name = p_name; //validate name first
+ while (param_name.length() && !is_ascii_char(param_name[0])) {
+ param_name = param_name.substr(1, param_name.length() - 1);
}
- if (!name.is_empty()) {
+ if (!param_name.is_empty()) {
String valid_name;
- for (int i = 0; i < name.length(); i++) {
- if (is_ascii_identifier_char(name[i])) {
- valid_name += String::chr(name[i]);
- } else if (name[i] == ' ') {
+ for (int i = 0; i < param_name.length(); i++) {
+ if (is_ascii_identifier_char(param_name[i])) {
+ valid_name += String::chr(param_name[i]);
+ } else if (param_name[i] == ' ') {
valid_name += "_";
}
}
- name = valid_name;
+ param_name = valid_name;
}
- if (name.is_empty()) {
- name = p_parameter->get_caption();
+ if (param_name.is_empty()) {
+ param_name = p_parameter->get_caption();
}
int attempt = 1;
@@ -1312,7 +1312,7 @@ String VisualShader::validate_parameter_name(const String &p_name, const Ref<Vis
if (node == p_parameter) { //do not test on self
continue;
}
- if (node.is_valid() && node->get_parameter_name() == name) {
+ if (node.is_valid() && node->get_parameter_name() == param_name) {
exists = true;
break;
}
@@ -1325,17 +1325,17 @@ String VisualShader::validate_parameter_name(const String &p_name, const Ref<Vis
if (exists) {
//remove numbers, put new and try again
attempt++;
- while (name.length() && is_digit(name[name.length() - 1])) {
- name = name.substr(0, name.length() - 1);
+ while (param_name.length() && is_digit(param_name[param_name.length() - 1])) {
+ param_name = param_name.substr(0, param_name.length() - 1);
}
- ERR_FAIL_COND_V(name.is_empty(), String());
- name += itos(attempt);
+ ERR_FAIL_COND_V(param_name.is_empty(), String());
+ param_name += itos(attempt);
} else {
break;
}
}
- return name;
+ return param_name;
}
static const char *type_string[VisualShader::TYPE_MAX] = {
@@ -1352,12 +1352,12 @@ static const char *type_string[VisualShader::TYPE_MAX] = {
};
bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name == "mode") {
+ String prop_name = p_name;
+ if (prop_name == "mode") {
set_mode(Shader::Mode(int(p_value)));
return true;
- } else if (name.begins_with("flags/")) {
- StringName flag = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("flags/")) {
+ StringName flag = prop_name.get_slicec('/', 1);
bool enable = p_value;
if (enable) {
flags.insert(flag);
@@ -1366,18 +1366,18 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
}
_queue_update();
return true;
- } else if (name.begins_with("modes/")) {
- String mode = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("modes/")) {
+ String mode_name = prop_name.get_slicec('/', 1);
int value = p_value;
if (value == 0) {
- modes.erase(mode); //means it's default anyway, so don't store it
+ modes.erase(mode_name); //means it's default anyway, so don't store it
} else {
- modes[mode] = value;
+ modes[mode_name] = value;
}
_queue_update();
return true;
- } else if (name.begins_with("varyings/")) {
- String var_name = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("varyings/")) {
+ String var_name = prop_name.get_slicec('/', 1);
Varying value = Varying();
value.name = var_name;
if (value.from_string(p_value) && !varyings.has(var_name)) {
@@ -1386,8 +1386,8 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
}
_queue_update();
return true;
- } else if (name.begins_with("nodes/")) {
- String typestr = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("nodes/")) {
+ String typestr = prop_name.get_slicec('/', 1);
Type type = TYPE_VERTEX;
for (int i = 0; i < TYPE_MAX; i++) {
if (typestr == type_string[i]) {
@@ -1396,7 +1396,7 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
}
}
- String index = name.get_slicec('/', 2);
+ String index = prop_name.get_slicec('/', 2);
if (index == "connections") {
Vector<int> conns = p_value;
if (conns.size() % 4 == 0) {
@@ -1408,7 +1408,7 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
}
int id = index.to_int();
- String what = name.get_slicec('/', 3);
+ String what = prop_name.get_slicec('/', 3);
if (what == "node") {
add_node(type, p_value, Vector2(), id);
@@ -1434,32 +1434,32 @@ bool VisualShader::_set(const StringName &p_name, const Variant &p_value) {
}
bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name == "mode") {
+ String prop_name = p_name;
+ if (prop_name == "mode") {
r_ret = get_mode();
return true;
- } else if (name.begins_with("flags/")) {
- StringName flag = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("flags/")) {
+ StringName flag = prop_name.get_slicec('/', 1);
r_ret = flags.has(flag);
return true;
- } else if (name.begins_with("modes/")) {
- String mode = name.get_slicec('/', 1);
- if (modes.has(mode)) {
- r_ret = modes[mode];
+ } else if (prop_name.begins_with("modes/")) {
+ String mode_name = prop_name.get_slicec('/', 1);
+ if (modes.has(mode_name)) {
+ r_ret = modes[mode_name];
} else {
r_ret = 0;
}
return true;
- } else if (name.begins_with("varyings/")) {
- String var_name = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("varyings/")) {
+ String var_name = prop_name.get_slicec('/', 1);
if (varyings.has(var_name)) {
r_ret = varyings[var_name].to_string();
} else {
r_ret = String();
}
return true;
- } else if (name.begins_with("nodes/")) {
- String typestr = name.get_slicec('/', 1);
+ } else if (prop_name.begins_with("nodes/")) {
+ String typestr = prop_name.get_slicec('/', 1);
Type type = TYPE_VERTEX;
for (int i = 0; i < TYPE_MAX; i++) {
if (typestr == type_string[i]) {
@@ -1468,7 +1468,7 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
}
}
- String index = name.get_slicec('/', 2);
+ String index = prop_name.get_slicec('/', 2);
if (index == "connections") {
Vector<int> conns;
for (const Connection &E : graph[type].connections) {
@@ -1483,7 +1483,7 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
}
int id = index.to_int();
- String what = name.get_slicec('/', 3);
+ String what = prop_name.get_slicec('/', 3);
if (what == "node") {
r_ret = get_node(type, id);
@@ -1509,11 +1509,10 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const {
}
void VisualShader::reset_state() {
-#ifndef _MSC_VER
-#warning everything needs to be cleared here
-#endif
+ // TODO: Everything needs to be cleared here.
emit_changed();
}
+
void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
//mode
p_list->push_back(PropertyInfo(Variant::INT, PNAME("mode"), PROPERTY_HINT_ENUM, "Node3D,CanvasItem,Particles,Sky,Fog"));
@@ -1580,12 +1579,12 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
-Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<VisualShader::DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, HashSet<int> &processed, bool for_preview, HashSet<StringName> &r_classes) const {
- const Ref<VisualShaderNode> vsnode = graph[type].nodes[node].node;
+Error VisualShader::_write_node(Type type, StringBuilder *p_global_code, StringBuilder *p_global_code_per_node, HashMap<Type, StringBuilder> *p_global_code_per_func, StringBuilder &r_code, Vector<VisualShader::DefaultTextureParam> &r_def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &p_input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &p_output_connections, int p_node, HashSet<int> &r_processed, bool p_for_preview, HashSet<StringName> &r_classes) const {
+ const Ref<VisualShaderNode> vsnode = graph[type].nodes[p_node].node;
if (vsnode->is_disabled()) {
- code += "// " + vsnode->get_caption() + ":" + itos(node) + "\n";
- code += " // Node is disabled and code is not generated.\n";
+ r_code += "// " + vsnode->get_caption() + ":" + itos(p_node) + "\n";
+ r_code += " // Node is disabled and code is not generated.\n";
return OK;
}
@@ -1593,16 +1592,16 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
int input_count = vsnode->get_input_port_count();
for (int i = 0; i < input_count; i++) {
ConnectionKey ck;
- ck.node = node;
+ ck.node = p_node;
ck.port = i;
- if (input_connections.has(ck)) {
- int from_node = input_connections[ck]->get().from_node;
- if (processed.has(from_node)) {
+ if (p_input_connections.has(ck)) {
+ int from_node = p_input_connections[ck]->get().from_node;
+ if (r_processed.has(from_node)) {
continue;
}
- Error err = _write_node(type, global_code, global_code_per_node, global_code_per_func, code, def_tex_params, input_connections, output_connections, from_node, processed, for_preview, r_classes);
+ Error err = _write_node(type, p_global_code, p_global_code_per_node, p_global_code_per_func, r_code, r_def_tex_params, p_input_connections, p_output_connections, from_node, r_processed, p_for_preview, r_classes);
if (err) {
return err;
}
@@ -1611,19 +1610,19 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
// then this node
- Vector<VisualShader::DefaultTextureParam> params = vsnode->get_default_texture_parameters(type, node);
+ Vector<VisualShader::DefaultTextureParam> params = vsnode->get_default_texture_parameters(type, p_node);
for (int i = 0; i < params.size(); i++) {
- def_tex_params.push_back(params[i]);
+ r_def_tex_params.push_back(params[i]);
}
Ref<VisualShaderNodeInput> input = vsnode;
- bool skip_global = input.is_valid() && for_preview;
+ bool skip_global = input.is_valid() && p_for_preview;
if (!skip_global) {
Ref<VisualShaderNodeParameter> parameter = vsnode;
if (!parameter.is_valid() || !parameter->is_global_code_generated()) {
- if (global_code) {
- *global_code += vsnode->generate_global(get_mode(), type, node);
+ if (p_global_code) {
+ *p_global_code += vsnode->generate_global(get_mode(), type, p_node);
}
}
@@ -1632,12 +1631,12 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
class_name = vsnode->get_script_instance()->get_script()->get_path();
}
if (!r_classes.has(class_name)) {
- if (global_code_per_node) {
- *global_code_per_node += vsnode->generate_global_per_node(get_mode(), node);
+ if (p_global_code_per_node) {
+ *p_global_code_per_node += vsnode->generate_global_per_node(get_mode(), p_node);
}
for (int i = 0; i < TYPE_MAX; i++) {
- if (global_code_per_func) {
- (*global_code_per_func)[Type(i)] += vsnode->generate_global_per_func(get_mode(), Type(i), node);
+ if (p_global_code_per_func) {
+ (*p_global_code_per_func)[Type(i)] += vsnode->generate_global_per_func(get_mode(), Type(i), p_node);
}
}
r_classes.insert(class_name);
@@ -1645,11 +1644,11 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
}
if (!vsnode->is_code_generated()) { // just generate globals and ignore locals
- processed.insert(node);
+ r_processed.insert(p_node);
return OK;
}
- String node_name = "// " + vsnode->get_caption() + ":" + itos(node) + "\n";
+ String node_name = "// " + vsnode->get_caption() + ":" + itos(p_node) + "\n";
String node_code;
Vector<String> input_vars;
@@ -1658,18 +1657,18 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
for (int i = 0; i < input_count; i++) {
ConnectionKey ck;
- ck.node = node;
+ ck.node = p_node;
ck.port = i;
- if (input_connections.has(ck)) {
+ if (p_input_connections.has(ck)) {
//connected to something, use that output
- int from_node = input_connections[ck]->get().from_node;
+ int from_node = p_input_connections[ck]->get().from_node;
if (graph[type].nodes[from_node].node->is_disabled()) {
continue;
}
- int from_port = input_connections[ck]->get().from_port;
+ int from_port = p_input_connections[ck]->get().from_port;
VisualShaderNode::PortType in_type = vsnode->get_input_port_type(i);
VisualShaderNode::PortType out_type = graph[type].nodes[from_node].node->get_output_port_type(from_port);
@@ -1826,32 +1825,32 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
Variant defval = vsnode->get_input_port_default_value(i);
if (defval.get_type() == Variant::FLOAT) {
float val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " float " + inputs[i] + " = " + vformat("%.5f", val) + ";\n";
} else if (defval.get_type() == Variant::INT) {
int val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " int " + inputs[i] + " = " + itos(val) + ";\n";
} else if (defval.get_type() == Variant::BOOL) {
bool val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " bool " + inputs[i] + " = " + (val ? "true" : "false") + ";\n";
} else if (defval.get_type() == Variant::VECTOR2) {
Vector2 val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " vec2 " + inputs[i] + " = " + vformat("vec2(%.5f, %.5f);\n", val.x, val.y);
} else if (defval.get_type() == Variant::VECTOR3) {
Vector3 val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " vec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z);
} else if (defval.get_type() == Variant::QUATERNION) {
Quaternion val = defval;
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
node_code += " vec4 " + inputs[i] + " = " + vformat("vec4(%.5f, %.5f, %.5f, %.5f);\n", val.x, val.y, val.z, val.w);
} else if (defval.get_type() == Variant::TRANSFORM3D) {
Transform3D val = defval;
val.basis.transpose();
- inputs[i] = "n_in" + itos(node) + "p" + itos(i);
+ inputs[i] = "n_in" + itos(p_node) + "p" + itos(i);
Array values;
for (int j = 0; j < 3; j++) {
values.push_back(val.basis[j].x);
@@ -1903,7 +1902,7 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
if (vsnode->is_simple_decl()) { // less code to generate for some simple_decl nodes
for (int i = 0, j = 0; i < initial_output_count; i++, j++) {
- String var_name = "n_out" + itos(node) + "p" + itos(j);
+ String var_name = "n_out" + itos(p_node) + "p" + itos(j);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR:
outputs[i] = "float " + var_name;
@@ -1948,28 +1947,28 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
} else {
for (int i = 0, j = 0; i < initial_output_count; i++, j++) {
- outputs[i] = "n_out" + itos(node) + "p" + itos(j);
+ outputs[i] = "n_out" + itos(p_node) + "p" + itos(j);
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_SCALAR:
- code += " float " + outputs[i] + ";\n";
+ r_code += " float " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_SCALAR_INT:
- code += " int " + outputs[i] + ";\n";
+ r_code += " int " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_VECTOR_2D:
- code += " vec2 " + outputs[i] + ";\n";
+ r_code += " vec2 " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_VECTOR_3D:
- code += " vec3 " + outputs[i] + ";\n";
+ r_code += " vec3 " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_VECTOR_4D:
- code += " vec4 " + outputs[i] + ";\n";
+ r_code += " vec4 " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_BOOLEAN:
- code += " bool " + outputs[i] + ";\n";
+ r_code += " bool " + outputs[i] + ";\n";
break;
case VisualShaderNode::PORT_TYPE_TRANSFORM:
- code += " mat4 " + outputs[i] + ";\n";
+ r_code += " mat4 " + outputs[i] + ";\n";
break;
default:
break;
@@ -1992,73 +1991,73 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
}
}
- node_code += vsnode->generate_code(get_mode(), type, node, inputs, outputs, for_preview);
+ node_code += vsnode->generate_code(get_mode(), type, p_node, inputs, outputs, p_for_preview);
if (!node_code.is_empty()) {
- code += node_name;
- code += node_code;
+ r_code += node_name;
+ r_code += node_code;
}
for (int i = 0; i < output_count; i++) {
if (expanded_output_ports[i]) {
switch (vsnode->get_output_port_type(i)) {
case VisualShaderNode::PORT_TYPE_VECTOR_2D: {
- if (vsnode->is_output_port_connected(i + 1) || (for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
- String r = "n_out" + itos(node) + "p" + itos(i + 1);
- code += " float " + r + " = n_out" + itos(node) + "p" + itos(i) + ".r;\n";
+ if (vsnode->is_output_port_connected(i + 1) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
+ String r = "n_out" + itos(p_node) + "p" + itos(i + 1);
+ r_code += " float " + r + " = n_out" + itos(p_node) + "p" + itos(i) + ".r;\n";
outputs[i + 1] = r;
}
- if (vsnode->is_output_port_connected(i + 2) || (for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
- String g = "n_out" + itos(node) + "p" + itos(i + 2);
- code += " float " + g + " = n_out" + itos(node) + "p" + itos(i) + ".g;\n";
+ if (vsnode->is_output_port_connected(i + 2) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
+ String g = "n_out" + itos(p_node) + "p" + itos(i + 2);
+ r_code += " float " + g + " = n_out" + itos(p_node) + "p" + itos(i) + ".g;\n";
outputs[i + 2] = g;
}
i += 2;
} break;
case VisualShaderNode::PORT_TYPE_VECTOR_3D: {
- if (vsnode->is_output_port_connected(i + 1) || (for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
- String r = "n_out" + itos(node) + "p" + itos(i + 1);
- code += " float " + r + " = n_out" + itos(node) + "p" + itos(i) + ".r;\n";
+ if (vsnode->is_output_port_connected(i + 1) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
+ String r = "n_out" + itos(p_node) + "p" + itos(i + 1);
+ r_code += " float " + r + " = n_out" + itos(p_node) + "p" + itos(i) + ".r;\n";
outputs[i + 1] = r;
}
- if (vsnode->is_output_port_connected(i + 2) || (for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
- String g = "n_out" + itos(node) + "p" + itos(i + 2);
- code += " float " + g + " = n_out" + itos(node) + "p" + itos(i) + ".g;\n";
+ if (vsnode->is_output_port_connected(i + 2) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
+ String g = "n_out" + itos(p_node) + "p" + itos(i + 2);
+ r_code += " float " + g + " = n_out" + itos(p_node) + "p" + itos(i) + ".g;\n";
outputs[i + 2] = g;
}
- if (vsnode->is_output_port_connected(i + 3) || (for_preview && vsnode->get_output_port_for_preview() == (i + 3))) { // blue-component
- String b = "n_out" + itos(node) + "p" + itos(i + 3);
- code += " float " + b + " = n_out" + itos(node) + "p" + itos(i) + ".b;\n";
+ if (vsnode->is_output_port_connected(i + 3) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 3))) { // blue-component
+ String b = "n_out" + itos(p_node) + "p" + itos(i + 3);
+ r_code += " float " + b + " = n_out" + itos(p_node) + "p" + itos(i) + ".b;\n";
outputs[i + 3] = b;
}
i += 3;
} break;
case VisualShaderNode::PORT_TYPE_VECTOR_4D: {
- if (vsnode->is_output_port_connected(i + 1) || (for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
- String r = "n_out" + itos(node) + "p" + itos(i + 1);
- code += " float " + r + " = n_out" + itos(node) + "p" + itos(i) + ".r;\n";
+ if (vsnode->is_output_port_connected(i + 1) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 1))) { // red-component
+ String r = "n_out" + itos(p_node) + "p" + itos(i + 1);
+ r_code += " float " + r + " = n_out" + itos(p_node) + "p" + itos(i) + ".r;\n";
outputs[i + 1] = r;
}
- if (vsnode->is_output_port_connected(i + 2) || (for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
- String g = "n_out" + itos(node) + "p" + itos(i + 2);
- code += " float " + g + " = n_out" + itos(node) + "p" + itos(i) + ".g;\n";
+ if (vsnode->is_output_port_connected(i + 2) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 2))) { // green-component
+ String g = "n_out" + itos(p_node) + "p" + itos(i + 2);
+ r_code += " float " + g + " = n_out" + itos(p_node) + "p" + itos(i) + ".g;\n";
outputs[i + 2] = g;
}
- if (vsnode->is_output_port_connected(i + 3) || (for_preview && vsnode->get_output_port_for_preview() == (i + 3))) { // blue-component
- String b = "n_out" + itos(node) + "p" + itos(i + 3);
- code += " float " + b + " = n_out" + itos(node) + "p" + itos(i) + ".b;\n";
+ if (vsnode->is_output_port_connected(i + 3) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 3))) { // blue-component
+ String b = "n_out" + itos(p_node) + "p" + itos(i + 3);
+ r_code += " float " + b + " = n_out" + itos(p_node) + "p" + itos(i) + ".b;\n";
outputs[i + 3] = b;
}
- if (vsnode->is_output_port_connected(i + 4) || (for_preview && vsnode->get_output_port_for_preview() == (i + 4))) { // alpha-component
- String a = "n_out" + itos(node) + "p" + itos(i + 4);
- code += " float " + a + " = n_out" + itos(node) + "p" + itos(i) + ".a;\n";
+ if (vsnode->is_output_port_connected(i + 4) || (p_for_preview && vsnode->get_output_port_for_preview() == (i + 4))) { // alpha-component
+ String a = "n_out" + itos(p_node) + "p" + itos(i + 4);
+ r_code += " float " + a + " = n_out" + itos(p_node) + "p" + itos(i) + ".a;\n";
outputs[i + 4] = a;
}
@@ -2071,11 +2070,11 @@ Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBui
}
if (!node_code.is_empty()) {
- code += "\n";
+ r_code += "\n";
}
- code += "\n"; //
- processed.insert(node);
+ r_code += "\n"; //
+ r_processed.insert(p_node);
return OK;
}
@@ -2103,7 +2102,7 @@ void VisualShader::_update_shader() const {
StringBuilder global_code;
StringBuilder global_code_per_node;
HashMap<Type, StringBuilder> global_code_per_func;
- StringBuilder code;
+ StringBuilder shader_code;
Vector<VisualShader::DefaultTextureParam> default_tex_params;
HashSet<StringName> classes;
HashMap<int, int> insertion_pos;
@@ -2340,7 +2339,7 @@ void VisualShader::_update_shader() const {
if (shader_mode != Shader::MODE_PARTICLES) {
func_code += "\nvoid " + String(func_name[i]) + "() {\n";
}
- insertion_pos.insert(i, code.get_string_length() + func_code.get_string_length());
+ insertion_pos.insert(i, shader_code.get_string_length() + func_code.get_string_length());
Error err = _write_node(Type(i), &global_code, &global_code_per_node, &global_code_per_func, func_code, default_tex_params, input_connections, output_connections, NODE_ID_OUTPUT, processed, false, classes);
ERR_FAIL_COND(err != OK);
@@ -2364,7 +2363,7 @@ void VisualShader::_update_shader() const {
} else {
func_code += varying_code;
func_code += "}\n";
- code += func_code;
+ shader_code += func_code;
}
}
@@ -2377,65 +2376,65 @@ void VisualShader::_update_shader() const {
bool has_process_custom = !code_map[TYPE_PROCESS_CUSTOM].is_empty();
bool has_collide = !code_map[TYPE_COLLIDE].is_empty();
- code += "void start() {\n";
+ shader_code += "void start() {\n";
if (has_start || has_start_custom) {
- code += " uint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n";
- code += " vec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n";
- code += " float __radians;\n";
- code += " vec3 __vec3_buff1;\n";
- code += " vec3 __vec3_buff2;\n";
- code += " float __scalar_buff1;\n";
- code += " float __scalar_buff2;\n";
- code += " int __scalar_ibuff;\n";
- code += " vec4 __vec4_buff;\n";
- code += " vec3 __ndiff = normalize(__diff);\n\n";
+ shader_code += " uint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n";
+ shader_code += " vec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n";
+ shader_code += " float __radians;\n";
+ shader_code += " vec3 __vec3_buff1;\n";
+ shader_code += " vec3 __vec3_buff2;\n";
+ shader_code += " float __scalar_buff1;\n";
+ shader_code += " float __scalar_buff2;\n";
+ shader_code += " int __scalar_ibuff;\n";
+ shader_code += " vec4 __vec4_buff;\n";
+ shader_code += " vec3 __ndiff = normalize(__diff);\n\n";
}
if (has_start) {
- code += " {\n";
- code += code_map[TYPE_START].replace("\n ", "\n ");
- code += " }\n";
+ shader_code += " {\n";
+ shader_code += code_map[TYPE_START].replace("\n ", "\n ");
+ shader_code += " }\n";
if (has_start_custom) {
- code += " \n";
+ shader_code += " \n";
}
}
if (has_start_custom) {
- code += " {\n";
- code += code_map[TYPE_START_CUSTOM].replace("\n ", "\n ");
- code += " }\n";
+ shader_code += " {\n";
+ shader_code += code_map[TYPE_START_CUSTOM].replace("\n ", "\n ");
+ shader_code += " }\n";
}
- code += "}\n\n";
- code += "void process() {\n";
+ shader_code += "}\n\n";
+ shader_code += "void process() {\n";
if (has_process || has_process_custom || has_collide) {
- code += " uint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n";
- code += " vec3 __vec3_buff1;\n";
- code += " vec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n";
- code += " vec3 __ndiff = normalize(__diff);\n\n";
+ shader_code += " uint __seed = __hash(NUMBER + uint(1) + RANDOM_SEED);\n";
+ shader_code += " vec3 __vec3_buff1;\n";
+ shader_code += " vec3 __diff = TRANSFORM[3].xyz - EMISSION_TRANSFORM[3].xyz;\n";
+ shader_code += " vec3 __ndiff = normalize(__diff);\n\n";
}
- code += " {\n";
+ shader_code += " {\n";
String tab = " ";
if (has_collide) {
- code += " if (COLLIDED) {\n\n";
- code += code_map[TYPE_COLLIDE].replace("\n ", "\n ");
+ shader_code += " if (COLLIDED) {\n\n";
+ shader_code += code_map[TYPE_COLLIDE].replace("\n ", "\n ");
if (has_process) {
- code += " } else {\n\n";
+ shader_code += " } else {\n\n";
tab += " ";
}
}
if (has_process) {
- code += code_map[TYPE_PROCESS].replace("\n ", "\n " + tab);
+ shader_code += code_map[TYPE_PROCESS].replace("\n ", "\n " + tab);
}
if (has_collide) {
- code += " }\n";
+ shader_code += " }\n";
}
- code += " }\n";
+ shader_code += " }\n";
if (has_process_custom) {
- code += " {\n\n";
- code += code_map[TYPE_PROCESS_CUSTOM].replace("\n ", "\n ");
- code += " }\n";
+ shader_code += " {\n\n";
+ shader_code += code_map[TYPE_PROCESS_CUSTOM].replace("\n ", "\n ");
+ shader_code += " }\n";
}
- code += "}\n\n";
+ shader_code += "}\n\n";
global_compute_code += "float __rand_from_seed(inout uint seed) {\n";
global_compute_code += " int k;\n";
@@ -2504,7 +2503,7 @@ void VisualShader::_update_shader() const {
final_code += global_compute_code;
final_code += global_code_per_node;
final_code += global_expressions;
- String tcode = code;
+ String tcode = shader_code;
for (int i = 0; i < TYPE_MAX; i++) {
if (!has_func_name(RenderingServer::ShaderMode(shader_mode), func_name[i])) {
continue;
@@ -3648,12 +3647,12 @@ String VisualShaderNodeOutput::get_output_port_name(int p_port) const {
bool VisualShaderNodeOutput::is_port_separator(int p_index) const {
if (shader_mode == Shader::MODE_SPATIAL && shader_type == VisualShader::TYPE_VERTEX) {
- String name = get_input_port_name(p_index);
- return bool(name == "Model View Matrix");
+ String port_name = get_input_port_name(p_index);
+ return bool(port_name == "Model View Matrix");
}
if (shader_mode == Shader::MODE_SPATIAL && shader_type == VisualShader::TYPE_FRAGMENT) {
- String name = get_input_port_name(p_index);
- return bool(name == "AO" || name == "Normal" || name == "Rim" || name == "Clearcoat" || name == "Anisotropy" || name == "Subsurf Scatter" || name == "Alpha Scissor Threshold");
+ String port_name = get_input_port_name(p_index);
+ return bool(port_name == "AO" || port_name == "Normal" || port_name == "Rim" || port_name == "Clearcoat" || port_name == "Anisotropy" || port_name == "Subsurf Scatter" || port_name == "Alpha Scissor Threshold");
}
return false;
}
@@ -3666,15 +3665,15 @@ String VisualShaderNodeOutput::generate_code(Shader::Mode p_mode, VisualShader::
int idx = 0;
int count = 0;
- String code;
+ String shader_code;
while (ports[idx].mode != Shader::MODE_MAX) {
if (ports[idx].mode == shader_mode && ports[idx].shader_type == shader_type) {
if (!p_input_vars[count].is_empty()) {
String s = ports[idx].string;
if (s.contains(":")) {
- code += " " + s.get_slicec(':', 0) + " = " + p_input_vars[count] + "." + s.get_slicec(':', 1) + ";\n";
+ shader_code += " " + s.get_slicec(':', 0) + " = " + p_input_vars[count] + "." + s.get_slicec(':', 1) + ";\n";
} else {
- code += " " + s + " = " + p_input_vars[count] + ";\n";
+ shader_code += " " + s + " = " + p_input_vars[count] + ";\n";
}
}
count++;
@@ -3682,7 +3681,7 @@ String VisualShaderNodeOutput::generate_code(Shader::Mode p_mode, VisualShader::
idx++;
}
- return code;
+ return shader_code;
}
VisualShaderNodeOutput::VisualShaderNodeOutput() {
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 3aba550f03..5ed5f22cd0 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -156,7 +156,7 @@ private:
}
};
- Error _write_node(Type p_type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, HashSet<int> &processed, bool for_preview, HashSet<StringName> &r_classes) const;
+ Error _write_node(Type p_type, StringBuilder *p_global_code, StringBuilder *p_global_code_per_node, HashMap<Type, StringBuilder> *p_global_code_per_func, StringBuilder &r_code, Vector<DefaultTextureParam> &r_def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &p_input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &p_output_connections, int p_node, HashSet<int> &r_processed, bool p_for_preview, HashSet<StringName> &r_classes) const;
void _input_type_changed(Type p_type, int p_id);
bool has_func_name(RenderingServer::ShaderMode p_mode, const String &p_func_name) const;
diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader_particle_nodes.cpp
index df6abe161e..ab7354f6e7 100644
--- a/scene/resources/visual_shader_particle_nodes.cpp
+++ b/scene/resources/visual_shader_particle_nodes.cpp
@@ -1291,12 +1291,12 @@ String VisualShaderNodeParticleOutput::get_input_port_name(int p_port) const {
bool VisualShaderNodeParticleOutput::is_port_separator(int p_index) const {
if (shader_type == VisualShader::TYPE_START || shader_type == VisualShader::TYPE_PROCESS) {
- String name = get_input_port_name(p_index);
- return bool(name == "Scale");
+ String port_name = get_input_port_name(p_index);
+ return bool(port_name == "Scale");
}
if (shader_type == VisualShader::TYPE_START_CUSTOM || shader_type == VisualShader::TYPE_PROCESS_CUSTOM) {
- String name = get_input_port_name(p_index);
- return bool(name == "Velocity");
+ String port_name = get_input_port_name(p_index);
+ return bool(port_name == "Velocity");
}
return false;
}
@@ -1604,24 +1604,24 @@ String VisualShaderNodeParticleEmit::generate_code(Shader::Mode p_mode, VisualSh
flags_arr.push_back("FLAG_EMIT_CUSTOM");
}
- String flags;
+ String flags_str;
for (int i = 0; i < flags_arr.size(); i++) {
if (i > 0) {
- flags += "|";
+ flags_str += "|";
}
- flags += flags_arr[i];
+ flags_str += flags_arr[i];
}
- if (flags.is_empty()) {
- flags = "uint(0)";
+ if (flags_str.is_empty()) {
+ flags_str = "uint(0)";
}
if (!default_condition) {
code += " if (" + p_input_vars[0] + ") {\n";
}
- code += tab + "emit_subparticle(" + transform + ", " + velocity + ", vec4(" + color + ", " + alpha + "), vec4(" + custom + ", " + custom_alpha + "), " + flags + ");\n";
+ code += tab + "emit_subparticle(" + transform + ", " + velocity + ", vec4(" + color + ", " + alpha + "), vec4(" + custom + ", " + custom_alpha + "), " + flags_str + ");\n";
if (!default_condition) {
code += " }\n";