summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-04-03 18:56:43 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-07-28 18:46:59 +0200
commit4b42379c8fb89c28a8c38e79ac3573f5b34f8fb4 (patch)
tree791d890cb434e4b67513518d3b6507e53b02065c /editor
parent2e05cc3314d0fd04f0e151ad0a827b34b28d8ece (diff)
downloadredot-engine-4b42379c8fb89c28a8c38e79ac3573f5b34f8fb4.tar.gz
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much easier to find the methods when searching in the class reference.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp10
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp8
-rw-r--r--editor/project_settings_editor.cpp8
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/shader_globals_editor.cpp36
6 files changed, 33 insertions, 33 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 37329c92f3..983b89c3b5 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1035,7 +1035,7 @@ void EditorNode::_sources_changed(bool p_exist) {
// Reload the global shader variables, but this time
// loading textures, as they are now properly imported.
- RenderingServer::get_singleton()->global_variables_load_settings(true);
+ RenderingServer::get_singleton()->global_shader_uniforms_load_settings(true);
// Start preview thread now that it's safe.
if (!singleton->cmdline_export_mode) {
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index bdf566e991..54c72e4d27 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -309,9 +309,9 @@ void ShaderTextEditor::_check_shader_mode() {
}
}
-static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
- RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
- return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt);
+static ShaderLanguage::DataType _get_global_shader_uniform_type(const StringName &p_variable) {
+ RS::GlobalShaderUniformType gvt = RS::get_singleton()->global_shader_uniform_get_type(p_variable);
+ return (ShaderLanguage::DataType)RS::global_shader_uniform_type_get_shader_datatype(gvt);
}
static String complete_from_path;
@@ -358,7 +358,7 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptLa
ShaderLanguage sl;
String calltip;
ShaderLanguage::ShaderCompileInfo info;
- info.global_variable_type_func = _get_global_variable_type;
+ info.global_shader_uniform_type_func = _get_global_shader_uniform_type;
if (shader.is_null()) {
info.is_include = true;
@@ -448,7 +448,7 @@ void ShaderTextEditor::_validate_script() {
sl.set_warning_flags(flags);
ShaderLanguage::ShaderCompileInfo info;
- info.global_variable_type_func = _get_global_variable_type;
+ info.global_shader_uniform_type_func = _get_global_shader_uniform_type;
if (shader.is_null()) {
info.is_include = true;
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 69a125a029..d6d45b8210 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -4563,9 +4563,9 @@ void VisualShaderEditor::_preview_size_changed() {
preview_vbox->set_custom_minimum_size(preview_window->get_size());
}
-static ShaderLanguage::DataType _get_global_variable_type(const StringName &p_variable) {
- RS::GlobalVariableType gvt = RS::get_singleton()->global_variable_get_type(p_variable);
- return (ShaderLanguage::DataType)RS::global_variable_type_get_shader_datatype(gvt);
+static ShaderLanguage::DataType _get_global_shader_uniform_type(const StringName &p_variable) {
+ RS::GlobalShaderUniformType gvt = RS::get_singleton()->global_shader_uniform_get_type(p_variable);
+ return (ShaderLanguage::DataType)RS::global_shader_uniform_type_get_shader_datatype(gvt);
}
void VisualShaderEditor::_update_preview() {
@@ -4582,7 +4582,7 @@ void VisualShaderEditor::_update_preview() {
info.functions = ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(visual_shader->get_mode()));
info.render_modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(visual_shader->get_mode()));
info.shader_types = ShaderTypes::get_singleton()->get_types();
- info.global_variable_type_func = _get_global_variable_type;
+ info.global_shader_uniform_type_func = _get_global_shader_uniform_type;
ShaderLanguage sl;
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 077dfc60c0..be1ad1ca9c 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -669,10 +669,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
autoload_settings->connect("autoload_changed", callable_mp(this, &ProjectSettingsEditor::queue_save));
tab_container->add_child(autoload_settings);
- shaders_global_variables_editor = memnew(ShaderGlobalsEditor);
- shaders_global_variables_editor->set_name(TTR("Shader Globals"));
- shaders_global_variables_editor->connect("globals_changed", callable_mp(this, &ProjectSettingsEditor::queue_save));
- tab_container->add_child(shaders_global_variables_editor);
+ shaders_global_shader_uniforms_editor = memnew(ShaderGlobalsEditor);
+ shaders_global_shader_uniforms_editor->set_name(TTR("Shader Globals"));
+ shaders_global_shader_uniforms_editor->connect("globals_changed", callable_mp(this, &ProjectSettingsEditor::queue_save));
+ tab_container->add_child(shaders_global_shader_uniforms_editor);
plugin_settings = memnew(EditorPluginSettings);
plugin_settings->set_name(TTR("Plugins"));
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 24d61db443..455aaae11c 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -55,7 +55,7 @@ class ProjectSettingsEditor : public AcceptDialog {
ActionMapEditor *action_map_editor = nullptr;
LocalizationEditor *localization_editor = nullptr;
EditorAutoloadSettings *autoload_settings = nullptr;
- ShaderGlobalsEditor *shaders_global_variables_editor = nullptr;
+ ShaderGlobalsEditor *shaders_global_shader_uniforms_editor = nullptr;
EditorPluginSettings *plugin_settings = nullptr;
LineEdit *search_box = nullptr;
diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp
index 26bd3a5979..5bf7e958f6 100644
--- a/editor/shader_globals_editor.cpp
+++ b/editor/shader_globals_editor.cpp
@@ -79,7 +79,7 @@ protected:
}
bool _set(const StringName &p_name, const Variant &p_value) {
- Variant existing = RS::get_singleton()->global_variable_get(p_name);
+ Variant existing = RS::get_singleton()->global_shader_uniform_get(p_name);
if (existing.get_type() == Variant::NIL) {
return false;
@@ -88,9 +88,9 @@ protected:
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo->create_action(TTR("Set Shader Global Variable"));
- undo_redo->add_do_method(RS::get_singleton(), "global_variable_set", p_name, p_value);
- undo_redo->add_undo_method(RS::get_singleton(), "global_variable_set", p_name, existing);
- RS::GlobalVariableType type = RS::get_singleton()->global_variable_get_type(p_name);
+ undo_redo->add_do_method(RS::get_singleton(), "global_shader_uniform_set", p_name, p_value);
+ undo_redo->add_undo_method(RS::get_singleton(), "global_shader_uniform_set", p_name, existing);
+ RS::GlobalShaderUniformType type = RS::get_singleton()->global_shader_uniform_get_type(p_name);
Dictionary gv;
gv["type"] = global_var_type_names[type];
if (type >= RS::GLOBAL_VAR_TYPE_SAMPLER2D) {
@@ -117,17 +117,17 @@ protected:
}
bool _get(const StringName &p_name, Variant &r_ret) const {
- r_ret = RS::get_singleton()->global_variable_get(p_name);
+ r_ret = RS::get_singleton()->global_shader_uniform_get(p_name);
return r_ret.get_type() != Variant::NIL;
}
void _get_property_list(List<PropertyInfo> *p_list) const {
Vector<StringName> variables;
- variables = RS::get_singleton()->global_variable_get_list();
+ variables = RS::get_singleton()->global_shader_uniform_get_list();
for (int i = 0; i < variables.size(); i++) {
PropertyInfo pinfo;
pinfo.name = variables[i];
- switch (RS::get_singleton()->global_variable_get_type(variables[i])) {
+ switch (RS::get_singleton()->global_shader_uniform_get_type(variables[i])) {
case RS::GLOBAL_VAR_TYPE_BOOL: {
pinfo.type = Variant::BOOL;
} break;
@@ -241,7 +241,7 @@ public:
}
};
-static Variant create_var(RS::GlobalVariableType p_type) {
+static Variant create_var(RS::GlobalShaderUniformType p_type) {
switch (p_type) {
case RS::GLOBAL_VAR_TYPE_BOOL: {
return false;
@@ -376,12 +376,12 @@ static Variant create_var(RS::GlobalVariableType p_type) {
void ShaderGlobalsEditor::_variable_added() {
String var = variable_name->get_text().strip_edges();
if (var.is_empty() || !var.is_valid_identifier()) {
- EditorNode::get_singleton()->show_warning(TTR("Please specify a valid variable identifier name."));
+ EditorNode::get_singleton()->show_warning(TTR("Please specify a valid shader uniform identifier name."));
return;
}
- if (RenderingServer::get_singleton()->global_variable_get(var).get_type() != Variant::NIL) {
- EditorNode::get_singleton()->show_warning(vformat(TTR("Global variable '%s' already exists'"), var));
+ if (RenderingServer::get_singleton()->global_shader_uniform_get(var).get_type() != Variant::NIL) {
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Global shader uniform '%s' already exists'"), var));
return;
}
@@ -395,11 +395,11 @@ void ShaderGlobalsEditor::_variable_added() {
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
- Variant value = create_var(RS::GlobalVariableType(variable_type->get_selected()));
+ Variant value = create_var(RS::GlobalShaderUniformType(variable_type->get_selected()));
- undo_redo->create_action(TTR("Add Shader Global Variable"));
- undo_redo->add_do_method(RS::get_singleton(), "global_variable_add", var, RS::GlobalVariableType(variable_type->get_selected()), value);
- undo_redo->add_undo_method(RS::get_singleton(), "global_variable_remove", var);
+ undo_redo->create_action(TTR("Add Shader Global Uniform"));
+ undo_redo->add_do_method(RS::get_singleton(), "global_shader_uniform_add", var, RS::GlobalShaderUniformType(variable_type->get_selected()), value);
+ undo_redo->add_undo_method(RS::get_singleton(), "global_shader_uniform_remove", var);
Dictionary gv;
gv["type"] = global_var_type_names[variable_type->get_selected()];
gv["value"] = value;
@@ -414,9 +414,9 @@ void ShaderGlobalsEditor::_variable_added() {
void ShaderGlobalsEditor::_variable_deleted(const String &p_variable) {
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
- undo_redo->create_action(TTR("Add Shader Global Variable"));
- undo_redo->add_do_method(RS::get_singleton(), "global_variable_remove", p_variable);
- undo_redo->add_undo_method(RS::get_singleton(), "global_variable_add", p_variable, RS::get_singleton()->global_variable_get_type(p_variable), RS::get_singleton()->global_variable_get(p_variable));
+ undo_redo->create_action(TTR("Add Shader Global Uniform"));
+ undo_redo->add_do_method(RS::get_singleton(), "global_shader_uniform_remove", p_variable);
+ undo_redo->add_undo_method(RS::get_singleton(), "global_shader_uniform_add", p_variable, RS::get_singleton()->global_shader_uniform_get_type(p_variable), RS::get_singleton()->global_shader_uniform_get(p_variable));
undo_redo->add_do_property(ProjectSettings::get_singleton(), "shader_globals/" + p_variable, Variant());
undo_redo->add_undo_property(ProjectSettings::get_singleton(), "shader_globals/" + p_variable, ProjectSettings::get_singleton()->get("shader_globals/" + p_variable));