diff --git a/doc/classes/VisualShaderNodeScalarUniform.xml b/doc/classes/VisualShaderNodeScalarUniform.xml
index d1a47425559..fab766d3f92 100644
--- a/doc/classes/VisualShaderNodeScalarUniform.xml
+++ b/doc/classes/VisualShaderNodeScalarUniform.xml
@@ -1,13 +1,38 @@
+ A scalar uniform to be used within the visual shader graph.
+ Translated to [code]uniform float[/code] in the shader language.
+
+
+ A hint applied to the uniform, which controls the values it can take when set through the inspector.
+
+
+ Minimum value for range hints. Used if [member hint] is set to [constant HINT_RANGE] or [constant HINT_RANGE_STEP].
+
+
+ Maximum value for range hints. Used if [member hint] is set to [constant HINT_RANGE] or [constant HINT_RANGE_STEP].
+
+
+ Step (increment) value for the range hint with step. Used if [member hint] is set to [constant HINT_RANGE_STEP].
+
+
+
+ No hint used.
+
+
+ A range hint for scalar value, which limits possible input values between [member min] and [member max]. Translated to [code]hint_range(min, max)[/code] in shader code.
+
+
+ A range hint for scalar value with step, which limits possible input values between [member min] and [member max], with a step (increment) of [member step]). Translated to [code]hint_range(min, max, step)[/code] in shader code.
+
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index e334d4b0939..fb095692bca 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -556,6 +556,7 @@ void VisualShaderEditor::_update_graph() {
}
Ref uniform = vsnode;
+ Ref scalar_uniform = vsnode;
if (uniform.is_valid()) {
graph->add_child(node);
_update_created_node(node);
@@ -570,7 +571,9 @@ void VisualShaderEditor::_update_graph() {
//shortcut
VisualShaderNode::PortType port_right = vsnode->get_output_port_type(0);
node->set_slot(0, false, VisualShaderNode::PORT_TYPE_SCALAR, Color(), true, port_right, type_color[port_right]);
- continue;
+ if (!scalar_uniform.is_valid()) {
+ continue;
+ }
}
port_offset++;
}
@@ -582,11 +585,16 @@ void VisualShaderEditor::_update_graph() {
}
}
- if (custom_editor && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) {
+ if (custom_editor && !scalar_uniform.is_valid() && vsnode->get_output_port_count() > 0 && vsnode->get_output_port_name(0) == "" && (vsnode->get_input_port_count() == 0 || vsnode->get_input_port_name(0) == "")) {
//will be embedded in first port
} else if (custom_editor) {
+
port_offset++;
node->add_child(custom_editor);
+ if (scalar_uniform.is_valid()) {
+ custom_editor->call_deferred("_show_prop_names", true);
+ continue;
+ }
custom_editor = NULL;
}
@@ -2972,6 +2980,13 @@ public:
bool updating;
Ref node;
Vector properties;
+ Vector