summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-13 09:10:18 +0100
committerGitHub <noreply@github.com>2020-02-13 09:10:18 +0100
commitd661ca53575142582254f56afd5f92563db6dd9f (patch)
tree7e758134e420b0fe1073364af460fb2341698264 /editor
parent57dca8b8cc03265de7b8288620f095cb04d8c611 (diff)
parentbc647393ba043239ac18f4a7414f138a3117bd00 (diff)
Merge pull request #36172 from Chaosus/vs_custom_highend
Added virtual method to VisualShaderNodeCustom to enable high-end mark
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp11
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 438c640bab..ebd7b4edf6 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -116,7 +116,7 @@ void VisualShaderEditor::clear_custom_types() {
}
}
-void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory) {
+void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend) {
ERR_FAIL_COND(!p_name.is_valid_identifier());
ERR_FAIL_COND(!p_script.is_valid());
@@ -135,6 +135,7 @@ void VisualShaderEditor::add_custom_type(const String &p_name, const Ref<Script>
ao.description = p_description;
ao.category = p_category;
ao.sub_category = p_subcategory;
+ ao.highend = p_highend;
ao.is_custom = true;
bool begin = false;
@@ -247,6 +248,11 @@ void VisualShaderEditor::update_custom_nodes() {
subcategory = (String)ref->call("_get_subcategory");
}
+ bool highend = false;
+ if (ref->has_method("_is_highend")) {
+ highend = (bool)ref->call("_is_highend");
+ }
+
Dictionary dict;
dict["name"] = name;
dict["script"] = script;
@@ -254,6 +260,7 @@ void VisualShaderEditor::update_custom_nodes() {
dict["return_icon_type"] = return_icon_type;
dict["category"] = category;
dict["subcategory"] = subcategory;
+ dict["highend"] = highend;
String key;
key = category;
@@ -277,7 +284,7 @@ void VisualShaderEditor::update_custom_nodes() {
const Dictionary &value = (Dictionary)added[key];
- add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"]);
+ add_custom_type(value["name"], value["script"], value["description"], value["return_icon_type"], value["category"], value["subcategory"], value["highend"]);
}
_update_options_menu();
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index f4971ae36d..150cf16167 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -265,7 +265,7 @@ public:
static VisualShaderEditor *get_singleton() { return singleton; }
void clear_custom_types();
- void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory);
+ void add_custom_type(const String &p_name, const Ref<Script> &p_script, const String &p_description, int p_return_icon_type, const String &p_category, const String &p_subcategory, bool p_highend);
virtual Size2 get_minimum_size() const;
void edit(VisualShader *p_visual_shader);