summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-08-02 21:55:50 +0300
committerGitHub <noreply@github.com>2021-08-02 21:55:50 +0300
commitbd6b7c4b0ffef9176e89d5654f1d52aeab085602 (patch)
tree681dced2d6221a48ac09f3d933e01998ee50e51a /editor
parent610fbc556a9968f6ccb5f5e6b3a858b39f0b9aa0 (diff)
parent94c6817b51fa175a337420cd18cb9313fbc5889b (diff)
Merge pull request #51144 from Chaosus/vs_version
Makes dictionary instead of string for visual shader version
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 07167ae199..b35782ed17 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -35,7 +35,6 @@
#include "core/io/resource_loader.h"
#include "core/math/math_defs.h"
#include "core/os/keyboard.h"
-#include "core/version.h"
#include "editor/editor_log.h"
#include "editor/editor_properties.h"
#include "editor/editor_scale.h"
@@ -999,9 +998,23 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) {
visual_shader->connect("changed", callable_mp(this, &VisualShaderEditor::_update_preview));
}
#ifndef DISABLE_DEPRECATED
- String version = VERSION_BRANCH;
- if (visual_shader->get_version() != version) {
- visual_shader->update_version(version);
+ Dictionary engine_version = Engine::get_singleton()->get_version_info();
+ static Array components;
+ if (components.is_empty()) {
+ components.push_back("major");
+ components.push_back("minor");
+ }
+ const Dictionary vs_version = visual_shader->get_engine_version();
+ if (!vs_version.has_all(components)) {
+ visual_shader->update_engine_version(engine_version);
+ } else {
+ for (int i = 0; i < components.size(); i++) {
+ if (vs_version[components[i]] != engine_version[components[i]]) {
+ visual_shader->update_engine_version(engine_version);
+ print_line(vformat(TTR("The shader (\"%s\") has been updated to correspond Godot %s.%s version."), visual_shader->get_path(), engine_version["major"], engine_version["minor"]));
+ break;
+ }
+ }
}
#endif
visual_shader->set_graph_offset(graph->get_scroll_ofs() / EDSCALE);