summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc/doc_data.cpp42
-rw-r--r--editor/doc/doc_data.h1
-rw-r--r--editor/editor_help.cpp66
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/editor_properties.cpp51
-rw-r--r--editor/editor_properties.h15
-rw-r--r--editor/editor_settings.cpp13
-rw-r--r--editor/editor_spin_slider.h3
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp5
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp200
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h9
-rwxr-xr-xeditor/translations/extract.py4
12 files changed, 305 insertions, 108 deletions
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 041f81d063..6ee07d3661 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -248,6 +248,28 @@ void DocData::generate(bool p_basic_types) {
prop.setter = setter;
prop.getter = getter;
+ Variant default_value = Variant();
+ bool default_value_valid = false;
+
+ if (ClassDB::can_instance(name)) {
+ default_value = ClassDB::class_get_default_property_value(name, E->get().name, &default_value_valid);
+ } else {
+ // Cannot get default value of classes that can't be instanced
+ List<StringName> inheriting_classes;
+ ClassDB::get_direct_inheriters_from_class(name, &inheriting_classes);
+ for (List<StringName>::Element *E2 = inheriting_classes.front(); E2; E2 = E2->next()) {
+ if (ClassDB::can_instance(E2->get())) {
+ default_value = ClassDB::class_get_default_property_value(E2->get(), E->get().name, &default_value_valid);
+ if (default_value_valid)
+ break;
+ }
+ }
+ }
+
+ if (default_value_valid) {
+ prop.default_value = default_value.get_construct_string();
+ }
+
bool found_type = false;
if (getter != StringName()) {
MethodBind *mb = ClassDB::get_method(name, getter);
@@ -412,6 +434,7 @@ void DocData::generate(bool p_basic_types) {
PropertyDoc pd;
pd.name = E->get();
pd.type = "int";
+ pd.default_value = itos(Theme::get_default()->get_constant(E->get(), cname));
c.theme_properties.push_back(pd);
}
@@ -422,6 +445,7 @@ void DocData::generate(bool p_basic_types) {
PropertyDoc pd;
pd.name = E->get();
pd.type = "Color";
+ pd.default_value = Variant(Theme::get_default()->get_color(E->get(), cname)).get_construct_string();
c.theme_properties.push_back(pd);
}
@@ -530,6 +554,7 @@ void DocData::generate(bool p_basic_types) {
PropertyDoc property;
property.name = pi.name;
property.type = Variant::get_type_name(pi.type);
+ property.default_value = v.get(pi.name).get_construct_string();
c.properties.push_back(property);
}
@@ -1063,12 +1088,15 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
for (int i = 0; i < c.properties.size(); i++) {
- String enum_text;
+ String additional_attributes;
if (c.properties[i].enumeration != String()) {
- enum_text = " enum=\"" + c.properties[i].enumeration + "\"";
+ additional_attributes += " enum=\"" + c.properties[i].enumeration + "\"";
+ }
+ if (c.properties[i].default_value != String()) {
+ additional_attributes += " default=\"" + c.properties[i].default_value.xml_escape(true) + "\"";
}
const PropertyDoc &p = c.properties[i];
- _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\"" + enum_text + ">");
+ _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\"" + additional_attributes + ">");
_write_string(f, 3, p.description.strip_edges().xml_escape());
_write_string(f, 2, "</member>");
}
@@ -1125,8 +1153,14 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
for (int i = 0; i < c.theme_properties.size(); i++) {
const PropertyDoc &p = c.theme_properties[i];
- _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\">");
+
+ if (p.default_value != "")
+ _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\" default=\"" + p.default_value.xml_escape(true) + "\">");
+ else
+ _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\">");
+
_write_string(f, 3, p.description.strip_edges().xml_escape());
+
_write_string(f, 2, "</theme_item>");
}
_write_string(f, 1, "</theme_items>");
diff --git a/editor/doc/doc_data.h b/editor/doc/doc_data.h
index d3844adb7e..3d5867dcca 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc/doc_data.h
@@ -73,6 +73,7 @@ public:
String enumeration;
String description;
String setter, getter;
+ String default_value;
bool operator<(const PropertyDoc &p_prop) const {
return name < p_prop.name;
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9918b655fb..ff50940842 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -48,9 +48,9 @@ void EditorHelp::_init_colors() {
text_color = get_color("default_color", "RichTextLabel");
headline_color = get_color("headline_color", "EditorHelp");
base_type_color = title_color.linear_interpolate(text_color, 0.5);
- comment_color = text_color * Color(1, 1, 1, 0.6);
+ comment_color = text_color * Color(1, 1, 1, 0.4);
symbol_color = comment_color;
- value_color = text_color * Color(1, 1, 1, 0.4);
+ value_color = text_color * Color(1, 1, 1, 0.6);
qualifier_color = text_color * Color(1, 1, 1, 0.8);
type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
@@ -258,9 +258,11 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
if (p_method.arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text("=");
+ class_desc->add_text(" = ");
class_desc->pop();
+ class_desc->push_color(value_color);
_add_text(_fix_constant(p_method.arguments[j].default_value));
+ class_desc->pop();
}
class_desc->pop();
@@ -471,23 +473,37 @@ void EditorHelp::_update_doc() {
if (cd.properties[i].description != "") {
describe = true;
}
+
class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+ class_desc->push_color(headline_color);
+
if (describe) {
class_desc->push_meta("@member " + cd.properties[i].name);
}
- class_desc->push_font(doc_code_font);
- class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
- class_desc->pop();
- class_desc->pop();
-
if (describe) {
class_desc->pop();
property_descr = true;
}
+ if (cd.properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop();
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.properties[i].default_value));
+ class_desc->pop();
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop();
+ }
+
+ class_desc->pop();
+ class_desc->pop();
+
class_desc->pop();
}
@@ -613,6 +629,19 @@ void EditorHelp::_update_doc() {
class_desc->push_color(headline_color);
_add_text(cd.theme_properties[i].name);
class_desc->pop();
+
+ if (cd.theme_properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop();
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.theme_properties[i].default_value));
+ class_desc->pop();
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop();
+ }
+
class_desc->pop();
if (cd.theme_properties[i].description != "") {
@@ -671,7 +700,7 @@ void EditorHelp::_update_doc() {
if (cd.signals[i].arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text("=");
+ class_desc->add_text(" = ");
class_desc->pop();
_add_text(cd.signals[i].arguments[j].default_value);
}
@@ -777,7 +806,7 @@ void EditorHelp::_update_doc() {
class_desc->add_text(" = ");
class_desc->pop();
class_desc->push_color(value_color);
- _add_text(enum_list[i].value);
+ _add_text(_fix_constant(enum_list[i].value));
class_desc->pop();
class_desc->pop();
if (enum_list[i].description != "") {
@@ -843,7 +872,7 @@ void EditorHelp::_update_doc() {
class_desc->add_text(" = ");
class_desc->pop();
class_desc->push_color(value_color);
- _add_text(constants[i].value);
+ _add_text(_fix_constant(constants[i].value));
class_desc->pop();
class_desc->pop();
@@ -963,6 +992,21 @@ void EditorHelp::_update_doc() {
class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
class_desc->pop(); // color
+
+ if (cd.properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop(); // color
+
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.properties[i].default_value));
+ class_desc->pop(); // color
+
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop(); // color
+ }
+
class_desc->pop(); // font
class_desc->pop(); // cell
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3d640b4d35..83d820ff0e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6342,6 +6342,10 @@ EditorNode::EditorNode() {
Ref<ParticlesMaterialConversionPlugin> particles_mat_convert;
particles_mat_convert.instance();
resource_conversion_plugins.push_back(particles_mat_convert);
+
+ Ref<VisualShaderConversionPlugin> vshader_convert;
+ vshader_convert.instance();
+ resource_conversion_plugins.push_back(vshader_convert);
}
update_spinner_step_msec = OS::get_singleton()->get_ticks_msec();
update_spinner_step_frame = Engine::get_singleton()->get_frames_drawn();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 8e4ec47435..659893a1b6 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "editor_properties.h"
+
#include "editor/editor_resource_preview.h"
#include "editor_node.h"
#include "editor_properties_array_dict.h"
@@ -925,6 +926,9 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
preset->set_global_position(easing_draw->get_global_transform().xform(mb->get_position()));
preset->popup();
}
+ if (mb.is_valid() && mb->is_doubleclick() && mb->get_button_index() == BUTTON_LEFT) {
+ _setup_spin();
+ }
Ref<InputEventMouseMotion> mm = p_ev;
@@ -963,7 +967,6 @@ void EditorPropertyEasing::_draw_easing() {
Size2 s = easing_draw->get_size();
Rect2 r(Point2(), s);
r = r.grow(3);
- //get_stylebox("normal", "LineEdit")->draw(ci, r);
int points = 48;
@@ -1006,6 +1009,31 @@ void EditorPropertyEasing::_set_preset(int p_preset) {
easing_draw->update();
}
+void EditorPropertyEasing::_setup_spin() {
+ setting = true;
+ spin->setup_and_show();
+ spin->get_line_edit()->set_text(rtos(get_edited_object()->get(get_edited_property())));
+ setting = false;
+ spin->show();
+}
+
+void EditorPropertyEasing::_spin_value_changed(double p_value) {
+ if (setting)
+ return;
+
+ // 0 is a singularity, but both positive and negative values
+ // are otherwise allowed. Enforce 0+ as workaround.
+ if (Math::is_zero_approx(p_value)) {
+ p_value = 0.00001;
+ }
+ emit_changed(get_edited_property(), p_value);
+ _spin_focus_exited();
+}
+
+void EditorPropertyEasing::_spin_focus_exited() {
+ spin->hide();
+}
+
void EditorPropertyEasing::setup(bool p_full, bool p_flip) {
flip = p_flip;
@@ -1028,9 +1056,6 @@ void EditorPropertyEasing::_notification(int p_what) {
}
easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2));
} break;
- case NOTIFICATION_RESIZED: {
-
- } break;
}
}
@@ -1039,6 +1064,9 @@ void EditorPropertyEasing::_bind_methods() {
ClassDB::bind_method("_draw_easing", &EditorPropertyEasing::_draw_easing);
ClassDB::bind_method("_drag_easing", &EditorPropertyEasing::_drag_easing);
ClassDB::bind_method("_set_preset", &EditorPropertyEasing::_set_preset);
+
+ ClassDB::bind_method("_spin_value_changed", &EditorPropertyEasing::_spin_value_changed);
+ ClassDB::bind_method("_spin_focus_exited", &EditorPropertyEasing::_spin_focus_exited);
}
EditorPropertyEasing::EditorPropertyEasing() {
@@ -1053,6 +1081,19 @@ EditorPropertyEasing::EditorPropertyEasing() {
add_child(preset);
preset->connect("id_pressed", this, "_set_preset");
+ spin = memnew(EditorSpinSlider);
+ spin->set_flat(true);
+ spin->set_min(-100);
+ spin->set_max(100);
+ spin->set_step(0);
+ spin->set_hide_slider(true);
+ spin->set_allow_lesser(true);
+ spin->set_allow_greater(true);
+ spin->connect("value_changed", this, "_spin_value_changed");
+ spin->get_line_edit()->connect("focus_exited", this, "_spin_focus_exited");
+ spin->hide();
+ add_child(spin);
+
flip = false;
full = false;
}
@@ -2808,6 +2849,7 @@ EditorPropertyResource::EditorPropertyResource() {
assign->set_drag_forwarding(this);
assign->connect("draw", this, "_button_draw");
hbc->add_child(assign);
+ add_focusable(assign);
preview = memnew(TextureRect);
preview->set_expand(true);
@@ -2828,6 +2870,7 @@ EditorPropertyResource::EditorPropertyResource() {
edit->connect("pressed", this, "_update_menu");
hbc->add_child(edit);
edit->connect("gui_input", this, "_button_input");
+ add_focusable(edit);
file = NULL;
scene_tree = NULL;
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 02d9349f2d..0a4a07cdc0 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -32,12 +32,12 @@
#define EDITOR_PROPERTIES_H
#include "editor/create_dialog.h"
-#include "editor/editor_file_system.h"
#include "editor/editor_inspector.h"
#include "editor/editor_spin_slider.h"
#include "editor/property_selector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/color_picker.h"
+#include "scene/gui/line_edit.h"
class EditorPropertyNil : public EditorProperty {
GDCLASS(EditorPropertyNil, EditorProperty);
@@ -308,7 +308,11 @@ class EditorPropertyEasing : public EditorProperty {
GDCLASS(EditorPropertyEasing, EditorProperty);
Control *easing_draw;
PopupMenu *preset;
+ EditorSpinSlider *spin;
+ bool setting;
+
bool full;
+ bool flip;
enum {
EASING_ZERO,
@@ -321,13 +325,16 @@ class EditorPropertyEasing : public EditorProperty {
};
- bool flip;
-
void _drag_easing(const Ref<InputEvent> &p_ev);
void _draw_easing();
- void _notification(int p_what);
void _set_preset(int);
+ void _setup_spin();
+ void _spin_value_changed(double p_value);
+ void _spin_focus_exited();
+
+ void _notification(int p_what);
+
protected:
static void _bind_methods();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8521c0c723..a36163f661 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1473,6 +1473,10 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
+ if (!EditorSettings::get_singleton()) {
+ return NULL;
+ }
+
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
if (!sc.is_valid()) {
ERR_EXPLAIN("Used ED_GET_SHORTCUT with invalid shortcut: " + p_path);
@@ -1508,6 +1512,15 @@ Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p
ie->set_metakey(bool(p_keycode & KEY_MASK_META));
}
+ if (!EditorSettings::get_singleton()) {
+ Ref<ShortCut> sc;
+ sc.instance();
+ sc->set_name(p_name);
+ sc->set_shortcut(ie);
+ sc->set_meta("original", ie);
+ return sc;
+ }
+
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
if (sc.is_valid()) {
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index 1523c20f48..d91380e175 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -102,6 +102,9 @@ public:
void set_custom_label_color(bool p_use_custom_label_color, Color p_custom_label_color);
+ void setup_and_show() { _focus_entered(); }
+ LineEdit *get_line_edit() { return value_input; }
+
virtual Size2 get_minimum_size() const;
EditorSpinSlider();
};
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 069d9d25ee..35cfdf15be 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -974,6 +974,7 @@ void TileSetEditor::_on_workspace_draw() {
workspace->draw_rect(region, c, false);
}
}
+ delete tiles;
if (edit_mode == EDITMODE_REGION) {
if (workspace_mode != WORKSPACE_EDIT) {
@@ -1068,6 +1069,7 @@ void TileSetEditor::_on_workspace_overlay_draw() {
c = Color(0.1, 0.1, 0.1);
workspace_overlay->draw_string(font, region.position, tile_id_name, c);
}
+ delete tiles;
}
int t_id = get_current_tile();
@@ -1115,10 +1117,12 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
set_current_tile(t_id);
workspace->update();
workspace_overlay->update();
+ delete tiles;
return;
}
}
}
+ delete tiles;
}
}
@@ -3118,6 +3122,7 @@ void TileSetEditor::update_workspace_minsize() {
workspace_min_size.y = region.position.y + region.size.y;
}
}
+ delete tiles;
workspace->set_custom_minimum_size(workspace_min_size + WORKSPACE_MARGIN * 2);
workspace_container->set_custom_minimum_size(workspace_min_size + WORKSPACE_MARGIN * 2);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index b4200d5662..e1929d7489 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -2049,23 +2049,23 @@ VisualShaderEditor::VisualShaderEditor() {
// INPUT
// SPATIAL-FOR-ALL
-
- add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", TTR("'camera' input parameter for all shader modes."), "camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", TTR("'inv_camera' input parameter for all shader modes."), "inv_camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", TTR("'inv_projection' input parameter for all shader modes."), "inv_projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Normal", "Input", "All", "VisualShaderNodeInput", TTR("'normal' input parameter for all shader modes."), "normal", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Projection", "Input", "All", "VisualShaderNodeInput", TTR("'projection' input parameter for all shader modes."), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", TTR("'time' input parameter for all shader modes."), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("ViewportSize", "Input", "All", "VisualShaderNodeInput", TTR("'viewport_size' input parameter for all shader modes."), "viewport_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("World", "Input", "All", "VisualShaderNodeInput", TTR("'world' input parameter for all shader modes."), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ const String input_param_shader_modes = "'%s' input parameter for all shader modes.";
+ add_options.push_back(AddOption("Camera", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "camera"), "camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("InvCamera", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "inv_camera"), "inv_camera", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("InvProjection", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "inv_projection"), "inv_projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Normal", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "normal"), "normal", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Projection", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "camera"), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ViewportSize", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "viewport_size"), "viewport_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("World", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "world"), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, -1, Shader::MODE_SPATIAL));
// CANVASITEM-FOR-ALL
- add_options.push_back(AddOption("Alpha", "Input", "All", "VisualShaderNodeInput", TTR("'alpha' input parameter for all shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("Color", "Input", "All", "VisualShaderNodeInput", TTR("'color' input parameter for all shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("TexturePixelSize", "Input", "All", "VisualShaderNodeInput", TTR("'texture_pixel_size' input parameter for all shader modes."), "texture_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", TTR("'time' input parameter for all shader modes."), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("UV", "Input", "All", "VisualShaderNodeInput", TTR("'uv' input parameter for all shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Alpha", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Color", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("TexturePixelSize", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "texture_pixel_size"), "texture_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Time", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, -1, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("UV", "Input", "All", "VisualShaderNodeInput", vformat(TTR(input_param_shader_modes), "uv"), "uv", VisualShaderNode::PORT_TYPE_VECTOR, -1, Shader::MODE_CANVAS_ITEM));
/////////////////
@@ -2073,81 +2073,88 @@ VisualShaderEditor::VisualShaderEditor() {
// SPATIAL INPUTS
- add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex and fragment shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", TTR("'binormal' input parameter for vertex and fragment shader modes."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Color", "Input", "Fragment", "VisualShaderNodeInput", TTR("'color' input parameter for vertex and fragment shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment shader mode."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment shader mode."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Side", "Input", "Fragment", "VisualShaderNodeInput", TTR("'side' input parameter for fragment shader mode."), "side", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Tangent", "Input", "Fragment", "VisualShaderNodeInput", TTR("'tangent' input parameter for vertex and fragment shader modes."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("UV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv' input parameter for vertex and fragment shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("UV2", "Input", "Fragment", "VisualShaderNodeInput", TTR("'uv2' input parameter for vertex and fragment shader modes."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Vertex", "Input", "Fragment", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex and fragment shader modes."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("View", "Input", "Fragment", "VisualShaderNodeInput", TTR("'view' input parameter for fragment and light shader modes."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
-
- add_options.push_back(AddOption("Albedo", "Input", "Light", "VisualShaderNodeInput", TTR("'albedo' input parameter for light shader mode."), "albedo", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Attenuation", "Input", "Light", "VisualShaderNodeInput", TTR("'attenuation' input parameter for light shader mode."), "attenuation", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Diffuse", "Input", "Light", "VisualShaderNodeInput", TTR("'diffuse' input parameter for light shader mode."), "diffuse", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Light", "Input", "Light", "VisualShaderNodeInput", TTR("'light' input parameter for light shader mode."), "light", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", TTR("'light_color' input parameter for light shader mode."), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Roughness", "Input", "Light", "VisualShaderNodeInput", TTR("'roughness' input parameter for light shader mode."), "roughness", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Specular", "Input", "Light", "VisualShaderNodeInput", TTR("'specular' input parameter for light shader mode."), "specular", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Transmission", "Input", "Light", "VisualShaderNodeInput", TTR("'transmission' input parameter for light shader mode."), "transmission", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("View", "Input", "Light", "VisualShaderNodeInput", TTR("'view' input parameter for fragment and light shader modes."), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
-
- add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex and fragment shader modes."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Binormal", "Input", "Vertex", "VisualShaderNodeInput", TTR("'binormal' input parameter for vertex and fragment shader modes."), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", TTR("'color' input parameter for vertex and fragment shader modes."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("ModelView", "Input", "Vertex", "VisualShaderNodeInput", TTR("'modelview' input parameter for vertex shader mode."), "modelview", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", TTR("'point_size' input parameter for vertex shader mode."), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Tangent", "Input", "Vertex", "VisualShaderNodeInput", TTR("'tangent' input parameter for vertex and fragment shader mode."), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("UV", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv' input parameter for vertex and fragment shader modes."), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("UV2", "Input", "Vertex", "VisualShaderNodeInput", TTR("'uv2' input parameter for vertex and fragment shader modes."), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
- add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex and fragment shader modes."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ const String input_param_for_vertex_and_fragment_shader_modes = "'%s' input parameter for vertex and fragment shader modes.";
+ const String input_param_for_fragment_and_light_shader_modes = "'%s' input parameter for fragment and light shader modes.";
+ const String input_param_for_fragment_shader_mode = "'%s' input parameter for fragment shader mode.";
+ const String input_param_for_light_shader_mode = "'%s' input parameter for light shader mode.";
+ const String input_param_for_vertex_shader_mode = "'%s' input parameter for vertex shader mode.";
+ const String input_param_for_vertex_and_fragment_shader_mode = "'%s' input parameter for vertex and fragment shader mode.";
+
+ add_options.push_back(AddOption("Alpha", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Binormal", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "binormal"), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Color", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_shader_mode), "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_shader_mode), "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Side", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_shader_mode), "side"), "side", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Tangent", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "tangent"), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "uv"), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV2", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "uv2"), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Vertex", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "vertex"), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("View", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "view"), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_SPATIAL));
+
+ add_options.push_back(AddOption("Albedo", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "albedo"), "albedo", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Attenuation", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "attenuation"), "attenuation", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Diffuse", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "diffuse"), "diffuse", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Light", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light"), "light", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_color"), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Roughness", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "roughness"), "roughness", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Specular", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "specular"), "specular", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Transmission", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "transmission"), "transmission", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("View", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "view"), "view", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_SPATIAL));
+
+ add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Binormal", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "binormal"), "binormal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("ModelView", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "modelview"), "modelview", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "point_size"), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Tangent", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_mode), "tangent"), "tangent", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "uv"), "uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("UV2", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "uv2"), "uv2", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
+ add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "vertex"), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_SPATIAL));
// CANVASITEM INPUTS
- add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightPass", "Input", "Fragment", "VisualShaderNodeInput", TTR("'light_pass' input parameter for vertex and fragment shader modes."), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment and light shader modes."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("ScreenPixelSize", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_pixel_size' input parameter for fragment shader mode."), "screen_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment and light shader modes."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
-
- add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'fragcoord' input parameter for fragment and light shader modes."), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightAlpha", "Input", "Light", "VisualShaderNodeInput", TTR("'light_alpha' input parameter for light shader mode."), "light_alpha", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", TTR("'light_color' input parameter for light shader mode."), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightHeight", "Input", "Light", "VisualShaderNodeInput", TTR("'light_height' input parameter for light shader mode."), "light_height", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightUV", "Input", "Light", "VisualShaderNodeInput", TTR("'light_uv' input parameter for light shader mode."), "light_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightVector", "Input", "Light", "VisualShaderNodeInput", TTR("'light_vec' input parameter for light shader mode."), "light_vec", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("Normal", "Input", "Light", "VisualShaderNodeInput", TTR("'normal' input parameter for light shader mode."), "normal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("PointCoord", "Input", "Light", "VisualShaderNodeInput", TTR("'point_coord' input parameter for fragment and light shader modes."), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("ScreenUV", "Input", "Light", "VisualShaderNodeInput", TTR("'screen_uv' input parameter for fragment and light shader modes."), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("ShadowColor", "Input", "Light", "VisualShaderNodeInput", TTR("'shadow_color' input parameter for light shader mode."), "shadow_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
-
- add_options.push_back(AddOption("Extra", "Input", "Vertex", "VisualShaderNodeInput", TTR("'extra' input parameter for vertex shader mode."), "extra", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("LightPass", "Input", "Vertex", "VisualShaderNodeInput", TTR("'light_pass' input parameter for vertex and fragment shader modes."), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", TTR("'point_size' input parameter for vertex shader mode."), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("Projection", "Input", "Vertex", "VisualShaderNodeInput", TTR("'projection' input parameter for vertex shader mode."), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", TTR("'vertex' input parameter for vertex shader mode."), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
- add_options.push_back(AddOption("World", "Input", "Vertex", "VisualShaderNodeInput", TTR("'world' input parameter for vertex shader mode."), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("FragCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightPass", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "light_pass"), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointCoord", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenPixelSize", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_shader_mode), "screen_pixel_size"), "screen_pixel_size", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Fragment", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_FRAGMENT, Shader::MODE_CANVAS_ITEM));
+
+ add_options.push_back(AddOption("FragCoord", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "fragcoord"), "fragcoord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightAlpha", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_alpha"), "light_alpha", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightColor", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_color"), "light_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightHeight", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_height"), "light_height", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightUV", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_uv"), "light_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightVector", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "light_vec"), "light_vec", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Normal", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "normal"), "normal", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointCoord", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "point_coord"), "point_coord", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ScreenUV", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_fragment_and_light_shader_modes), "screen_uv"), "screen_uv", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("ShadowColor", "Input", "Light", "VisualShaderNodeInput", vformat(TTR(input_param_for_light_shader_mode), "shadow_color"), "shadow_color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_LIGHT, Shader::MODE_CANVAS_ITEM));
+
+ add_options.push_back(AddOption("Extra", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "extra"), "extra", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("LightPass", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_and_fragment_shader_modes), "light_pass"), "light_pass", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("PointSize", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "point_size"), "point_size", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Projection", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "projection"), "projection", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("Vertex", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "vertex"), "vertex", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
+ add_options.push_back(AddOption("World", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "world"), "world", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_CANVAS_ITEM));
// PARTICLES INPUTS
- add_options.push_back(AddOption("Active", "Input", "Vertex", "VisualShaderNodeInput", TTR("'active' input parameter for vertex shader mode."), "active", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'alpha' input parameter for vertex shader mode."), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", TTR("'color' input parameter for vertex shader mode."), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Custom", "Input", "Vertex", "VisualShaderNodeInput", TTR("'custom' input parameter for vertex shader mode."), "custom", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("CustomAlpha", "Input", "Vertex", "VisualShaderNodeInput", TTR("'custom_alpha' input parameter for vertex shader mode."), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Delta", "Input", "Vertex", "VisualShaderNodeInput", TTR("'delta' input parameter for vertex shader mode."), "delta", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("EmissionTransform", "Input", "Vertex", "VisualShaderNodeInput", TTR("'emission_transform' input parameter for vertex shader mode."), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Index", "Input", "Vertex", "VisualShaderNodeInput", TTR("'index' input parameter for vertex shader mode."), "index", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("LifeTime", "Input", "Vertex", "VisualShaderNodeInput", TTR("'lifetime' input parameter for vertex shader mode."), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Restart", "Input", "Vertex", "VisualShaderNodeInput", TTR("'restart' input parameter for vertex shader mode."), "restart", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Time", "Input", "Vertex", "VisualShaderNodeInput", TTR("'time' input parameter for vertex shader mode."), "time", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Transform", "Input", "Vertex", "VisualShaderNodeInput", TTR("'transform' input parameter for vertex shader mode."), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
- add_options.push_back(AddOption("Velocity", "Input", "Vertex", "VisualShaderNodeInput", TTR("'velocity' input parameter for vertex shader mode."), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Active", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "active"), "active", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Alpha", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "alpha"), "alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Color", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "color"), "color", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Custom", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "custom"), "custom", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("CustomAlpha", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "custom_alpha"), "custom_alpha", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Delta", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "delta"), "delta", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("EmissionTransform", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "emission_transform"), "emission_transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Index", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "index"), "index", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("LifeTime", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "lifetime"), "lifetime", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Restart", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "restart"), "restart", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Time", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "time"), "time", VisualShaderNode::PORT_TYPE_SCALAR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Transform", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "transform"), "transform", VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
+ add_options.push_back(AddOption("Velocity", "Input", "Vertex", "VisualShaderNodeInput", vformat(TTR(input_param_for_vertex_shader_mode), "velocity"), "velocity", VisualShaderNode::PORT_TYPE_VECTOR, VisualShader::TYPE_VERTEX, Shader::MODE_PARTICLES));
// SCALAR
@@ -2764,3 +2771,30 @@ void VisualShaderNodePortPreview::_bind_methods() {
VisualShaderNodePortPreview::VisualShaderNodePortPreview() {
}
+
+//////////////////////////////////
+
+String VisualShaderConversionPlugin::converts_to() const {
+
+ return "Shader";
+}
+
+bool VisualShaderConversionPlugin::handles(const Ref<Resource> &p_resource) const {
+
+ Ref<VisualShader> vshader = p_resource;
+ return vshader.is_valid();
+}
+
+Ref<Resource> VisualShaderConversionPlugin::convert(const Ref<Resource> &p_resource) const {
+
+ Ref<VisualShader> vshader = p_resource;
+ ERR_FAIL_COND_V(!vshader.is_valid(), Ref<Resource>());
+
+ Ref<Shader> shader;
+ shader.instance();
+
+ String code = vshader->get_code();
+ shader->set_code(code);
+
+ return shader;
+}
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 49a7a21ea7..fa72b5ec29 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -302,4 +302,13 @@ public:
VisualShaderNodePortPreview();
};
+class VisualShaderConversionPlugin : public EditorResourceConversionPlugin {
+ GDCLASS(VisualShaderConversionPlugin, EditorResourceConversionPlugin);
+
+public:
+ virtual String converts_to() const;
+ virtual bool handles(const Ref<Resource> &p_resource) const;
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const;
+};
+
#endif // VISUAL_SHADER_EDITOR_PLUGIN_H
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index 70eb15da62..07b34f7562 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -116,7 +116,7 @@ shutil.move("editor.pot", "editor/translations/editor.pot")
# TODO: Make that in a portable way, if we care; if not, kudos to Unix users
if (os.name == "posix"):
- added = subprocess.check_output("git diff editor/translations/editor.pot | grep \+msgid | wc -l", shell=True)
- removed = subprocess.check_output("git diff editor/translations/editor.pot | grep \\\-msgid | wc -l", shell=True)
+ added = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \+msgid | wc -l", shell=True)
+ removed = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \\\-msgid | wc -l", shell=True)
print("\n# Template changes compared to the staged status:")
print("# Additions: %s msgids.\n# Deletions: %s msgids." % (int(added), int(removed)))