summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Node.xml9
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp17
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h2
-rw-r--r--drivers/vulkan/vulkan_context.cpp2
-rw-r--r--editor/code_editor.cpp10
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_themes.cpp3
-rw-r--r--editor/import_dock.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp1
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp11
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/scene_tree_dock.cpp6
-rw-r--r--modules/visual_script/visual_script_editor.cpp2
-rw-r--r--scene/gui/control.cpp4
-rw-r--r--scene/main/canvas_layer.cpp8
-rw-r--r--scene/main/instance_placeholder.cpp2
-rw-r--r--scene/main/node.cpp11
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/resources/visual_shader.cpp11
-rw-r--r--scene/resources/visual_shader.h2
21 files changed, 69 insertions, 46 deletions
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index d7bff83575..8c588f0373 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -238,7 +238,7 @@
<return type="int">
</return>
<description>
- Returns the node's index, i.e. its position among the siblings of its parent.
+ Returns the node's order in the scene tree branch. For example, if called on the first child node the position is [code]0[/code].
</description>
</method>
<method name="get_network_master" qualifiers="const">
@@ -331,13 +331,6 @@
Returns the time elapsed since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.iterations_per_second].
</description>
</method>
- <method name="get_position_in_parent" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the node's order in the scene tree branch. For example, if called on the first child node the position is [code]0[/code].
- </description>
- </method>
<method name="get_process_delta_time" qualifiers="const">
<return type="float">
</return>
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 69957d9939..5e4143c960 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "rendering_device_vulkan.h"
+
#include "core/hashfuncs.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
@@ -1265,7 +1266,7 @@ Error RenderingDeviceVulkan::_buffer_free(Buffer *p_buffer) {
ERR_FAIL_COND_V(p_buffer->size == 0, ERR_INVALID_PARAMETER);
vmaDestroyBuffer(allocator, p_buffer->buffer, p_buffer->allocation);
- p_buffer->buffer = nullptr;
+ p_buffer->buffer = VK_NULL_HANDLE;
p_buffer->allocation = nullptr;
p_buffer->size = 0;
@@ -4250,7 +4251,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
VkWriteDescriptorSet write; //common header
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
write.pNext = nullptr;
- write.dstSet = nullptr; //will assign afterwards when everything is valid
+ write.dstSet = VK_NULL_HANDLE; //will assign afterwards when everything is valid
write.dstBinding = set_uniform.binding;
uint32_t type_size = 1;
@@ -4363,7 +4364,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
"Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_SAMPLING_BIT usage flag set in order to be used as uniform.");
VkDescriptorImageInfo img_info;
- img_info.sampler = nullptr;
+ img_info.sampler = VK_NULL_HANDLE;
img_info.imageView = texture->view;
if (texture->usage_flags & (TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | TEXTURE_USAGE_RESOLVE_ATTACHMENT_BIT)) {
@@ -4416,7 +4417,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
"Image (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_STORAGE_BIT usage flag set in order to be used as uniform.");
VkDescriptorImageInfo img_info;
- img_info.sampler = nullptr;
+ img_info.sampler = VK_NULL_HANDLE;
img_info.imageView = texture->view;
if (texture->owner.is_valid()) {
@@ -5048,11 +5049,11 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
graphics_pipeline_create_info.renderPass = fb_format.render_pass;
graphics_pipeline_create_info.subpass = 0;
- graphics_pipeline_create_info.basePipelineHandle = nullptr;
+ graphics_pipeline_create_info.basePipelineHandle = VK_NULL_HANDLE;
graphics_pipeline_create_info.basePipelineIndex = 0;
RenderPipeline pipeline;
- VkResult err = vkCreateGraphicsPipelines(device, nullptr, 1, &graphics_pipeline_create_info, nullptr, &pipeline.pipeline);
+ VkResult err = vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &graphics_pipeline_create_info, nullptr, &pipeline.pipeline);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateGraphicsPipelines failed with error " + itos(err) + ".");
pipeline.set_formats = shader->set_formats;
@@ -5121,11 +5122,11 @@ RID RenderingDeviceVulkan::compute_pipeline_create(RID p_shader) {
compute_pipeline_create_info.stage = shader->pipeline_stages[0];
compute_pipeline_create_info.layout = shader->pipeline_layout;
- compute_pipeline_create_info.basePipelineHandle = nullptr;
+ compute_pipeline_create_info.basePipelineHandle = VK_NULL_HANDLE;
compute_pipeline_create_info.basePipelineIndex = 0;
ComputePipeline pipeline;
- VkResult err = vkCreateComputePipelines(device, nullptr, 1, &compute_pipeline_create_info, nullptr, &pipeline.pipeline);
+ VkResult err = vkCreateComputePipelines(device, VK_NULL_HANDLE, 1, &compute_pipeline_create_info, nullptr, &pipeline.pipeline);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateComputePipelines failed with error " + itos(err) + ".");
pipeline.set_formats = shader->set_formats;
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 208109bba3..a46b80e2f4 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -207,7 +207,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkDescriptorBufferInfo buffer_info; //used for binding
Buffer() {
size = 0;
- buffer = nullptr;
+ buffer = VK_NULL_HANDLE;
allocation = nullptr;
}
};
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index d3666bca52..68b4cdf4a4 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -937,7 +937,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
/*compositeAlpha*/ compositeAlpha,
/*presentMode*/ swapchainPresentMode,
/*clipped*/ true,
- /*oldSwapchain*/ nullptr,
+ /*oldSwapchain*/ VK_NULL_HANDLE,
};
err = fpCreateSwapchainKHR(device, &swapchain_ci, nullptr, &window->swapchain);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 157a9cdca7..77e20b971c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -226,6 +226,10 @@ void FindReplaceBar::_replace_all() {
text_edit->begin_complex_operation();
+ if (selection_enabled && is_selection_only()) {
+ text_edit->cursor_set_line(selection_begin.width);
+ text_edit->cursor_set_column(selection_begin.height);
+ }
if (search_current()) {
do {
// replace area
@@ -243,7 +247,7 @@ void FindReplaceBar::_replace_all() {
if (selection_enabled && is_selection_only()) {
if (match_from < selection_begin || match_to > selection_end) {
- continue;
+ break; // Done.
}
// Replace but adjust selection bounds.
@@ -289,6 +293,10 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
r_line = text_edit->cursor_get_line();
r_col = text_edit->cursor_get_column();
+ if (text_edit->is_selection_active() && is_selection_only()) {
+ return;
+ }
+
if (r_line == result_line && r_col >= result_col && r_col <= result_col + get_search_text().length()) {
r_col = result_col;
}
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 1f3ff1b332..cf478f20e5 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2196,7 +2196,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
file_system_dock->navigate_to_path(res->get_path());
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_position_in_parent());
+ tab_container->set_current_tab(file_system_dock->get_index());
} break;
default: {
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 663068b2b5..a9af29ddf2 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -997,6 +997,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// LinkButton
theme->set_stylebox("focus", "LinkButton", style_empty);
theme->set_color("font_color", "LinkButton", font_color);
+ theme->set_color("font_color_hover", "LinkButton", font_color_hl);
+ theme->set_color("font_color_pressed", "LinkButton", accent_color);
+ theme->set_color("font_color_disabled", "LinkButton", font_color_disabled);
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 23be42aaea..22f6aedeaa 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -450,8 +450,8 @@ void ImportDock::_reimport() {
String importer_name = params->importer->get_importer_name();
- if (params->checking) {
- //update only what edited (checkboxes)
+ if (params->checking && config->get_value("remap", "importer") == params->importer->get_importer_name()) {
+ //update only what is edited (checkboxes) if the importer is the same
for (List<PropertyInfo>::Element *E = params->properties.front(); E; E = E->next()) {
if (params->checked.has(E->get().name)) {
config->set_value("params", E->get().name, params->values[E->get().name]);
@@ -558,7 +558,7 @@ ImportDock::ImportDock() {
hb->add_spacer();
reimport_confirm = memnew(ConfirmationDialog);
- reimport_confirm->get_ok()->set_text(TTR("Save scenes, re-import and restart"));
+ reimport_confirm->get_ok()->set_text(TTR("Save Scenes, Re-Import, and Restart"));
add_child(reimport_confirm);
reimport_confirm->connect("confirmed", callable_mp(this, &ImportDock::_reimport_and_restart));
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index dd80fff008..0b97ade278 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1243,7 +1243,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_system_dock->navigate_to_path(path);
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_position_in_parent());
+ tab_container->set_current_tab(file_system_dock->get_index());
}
} break;
case CLOSE_DOCS: {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index cd69c1e6f9..8892d13f51 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -1030,6 +1030,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
hscroll->connect("value_changed", callable_mp(this, &TextureRegionEditor::_scroll_changed));
updating_scroll = false;
+ autoslice_is_dirty = true;
}
void TextureRegionEditorPlugin::edit(Object *p_object) {
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index b1bd6392d8..294ce2c4cd 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -556,6 +556,17 @@ void VisualShaderEditor::_update_graph() {
uniform_name->connect("text_entered", callable_mp(this, &VisualShaderEditor::_line_edit_changed), varray(uniform_name, nodes[n_i]));
uniform_name->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_line_edit_focus_out), varray(uniform_name, nodes[n_i]));
+ String error = vsnode->get_warning(visual_shader->get_mode(), type);
+ if (error != String()) {
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 4 * EDSCALE));
+ node->add_child(offset);
+ Label *error_label = memnew(Label);
+ error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
+ error_label->set_text(error);
+ node->add_child(error_label);
+ }
+
if (vsnode->get_input_port_count() == 0 && vsnode->get_output_port_count() == 1 && vsnode->get_output_port_name(0) == "") {
//shortcut
VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 444cae42c5..978c95b9c8 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -257,7 +257,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
file_system_dock->navigate_to_path(r->get_path());
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_position_in_parent());
+ tab_container->set_current_tab(file_system_dock->get_index());
} break;
default: {
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index eaefd04c6b..a729f62123 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1535,7 +1535,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
if (p_nodes[ni] == p_new_parent)
return; // Attempt to reparent to itself.
- if (p_nodes[ni]->get_parent() != p_new_parent || p_position_in_parent + ni != p_nodes[ni]->get_position_in_parent())
+ if (p_nodes[ni]->get_parent() != p_new_parent || p_position_in_parent + ni != p_nodes[ni]->get_index())
no_change = false;
}
@@ -1644,7 +1644,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
owners.push_back(E->get());
}
- int child_pos = node->get_position_in_parent();
+ int child_pos = node->get_index();
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node);
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "move_child", node, child_pos);
@@ -1918,7 +1918,7 @@ Node *SceneTreeDock::_get_selection_group_tail(Node *p_node, List<Node *> p_list
Node *tail = p_node;
Node *parent = tail->get_parent();
- for (int i = p_node->get_position_in_parent(); i < parent->get_child_count(); i++) {
+ for (int i = p_node->get_index(); i < parent->get_child_count(); i++) {
Node *sibling = parent->get_child(i);
if (p_list.find(sibling))
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 30522930c7..ab528fac30 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -1262,7 +1262,7 @@ void VisualScriptEditor::_add_func_input() {
}
func_input_vbox->add_child(hbox);
- hbox->set_meta("id", hbox->get_position_in_parent());
+ hbox->set_meta("id", hbox->get_index());
delete_button->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_func_input), varray(hbox));
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 775f863a4f..b4dc37c74f 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1893,7 +1893,7 @@ static Control *_next_control(Control *p_from) {
return nullptr;
}
- int next = p_from->get_position_in_parent();
+ int next = p_from->get_index();
ERR_FAIL_INDEX_V(next, parent->get_child_count(), nullptr);
for (int i = (next + 1); i < parent->get_child_count(); i++) {
@@ -2032,7 +2032,7 @@ Control *Control::find_prev_valid_focus() const {
} else {
- for (int i = (from->get_position_in_parent() - 1); i >= 0; i--) {
+ for (int i = (from->get_index() - 1); i >= 0; i--) {
Control *c = Object::cast_to<Control>(from->get_parent()->get_child(i));
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index 15f64390de..c1caa943e3 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -35,7 +35,7 @@ void CanvasLayer::set_layer(int p_xform) {
layer = p_xform;
if (viewport.is_valid())
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
}
int CanvasLayer::get_layer() const {
@@ -151,7 +151,7 @@ void CanvasLayer::_notification(int p_what) {
viewport = vp->get_viewport_rid();
RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
_update_follow_viewport();
@@ -167,7 +167,7 @@ void CanvasLayer::_notification(int p_what) {
case NOTIFICATION_MOVED_IN_PARENT: {
if (is_inside_tree())
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
} break;
}
@@ -214,7 +214,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) {
viewport = vp->get_viewport_rid();
RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
- RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent());
+ RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_index());
RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
}
}
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 78958a7a1c..062b221c84 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -95,7 +95,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
if (!scene)
return nullptr;
scene->set_name(get_name());
- int pos = get_position_in_parent();
+ int pos = get_index();
for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
scene->set(E->get().name, E->get().value);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 6b46ffd8ad..50f3bf834f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1268,7 +1268,7 @@ void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_uniq
add_child(p_child, p_legible_unique_name);
if (is_a_parent_of(p_node)) {
- move_child(p_child, p_node->get_position_in_parent() + 1);
+ move_child(p_child, p_node->get_index() + 1);
} else {
WARN_PRINT("Cannot move under node " + p_node->get_name() + " as " + p_child->get_name() + " does not share a parent.");
}
@@ -1918,6 +1918,7 @@ int Node::get_index() const {
return data.pos;
}
+
void Node::remove_and_skip() {
ERR_FAIL_COND(!data.parent);
@@ -2042,11 +2043,6 @@ bool Node::get_scene_instance_load_placeholder() const {
return data.use_placeholder;
}
-int Node::get_position_in_parent() const {
-
- return data.pos;
-}
-
Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const {
Node *node = nullptr;
@@ -2215,7 +2211,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
}
parent->add_child(dup);
- int pos = E->get()->get_position_in_parent();
+ int pos = E->get()->get_index();
if (pos < parent->get_child_count() - 1) {
@@ -2860,7 +2856,6 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_pause_mode"), &Node::get_pause_mode);
ClassDB::bind_method(D_METHOD("can_process"), &Node::can_process);
ClassDB::bind_method(D_METHOD("print_stray_nodes"), &Node::_print_stray_nodes);
- ClassDB::bind_method(D_METHOD("get_position_in_parent"), &Node::get_position_in_parent);
ClassDB::bind_method(D_METHOD("set_display_folded", "fold"), &Node::set_display_folded);
ClassDB::bind_method(D_METHOD("is_displayed_folded"), &Node::is_displayed_folded);
diff --git a/scene/main/node.h b/scene/main/node.h
index 292ec0e291..5de07d506e 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -369,8 +369,6 @@ public:
void set_process_unhandled_key_input(bool p_enable);
bool is_processing_unhandled_key_input() const;
- int get_position_in_parent() const;
-
Node *duplicate(int p_flags = DUPLICATE_GROUPS | DUPLICATE_SIGNALS | DUPLICATE_SCRIPTS) const;
Node *duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const;
#ifdef TOOLS_ENABLED
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index f70f54412b..310a7ef4e4 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2164,6 +2164,17 @@ void VisualShaderNodeUniform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "uniform_name"), "set_uniform_name", "get_uniform_name");
}
+String VisualShaderNodeUniform::get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const {
+
+ List<String> keyword_list;
+ ShaderLanguage::get_keyword_list(&keyword_list);
+ if (keyword_list.find(uniform_name)) {
+ return TTR("Uniform name cannot be equal to a shader keyword. Choose another name.");
+ }
+
+ return String();
+}
+
VisualShaderNodeUniform::VisualShaderNodeUniform() {
}
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 450dcfa081..ecf3f93fbb 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -379,6 +379,8 @@ public:
void set_uniform_name(const String &p_name);
String get_uniform_name() const;
+ virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const;
+
VisualShaderNodeUniform();
};