summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/base_button.cpp5
-rw-r--r--scene/gui/shortcut.cpp2
-rw-r--r--scene/gui/tab_container.cpp69
-rw-r--r--scene/gui/tab_container.h1
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/resources/canvas_item_material.cpp7
-rw-r--r--scene/resources/default_theme/icon_grid_layout.pngbin640 -> 2170 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h6
-rw-r--r--scene/resources/material.cpp8
-rw-r--r--scene/resources/particles_material.cpp7
-rw-r--r--scene/resources/sky_material.cpp15
-rw-r--r--scene/resources/visual_shader.cpp21
-rw-r--r--scene/resources/visual_shader.h1
-rw-r--r--scene/resources/visual_shader_nodes.cpp433
-rw-r--r--scene/resources/visual_shader_nodes.h97
-rw-r--r--scene/resources/visual_shader_particle_nodes.cpp25
-rw-r--r--scene/resources/visual_shader_particle_nodes.h4
17 files changed, 496 insertions, 209 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 871ad889ca..d252a4507c 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -145,10 +145,11 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) {
if (status.press_attempt && status.pressing_inside) {
if (toggle_mode) {
+ bool is_pressed = p_event->is_pressed();
if (Object::cast_to<InputEventShortcut>(*p_event)) {
- action_mode = ACTION_MODE_BUTTON_PRESS; // HACK.
+ is_pressed = false;
}
- if ((p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_PRESS) || (!p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
+ if ((is_pressed && action_mode == ACTION_MODE_BUTTON_PRESS) || (!is_pressed && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
if (action_mode == ACTION_MODE_BUTTON_PRESS) {
status.press_attempt = false;
status.pressing_inside = false;
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 1c29870682..c0aac6d91a 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -43,7 +43,7 @@ Ref<InputEvent> Shortcut::get_event() const {
bool Shortcut::matches_event(const Ref<InputEvent> &p_event) const {
Ref<InputEventShortcut> ies = p_event;
- if (ies != nullptr) {
+ if (ies.is_valid()) {
if (ies->get_shortcut().ptr() == this) {
return true;
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index cc41d961f6..53a2fe4d93 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -535,7 +535,7 @@ void TabContainer::_notification(int p_what) {
}
void TabContainer::_draw_tab(Ref<StyleBox> &p_tab_style, Color &p_font_color, int p_index, float p_x) {
- Vector<Control *> tabs = _get_tabs();
+ Control *control = get_tab_control(p_index);
RID canvas = get_canvas_item();
Ref<Font> font = get_theme_font(SNAME("font"));
Color font_outline_color = get_theme_color(SNAME("font_outline_color"));
@@ -549,7 +549,6 @@ void TabContainer::_draw_tab(Ref<StyleBox> &p_tab_style, Color &p_font_color, in
p_tab_style->draw(canvas, tab_rect);
// Draw the tab contents.
- Control *control = Object::cast_to<Control>(tabs[p_index]);
String text = control->has_meta("_tab_name") ? String(atr(String(control->get_meta("_tab_name")))) : String(atr(control->get_name()));
int x_content = tab_rect.position.x + p_tab_style->get_margin(SIDE_LEFT);
@@ -620,10 +619,10 @@ void TabContainer::_repaint() {
if (tabs_visible) {
c->set_offset(SIDE_TOP, _get_top_margin());
}
- c->set_offset(Side(SIDE_TOP), c->get_offset(Side(SIDE_TOP)) + sb->get_margin(Side(SIDE_TOP)));
- c->set_offset(Side(SIDE_LEFT), c->get_offset(Side(SIDE_LEFT)) + sb->get_margin(Side(SIDE_LEFT)));
- c->set_offset(Side(SIDE_RIGHT), c->get_offset(Side(SIDE_RIGHT)) - sb->get_margin(Side(SIDE_RIGHT)));
- c->set_offset(Side(SIDE_BOTTOM), c->get_offset(Side(SIDE_BOTTOM)) - sb->get_margin(Side(SIDE_BOTTOM)));
+ c->set_offset(SIDE_TOP, c->get_offset(SIDE_TOP) + sb->get_margin(SIDE_TOP));
+ c->set_offset(SIDE_LEFT, c->get_offset(SIDE_LEFT) + sb->get_margin(SIDE_LEFT));
+ c->set_offset(SIDE_RIGHT, c->get_offset(SIDE_RIGHT) - sb->get_margin(SIDE_RIGHT));
+ c->set_offset(SIDE_BOTTOM, c->get_offset(SIDE_BOTTOM) - sb->get_margin(SIDE_BOTTOM));
} else {
c->hide();
@@ -682,7 +681,7 @@ Vector<Control *> TabContainer::_get_tabs() const {
Vector<Control *> controls;
for (int i = 0; i < get_child_count(); i++) {
Control *control = Object::cast_to<Control>(get_child(i));
- if (!control || control->is_top_level_control()) {
+ if (!control || control->is_set_as_top_level()) {
continue;
}
@@ -700,10 +699,7 @@ void TabContainer::add_child_notify(Node *p_child) {
Container::add_child_notify(p_child);
Control *c = Object::cast_to<Control>(p_child);
- if (!c) {
- return;
- }
- if (c->is_set_as_top_level()) {
+ if (!c || c->is_set_as_top_level()) {
return;
}
@@ -726,10 +722,10 @@ void TabContainer::add_child_notify(Node *p_child) {
c->set_offset(SIDE_TOP, _get_top_margin());
}
Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"));
- c->set_offset(Side(SIDE_TOP), c->get_offset(Side(SIDE_TOP)) + sb->get_margin(Side(SIDE_TOP)));
- c->set_offset(Side(SIDE_LEFT), c->get_offset(Side(SIDE_LEFT)) + sb->get_margin(Side(SIDE_LEFT)));
- c->set_offset(Side(SIDE_RIGHT), c->get_offset(Side(SIDE_RIGHT)) - sb->get_margin(Side(SIDE_RIGHT)));
- c->set_offset(Side(SIDE_BOTTOM), c->get_offset(Side(SIDE_BOTTOM)) - sb->get_margin(Side(SIDE_BOTTOM)));
+ c->set_offset(SIDE_TOP, c->get_offset(SIDE_TOP) + sb->get_margin(SIDE_TOP));
+ c->set_offset(SIDE_LEFT, c->get_offset(SIDE_LEFT) + sb->get_margin(SIDE_LEFT));
+ c->set_offset(SIDE_RIGHT, c->get_offset(SIDE_RIGHT) - sb->get_margin(SIDE_RIGHT));
+ c->set_offset(SIDE_BOTTOM, c->get_offset(SIDE_BOTTOM) - sb->get_margin(SIDE_BOTTOM));
update();
p_child->connect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
if (first && is_inside_tree()) {
@@ -739,8 +735,13 @@ void TabContainer::add_child_notify(Node *p_child) {
void TabContainer::move_child_notify(Node *p_child) {
Container::move_child_notify(p_child);
- call_deferred(SNAME("_update_current_tab"));
- _refresh_texts();
+
+ Control *c = Object::cast_to<Control>(p_child);
+ if (!c || c->is_set_as_top_level()) {
+ return;
+ }
+
+ _update_current_tab();
update();
}
@@ -785,21 +786,18 @@ Control *TabContainer::get_tab_control(int p_idx) const {
}
Control *TabContainer::get_current_tab_control() const {
- Vector<Control *> tabs = _get_tabs();
- if (current >= 0 && current < tabs.size()) {
- return tabs[current];
- } else {
- return nullptr;
- }
+ return get_tab_control(current);
}
void TabContainer::remove_child_notify(Node *p_child) {
Container::remove_child_notify(p_child);
- if (!Object::cast_to<Control>(p_child)) {
+ Control *c = Object::cast_to<Control>(p_child);
+ if (!c || c->is_set_as_top_level()) {
return;
}
+ // Defer the call because tab is not yet removed (remove_child_notify is called right before p_child is actually removed).
call_deferred(SNAME("_update_current_tab"));
p_child->disconnect("renamed", callable_mp(this, &TabContainer::_child_renamed_callback));
@@ -808,10 +806,9 @@ void TabContainer::remove_child_notify(Node *p_child) {
}
void TabContainer::_update_current_tab() {
- Vector<Control *> tabs = _get_tabs();
_refresh_texts();
- int tc = tabs.size();
+ int tc = get_tab_count();
if (current >= tc) {
current = tc - 1;
}
@@ -1019,12 +1016,8 @@ bool TabContainer::is_all_tabs_in_front() const {
return all_tabs_in_front;
}
-Control *TabContainer::_get_tab(int p_idx) const {
- return get_tab_control(p_idx);
-}
-
void TabContainer::set_tab_title(int p_tab, const String &p_title) {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_name", p_title);
_refresh_texts();
@@ -1032,7 +1025,7 @@ void TabContainer::set_tab_title(int p_tab, const String &p_title) {
}
String TabContainer::get_tab_title(int p_tab) const {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND_V(!child, "");
if (child->has_meta("_tab_name")) {
return child->get_meta("_tab_name");
@@ -1042,14 +1035,14 @@ String TabContainer::get_tab_title(int p_tab) const {
}
void TabContainer::set_tab_icon(int p_tab, const Ref<Texture2D> &p_icon) {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_icon", p_icon);
update();
}
Ref<Texture2D> TabContainer::get_tab_icon(int p_tab) const {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND_V(!child, Ref<Texture2D>());
if (child->has_meta("_tab_icon")) {
return child->get_meta("_tab_icon");
@@ -1059,14 +1052,14 @@ Ref<Texture2D> TabContainer::get_tab_icon(int p_tab) const {
}
void TabContainer::set_tab_disabled(int p_tab, bool p_disabled) {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_disabled", p_disabled);
update();
}
bool TabContainer::get_tab_disabled(int p_tab) const {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND_V(!child, false);
if (child->has_meta("_tab_disabled")) {
return child->get_meta("_tab_disabled");
@@ -1076,7 +1069,7 @@ bool TabContainer::get_tab_disabled(int p_tab) const {
}
void TabContainer::set_tab_hidden(int p_tab, bool p_hidden) {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND(!child);
child->set_meta("_tab_hidden", p_hidden);
update();
@@ -1095,7 +1088,7 @@ void TabContainer::set_tab_hidden(int p_tab, bool p_hidden) {
}
bool TabContainer::get_tab_hidden(int p_tab) const {
- Control *child = _get_tab(p_tab);
+ Control *child = get_tab_control(p_tab);
ERR_FAIL_COND_V(!child, false);
if (child->has_meta("_tab_hidden")) {
return child->get_meta("_tab_hidden");
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 4ed5255729..35f18eff8e 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -57,7 +57,6 @@ private:
bool menu_hovered = false;
int highlight_arrow = -1;
TabAlign align = ALIGN_CENTER;
- Control *_get_tab(int p_idx) const;
int _get_top_margin() const;
mutable ObjectID popup_obj_id;
bool drag_to_rearrange_enabled = false;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 745920fcdd..a2c5769947 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4332,7 +4332,9 @@ bool TextEdit::is_highlight_all_occurrences_enabled() const {
void TextEdit::set_draw_control_chars(bool p_draw_control_chars) {
if (draw_control_chars != p_draw_control_chars) {
draw_control_chars = p_draw_control_chars;
- menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars);
+ if (menu) {
+ menu->set_item_checked(menu->get_item_index(MENU_DISPLAY_UCC), draw_control_chars);
+ }
text.set_draw_control_chars(draw_control_chars);
text.invalidate_all();
update();
diff --git a/scene/resources/canvas_item_material.cpp b/scene/resources/canvas_item_material.cpp
index 7ba57a6532..7501efea9e 100644
--- a/scene/resources/canvas_item_material.cpp
+++ b/scene/resources/canvas_item_material.cpp
@@ -30,6 +30,8 @@
#include "canvas_item_material.h"
+#include "core/version.h"
+
Mutex CanvasItemMaterial::material_mutex;
SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = nullptr;
Map<CanvasItemMaterial::MaterialKey, CanvasItemMaterial::ShaderData> CanvasItemMaterial::shader_map;
@@ -78,7 +80,10 @@ void CanvasItemMaterial::_update_shader() {
//must create a shader!
- String code = "shader_type canvas_item;\nrender_mode ";
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
+ String code = "// NOTE: Shader automatically converted from " VERSION_NAME " " VERSION_FULL_CONFIG "'s CanvasItemMaterial.\n\n";
+
+ code += "shader_type canvas_item;\nrender_mode ";
switch (blend_mode) {
case BLEND_MODE_MIX:
code += "blend_mix";
diff --git a/scene/resources/default_theme/icon_grid_layout.png b/scene/resources/default_theme/icon_grid_layout.png
index 00a6179d5e..a249252a79 100644
--- a/scene/resources/default_theme/icon_grid_layout.png
+++ b/scene/resources/default_theme/icon_grid_layout.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index 865ee86c76..4a53926066 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -178,11 +178,11 @@ static const unsigned char icon_folder_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0xb5, 0xfa, 0x37, 0xea, 0x0, 0x0, 0x0, 0x2e, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0xa0, 0x6, 0x78, 0x70, 0xf4, 0xc1, 0x7f, 0x24, 0x78, 0x18, 0x53, 0xc1, 0x7f, 0x54, 0x48, 0x50, 0xc1, 0x43, 0x1b, 0xbc, 0xa, 0x50, 0xad, 0x23, 0xa4, 0xe0, 0xff, 0x70, 0x52, 0x70, 0x18, 0x97, 0xf4, 0xfd, 0x43, 0xd4, 0x88, 0x4a, 0x0, 0x5a, 0xcb, 0x18, 0xab, 0x5e, 0xd9, 0x1a, 0x53, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
-static const unsigned char icon_grid_minimap_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0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, 0x35, 0x80, 0x63, 0xa0, 0x2e, 0x3d, 0xf6, 0xc2, 0x91, 0xdc, 0x0, 0x5c, 0x55, 0x5d, 0xbf, 0x4, 0x9e, 0x3, 0x72, 0xfe, 0xaf, 0xfb, 0xaa, 0xe7, 0x79, 0x1f, 0x8d, 0x31, 0x6d, 0x29, 0x36, 0xf5, 0xce, 0x14, 0xb8, 0x33, 0x44, 0xc4, 0x6f, 0xdf, 0xf7, 0xd7, 0x8d, 0x31, 0xed, 0x5e, 0xe2, 0x1f, 0xb, 0x5c, 0xe2, 0xcb, 0xd, 0x9b, 0x69, 0xcb, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+static const unsigned char icon_grid_layout_png[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x5, 0x52, 0x69, 0x54, 0x58, 0x74, 0x58, 0x4d, 0x4c, 0x3a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x78, 0x6d, 0x70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3c, 0x3f, 0x78, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x3d, 0x22, 0xef, 0xbb, 0xbf, 0x22, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x57, 0x35, 0x4d, 0x30, 0x4d, 0x70, 0x43, 0x65, 0x68, 0x69, 0x48, 0x7a, 0x72, 0x65, 0x53, 0x7a, 0x4e, 0x54, 0x63, 0x7a, 0x6b, 0x63, 0x39, 0x64, 0x22, 0x3f, 0x3e, 0xa, 0x3c, 0x78, 0x3a, 0x78, 0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x3d, 0x22, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x3a, 0x6e, 0x73, 0x3a, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x22, 0x20, 0x78, 0x3a, 0x78, 0x6d, 0x70, 0x74, 0x6b, 0x3d, 0x22, 0x58, 0x4d, 0x50, 0x20, 0x43, 0x6f, 0x72, 0x65, 0x20, 0x35, 0x2e, 0x35, 0x2e, 0x30, 0x22, 0x3e, 0xa, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x72, 0x64, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x32, 0x2f, 0x32, 0x32, 0x2d, 0x72, 0x64, 0x66, 0x2d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2d, 0x6e, 0x73, 0x23, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x64, 0x66, 0x3a, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x3d, 0x22, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x64, 0x63, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x70, 0x75, 0x72, 0x6c, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x64, 0x63, 0x2f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x31, 0x2e, 0x31, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x65, 0x78, 0x69, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x78, 0x69, 0x66, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x74, 0x69, 0x66, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, 0x66, 0x66, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x6d, 0x6d, 0x2f, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x73, 0x74, 0x45, 0x76, 0x74, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x2f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x23, 0x22, 0xa, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x66, 0x3a, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x58, 0x44, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x36, 0x22, 0xa, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x66, 0x3a, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x59, 0x44, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x36, 0x22, 0xa, 0x20, 0x20, 0x20, 0x65, 0x78, 0x69, 0x66, 0x3a, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x3d, 0x22, 0x31, 0x22, 0xa, 0x20, 0x20, 0x20, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x57, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x36, 0x22, 0xa, 0x20, 0x20, 0x20, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3d, 0x22, 0x31, 0x36, 0x22, 0xa, 0x20, 0x20, 0x20, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x6e, 0x69, 0x74, 0x3d, 0x22, 0x32, 0x22, 0xa, 0x20, 0x20, 0x20, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x58, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x37, 0x32, 0x2e, 0x30, 0x22, 0xa, 0x20, 0x20, 0x20, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x59, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x37, 0x32, 0x2e, 0x30, 0x22, 0xa, 0x20, 0x20, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3a, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x3d, 0x22, 0x33, 0x22, 0xa, 0x20, 0x20, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x3a, 0x49, 0x43, 0x43, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x3d, 0x22, 0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x22, 0xa, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x70, 0x3a, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x44, 0x61, 0x74, 0x65, 0x3d, 0x22, 0x32, 0x30, 0x32, 0x31, 0x2d, 0x30, 0x38, 0x2d, 0x31, 0x35, 0x54, 0x30, 0x39, 0x3a, 0x34, 0x31, 0x3a, 0x34, 0x30, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x22, 0xa, 0x20, 0x20, 0x20, 0x78, 0x6d, 0x70, 0x3a, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x44, 0x61, 0x74, 0x65, 0x3d, 0x22, 0x32, 0x30, 0x32, 0x31, 0x2d, 0x30, 0x38, 0x2d, 0x31, 0x35, 0x54, 0x30, 0x39, 0x3a, 0x34, 0x31, 0x3a, 0x34, 0x30, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x3c, 0x64, 0x63, 0x3a, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x41, 0x6c, 0x74, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x6c, 0x69, 0x20, 0x78, 0x6d, 0x6c, 0x3a, 0x6c, 0x61, 0x6e, 0x67, 0x3d, 0x22, 0x78, 0x2d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0x3e, 0x47, 0x72, 0x69, 0x64, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x6c, 0x69, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x41, 0x6c, 0x74, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x64, 0x63, 0x3a, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x3c, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x53, 0x65, 0x71, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x6c, 0x69, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x45, 0x76, 0x74, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x45, 0x76, 0x74, 0x3a, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3d, 0x22, 0x41, 0x66, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x20, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x20, 0x31, 0x2e, 0x39, 0x2e, 0x31, 0x22, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x74, 0x45, 0x76, 0x74, 0x3a, 0x77, 0x68, 0x65, 0x6e, 0x3d, 0x22, 0x32, 0x30, 0x32, 0x31, 0x2d, 0x30, 0x38, 0x2d, 0x31, 0x35, 0x54, 0x30, 0x39, 0x3a, 0x34, 0x31, 0x3a, 0x34, 0x30, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0x22, 0x2f, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x53, 0x65, 0x71, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0xa, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x3e, 0xa, 0x3c, 0x2f, 0x78, 0x3a, 0x78, 0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x3e, 0xa, 0x3c, 0x3f, 0x78, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x65, 0x6e, 0x64, 0x3d, 0x22, 0x72, 0x22, 0x3f, 0x3e, 0x10, 0xfa, 0x51, 0xae, 0x0, 0x0, 0x1, 0x82, 0x69, 0x43, 0x43, 0x50, 0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x0, 0x0, 0x28, 0x91, 0x75, 0x91, 0xbf, 0x4b, 0x42, 0x51, 0x14, 0xc7, 0x3f, 0x5a, 0xa1, 0x94, 0x61, 0x50, 0x43, 0x43, 0x83, 0x84, 0x45, 0x83, 0x85, 0x15, 0x84, 0x2d, 0xd, 0x4a, 0xbf, 0xa0, 0x1a, 0xd4, 0x20, 0xab, 0x45, 0x9f, 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16, 0x73, 0xe8, 0xca, 0x6c, 0x3f, 0xdf, 0x59, 0xcd, 0x9a, 0x5b, 0x83, 0x67, 0x47, 0x7b, 0xb, 0xa7, 0x98, 0xcf, 0x9, 0xc7, 0xaa, 0x2d, 0xac, 0xe5, 0xf3, 0xbf, 0xcc, 0xde, 0xe1, 0x47, 0x66, 0x5b, 0xa5, 0xc1, 0x67, 0xff, 0x87, 0x78, 0xa5, 0x9a, 0xc1, 0x1a, 0x5e, 0x65, 0xd6, 0xc2, 0x24, 0x3e, 0xe4, 0x36, 0xe0, 0x84, 0xda, 0x1a, 0x1f, 0x8a, 0x94, 0xd2, 0x6, 0xc6, 0x30, 0x1e, 0x11, 0xbf, 0xda, 0xbc, 0x7c, 0x89, 0xc3, 0x58, 0x44, 0x77, 0x7, 0x8f, 0x2e, 0x4c, 0xa9, 0x1e, 0xd1, 0xa7, 0x88, 0xd8, 0x29, 0x5b, 0xa0, 0x7a, 0xc2, 0xf1, 0x80, 0x41, 0x23, 0xe7, 0x4b, 0xbc, 0x79, 0x6a, 0xe5, 0x65, 0xb, 0x5f, 0x53, 0x4a, 0x67, 0x29, 0xa5, 0xf7, 0x25, 0x6f, 0x76, 0x12, 0xdc, 0x13, 0x7b, 0x98, 0x88, 0x88, 0xef, 0x25, 0xbc, 0x1, 0x6c, 0x4d, 0x56, 0x9e, 0x2a, 0x4e, 0x48, 0xae, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
-static const unsigned char icon_grid_layout_png[] = {
+static const unsigned char icon_grid_minimap_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x6, 0x0, 0x0, 0x0, 0x1f, 0xf3, 0xff, 0x61, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0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d, 0x29, 0x36, 0xf5, 0xce, 0x14, 0xb8, 0x33, 0x44, 0xc4, 0x6f, 0xdf, 0xf7, 0xd7, 0x8d, 0x31, 0xed, 0x5e, 0xe2, 0x1f, 0xb, 0x5c, 0xe2, 0xcb, 0xd, 0x9b, 0x69, 0xcb, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 896a33e02e..1d2a2ef26c 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -31,6 +31,7 @@
#include "material.h"
#include "core/config/engine.h"
+#include "core/version.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
@@ -469,7 +470,12 @@ void BaseMaterial3D::_update_shader() {
//must create a shader!
- String code = "shader_type spatial;\nrender_mode ";
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
+ String code = vformat(
+ "// NOTE: Shader automatically converted from " VERSION_NAME " " VERSION_FULL_CONFIG "'s %s.\n\n",
+ orm ? "ORMMaterial3D" : "StandardMaterial3D");
+
+ code += "shader_type spatial;\nrender_mode ";
switch (blend_mode) {
case BLEND_MODE_MIX:
code += "blend_mix";
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 91569e65d6..34f4142a14 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -30,6 +30,8 @@
#include "particles_material.h"
+#include "core/version.h"
+
Mutex ParticlesMaterial::material_mutex;
SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = nullptr;
Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map;
@@ -141,7 +143,10 @@ void ParticlesMaterial::_update_shader() {
//must create a shader!
- String code = "shader_type particles;\n";
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
+ String code = "// NOTE: Shader automatically converted from " VERSION_NAME " " VERSION_FULL_CONFIG "'s ParticlesMaterial.\n\n";
+
+ code += "shader_type particles;\n";
if (collision_scale) {
code += "render_mode collision_use_scale;\n";
diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp
index ec00f9d7b7..39082b6f7a 100644
--- a/scene/resources/sky_material.cpp
+++ b/scene/resources/sky_material.cpp
@@ -30,6 +30,8 @@
#include "sky_material.h"
+#include "core/version.h"
+
Mutex ProceduralSkyMaterial::shader_mutex;
RID ProceduralSkyMaterial::shader;
@@ -204,7 +206,10 @@ void ProceduralSkyMaterial::_update_shader() {
if (shader.is_null()) {
shader = RS::get_singleton()->shader_create();
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
RS::get_singleton()->shader_set_code(shader, R"(
+// NOTE: Shader automatically converted from )" VERSION_NAME " " VERSION_FULL_CONFIG R"('s ProceduralSkyMaterial.
+
shader_type sky;
uniform vec4 sky_top_color : hint_color = vec4(0.35, 0.46, 0.71, 1.0);
@@ -350,10 +355,13 @@ void PanoramaSkyMaterial::_update_shader() {
if (shader.is_null()) {
shader = RS::get_singleton()->shader_create();
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
RS::get_singleton()->shader_set_code(shader, R"(
+// NOTE: Shader automatically converted from )" VERSION_NAME " " VERSION_FULL_CONFIG R"('s PanoramaSkyMaterial.
+
shader_type sky;
-uniform sampler2D source_panorama : filter_linear;
+uniform sampler2D source_panorama : filter_linear, hint_albedo;
void sky() {
COLOR = texture(source_panorama, SKY_COORDS).rgb;
@@ -561,7 +569,10 @@ void PhysicalSkyMaterial::_update_shader() {
if (shader.is_null()) {
shader = RS::get_singleton()->shader_create();
+ // Add a comment to describe the shader origin (useful when converting to ShaderMaterial).
RS::get_singleton()->shader_set_code(shader, R"(
+// NOTE: Shader automatically converted from )" VERSION_NAME " " VERSION_FULL_CONFIG R"('s PhysicalSkyMaterial.
+
shader_type sky;
uniform float rayleigh : hint_range(0, 64) = 2.0;
@@ -576,7 +587,7 @@ uniform vec4 ground_color : hint_color = vec4(1.0);
uniform float exposure : hint_range(0, 128) = 0.1;
uniform float dither_strength : hint_range(0, 10) = 1.0;
-uniform sampler2D night_sky : hint_black;
+uniform sampler2D night_sky : hint_black_albedo;
const vec3 UP = vec3( 0.0, 1.0, 0.0 );
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 75dd7448e7..b00dcca004 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -3032,6 +3032,10 @@ String VisualShaderNodeUniform::get_uniform_name() const {
}
void VisualShaderNodeUniform::set_qualifier(VisualShaderNodeUniform::Qualifier p_qual) {
+ ERR_FAIL_INDEX(int(p_qual), int(QUAL_MAX));
+ if (qualifier == p_qual) {
+ return;
+ }
qualifier = p_qual;
emit_changed();
}
@@ -3061,6 +3065,7 @@ void VisualShaderNodeUniform::_bind_methods() {
BIND_ENUM_CONSTANT(QUAL_NONE);
BIND_ENUM_CONSTANT(QUAL_GLOBAL);
BIND_ENUM_CONSTANT(QUAL_INSTANCE);
+ BIND_ENUM_CONSTANT(QUAL_MAX);
}
String VisualShaderNodeUniform::_get_qual_str() const {
@@ -3072,6 +3077,8 @@ String VisualShaderNodeUniform::_get_qual_str() const {
return "global ";
case QUAL_INSTANCE:
return "instance ";
+ default:
+ break;
}
}
return String();
@@ -3094,6 +3101,8 @@ String VisualShaderNodeUniform::get_warning(Shader::Mode p_mode, VisualShader::T
case QUAL_INSTANCE:
qualifier_str = "instance";
break;
+ default:
+ break;
}
return vformat(TTR("This uniform type does not support the '%s' qualifier."), qualifier_str);
} else if (qualifier == Qualifier::QUAL_GLOBAL) {
@@ -3350,6 +3359,10 @@ bool VisualShaderNodeGroupBase::is_valid_port_name(const String &p_name) const {
}
void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const String &p_name) {
+ ERR_FAIL_COND(has_input_port(p_id));
+ ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
Vector<String> inputs_strings = inputs.split(";", false);
int index = 0;
@@ -3422,6 +3435,10 @@ bool VisualShaderNodeGroupBase::has_input_port(int p_id) const {
}
void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const String &p_name) {
+ ERR_FAIL_COND(has_output_port(p_id));
+ ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
Vector<String> outputs_strings = outputs.split(";", false);
int index = 0;
@@ -3503,7 +3520,7 @@ void VisualShaderNodeGroupBase::clear_output_ports() {
void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
ERR_FAIL_COND(!has_input_port(p_id));
- ERR_FAIL_COND(p_type < 0 || p_type >= PORT_TYPE_MAX);
+ ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
if (input_ports[p_id].type == p_type) {
return;
@@ -3575,7 +3592,7 @@ String VisualShaderNodeGroupBase::get_input_port_name(int p_id) const {
void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
ERR_FAIL_COND(!has_output_port(p_id));
- ERR_FAIL_COND(p_type < 0 || p_type >= PORT_TYPE_MAX);
+ ERR_FAIL_INDEX(p_type, int(PORT_TYPE_MAX));
if (output_ports[p_id].type == p_type) {
return;
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index abf55185ab..31651318ae 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -435,6 +435,7 @@ public:
QUAL_NONE,
QUAL_GLOBAL,
QUAL_INSTANCE,
+ QUAL_MAX,
};
private:
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index a8ec78f63e..e45dfdcb1b 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -69,8 +69,11 @@ String VisualShaderNodeFloatConstant::generate_code(Shader::Mode p_mode, VisualS
return " " + p_output_vars[0] + " = " + vformat("%.6f", constant) + ";\n";
}
-void VisualShaderNodeFloatConstant::set_constant(float p_value) {
- constant = p_value;
+void VisualShaderNodeFloatConstant::set_constant(float p_constant) {
+ if (Math::is_equal_approx(constant, p_constant)) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -85,7 +88,7 @@ Vector<StringName> VisualShaderNodeFloatConstant::get_editable_properties() cons
}
void VisualShaderNodeFloatConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeFloatConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeFloatConstant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeFloatConstant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "constant"), "set_constant", "get_constant");
@@ -128,8 +131,11 @@ String VisualShaderNodeIntConstant::generate_code(Shader::Mode p_mode, VisualSha
return " " + p_output_vars[0] + " = " + itos(constant) + ";\n";
}
-void VisualShaderNodeIntConstant::set_constant(int p_value) {
- constant = p_value;
+void VisualShaderNodeIntConstant::set_constant(int p_constant) {
+ if (constant == p_constant) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -144,7 +150,7 @@ Vector<StringName> VisualShaderNodeIntConstant::get_editable_properties() const
}
void VisualShaderNodeIntConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeIntConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeIntConstant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeIntConstant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::INT, "constant"), "set_constant", "get_constant");
@@ -187,8 +193,11 @@ String VisualShaderNodeBooleanConstant::generate_code(Shader::Mode p_mode, Visua
return " " + p_output_vars[0] + " = " + (constant ? "true" : "false") + ";\n";
}
-void VisualShaderNodeBooleanConstant::set_constant(bool p_value) {
- constant = p_value;
+void VisualShaderNodeBooleanConstant::set_constant(bool p_constant) {
+ if (constant == p_constant) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -203,7 +212,7 @@ Vector<StringName> VisualShaderNodeBooleanConstant::get_editable_properties() co
}
void VisualShaderNodeBooleanConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeBooleanConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeBooleanConstant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeBooleanConstant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "constant"), "set_constant", "get_constant");
@@ -257,8 +266,11 @@ String VisualShaderNodeColorConstant::generate_code(Shader::Mode p_mode, VisualS
return code;
}
-void VisualShaderNodeColorConstant::set_constant(Color p_value) {
- constant = p_value;
+void VisualShaderNodeColorConstant::set_constant(const Color &p_constant) {
+ if (constant.is_equal_approx(p_constant)) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -273,7 +285,7 @@ Vector<StringName> VisualShaderNodeColorConstant::get_editable_properties() cons
}
void VisualShaderNodeColorConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeColorConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeColorConstant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeColorConstant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "constant"), "set_constant", "get_constant");
@@ -316,8 +328,11 @@ String VisualShaderNodeVec3Constant::generate_code(Shader::Mode p_mode, VisualSh
return " " + p_output_vars[0] + " = " + vformat("vec3(%.6f, %.6f, %.6f)", constant.x, constant.y, constant.z) + ";\n";
}
-void VisualShaderNodeVec3Constant::set_constant(Vector3 p_value) {
- constant = p_value;
+void VisualShaderNodeVec3Constant::set_constant(const Vector3 &p_constant) {
+ if (constant.is_equal_approx(p_constant)) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -332,7 +347,7 @@ Vector<StringName> VisualShaderNodeVec3Constant::get_editable_properties() const
}
void VisualShaderNodeVec3Constant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeVec3Constant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeVec3Constant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeVec3Constant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "constant"), "set_constant", "get_constant");
@@ -383,8 +398,11 @@ String VisualShaderNodeTransformConstant::generate_code(Shader::Mode p_mode, Vis
return code;
}
-void VisualShaderNodeTransformConstant::set_constant(Transform3D p_value) {
- constant = p_value;
+void VisualShaderNodeTransformConstant::set_constant(const Transform3D &p_constant) {
+ if (constant.is_equal_approx(p_constant)) {
+ return;
+ }
+ constant = p_constant;
emit_changed();
}
@@ -399,7 +417,7 @@ Vector<StringName> VisualShaderNodeTransformConstant::get_editable_properties()
}
void VisualShaderNodeTransformConstant::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeTransformConstant::set_constant);
+ ClassDB::bind_method(D_METHOD("set_constant", "constant"), &VisualShaderNodeTransformConstant::set_constant);
ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeTransformConstant::get_constant);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "constant"), "set_constant", "get_constant");
@@ -502,6 +520,8 @@ String VisualShaderNodeTexture::generate_global(Shader::Mode p_mode, VisualShade
case TYPE_NORMAL_MAP:
u += " : hint_normal";
break;
+ default:
+ break;
}
return u + ";\n";
}
@@ -685,8 +705,11 @@ String VisualShaderNodeTexture::generate_code(Shader::Mode p_mode, VisualShader:
}
void VisualShaderNodeTexture::set_source(Source p_source) {
- source = p_source;
- switch (source) {
+ ERR_FAIL_INDEX(int(p_source), int(SOURCE_MAX));
+ if (source == p_source) {
+ return;
+ }
+ switch (p_source) {
case SOURCE_TEXTURE:
simple_decl = true;
break;
@@ -705,7 +728,10 @@ void VisualShaderNodeTexture::set_source(Source p_source) {
case SOURCE_PORT:
simple_decl = false;
break;
+ default:
+ break;
}
+ source = p_source;
emit_changed();
emit_signal(SNAME("editor_refresh_request"));
}
@@ -714,8 +740,8 @@ VisualShaderNodeTexture::Source VisualShaderNodeTexture::get_source() const {
return source;
}
-void VisualShaderNodeTexture::set_texture(Ref<Texture2D> p_value) {
- texture = p_value;
+void VisualShaderNodeTexture::set_texture(Ref<Texture2D> p_texture) {
+ texture = p_texture;
emit_changed();
}
@@ -723,8 +749,12 @@ Ref<Texture2D> VisualShaderNodeTexture::get_texture() const {
return texture;
}
-void VisualShaderNodeTexture::set_texture_type(TextureType p_type) {
- texture_type = p_type;
+void VisualShaderNodeTexture::set_texture_type(TextureType p_texture_type) {
+ ERR_FAIL_INDEX(int(p_texture_type), int(TYPE_MAX));
+ if (texture_type == p_texture_type) {
+ return;
+ }
+ texture_type = p_texture_type;
emit_changed();
}
@@ -797,9 +827,12 @@ void VisualShaderNodeTexture::_bind_methods() {
BIND_ENUM_CONSTANT(SOURCE_2D_NORMAL);
BIND_ENUM_CONSTANT(SOURCE_DEPTH);
BIND_ENUM_CONSTANT(SOURCE_PORT);
+ BIND_ENUM_CONSTANT(SOURCE_MAX);
+
BIND_ENUM_CONSTANT(TYPE_DATA);
BIND_ENUM_CONSTANT(TYPE_COLOR);
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
+ BIND_ENUM_CONSTANT(TYPE_MAX);
}
VisualShaderNodeTexture::VisualShaderNodeTexture() {
@@ -1074,6 +1107,10 @@ String VisualShaderNodeSample3D::generate_code(Shader::Mode p_mode, VisualShader
}
void VisualShaderNodeSample3D::set_source(Source p_source) {
+ ERR_FAIL_INDEX(int(p_source), int(SOURCE_MAX));
+ if (source == p_source) {
+ return;
+ }
source = p_source;
emit_changed();
emit_signal(SNAME("editor_refresh_request"));
@@ -1091,6 +1128,7 @@ void VisualShaderNodeSample3D::_bind_methods() {
BIND_ENUM_CONSTANT(SOURCE_TEXTURE);
BIND_ENUM_CONSTANT(SOURCE_PORT);
+ BIND_ENUM_CONSTANT(SOURCE_MAX);
}
String VisualShaderNodeSample3D::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
@@ -1127,7 +1165,7 @@ String VisualShaderNodeTexture2DArray::get_input_port_name(int p_port) const {
Vector<VisualShader::DefaultTextureParam> VisualShaderNodeTexture2DArray::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const {
VisualShader::DefaultTextureParam dtp;
dtp.name = make_unique_id(p_type, p_id, "tex3d");
- dtp.param = texture;
+ dtp.param = texture_array;
Vector<VisualShader::DefaultTextureParam> ret;
ret.push_back(dtp);
return ret;
@@ -1140,13 +1178,13 @@ String VisualShaderNodeTexture2DArray::generate_global(Shader::Mode p_mode, Visu
return String();
}
-void VisualShaderNodeTexture2DArray::set_texture_array(Ref<Texture2DArray> p_value) {
- texture = p_value;
+void VisualShaderNodeTexture2DArray::set_texture_array(Ref<Texture2DArray> p_texture_array) {
+ texture_array = p_texture_array;
emit_changed();
}
Ref<Texture2DArray> VisualShaderNodeTexture2DArray::get_texture_array() const {
- return texture;
+ return texture_array;
}
Vector<StringName> VisualShaderNodeTexture2DArray::get_editable_properties() const {
@@ -1197,8 +1235,8 @@ String VisualShaderNodeTexture3D::generate_global(Shader::Mode p_mode, VisualSha
return String();
}
-void VisualShaderNodeTexture3D::set_texture(Ref<Texture3D> p_value) {
- texture = p_value;
+void VisualShaderNodeTexture3D::set_texture(Ref<Texture3D> p_texture) {
+ texture = p_texture;
emit_changed();
}
@@ -1301,6 +1339,8 @@ String VisualShaderNodeCubemap::generate_global(Shader::Mode p_mode, VisualShade
case TYPE_NORMAL_MAP:
u += " : hint_normal";
break;
+ default:
+ break;
}
return u + ";\n";
}
@@ -1364,6 +1404,10 @@ String VisualShaderNodeCubemap::get_input_port_default_hint(int p_port) const {
}
void VisualShaderNodeCubemap::set_source(Source p_source) {
+ ERR_FAIL_INDEX(int(p_source), int(SOURCE_MAX));
+ if (source == p_source) {
+ return;
+ }
source = p_source;
emit_changed();
emit_signal(SNAME("editor_refresh_request"));
@@ -1373,8 +1417,8 @@ VisualShaderNodeCubemap::Source VisualShaderNodeCubemap::get_source() const {
return source;
}
-void VisualShaderNodeCubemap::set_cube_map(Ref<Cubemap> p_value) {
- cube_map = p_value;
+void VisualShaderNodeCubemap::set_cube_map(Ref<Cubemap> p_cube_map) {
+ cube_map = p_cube_map;
emit_changed();
}
@@ -1382,8 +1426,12 @@ Ref<Cubemap> VisualShaderNodeCubemap::get_cube_map() const {
return cube_map;
}
-void VisualShaderNodeCubemap::set_texture_type(TextureType p_type) {
- texture_type = p_type;
+void VisualShaderNodeCubemap::set_texture_type(TextureType p_texture_type) {
+ ERR_FAIL_INDEX(int(p_texture_type), int(TYPE_MAX));
+ if (texture_type == p_texture_type) {
+ return;
+ }
+ texture_type = p_texture_type;
emit_changed();
}
@@ -1424,10 +1472,12 @@ void VisualShaderNodeCubemap::_bind_methods() {
BIND_ENUM_CONSTANT(SOURCE_TEXTURE);
BIND_ENUM_CONSTANT(SOURCE_PORT);
+ BIND_ENUM_CONSTANT(SOURCE_MAX);
BIND_ENUM_CONSTANT(TYPE_DATA);
BIND_ENUM_CONSTANT(TYPE_COLOR);
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
+ BIND_ENUM_CONSTANT(TYPE_MAX);
}
VisualShaderNodeCubemap::VisualShaderNodeCubemap() {
@@ -1497,12 +1547,17 @@ String VisualShaderNodeFloatOp::generate_code(Shader::Mode p_mode, VisualShader:
case OP_STEP:
code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
+ default:
+ break;
}
-
return code;
}
void VisualShaderNodeFloatOp::set_operator(Operator p_op) {
+ ERR_FAIL_INDEX(int(p_op), int(OP_ENUM_SIZE));
+ if (op == p_op) {
+ return;
+ }
op = p_op;
emit_changed();
}
@@ -1533,6 +1588,7 @@ void VisualShaderNodeFloatOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_MIN);
BIND_ENUM_CONSTANT(OP_ATAN2);
BIND_ENUM_CONSTANT(OP_STEP);
+ BIND_ENUM_CONSTANT(OP_ENUM_SIZE);
}
VisualShaderNodeFloatOp::VisualShaderNodeFloatOp() {
@@ -1594,12 +1650,18 @@ String VisualShaderNodeIntOp::generate_code(Shader::Mode p_mode, VisualShader::T
case OP_MIN:
code += "min(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
+ default:
+ break;
}
return code;
}
void VisualShaderNodeIntOp::set_operator(Operator p_op) {
+ ERR_FAIL_INDEX(int(p_op), OP_ENUM_SIZE);
+ if (op == p_op) {
+ return;
+ }
op = p_op;
emit_changed();
}
@@ -1627,6 +1689,7 @@ void VisualShaderNodeIntOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_MOD);
BIND_ENUM_CONSTANT(OP_MAX);
BIND_ENUM_CONSTANT(OP_MIN);
+ BIND_ENUM_CONSTANT(OP_ENUM_SIZE);
}
VisualShaderNodeIntOp::VisualShaderNodeIntOp() {
@@ -1703,12 +1766,18 @@ String VisualShaderNodeVectorOp::generate_code(Shader::Mode p_mode, VisualShader
case OP_STEP:
code += "step(" + p_input_vars[0] + ", " + p_input_vars[1] + ");\n";
break;
+ default:
+ break;
}
return code;
}
void VisualShaderNodeVectorOp::set_operator(Operator p_op) {
+ ERR_FAIL_INDEX(int(p_op), int(OP_ENUM_SIZE));
+ if (op == p_op) {
+ return;
+ }
op = p_op;
emit_changed();
}
@@ -1741,6 +1810,7 @@ void VisualShaderNodeVectorOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_ATAN2);
BIND_ENUM_CONSTANT(OP_REFLECT);
BIND_ENUM_CONSTANT(OP_STEP);
+ BIND_ENUM_CONSTANT(OP_ENUM_SIZE);
}
VisualShaderNodeVectorOp::VisualShaderNodeVectorOp() {
@@ -1844,14 +1914,19 @@ String VisualShaderNodeColorOp::generate_code(Shader::Mode p_mode, VisualShader:
}
} break;
+ default:
+ break;
}
return code;
}
void VisualShaderNodeColorOp::set_operator(Operator p_op) {
- op = p_op;
- switch (op) {
+ ERR_FAIL_INDEX(int(p_op), int(OP_MAX));
+ if (op == p_op) {
+ return;
+ }
+ switch (p_op) {
case OP_SCREEN:
simple_decl = true;
break;
@@ -1879,7 +1954,10 @@ void VisualShaderNodeColorOp::set_operator(Operator p_op) {
case OP_HARD_LIGHT:
simple_decl = false;
break;
+ default:
+ break;
}
+ op = p_op;
emit_changed();
}
@@ -1908,6 +1986,7 @@ void VisualShaderNodeColorOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_BURN);
BIND_ENUM_CONSTANT(OP_SOFT_LIGHT);
BIND_ENUM_CONSTANT(OP_HARD_LIGHT);
+ BIND_ENUM_CONSTANT(OP_MAX);
}
VisualShaderNodeColorOp::VisualShaderNodeColorOp() {
@@ -1971,7 +2050,10 @@ String VisualShaderNodeTransformOp::generate_code(Shader::Mode p_mode, VisualSha
}
void VisualShaderNodeTransformOp::set_operator(Operator p_op) {
- ERR_FAIL_INDEX(int(p_op), int(OP_LIMITER));
+ ERR_FAIL_INDEX(int(p_op), int(OP_MAX));
+ if (op == p_op) {
+ return;
+ }
op = p_op;
emit_changed();
}
@@ -2001,7 +2083,7 @@ void VisualShaderNodeTransformOp::_bind_methods() {
BIND_ENUM_CONSTANT(OP_B_MINUS_A);
BIND_ENUM_CONSTANT(OP_A_DIV_B);
BIND_ENUM_CONSTANT(OP_B_DIV_A);
- BIND_ENUM_CONSTANT(OP_LIMITER);
+ BIND_ENUM_CONSTANT(OP_MAX);
}
VisualShaderNodeTransformOp::VisualShaderNodeTransformOp() {
@@ -2052,6 +2134,10 @@ String VisualShaderNodeTransformVecMult::generate_code(Shader::Mode p_mode, Visu
}
void VisualShaderNodeTransformVecMult::set_operator(Operator p_op) {
+ ERR_FAIL_INDEX(int(p_op), int(OP_MAX));
+ if (op == p_op) {
+ return;
+ }
op = p_op;
emit_changed();
}
@@ -2076,6 +2162,7 @@ void VisualShaderNodeTransformVecMult::_bind_methods() {
BIND_ENUM_CONSTANT(OP_BxA);
BIND_ENUM_CONSTANT(OP_3x3_AxB);
BIND_ENUM_CONSTANT(OP_3x3_BxA);
+ BIND_ENUM_CONSTANT(OP_MAX);
}
VisualShaderNodeTransformVecMult::VisualShaderNodeTransformVecMult() {
@@ -2114,7 +2201,7 @@ String VisualShaderNodeFloatFunc::get_output_port_name(int p_port) const {
}
String VisualShaderNodeFloatFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *scalar_func_id[FUNC_ONEMINUS + 1] = {
+ static const char *functions[FUNC_MAX] = {
"sin($)",
"cos($)",
"tan($)",
@@ -2148,11 +2235,14 @@ String VisualShaderNodeFloatFunc::generate_code(Shader::Mode p_mode, VisualShade
"trunc($)",
"1.0 - $"
};
-
- return " " + p_output_vars[0] + " = " + String(scalar_func_id[func]).replace("$", p_input_vars[0]) + ";\n";
+ return " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
}
void VisualShaderNodeFloatFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2205,6 +2295,7 @@ void VisualShaderNodeFloatFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_ROUNDEVEN);
BIND_ENUM_CONSTANT(FUNC_TRUNC);
BIND_ENUM_CONSTANT(FUNC_ONEMINUS);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeFloatFunc::VisualShaderNodeFloatFunc() {
@@ -2242,16 +2333,20 @@ String VisualShaderNodeIntFunc::get_output_port_name(int p_port) const {
}
String VisualShaderNodeIntFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *int_func_id[FUNC_SIGN + 1] = {
+ static const char *functions[FUNC_MAX] = {
"abs($)",
"-($)",
"sign($)"
};
- return " " + p_output_vars[0] + " = " + String(int_func_id[func]).replace("$", p_input_vars[0]) + ";\n";
+ return " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
}
void VisualShaderNodeIntFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2275,6 +2370,7 @@ void VisualShaderNodeIntFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_ABS);
BIND_ENUM_CONSTANT(FUNC_NEGATE);
BIND_ENUM_CONSTANT(FUNC_SIGN);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeIntFunc::VisualShaderNodeIntFunc() {
@@ -2312,7 +2408,7 @@ String VisualShaderNodeVectorFunc::get_output_port_name(int p_port) const {
}
String VisualShaderNodeVectorFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *vec_func_id[FUNC_ONEMINUS + 1] = {
+ static const char *vec_func_id[FUNC_MAX] = {
"normalize($)",
"max(min($, vec3(1.0)), vec3(0.0))",
"-($)",
@@ -2378,14 +2474,18 @@ String VisualShaderNodeVectorFunc::generate_code(Shader::Mode p_mode, VisualShad
}
void VisualShaderNodeVectorFunc::set_function(Function p_func) {
- func = p_func;
- if (func == FUNC_RGB2HSV) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
+ if (p_func == FUNC_RGB2HSV) {
simple_decl = false;
- } else if (func == FUNC_HSV2RGB) {
+ } else if (p_func == FUNC_HSV2RGB) {
simple_decl = false;
} else {
simple_decl = true;
}
+ func = p_func;
emit_changed();
}
@@ -2440,6 +2540,7 @@ void VisualShaderNodeVectorFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_TANH);
BIND_ENUM_CONSTANT(FUNC_TRUNC);
BIND_ENUM_CONSTANT(FUNC_ONEMINUS);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeVectorFunc::VisualShaderNodeVectorFunc() {
@@ -2498,12 +2599,18 @@ String VisualShaderNodeColorFunc::generate_code(Shader::Mode p_mode, VisualShade
code += " " + p_output_vars[0] + " = vec3(r, g, b);\n";
code += " }\n";
break;
+ default:
+ break;
}
return code;
}
void VisualShaderNodeColorFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2526,6 +2633,7 @@ void VisualShaderNodeColorFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_GRAYSCALE);
BIND_ENUM_CONSTANT(FUNC_SEPIA);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeColorFunc::VisualShaderNodeColorFunc() {
@@ -2564,17 +2672,21 @@ String VisualShaderNodeTransformFunc::get_output_port_name(int p_port) const {
}
String VisualShaderNodeTransformFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *funcs[FUNC_TRANSPOSE + 1] = {
+ static const char *functions[FUNC_MAX] = {
"inverse($)",
"transpose($)"
};
String code;
- code += " " + p_output_vars[0] + " = " + String(funcs[func]).replace("$", p_input_vars[0]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
return code;
}
void VisualShaderNodeTransformFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2597,6 +2709,7 @@ void VisualShaderNodeTransformFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_INVERSE);
BIND_ENUM_CONSTANT(FUNC_TRANSPOSE);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeTransformFunc::VisualShaderNodeTransformFunc() {
@@ -2639,8 +2752,6 @@ String VisualShaderNodeUVFunc::get_input_port_name(int p_port) const {
return "offset";
case FUNC_SCALING:
return "pivot";
- case FUNC_MAX:
- break;
default:
break;
}
@@ -2693,24 +2804,23 @@ String VisualShaderNodeUVFunc::generate_code(Shader::Mode p_mode, VisualShader::
case FUNC_SCALING: {
code += vformat(" %s = fma((%s - %s), %s, %s);\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot);
} break;
- case FUNC_MAX:
+ default:
break;
}
return code;
}
void VisualShaderNodeUVFunc::set_function(VisualShaderNodeUVFunc::Function p_func) {
- ERR_FAIL_INDEX(int(p_func), FUNC_MAX);
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
if (func == p_func) {
return;
}
- func = p_func;
-
if (p_func == FUNC_PANNING) {
set_input_port_default_value(2, Vector3()); // offset
} else { // FUNC_SCALING
set_input_port_default_value(2, Vector3(0.5, 0.5, 0.0)); // pivot
}
+ func = p_func;
emit_changed();
}
@@ -2886,18 +2996,22 @@ String VisualShaderNodeScalarDerivativeFunc::get_output_port_name(int p_port) co
}
String VisualShaderNodeScalarDerivativeFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *funcs[FUNC_Y + 1] = {
+ static const char *functions[FUNC_MAX] = {
"fwidth($)",
"dFdx($)",
"dFdy($)"
};
String code;
- code += " " + p_output_vars[0] + " = " + String(funcs[func]).replace("$", p_input_vars[0]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
return code;
}
void VisualShaderNodeScalarDerivativeFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2921,6 +3035,7 @@ void VisualShaderNodeScalarDerivativeFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_SUM);
BIND_ENUM_CONSTANT(FUNC_X);
BIND_ENUM_CONSTANT(FUNC_Y);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeScalarDerivativeFunc::VisualShaderNodeScalarDerivativeFunc() {
@@ -2958,18 +3073,22 @@ String VisualShaderNodeVectorDerivativeFunc::get_output_port_name(int p_port) co
}
String VisualShaderNodeVectorDerivativeFunc::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *funcs[FUNC_Y + 1] = {
+ static const char *functions[FUNC_MAX] = {
"fwidth($)",
"dFdx($)",
"dFdy($)"
};
String code;
- code += " " + p_output_vars[0] + " = " + String(funcs[func]).replace("$", p_input_vars[0]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
return code;
}
void VisualShaderNodeVectorDerivativeFunc::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -2993,6 +3112,7 @@ void VisualShaderNodeVectorDerivativeFunc::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_SUM);
BIND_ENUM_CONSTANT(FUNC_X);
BIND_ENUM_CONSTANT(FUNC_Y);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeVectorDerivativeFunc::VisualShaderNodeVectorDerivativeFunc() {
@@ -3057,7 +3177,7 @@ String VisualShaderNodeClamp::generate_code(Shader::Mode p_mode, VisualShader::T
}
void VisualShaderNodeClamp::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX((int)p_op_type, int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -3095,7 +3215,7 @@ Vector<StringName> VisualShaderNodeClamp::get_editable_properties() const {
}
void VisualShaderNodeClamp::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_op_type", "type"), &VisualShaderNodeClamp::set_op_type);
+ ClassDB::bind_method(D_METHOD("set_op_type", "op_type"), &VisualShaderNodeClamp::set_op_type);
ClassDB::bind_method(D_METHOD("get_op_type"), &VisualShaderNodeClamp::get_op_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Float,Int,Vector"), "set_op_type", "get_op_type");
@@ -3262,7 +3382,7 @@ String VisualShaderNodeStep::get_output_port_name(int p_port) const {
}
void VisualShaderNodeStep::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -3313,7 +3433,7 @@ Vector<StringName> VisualShaderNodeStep::get_editable_properties() const {
}
void VisualShaderNodeStep::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_op_type", "type"), &VisualShaderNodeStep::set_op_type);
+ ClassDB::bind_method(D_METHOD("set_op_type", "op_type"), &VisualShaderNodeStep::set_op_type);
ClassDB::bind_method(D_METHOD("get_op_type"), &VisualShaderNodeStep::get_op_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Scalar,Vector,VectorScalar"), "set_op_type", "get_op_type");
@@ -3386,7 +3506,7 @@ String VisualShaderNodeSmoothStep::get_output_port_name(int p_port) const {
}
void VisualShaderNodeSmoothStep::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -3440,7 +3560,7 @@ Vector<StringName> VisualShaderNodeSmoothStep::get_editable_properties() const {
}
void VisualShaderNodeSmoothStep::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_op_type", "type"), &VisualShaderNodeSmoothStep::set_op_type);
+ ClassDB::bind_method(D_METHOD("set_op_type", "op_type"), &VisualShaderNodeSmoothStep::set_op_type);
ClassDB::bind_method(D_METHOD("get_op_type"), &VisualShaderNodeSmoothStep::get_op_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Scalar,Vector,VectorScalar"), "set_op_type", "get_op_type");
@@ -3608,7 +3728,7 @@ String VisualShaderNodeMix::get_output_port_name(int p_port) const {
}
void VisualShaderNodeMix::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -3656,7 +3776,7 @@ Vector<StringName> VisualShaderNodeMix::get_editable_properties() const {
}
void VisualShaderNodeMix::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_op_type", "type"), &VisualShaderNodeMix::set_op_type);
+ ClassDB::bind_method(D_METHOD("set_op_type", "op_type"), &VisualShaderNodeMix::set_op_type);
ClassDB::bind_method(D_METHOD("get_op_type"), &VisualShaderNodeMix::get_op_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "op_type", PROPERTY_HINT_ENUM, "Scalar,Vector,VectorScalar"), "set_op_type", "get_op_type");
@@ -3925,6 +4045,10 @@ bool VisualShaderNodeFloatUniform::is_use_prop_slots() const {
}
void VisualShaderNodeFloatUniform::set_hint(Hint p_hint) {
+ ERR_FAIL_INDEX(int(p_hint), int(HINT_MAX));
+ if (hint == p_hint) {
+ return;
+ }
hint = p_hint;
emit_changed();
}
@@ -3934,6 +4058,9 @@ VisualShaderNodeFloatUniform::Hint VisualShaderNodeFloatUniform::get_hint() cons
}
void VisualShaderNodeFloatUniform::set_min(float p_value) {
+ if (Math::is_equal_approx(hint_range_min, p_value)) {
+ return;
+ }
hint_range_min = p_value;
emit_changed();
}
@@ -3943,6 +4070,9 @@ float VisualShaderNodeFloatUniform::get_min() const {
}
void VisualShaderNodeFloatUniform::set_max(float p_value) {
+ if (Math::is_equal_approx(hint_range_max, p_value)) {
+ return;
+ }
hint_range_max = p_value;
emit_changed();
}
@@ -3952,6 +4082,9 @@ float VisualShaderNodeFloatUniform::get_max() const {
}
void VisualShaderNodeFloatUniform::set_step(float p_value) {
+ if (Math::is_equal_approx(hint_range_step, p_value)) {
+ return;
+ }
hint_range_step = p_value;
emit_changed();
}
@@ -3961,6 +4094,9 @@ float VisualShaderNodeFloatUniform::get_step() const {
}
void VisualShaderNodeFloatUniform::set_default_value_enabled(bool p_enabled) {
+ if (default_value_enabled == p_enabled) {
+ return;
+ }
default_value_enabled = p_enabled;
emit_changed();
}
@@ -3970,6 +4106,9 @@ bool VisualShaderNodeFloatUniform::is_default_value_enabled() const {
}
void VisualShaderNodeFloatUniform::set_default_value(float p_value) {
+ if (Math::is_equal_approx(default_value, p_value)) {
+ return;
+ }
default_value = p_value;
emit_changed();
}
@@ -4007,6 +4146,7 @@ void VisualShaderNodeFloatUniform::_bind_methods() {
BIND_ENUM_CONSTANT(HINT_NONE);
BIND_ENUM_CONSTANT(HINT_RANGE);
BIND_ENUM_CONSTANT(HINT_RANGE_STEP);
+ BIND_ENUM_CONSTANT(HINT_MAX);
}
bool VisualShaderNodeFloatUniform::is_qualifier_supported(Qualifier p_qual) const {
@@ -4096,6 +4236,10 @@ bool VisualShaderNodeIntUniform::is_use_prop_slots() const {
}
void VisualShaderNodeIntUniform::set_hint(Hint p_hint) {
+ ERR_FAIL_INDEX(int(p_hint), int(HINT_MAX));
+ if (hint == p_hint) {
+ return;
+ }
hint = p_hint;
emit_changed();
}
@@ -4105,6 +4249,9 @@ VisualShaderNodeIntUniform::Hint VisualShaderNodeIntUniform::get_hint() const {
}
void VisualShaderNodeIntUniform::set_min(int p_value) {
+ if (hint_range_min == p_value) {
+ return;
+ }
hint_range_min = p_value;
emit_changed();
}
@@ -4114,6 +4261,9 @@ int VisualShaderNodeIntUniform::get_min() const {
}
void VisualShaderNodeIntUniform::set_max(int p_value) {
+ if (hint_range_max == p_value) {
+ return;
+ }
hint_range_max = p_value;
emit_changed();
}
@@ -4123,6 +4273,9 @@ int VisualShaderNodeIntUniform::get_max() const {
}
void VisualShaderNodeIntUniform::set_step(int p_value) {
+ if (hint_range_step == p_value) {
+ return;
+ }
hint_range_step = p_value;
emit_changed();
}
@@ -4131,8 +4284,11 @@ int VisualShaderNodeIntUniform::get_step() const {
return hint_range_step;
}
-void VisualShaderNodeIntUniform::set_default_value_enabled(bool p_enabled) {
- default_value_enabled = p_enabled;
+void VisualShaderNodeIntUniform::set_default_value_enabled(bool p_default_value_enabled) {
+ if (default_value_enabled == p_default_value_enabled) {
+ return;
+ }
+ default_value_enabled = p_default_value_enabled;
emit_changed();
}
@@ -4140,8 +4296,11 @@ bool VisualShaderNodeIntUniform::is_default_value_enabled() const {
return default_value_enabled;
}
-void VisualShaderNodeIntUniform::set_default_value(int p_value) {
- default_value = p_value;
+void VisualShaderNodeIntUniform::set_default_value(int p_default_value) {
+ if (default_value == p_default_value) {
+ return;
+ }
+ default_value = p_default_value;
emit_changed();
}
@@ -4178,6 +4337,7 @@ void VisualShaderNodeIntUniform::_bind_methods() {
BIND_ENUM_CONSTANT(HINT_NONE);
BIND_ENUM_CONSTANT(HINT_RANGE);
BIND_ENUM_CONSTANT(HINT_RANGE_STEP);
+ BIND_ENUM_CONSTANT(HINT_MAX);
}
bool VisualShaderNodeIntUniform::is_qualifier_supported(Qualifier p_qual) const {
@@ -4238,8 +4398,11 @@ String VisualShaderNodeBooleanUniform::get_output_port_name(int p_port) const {
return ""; //no output port means the editor will be used as port
}
-void VisualShaderNodeBooleanUniform::set_default_value_enabled(bool p_enabled) {
- default_value_enabled = p_enabled;
+void VisualShaderNodeBooleanUniform::set_default_value_enabled(bool p_default_value_enabled) {
+ if (default_value_enabled == p_default_value_enabled) {
+ return;
+ }
+ default_value_enabled = p_default_value_enabled;
emit_changed();
}
@@ -4247,8 +4410,11 @@ bool VisualShaderNodeBooleanUniform::is_default_value_enabled() const {
return default_value_enabled;
}
-void VisualShaderNodeBooleanUniform::set_default_value(bool p_value) {
- default_value = p_value;
+void VisualShaderNodeBooleanUniform::set_default_value(bool p_default_value) {
+ if (default_value == p_default_value) {
+ return;
+ }
+ default_value = p_default_value;
emit_changed();
}
@@ -4343,6 +4509,9 @@ String VisualShaderNodeColorUniform::get_output_port_name(int p_port) const {
}
void VisualShaderNodeColorUniform::set_default_value_enabled(bool p_enabled) {
+ if (default_value_enabled == p_enabled) {
+ return;
+ }
default_value_enabled = p_enabled;
emit_changed();
}
@@ -4352,6 +4521,9 @@ bool VisualShaderNodeColorUniform::is_default_value_enabled() const {
}
void VisualShaderNodeColorUniform::set_default_value(const Color &p_value) {
+ if (default_value.is_equal_approx(p_value)) {
+ return;
+ }
default_value = p_value;
emit_changed();
}
@@ -4689,6 +4861,9 @@ String VisualShaderNodeTextureUniform::generate_global(Shader::Mode p_mode, Visu
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
+ default:
+ code += ";\n";
+ break;
}
return code;
@@ -4727,8 +4902,12 @@ String VisualShaderNodeTextureUniform::generate_code(Shader::Mode p_mode, Visual
return code;
}
-void VisualShaderNodeTextureUniform::set_texture_type(TextureType p_type) {
- texture_type = p_type;
+void VisualShaderNodeTextureUniform::set_texture_type(TextureType p_texture_type) {
+ ERR_FAIL_INDEX(int(p_texture_type), int(TYPE_MAX));
+ if (texture_type == p_texture_type) {
+ return;
+ }
+ texture_type = p_texture_type;
emit_changed();
}
@@ -4736,8 +4915,12 @@ VisualShaderNodeTextureUniform::TextureType VisualShaderNodeTextureUniform::get_
return texture_type;
}
-void VisualShaderNodeTextureUniform::set_color_default(ColorDefault p_default) {
- color_default = p_default;
+void VisualShaderNodeTextureUniform::set_color_default(ColorDefault p_color_default) {
+ ERR_FAIL_INDEX(int(p_color_default), int(COLOR_DEFAULT_MAX));
+ if (color_default == p_color_default) {
+ return;
+ }
+ color_default = p_color_default;
emit_changed();
}
@@ -4766,9 +4949,11 @@ void VisualShaderNodeTextureUniform::_bind_methods() {
BIND_ENUM_CONSTANT(TYPE_COLOR);
BIND_ENUM_CONSTANT(TYPE_NORMAL_MAP);
BIND_ENUM_CONSTANT(TYPE_ANISO);
+ BIND_ENUM_CONSTANT(TYPE_MAX);
BIND_ENUM_CONSTANT(COLOR_DEFAULT_WHITE);
BIND_ENUM_CONSTANT(COLOR_DEFAULT_BLACK);
+ BIND_ENUM_CONSTANT(COLOR_DEFAULT_MAX);
}
String VisualShaderNodeTextureUniform::get_input_port_default_hint(int p_port) const {
@@ -4786,6 +4971,8 @@ bool VisualShaderNodeTextureUniform::is_qualifier_supported(Qualifier p_qual) co
return true;
case Qualifier::QUAL_INSTANCE:
return false;
+ default:
+ break;
}
return false;
}
@@ -4951,6 +5138,9 @@ String VisualShaderNodeTexture2DArrayUniform::generate_global(Shader::Mode p_mod
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
+ default:
+ code += ";\n";
+ break;
}
return code;
@@ -5021,6 +5211,9 @@ String VisualShaderNodeTexture3DUniform::generate_global(Shader::Mode p_mode, Vi
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
+ default:
+ code += ";\n";
+ break;
}
return code;
@@ -5091,6 +5284,9 @@ String VisualShaderNodeCubemapUniform::generate_global(Shader::Mode p_mode, Visu
case TYPE_ANISO:
code += " : hint_aniso;\n";
break;
+ default:
+ code += ";\n";
+ break;
}
return code;
@@ -5247,7 +5443,7 @@ String VisualShaderNodeSwitch::get_output_port_name(int p_port) const {
}
void VisualShaderNodeSwitch::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -5452,17 +5648,21 @@ String VisualShaderNodeIs::get_output_port_name(int p_port) const {
}
String VisualShaderNodeIs::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *funcs[FUNC_IS_NAN + 1] = {
+ static const char *functions[FUNC_MAX] = {
"isinf($)",
"isnan($)"
};
String code;
- code += " " + p_output_vars[0] + " = " + String(funcs[func]).replace("$", p_input_vars[0]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + String(functions[func]).replace("$", p_input_vars[0]) + ";\n";
return code;
}
void VisualShaderNodeIs::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -5485,6 +5685,7 @@ void VisualShaderNodeIs::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_IS_INF);
BIND_ENUM_CONSTANT(FUNC_IS_NAN);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
}
VisualShaderNodeIs::VisualShaderNodeIs() {
@@ -5498,14 +5699,14 @@ String VisualShaderNodeCompare::get_caption() const {
}
int VisualShaderNodeCompare::get_input_port_count() const {
- if (ctype == CTYPE_SCALAR && (func == FUNC_EQUAL || func == FUNC_NOT_EQUAL)) {
+ if (comparison_type == CTYPE_SCALAR && (func == FUNC_EQUAL || func == FUNC_NOT_EQUAL)) {
return 3;
}
return 2;
}
VisualShaderNodeCompare::PortType VisualShaderNodeCompare::get_input_port_type(int p_port) const {
- switch (ctype) {
+ switch (comparison_type) {
case CTYPE_SCALAR:
return PORT_TYPE_SCALAR;
case CTYPE_SCALAR_INT:
@@ -5548,17 +5749,16 @@ String VisualShaderNodeCompare::get_output_port_name(int p_port) const {
}
String VisualShaderNodeCompare::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
- if (ctype == CTYPE_BOOLEAN || ctype == CTYPE_TRANSFORM) {
+ if (comparison_type == CTYPE_BOOLEAN || comparison_type == CTYPE_TRANSFORM) {
if (func > FUNC_NOT_EQUAL) {
return TTR("Invalid comparison function for that type.");
}
}
-
return "";
}
String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
- static const char *ops[FUNC_LESS_THAN_EQUAL + 1] = {
+ static const char *operators[FUNC_MAX] = {
"==",
"!=",
">",
@@ -5567,7 +5767,7 @@ String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader:
"<=",
};
- static const char *funcs[FUNC_LESS_THAN_EQUAL + 1] = {
+ static const char *functions[FUNC_MAX] = {
"equal($)",
"notEqual($)",
"greaterThan($)",
@@ -5576,31 +5776,31 @@ String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader:
"lessThanEqual($)",
};
- static const char *conds[COND_ANY + 1] = {
+ static const char *conditions[COND_MAX] = {
"all($)",
"any($)",
};
String code;
- switch (ctype) {
+ switch (comparison_type) {
case CTYPE_SCALAR:
if (func == FUNC_EQUAL) {
code += " " + p_output_vars[0] + " = (abs(" + p_input_vars[0] + " - " + p_input_vars[1] + ") < " + p_input_vars[2] + ");";
} else if (func == FUNC_NOT_EQUAL) {
code += " " + p_output_vars[0] + " = !(abs(" + p_input_vars[0] + " - " + p_input_vars[1] + ") < " + p_input_vars[2] + ");";
} else {
- code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", operators[func]) + ";\n";
}
break;
case CTYPE_SCALAR_INT:
- code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", operators[func]) + ";\n";
break;
case CTYPE_VECTOR:
code += " {\n";
- code += " bvec3 _bv = " + String(funcs[func]).replace("$", p_input_vars[0] + ", " + p_input_vars[1]) + ";\n";
- code += " " + p_output_vars[0] + " = " + String(conds[condition]).replace("$", "_bv") + ";\n";
+ code += " bvec3 _bv = " + String(functions[func]).replace("$", p_input_vars[0] + ", " + p_input_vars[1]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + String(conditions[condition]).replace("$", "_bv") + ";\n";
code += " }\n";
break;
@@ -5608,14 +5808,14 @@ String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader:
if (func > FUNC_NOT_EQUAL) {
return " " + p_output_vars[0] + " = false;\n";
}
- code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", operators[func]) + ";\n";
break;
case CTYPE_TRANSFORM:
if (func > FUNC_NOT_EQUAL) {
return " " + p_output_vars[0] + " = false;\n";
}
- code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", ops[func]) + ";\n";
+ code += " " + p_output_vars[0] + " = " + (p_input_vars[0] + " $ " + p_input_vars[1]).replace("$", operators[func]) + ";\n";
break;
default:
@@ -5624,10 +5824,12 @@ String VisualShaderNodeCompare::generate_code(Shader::Mode p_mode, VisualShader:
return code;
}
-void VisualShaderNodeCompare::set_comparison_type(ComparisonType p_type) {
- ctype = p_type;
-
- switch (ctype) {
+void VisualShaderNodeCompare::set_comparison_type(ComparisonType p_comparison_type) {
+ ERR_FAIL_INDEX(int(p_comparison_type), int(CTYPE_MAX));
+ if (comparison_type == p_comparison_type) {
+ return;
+ }
+ switch (p_comparison_type) {
case CTYPE_SCALAR:
set_input_port_default_value(0, 0.0);
set_input_port_default_value(1, 0.0);
@@ -5653,15 +5855,22 @@ void VisualShaderNodeCompare::set_comparison_type(ComparisonType p_type) {
set_input_port_default_value(1, Transform3D());
simple_decl = true;
break;
+ default:
+ break;
}
+ comparison_type = p_comparison_type;
emit_changed();
}
VisualShaderNodeCompare::ComparisonType VisualShaderNodeCompare::get_comparison_type() const {
- return ctype;
+ return comparison_type;
}
void VisualShaderNodeCompare::set_function(Function p_func) {
+ ERR_FAIL_INDEX(int(p_func), int(FUNC_MAX));
+ if (func == p_func) {
+ return;
+ }
func = p_func;
emit_changed();
}
@@ -5670,8 +5879,12 @@ VisualShaderNodeCompare::Function VisualShaderNodeCompare::get_function() const
return func;
}
-void VisualShaderNodeCompare::set_condition(Condition p_cond) {
- condition = p_cond;
+void VisualShaderNodeCompare::set_condition(Condition p_condition) {
+ ERR_FAIL_INDEX(int(p_condition), int(COND_MAX));
+ if (condition == p_condition) {
+ return;
+ }
+ condition = p_condition;
emit_changed();
}
@@ -5683,7 +5896,7 @@ Vector<StringName> VisualShaderNodeCompare::get_editable_properties() const {
Vector<StringName> props;
props.push_back("type");
props.push_back("function");
- if (ctype == CTYPE_VECTOR) {
+ if (comparison_type == CTYPE_VECTOR) {
props.push_back("condition");
}
return props;
@@ -5708,6 +5921,7 @@ void VisualShaderNodeCompare::_bind_methods() {
BIND_ENUM_CONSTANT(CTYPE_VECTOR);
BIND_ENUM_CONSTANT(CTYPE_BOOLEAN);
BIND_ENUM_CONSTANT(CTYPE_TRANSFORM);
+ BIND_ENUM_CONSTANT(CTYPE_MAX);
BIND_ENUM_CONSTANT(FUNC_EQUAL);
BIND_ENUM_CONSTANT(FUNC_NOT_EQUAL);
@@ -5715,9 +5929,11 @@ void VisualShaderNodeCompare::_bind_methods() {
BIND_ENUM_CONSTANT(FUNC_GREATER_THAN_EQUAL);
BIND_ENUM_CONSTANT(FUNC_LESS_THAN);
BIND_ENUM_CONSTANT(FUNC_LESS_THAN_EQUAL);
+ BIND_ENUM_CONSTANT(FUNC_MAX);
BIND_ENUM_CONSTANT(COND_ALL);
BIND_ENUM_CONSTANT(COND_ANY);
+ BIND_ENUM_CONSTANT(COND_MAX);
}
VisualShaderNodeCompare::VisualShaderNodeCompare() {
@@ -5775,7 +5991,7 @@ String VisualShaderNodeMultiplyAdd::generate_code(Shader::Mode p_mode, VisualSha
}
void VisualShaderNodeMultiplyAdd::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
+ ERR_FAIL_INDEX((int)p_op_type, int(OP_TYPE_MAX));
if (op_type == p_op_type) {
return;
}
@@ -5898,7 +6114,10 @@ bool VisualShaderNodeBillboard::is_show_prop_names() const {
}
void VisualShaderNodeBillboard::set_billboard_type(BillboardType p_billboard_type) {
- ERR_FAIL_INDEX((int)p_billboard_type, BILLBOARD_TYPE_MAX);
+ ERR_FAIL_INDEX(int(p_billboard_type), int(BILLBOARD_TYPE_MAX));
+ if (billboard_type == p_billboard_type) {
+ return;
+ }
billboard_type = p_billboard_type;
simple_decl = bool(billboard_type == BILLBOARD_TYPE_DISABLED);
set_disabled(simple_decl);
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 99617b46a3..2c952300fe 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -76,7 +76,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(float p_value);
+ void set_constant(float p_constant);
float get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -106,7 +106,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(int p_value);
+ void set_constant(int p_constant);
int get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -136,7 +136,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(bool p_value);
+ void set_constant(bool p_constant);
bool get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -167,7 +167,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(Color p_value);
+ void set_constant(const Color &p_constant);
Color get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -197,7 +197,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(Vector3 p_value);
+ void set_constant(const Vector3 &p_constant);
Vector3 get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -227,7 +227,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_constant(Transform3D p_value);
+ void set_constant(const Transform3D &p_constant);
Transform3D get_constant() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -251,12 +251,14 @@ public:
SOURCE_2D_NORMAL,
SOURCE_DEPTH,
SOURCE_PORT,
+ SOURCE_MAX,
};
enum TextureType {
TYPE_DATA,
TYPE_COLOR,
TYPE_NORMAL_MAP,
+ TYPE_MAX,
};
private:
@@ -287,10 +289,10 @@ public:
void set_source(Source p_source);
Source get_source() const;
- void set_texture(Ref<Texture2D> p_value);
+ void set_texture(Ref<Texture2D> p_texture);
Ref<Texture2D> get_texture() const;
- void set_texture_type(TextureType p_type);
+ void set_texture_type(TextureType p_texture_type);
TextureType get_texture_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -327,7 +329,7 @@ public:
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_texture(Ref<CurveTexture> p_value);
+ void set_texture(Ref<CurveTexture> p_texture);
Ref<CurveTexture> get_texture() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -360,7 +362,7 @@ public:
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_texture(Ref<CurveXYZTexture> p_value);
+ void set_texture(Ref<CurveXYZTexture> p_texture);
Ref<CurveXYZTexture> get_texture() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -378,6 +380,7 @@ public:
enum Source {
SOURCE_TEXTURE,
SOURCE_PORT,
+ SOURCE_MAX,
};
protected:
@@ -410,7 +413,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeSample3D::Source)
class VisualShaderNodeTexture2DArray : public VisualShaderNodeSample3D {
GDCLASS(VisualShaderNodeTexture2DArray, VisualShaderNodeSample3D);
- Ref<Texture2DArray> texture;
+ Ref<Texture2DArray> texture_array;
protected:
static void _bind_methods();
@@ -423,7 +426,7 @@ public:
virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
- void set_texture_array(Ref<Texture2DArray> p_value);
+ void set_texture_array(Ref<Texture2DArray> p_texture_array);
Ref<Texture2DArray> get_texture_array() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -446,7 +449,7 @@ public:
virtual Vector<VisualShader::DefaultTextureParam> get_default_texture_parameters(VisualShader::Type p_type, int p_id) const override;
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
- void set_texture(Ref<Texture3D> p_value);
+ void set_texture(Ref<Texture3D> p_texture);
Ref<Texture3D> get_texture() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -461,13 +464,15 @@ class VisualShaderNodeCubemap : public VisualShaderNode {
public:
enum Source {
SOURCE_TEXTURE,
- SOURCE_PORT
+ SOURCE_PORT,
+ SOURCE_MAX,
};
enum TextureType {
TYPE_DATA,
TYPE_COLOR,
- TYPE_NORMAL_MAP
+ TYPE_NORMAL_MAP,
+ TYPE_MAX,
};
private:
@@ -497,10 +502,10 @@ public:
void set_source(Source p_source);
Source get_source() const;
- void set_cube_map(Ref<Cubemap> p_value);
+ void set_cube_map(Ref<Cubemap> p_cube_map);
Ref<Cubemap> get_cube_map() const;
- void set_texture_type(TextureType p_type);
+ void set_texture_type(TextureType p_texture_type);
TextureType get_texture_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -530,7 +535,8 @@ public:
OP_MAX,
OP_MIN,
OP_ATAN2,
- OP_STEP
+ OP_STEP,
+ OP_ENUM_SIZE,
};
protected:
@@ -573,6 +579,7 @@ public:
OP_MOD,
OP_MAX,
OP_MIN,
+ OP_ENUM_SIZE,
};
protected:
@@ -619,7 +626,8 @@ public:
OP_CROSS,
OP_ATAN2,
OP_REFLECT,
- OP_STEP
+ OP_STEP,
+ OP_ENUM_SIZE,
};
protected:
@@ -665,7 +673,8 @@ public:
OP_DODGE,
OP_BURN,
OP_SOFT_LIGHT,
- OP_HARD_LIGHT
+ OP_HARD_LIGHT,
+ OP_MAX,
};
protected:
@@ -714,7 +723,7 @@ public:
OP_B_MINUS_A,
OP_A_DIV_B,
OP_B_DIV_A,
- OP_LIMITER,
+ OP_MAX,
};
protected:
@@ -758,6 +767,7 @@ public:
OP_BxA,
OP_3x3_AxB,
OP_3x3_BxA,
+ OP_MAX,
};
protected:
@@ -828,7 +838,8 @@ public:
FUNC_RECIPROCAL,
FUNC_ROUNDEVEN,
FUNC_TRUNC,
- FUNC_ONEMINUS
+ FUNC_ONEMINUS,
+ FUNC_MAX,
};
protected:
@@ -871,6 +882,7 @@ public:
FUNC_ABS,
FUNC_NEGATE,
FUNC_SIGN,
+ FUNC_MAX,
};
protected:
@@ -944,7 +956,8 @@ public:
FUNC_TAN,
FUNC_TANH,
FUNC_TRUNC,
- FUNC_ONEMINUS
+ FUNC_ONEMINUS,
+ FUNC_MAX,
};
protected:
@@ -985,7 +998,8 @@ class VisualShaderNodeColorFunc : public VisualShaderNode {
public:
enum Function {
FUNC_GRAYSCALE,
- FUNC_SEPIA
+ FUNC_SEPIA,
+ FUNC_MAX,
};
protected:
@@ -1026,7 +1040,8 @@ class VisualShaderNodeTransformFunc : public VisualShaderNode {
public:
enum Function {
FUNC_INVERSE,
- FUNC_TRANSPOSE
+ FUNC_TRANSPOSE,
+ FUNC_MAX,
};
protected:
@@ -1092,7 +1107,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_function(Function p_op);
+ void set_function(Function p_func);
Function get_function() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -1201,7 +1216,7 @@ public:
virtual PortType get_output_port_type(int p_port) const override;
virtual String get_output_port_name(int p_port) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -1224,7 +1239,8 @@ public:
enum Function {
FUNC_SUM,
FUNC_X,
- FUNC_Y
+ FUNC_Y,
+ FUNC_MAX,
};
protected:
@@ -1264,7 +1280,8 @@ public:
enum Function {
FUNC_SUM,
FUNC_X,
- FUNC_Y
+ FUNC_Y,
+ FUNC_MAX,
};
protected:
@@ -1371,7 +1388,7 @@ public:
virtual PortType get_output_port_type(int p_port) const override;
virtual String get_output_port_name(int p_port) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -1413,7 +1430,7 @@ public:
virtual PortType get_output_port_type(int p_port) const override;
virtual String get_output_port_name(int p_port) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -1501,7 +1518,7 @@ public:
virtual PortType get_output_port_type(int p_port) const override;
virtual String get_output_port_name(int p_port) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -1613,6 +1630,7 @@ public:
HINT_NONE,
HINT_RANGE,
HINT_RANGE_STEP,
+ HINT_MAX,
};
private:
@@ -1679,6 +1697,7 @@ public:
HINT_NONE,
HINT_RANGE,
HINT_RANGE_STEP,
+ HINT_MAX,
};
private:
@@ -1919,11 +1938,13 @@ public:
TYPE_COLOR,
TYPE_NORMAL_MAP,
TYPE_ANISO,
+ TYPE_MAX,
};
enum ColorDefault {
COLOR_DEFAULT_WHITE,
- COLOR_DEFAULT_BLACK
+ COLOR_DEFAULT_BLACK,
+ COLOR_DEFAULT_MAX,
};
protected:
@@ -2113,7 +2134,7 @@ public:
virtual PortType get_output_port_type(int p_port) const override;
virtual String get_output_port_name(int p_port) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
@@ -2161,6 +2182,7 @@ public:
enum Function {
FUNC_IS_INF,
FUNC_IS_NAN,
+ FUNC_MAX,
};
protected:
@@ -2206,6 +2228,7 @@ public:
CTYPE_VECTOR,
CTYPE_BOOLEAN,
CTYPE_TRANSFORM,
+ CTYPE_MAX,
};
enum Function {
@@ -2215,15 +2238,17 @@ public:
FUNC_GREATER_THAN_EQUAL,
FUNC_LESS_THAN,
FUNC_LESS_THAN_EQUAL,
+ FUNC_MAX,
};
enum Condition {
COND_ALL,
COND_ANY,
+ COND_MAX,
};
protected:
- ComparisonType ctype = CTYPE_SCALAR;
+ ComparisonType comparison_type = CTYPE_SCALAR;
Function func = FUNC_EQUAL;
Condition condition = COND_ALL;
@@ -2291,7 +2316,7 @@ public:
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_op_type(OpType p_type);
+ void set_op_type(OpType p_op_type);
OpType get_op_type() const;
virtual Vector<StringName> get_editable_properties() const override;
diff --git a/scene/resources/visual_shader_particle_nodes.cpp b/scene/resources/visual_shader_particle_nodes.cpp
index 2250cf8d95..5fe801e037 100644
--- a/scene/resources/visual_shader_particle_nodes.cpp
+++ b/scene/resources/visual_shader_particle_nodes.cpp
@@ -402,15 +402,16 @@ String VisualShaderNodeParticleRandomness::generate_code(Shader::Mode p_mode, Vi
}
void VisualShaderNodeParticleRandomness::set_op_type(OpType p_op_type) {
- ERR_FAIL_INDEX((int)p_op_type, OP_TYPE_MAX);
- if (p_op_type != op_type) {
- if (p_op_type == OP_TYPE_SCALAR) {
- set_input_port_default_value(0, 0.0);
- set_input_port_default_value(1, 1.0);
- } else {
- set_input_port_default_value(0, Vector3(-1.0, -1.0, -1.0));
- set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0));
- }
+ ERR_FAIL_INDEX(int(p_op_type), int(OP_TYPE_MAX));
+ if (op_type == p_op_type) {
+ return;
+ }
+ if (p_op_type == OP_TYPE_SCALAR) {
+ set_input_port_default_value(0, 0.0);
+ set_input_port_default_value(1, 1.0);
+ } else {
+ set_input_port_default_value(0, Vector3(-1.0, -1.0, -1.0));
+ set_input_port_default_value(1, Vector3(1.0, 1.0, 1.0));
}
op_type = p_op_type;
emit_changed();
@@ -500,8 +501,6 @@ String VisualShaderNodeParticleAccelerator::generate_code(Shader::Mode p_mode, V
code += " __vec3_buff1 = cross(__ndiff, normalize(" + (p_input_vars[2].is_empty() ? "vec3" + (String)get_input_port_default_value(2) : p_input_vars[2]) + "));\n";
code += " " + p_output_vars[0] + " = length(__vec3_buff1) > 0.0 ? normalize(__vec3_buff1) * (" + (p_input_vars[0].is_empty() ? "vec3" + (String)get_input_port_default_value(0) : p_input_vars[0]) + " * mix(1.0, __rand_from_seed(__seed), " + (p_input_vars[1].is_empty() ? (String)get_input_port_default_value(1) : p_input_vars[1]) + ")) : vec3(0.0);\n";
break;
- case MODE_MAX:
- break;
default:
break;
}
@@ -510,6 +509,10 @@ String VisualShaderNodeParticleAccelerator::generate_code(Shader::Mode p_mode, V
}
void VisualShaderNodeParticleAccelerator::set_mode(Mode p_mode) {
+ ERR_FAIL_INDEX(int(p_mode), int(MODE_MAX));
+ if (mode == p_mode) {
+ return;
+ }
mode = p_mode;
emit_changed();
}
diff --git a/scene/resources/visual_shader_particle_nodes.h b/scene/resources/visual_shader_particle_nodes.h
index ecd187a885..f5435c3511 100644
--- a/scene/resources/visual_shader_particle_nodes.h
+++ b/scene/resources/visual_shader_particle_nodes.h
@@ -181,8 +181,8 @@ VARIANT_ENUM_CAST(VisualShaderNodeParticleRandomness::OpType)
// Process nodes
-class VisualShaderNodeParticleAccelerator : public VisualShaderNodeOutput {
- GDCLASS(VisualShaderNodeParticleAccelerator, VisualShaderNodeOutput);
+class VisualShaderNodeParticleAccelerator : public VisualShaderNode {
+ GDCLASS(VisualShaderNodeParticleAccelerator, VisualShaderNode);
public:
enum Mode {