Added virtual method to VisualShaderNodeCustom to enable high-end mark
This commit is contained in:
parent
3bc7fe5f1c
commit
bc647393ba
4 changed files with 19 additions and 3 deletions
|
@ -143,6 +143,14 @@
|
||||||
Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the root of the main category (see [method _get_category]).
|
Defining this method is [b]optional[/b]. If not overridden, the node will be filed under the root of the main category (see [method _get_category]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="_is_highend" qualifiers="virtual">
|
||||||
|
<return type="bool">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
Override this method to enable high-end mark in the Visual Shader Editor's members dialog.
|
||||||
|
Defining this method is [b]optional[/b]. If not overridden, it's false.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
<constants>
|
<constants>
|
||||||
</constants>
|
</constants>
|
||||||
|
|
|
@ -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_name.is_valid_identifier());
|
||||||
ERR_FAIL_COND(!p_script.is_valid());
|
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.description = p_description;
|
||||||
ao.category = p_category;
|
ao.category = p_category;
|
||||||
ao.sub_category = p_subcategory;
|
ao.sub_category = p_subcategory;
|
||||||
|
ao.highend = p_highend;
|
||||||
ao.is_custom = true;
|
ao.is_custom = true;
|
||||||
|
|
||||||
bool begin = false;
|
bool begin = false;
|
||||||
|
@ -247,6 +248,11 @@ void VisualShaderEditor::update_custom_nodes() {
|
||||||
subcategory = (String)ref->call("_get_subcategory");
|
subcategory = (String)ref->call("_get_subcategory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool highend = false;
|
||||||
|
if (ref->has_method("_is_highend")) {
|
||||||
|
highend = (bool)ref->call("_is_highend");
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary dict;
|
Dictionary dict;
|
||||||
dict["name"] = name;
|
dict["name"] = name;
|
||||||
dict["script"] = script;
|
dict["script"] = script;
|
||||||
|
@ -254,6 +260,7 @@ void VisualShaderEditor::update_custom_nodes() {
|
||||||
dict["return_icon_type"] = return_icon_type;
|
dict["return_icon_type"] = return_icon_type;
|
||||||
dict["category"] = category;
|
dict["category"] = category;
|
||||||
dict["subcategory"] = subcategory;
|
dict["subcategory"] = subcategory;
|
||||||
|
dict["highend"] = highend;
|
||||||
|
|
||||||
String key;
|
String key;
|
||||||
key = category;
|
key = category;
|
||||||
|
@ -277,7 +284,7 @@ void VisualShaderEditor::update_custom_nodes() {
|
||||||
|
|
||||||
const Dictionary &value = (Dictionary)added[key];
|
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();
|
_update_options_menu();
|
||||||
|
|
|
@ -265,7 +265,7 @@ public:
|
||||||
static VisualShaderEditor *get_singleton() { return singleton; }
|
static VisualShaderEditor *get_singleton() { return singleton; }
|
||||||
|
|
||||||
void clear_custom_types();
|
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;
|
virtual Size2 get_minimum_size() const;
|
||||||
void edit(VisualShader *p_visual_shader);
|
void edit(VisualShader *p_visual_shader);
|
||||||
|
|
|
@ -276,6 +276,7 @@ void VisualShaderNodeCustom::_bind_methods() {
|
||||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_port_name", PropertyInfo(Variant::INT, "port")));
|
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_output_port_name", PropertyInfo(Variant::INT, "port")));
|
||||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_code", PropertyInfo(Variant::ARRAY, "input_vars"), PropertyInfo(Variant::ARRAY, "output_vars"), PropertyInfo(Variant::INT, "mode"), PropertyInfo(Variant::INT, "type")));
|
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_code", PropertyInfo(Variant::ARRAY, "input_vars"), PropertyInfo(Variant::ARRAY, "output_vars"), PropertyInfo(Variant::INT, "mode"), PropertyInfo(Variant::INT, "type")));
|
||||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_global_code", PropertyInfo(Variant::INT, "mode")));
|
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_global_code", PropertyInfo(Variant::INT, "mode")));
|
||||||
|
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_highend"));
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualShaderNodeCustom::VisualShaderNodeCustom() {
|
VisualShaderNodeCustom::VisualShaderNodeCustom() {
|
||||||
|
|
Loading…
Reference in a new issue