diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-05-03 22:25:37 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-05-03 22:25:37 -0300 |
commit | 567cb691ec49844101247bb9dc34bc2722f6af4f (patch) | |
tree | caa577fdc22feec8869e66b32be34db0c90f8aa8 /tools/editor/plugins/shader_graph_editor_plugin.cpp | |
parent | c7e8def44696da9ddf0b459e166280668c84c4cb (diff) | |
download | redot-engine-567cb691ec49844101247bb9dc34bc2722f6af4f.tar.gz |
Modified editor strings to be translatable in the future
Diffstat (limited to 'tools/editor/plugins/shader_graph_editor_plugin.cpp')
-rw-r--r-- | tools/editor/plugins/shader_graph_editor_plugin.cpp | 382 |
1 files changed, 191 insertions, 191 deletions
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 36a8c79b84..f618f41cf8 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -674,7 +674,7 @@ GraphCurveMapEdit::GraphCurveMapEdit(){ void ShaderGraphView::_scalar_const_changed(double p_value,int p_id) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Scalar Constant",true); + ur->create_action(TTR("Change Scalar Constant"),true); ur->add_do_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,p_value); ur->add_undo_method(graph.ptr(),"scalar_const_node_set_value",type,p_id,graph->scalar_const_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -692,7 +692,7 @@ void ShaderGraphView::_vec_const_changed(double p_value, int p_id,Array p_arr){ } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Vec Constant",true); + ur->create_action(TTR("Change Vec Constant"),true); ur->add_do_method(graph.ptr(),"vec_const_node_set_value",type,p_id,val); ur->add_undo_method(graph.ptr(),"vec_const_node_set_value",type,p_id,graph->vec_const_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -705,7 +705,7 @@ void ShaderGraphView::_vec_const_changed(double p_value, int p_id,Array p_arr){ void ShaderGraphView::_rgb_const_changed(const Color& p_color, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change RGB Constant",true); + ur->create_action(TTR("Change RGB Constant"),true); ur->add_do_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,p_color); ur->add_undo_method(graph.ptr(),"rgb_const_node_set_value",type,p_id,graph->rgb_const_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -718,7 +718,7 @@ void ShaderGraphView::_rgb_const_changed(const Color& p_color, int p_id){ void ShaderGraphView::_scalar_op_changed(int p_op, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Scalar Operator"); + ur->create_action(TTR("Change Scalar Operator")); ur->add_do_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,p_op); ur->add_undo_method(graph.ptr(),"scalar_op_node_set_op",type,p_id,graph->scalar_op_node_get_op(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -731,7 +731,7 @@ void ShaderGraphView::_scalar_op_changed(int p_op, int p_id){ void ShaderGraphView::_vec_op_changed(int p_op, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Vec Operator"); + ur->create_action(TTR("Change Vec Operator")); ur->add_do_method(graph.ptr(),"vec_op_node_set_op",type,p_id,p_op); ur->add_undo_method(graph.ptr(),"vec_op_node_set_op",type,p_id,graph->vec_op_node_get_op(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -743,7 +743,7 @@ void ShaderGraphView::_vec_op_changed(int p_op, int p_id){ void ShaderGraphView::_vec_scalar_op_changed(int p_op, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change VecxScalar Operator"); + ur->create_action(TTR("Change VecxScalar Operator")); ur->add_do_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,p_op); ur->add_undo_method(graph.ptr(),"vec_scalar_op_node_set_op",type,p_id,graph->vec_scalar_op_node_get_op(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -756,7 +756,7 @@ void ShaderGraphView::_vec_scalar_op_changed(int p_op, int p_id){ void ShaderGraphView::_rgb_op_changed(int p_op, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change RGB Operator"); + ur->create_action(TTR("Change RGB Operator")); ur->add_do_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,p_op); ur->add_undo_method(graph.ptr(),"rgb_op_node_set_op",type,p_id,graph->rgb_op_node_get_op(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -768,7 +768,7 @@ void ShaderGraphView::_rgb_op_changed(int p_op, int p_id){ void ShaderGraphView::_xform_inv_rev_changed(bool p_enabled, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Toggle Rot Only"); + ur->create_action(TTR("Toggle Rot Only")); ur->add_do_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,p_enabled); ur->add_undo_method(graph.ptr(),"xform_vec_mult_node_set_no_translation",type,p_id,graph->xform_vec_mult_node_get_no_translation(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -781,7 +781,7 @@ void ShaderGraphView::_scalar_func_changed(int p_func, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Scalar Function"); + ur->create_action(TTR("Change Scalar Function")); ur->add_do_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,p_func); ur->add_undo_method(graph.ptr(),"scalar_func_node_set_function",type,p_id,graph->scalar_func_node_get_function(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -793,7 +793,7 @@ void ShaderGraphView::_scalar_func_changed(int p_func, int p_id){ void ShaderGraphView::_vec_func_changed(int p_func, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Vec Function"); + ur->create_action(TTR("Change Vec Function")); ur->add_do_method(graph.ptr(),"vec_func_node_set_function",type,p_id,p_func); ur->add_undo_method(graph.ptr(),"vec_func_node_set_function",type,p_id,graph->vec_func_node_get_function(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -806,7 +806,7 @@ void ShaderGraphView::_vec_func_changed(int p_func, int p_id){ void ShaderGraphView::_scalar_input_changed(double p_value,int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Scalar Uniform",true); + ur->create_action(TTR("Change Scalar Uniform"),true); ur->add_do_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,p_value); ur->add_undo_method(graph.ptr(),"scalar_input_node_set_value",type,p_id,graph->scalar_input_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -824,7 +824,7 @@ void ShaderGraphView::_vec_input_changed(double p_value, int p_id,Array p_arr){ } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Vec Uniform",true); + ur->create_action(TTR("Change Vec Uniform"),true); ur->add_do_method(graph.ptr(),"vec_input_node_set_value",type,p_id,val); ur->add_undo_method(graph.ptr(),"vec_input_node_set_value",type,p_id,graph->vec_input_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -862,7 +862,7 @@ void ShaderGraphView::_rgb_input_changed(const Color& p_color, int p_id){ UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change RGB Uniform",true); + ur->create_action(TTR("Change RGB Uniform"),true); ur->add_do_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,p_color); ur->add_undo_method(graph.ptr(),"rgb_input_node_set_value",type,p_id,graph->rgb_input_node_get_value(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -902,7 +902,7 @@ void ShaderGraphView::_variant_edited() { break; } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change default value"); + ur->create_action(TTR("Change default value")); ur->add_do_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v); ur->add_undo_method(graph.ptr(),"default_set_value",type,edited_id,edited_def, v2); ur->add_do_method(this,"_update_graph"); @@ -914,7 +914,7 @@ void ShaderGraphView::_variant_edited() { if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_CONST) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change XForm Uniform"); + ur->create_action(TTR("Change XForm Uniform")); ur->add_do_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,ped_popup->get_variant()); ur->add_undo_method(graph.ptr(),"xform_const_node_set_value",type,edited_id,graph->xform_const_node_get_value(type,edited_id)); ur->add_do_method(this,"_update_graph"); @@ -926,7 +926,7 @@ void ShaderGraphView::_variant_edited() { if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_XFORM_INPUT) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change XForm Uniform"); + ur->create_action(TTR("Change XForm Uniform")); ur->add_do_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,ped_popup->get_variant()); ur->add_undo_method(graph.ptr(),"xform_input_node_set_value",type,edited_id,graph->xform_input_node_get_value(type,edited_id)); ur->add_do_method(this,"_update_graph"); @@ -937,7 +937,7 @@ void ShaderGraphView::_variant_edited() { if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_TEXTURE_INPUT) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Texture Uniform"); + ur->create_action(TTR("Change Texture Uniform")); ur->add_do_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,ped_popup->get_variant()); ur->add_undo_method(graph.ptr(),"texture_input_node_set_value",type,edited_id,graph->texture_input_node_get_value(type,edited_id)); ur->add_do_method(this,"_update_graph"); @@ -948,7 +948,7 @@ void ShaderGraphView::_variant_edited() { if (graph->node_get_type(type,edited_id)==ShaderGraph::NODE_CUBEMAP_INPUT) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Cubemap Uniform"); + ur->create_action(TTR("Change Cubemap Uniform")); ur->add_do_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,ped_popup->get_variant()); ur->add_undo_method(graph.ptr(),"cubemap_input_node_set_value",type,edited_id,graph->cubemap_input_node_get_value(type,edited_id)); ur->add_do_method(this,"_update_graph"); @@ -962,7 +962,7 @@ void ShaderGraphView::_comment_edited(int p_id,Node* p_button) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); TextEdit *te=p_button->cast_to<TextEdit>(); - ur->create_action("Change Comment",true); + ur->create_action(TTR("Change Comment"),true); ur->add_do_method(graph.ptr(),"comment_node_set_text",type,p_id,te->get_text()); ur->add_undo_method(graph.ptr(),"comment_node_set_text",type,p_id,graph->comment_node_get_text(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -1002,9 +1002,9 @@ void ShaderGraphView::_color_ramp_changed(int p_id,Node* p_ramp) { DVector<Color> old_colors=graph->color_ramp_node_get_colors(type,p_id); if (old_offsets.size()!=new_offsets.size()) - ur->create_action("Add/Remove to Color Ramp"); + ur->create_action(TTR("Add/Remove to Color Ramp")); else - ur->create_action("Modify Color Ramp",true); + ur->create_action(TTR("Modify Color Ramp"),true); ur->add_do_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,new_colors,new_offsets); ur->add_undo_method(graph.ptr(),"color_ramp_node_set_ramp",type,p_id,old_colors,old_offsets); @@ -1038,9 +1038,9 @@ void ShaderGraphView::_curve_changed(int p_id,Node* p_curve) { DVector<Vector2> old_points=graph->curve_map_node_get_points(type,p_id); if (old_points.size()!=new_points.size()) - ur->create_action("Add/Remove to Curve Map"); + ur->create_action(TTR("Add/Remove to Curve Map")); else - ur->create_action("Modify Curve Map",true); + ur->create_action(TTR("Modify Curve Map"),true); ur->add_do_method(graph.ptr(),"curve_map_node_set_points",type,p_id,new_points); ur->add_undo_method(graph.ptr(),"curve_map_node_set_points",type,p_id,old_points); @@ -1058,7 +1058,7 @@ void ShaderGraphView::_input_name_changed(const String& p_name, int p_id, Node * ERR_FAIL_COND(!le); UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Input Name"); + ur->create_action(TTR("Change Input Name")); ur->add_do_method(graph.ptr(),"input_node_set_name",type,p_id,p_name); ur->add_undo_method(graph.ptr(),"input_node_set_name",type,p_id,graph->input_node_get_name(type,p_id)); ur->add_do_method(this,"_update_graph"); @@ -1110,7 +1110,7 @@ void ShaderGraphView::_connection_request(const String& p_from, int p_from_slot, ERR_FAIL_COND(from_idx==-1); ERR_FAIL_COND(to_idx==-1); - ur->create_action("Connect Graph Nodes"); + ur->create_action(TTR("Connect Graph Nodes")); List<ShaderGraph::Connection> conns; @@ -1152,7 +1152,7 @@ void ShaderGraphView::_disconnection_request(const String& p_from, int p_from_sl if (!graph->is_node_connected(type,from_idx,p_from_slot,to_idx,p_to_slot)) return; //nothing to disconnect - ur->create_action("Disconnect Graph Nodes"); + ur->create_action(TTR("Disconnect Graph Nodes")); List<ShaderGraph::Connection> conns; @@ -1170,7 +1170,7 @@ void ShaderGraphView::_disconnection_request(const String& p_from, int p_from_sl void ShaderGraphView::_node_removed(int p_id) { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Remove Shader Graph Node"); + ur->create_action(TTR("Remove Shader Graph Node")); ur->add_do_method(graph.ptr(),"node_remove",type,p_id); ur->add_undo_method(graph.ptr(),"node_add",type,graph->node_get_type(type,p_id),p_id); @@ -1193,7 +1193,7 @@ void ShaderGraphView::_node_removed(int p_id) { void ShaderGraphView::_begin_node_move() { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Move Shader Graph Node"); + ur->create_action(TTR("Move Shader Graph Node")); } void ShaderGraphView::_node_moved(const Vector2& p_from, const Vector2& p_to,int p_id) { @@ -1235,7 +1235,7 @@ void ShaderGraphView::_duplicate_nodes_request() return; UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Duplicate Graph Node(s)"); + ur->create_action(TTR("Duplicate Graph Node(s)")); ur->add_do_method(this,"_duplicate_nodes",s_id); List<int> n_ids = graph->generate_ids(type, s_id.size()); for (List<int>::Element *E=n_ids.front();E;E=E->next()) @@ -1272,7 +1272,7 @@ void ShaderGraphView::_delete_nodes_request() return; UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Delete Shader Graph Node(s)"); + ur->create_action(TTR("Delete Shader Graph Node(s)")); for (List<int>::Element *N=s_id.front();N;N=N->next()) { ur->add_do_method(graph.ptr(),"node_remove",type,N->get()); @@ -1427,7 +1427,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // all inputs (case Shader type dependent) case ShaderGraph::NODE_SCALAR_CONST: { - gn->set_title("Scalar"); + gn->set_title(TTR("Scalar")); SpinBox *sb = memnew( SpinBox ); sb->set_min(-100000); sb->set_max(100000); @@ -1440,7 +1440,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; //scalar constant case ShaderGraph::NODE_VEC_CONST: { - gn->set_title("Vector"); + gn->set_title(TTR("Vector")); Array v3p(true); for(int i=0;i<3;i++) { HBoxContainer *hbc = memnew( HBoxContainer ); @@ -1469,11 +1469,11 @@ void ShaderGraphView::_create_node(int p_id) { cpb->connect("color_changed",this,"_rgb_const_changed",varray(p_id)); gn->add_child(cpb); Label *l = memnew( Label ); - l->set_text("RGB"); + l->set_text(TTR("RGB")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); l = memnew( Label ); - l->set_text("Alpha"); + l->set_text(TTR("Alpha")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); @@ -1482,7 +1482,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; //rgb constant (shows a color picker instead) case ShaderGraph::NODE_XFORM_CONST: { - gn->set_title("XForm"); + gn->set_title(TTR("XForm")); ToolButton *edit = memnew( ToolButton ); edit->set_text("edit.."); edit->connect("pressed",this,"_xform_const_changed",varray(p_id,edit)); @@ -1492,7 +1492,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // 4x4 matrix constant case ShaderGraph::NODE_TIME: { - gn->set_title("Time"); + gn->set_title(TTR("Time")); Label *l = memnew( Label ); l->set_text("(s)"); l->set_align(Label::ALIGN_RIGHT); @@ -1502,34 +1502,34 @@ void ShaderGraphView::_create_node(int p_id) { } break; // time in seconds case ShaderGraph::NODE_SCREEN_TEX: { - gn->set_title("ScreenTex"); + gn->set_title(TTR("ScreenTex")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (!graph->is_slot_connected(type,p_id,0)) { Vector3 v = graph->default_get_value(type, p_id, 0); - hbc->add_child(make_editor("UV: " + v,gn,p_id,0,Variant::VECTOR3)); + hbc->add_child(make_editor(TTR("UV: ") + v,gn,p_id,0,Variant::VECTOR3)); } else { - hbc->add_child(make_label("UV",Variant::VECTOR3)); + hbc->add_child(make_label(TTR("UV"),Variant::VECTOR3)); } hbc->add_spacer(); - hbc->add_child( memnew(Label("RGB"))); + hbc->add_child( memnew(Label(TTR("RGB")))); gn->add_child(hbc); gn->set_slot(0,true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC],true,ShaderGraph::SLOT_TYPE_VEC,typecol[ShaderGraph::SLOT_TYPE_VEC]); } break; // screen texture sampler (takes UV) (only usable in fragment case Shader) case ShaderGraph::NODE_SCALAR_OP: { - gn->set_title("ScalarOp"); + gn->set_title(TTR("ScalarOp")); static const char* op_name[ShaderGraph::SCALAR_MAX_OP]={ - "Add", - "Sub", - "Mul", - "Div", - "Mod", - "Pow", - "Max", - "Min", - "Atan2" + ("Add"), + ("Sub"), + ("Mul"), + ("Div"), + ("Mod"), + ("Pow"), + ("Max"), + ("Min"), + ("Atan2") }; OptionButton *ob = memnew( OptionButton ); @@ -1567,17 +1567,17 @@ void ShaderGraphView::_create_node(int p_id) { } break; // scalar vs scalar op (mul: { } break; add: { } break; div: { } break; etc) case ShaderGraph::NODE_VEC_OP: { - gn->set_title("VecOp"); + gn->set_title(TTR("VecOp")); static const char* op_name[ShaderGraph::VEC_MAX_OP]={ - "Add", - "Sub", - "Mul", - "Div", - "Mod", - "Pow", - "Max", - "Min", - "Cross" + ("Add"), + ("Sub"), + ("Mul"), + ("Div"), + ("Mod"), + ("Pow"), + ("Max"), + ("Min"), + ("Cross") }; OptionButton *ob = memnew( OptionButton ); @@ -1615,11 +1615,11 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 vs vec3 op (mul: { } break;ad: { } break;div: { } break;crossprod: { } break;etc) case ShaderGraph::NODE_VEC_SCALAR_OP: { - gn->set_title("VecScalarOp"); + gn->set_title(TTR("VecScalarOp")); static const char* op_name[ShaderGraph::VEC_SCALAR_MAX_OP]={ - "Mul", - "Div", - "Pow", + ("Mul"), + ("Div"), + ("Pow"), }; OptionButton *ob = memnew( OptionButton ); @@ -1657,17 +1657,17 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 vs scalar op (mul: { } break; add: { } break; div: { } break; etc) case ShaderGraph::NODE_RGB_OP: { - gn->set_title("RGB Op"); + gn->set_title(TTR("RGB Op")); static const char* op_name[ShaderGraph::RGB_MAX_OP]={ - "Screen", - "Difference", - "Darken", - "Lighten", - "Overlay", - "Dodge", - "Burn", - "SoftLight", - "HardLight" + ("Screen"), + ("Difference"), + ("Darken"), + ("Lighten"), + ("Overlay"), + ("Dodge"), + ("Burn"), + ("SoftLight"), + ("HardLight") }; OptionButton *ob = memnew( OptionButton ); @@ -1702,7 +1702,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 vs vec3 rgb op (with scalar amount): { } break; like brighten: { } break; darken: { } break; burn: { } break; dodge: { } break; multiply: { } break; etc. case ShaderGraph::NODE_XFORM_MULT: { - gn->set_title("XFMult"); + gn->set_title(TTR("XFMult")); HBoxContainer *hbc = memnew( HBoxContainer ); if (graph->is_slot_connected(type, p_id, 0)) { hbc->add_child(make_label("a",Variant::TRANSFORM)); @@ -1725,9 +1725,9 @@ void ShaderGraphView::_create_node(int p_id) { } break; // mat4 x mat4 case ShaderGraph::NODE_XFORM_VEC_MULT: { - gn->set_title("XFVecMult"); + gn->set_title(TTR("XFVecMult")); - CheckBox *button = memnew (CheckBox("RotOnly")); + CheckBox *button = memnew (CheckBox(TTR("RotOnly"))); button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id)); button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id)); @@ -1758,10 +1758,10 @@ void ShaderGraphView::_create_node(int p_id) { } break; case ShaderGraph::NODE_XFORM_VEC_INV_MULT: { - gn->set_title("XFVecInvMult"); + gn->set_title(TTR("XFVecInvMult")); - CheckBox *button = memnew( CheckBox("RotOnly")); + CheckBox *button = memnew( CheckBox(TTR("RotOnly"))); button->set_pressed(graph->xform_vec_mult_node_get_no_translation(type,p_id)); button->connect("toggled",this,"_xform_inv_rev_changed",varray(p_id)); @@ -1793,28 +1793,28 @@ void ShaderGraphView::_create_node(int p_id) { } break; // mat4 x vec3 inverse mult (with no-translation option) case ShaderGraph::NODE_SCALAR_FUNC: { - gn->set_title("ScalarFunc"); + gn->set_title(TTR("ScalarFunc")); static const char* func_name[ShaderGraph::SCALAR_MAX_FUNC]={ - "Sin", - "Cos", - "Tan", - "ASin", - "ACos", - "ATan", - "SinH", - "CosH", - "TanH", - "Log", - "Exp", - "Sqrt", - "Abs", - "Sign", - "Floor", - "Round", - "Ceil", - "Frac", - "Satr", - "Neg" + ("Sin"), + ("Cos"), + ("Tan"), + ("ASin"), + ("ACos"), + ("ATan"), + ("SinH"), + ("CosH"), + ("TanH"), + ("Log"), + ("Exp"), + ("Sqrt"), + ("Abs"), + ("Sign"), + ("Floor"), + ("Round"), + ("Ceil"), + ("Frac"), + ("Satr"), + ("Neg") }; OptionButton *ob = memnew( OptionButton ); @@ -1846,14 +1846,14 @@ void ShaderGraphView::_create_node(int p_id) { - gn->set_title("VecFunc"); + gn->set_title(TTR("VecFunc")); static const char* func_name[ShaderGraph::VEC_MAX_FUNC]={ - "Normalize", - "Saturate", - "Negate", - "Reciprocal", - "RGB to HSV", - "HSV to RGB", + ("Normalize"), + ("Saturate"), + ("Negate"), + ("Reciprocal"), + ("RGB to HSV"), + ("HSV to RGB"), }; OptionButton *ob = memnew( OptionButton ); @@ -1882,7 +1882,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vector function (normalize: { } break; negate: { } break; reciprocal: { } break; rgb2hsv: { } break; hsv2rgb: { } break; etc: { } break; etc) case ShaderGraph::NODE_VEC_LEN: { - gn->set_title("VecLength"); + gn->set_title(TTR("VecLength")); HBoxContainer *hbc = memnew( HBoxContainer ); if (graph->is_slot_connected(type, p_id, 0)) { hbc->add_child(make_label("in", Variant::VECTOR3)); @@ -1899,7 +1899,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 length case ShaderGraph::NODE_DOT_PROD: { - gn->set_title("DotProduct"); + gn->set_title(TTR("DotProduct")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { @@ -1924,7 +1924,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 . vec3 (dot product -> scalar output) case ShaderGraph::NODE_VEC_TO_SCALAR: { - gn->set_title("Vec2Scalar"); + gn->set_title(TTR("Vec2Scalar")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { @@ -1955,7 +1955,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // 1 vec3 input: { } break; 3 scalar outputs case ShaderGraph::NODE_SCALAR_TO_VEC: { - gn->set_title("Scalar2Vec"); + gn->set_title(TTR("Scalar2Vec")); HBoxContainer *hbc = memnew( HBoxContainer ); if (graph->is_slot_connected(type, p_id, 0)) { hbc->add_child(make_label("x", Variant::REAL)); @@ -1986,7 +1986,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // 3 scalar input: { } break; 1 vec3 output case ShaderGraph::NODE_VEC_TO_XFORM: { - gn->set_title("Vec2XForm"); + gn->set_title(TTR("Vec2XForm")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { @@ -2025,7 +2025,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // 3 vec input: { } break; 1 xform output case ShaderGraph::NODE_XFORM_TO_VEC: { - gn->set_title("XForm2Vec"); + gn->set_title(TTR("XForm2Vec")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); @@ -2057,7 +2057,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // 3 vec input: { } break; 1 xform output case ShaderGraph::NODE_SCALAR_INTERP: { - gn->set_title("ScalarInterp"); + gn->set_title(TTR("ScalarInterp")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { @@ -2090,7 +2090,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // scalar interpolation (with optional curve) case ShaderGraph::NODE_VEC_INTERP: { - gn->set_title("VecInterp"); + gn->set_title(TTR("VecInterp")); HBoxContainer *hbc = memnew( HBoxContainer ); if (graph->is_slot_connected(type, p_id, 0)) { hbc->add_child(make_label("a", Variant::VECTOR3)); @@ -2174,7 +2174,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // scalar interpolation (with optional curve) case ShaderGraph::NODE_CURVE_MAP: { - gn->set_title("CurveMap"); + gn->set_title(TTR("CurveMap")); GraphCurveMapEdit * map = memnew( GraphCurveMapEdit ); DVector<Vector2> points = graph->curve_map_node_get_points(type,p_id); @@ -2221,7 +2221,7 @@ void ShaderGraphView::_create_node(int p_id) { case ShaderGraph::NODE_SCALAR_INPUT: { - gn->set_title("ScalarUniform"); + gn->set_title(TTR("ScalarUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2238,7 +2238,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // scalar uniform (assignable in material) case ShaderGraph::NODE_VEC_INPUT: { - gn->set_title("VectorUniform"); + gn->set_title(TTR("VectorUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2265,7 +2265,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // vec3 uniform (assignable in material) case ShaderGraph::NODE_RGB_INPUT: { - gn->set_title("ColorUniform"); + gn->set_title(TTR("ColorUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2275,11 +2275,11 @@ void ShaderGraphView::_create_node(int p_id) { cpb->connect("color_changed",this,"_rgb_input_changed",varray(p_id)); gn->add_child(cpb); Label *l = memnew( Label ); - l->set_text("RGB"); + l->set_text(TTR("RGB")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); l = memnew( Label ); - l->set_text("Alpha"); + l->set_text(TTR("Alpha")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); @@ -2289,7 +2289,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // color uniform (assignable in material) case ShaderGraph::NODE_XFORM_INPUT: { - gn->set_title("XFUniform"); + gn->set_title(TTR("XFUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2303,7 +2303,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // mat4 uniform (assignable in material) case ShaderGraph::NODE_TEXTURE_INPUT: { - gn->set_title("TexUniform"); + gn->set_title(TTR("TexUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2321,18 +2321,18 @@ void ShaderGraphView::_create_node(int p_id) { HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); + hbc->add_child(make_label(TTR("UV"), Variant::VECTOR3)); } else { Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); + hbc->add_child(make_editor(String(TTR("UV: "))+v,gn,p_id,0,Variant::VECTOR3)); } hbc->add_spacer(); - Label *l=memnew(Label("RGB")); + Label *l=memnew(Label(TTR("RGB"))); l->set_align(Label::ALIGN_RIGHT); hbc->add_child(l); gn->add_child(hbc); l = memnew( Label ); - l->set_text("Alpha"); + l->set_text(TTR("Alpha")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); @@ -2342,7 +2342,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // texture input (assignable in material) case ShaderGraph::NODE_CUBEMAP_INPUT: { - gn->set_title("TexUniform"); + gn->set_title(TTR("TexUniform")); LineEdit *le = memnew( LineEdit ); gn->add_child(le); le->set_text(graph->input_node_get_name(type,p_id)); @@ -2357,18 +2357,18 @@ void ShaderGraphView::_create_node(int p_id) { HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); + hbc->add_child(make_label(TTR("UV"), Variant::VECTOR3)); } else { Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); + hbc->add_child(make_editor(String(TTR("UV: "))+v,gn,p_id,0,Variant::VECTOR3)); } hbc->add_spacer(); - Label *l=memnew(Label("RGB")); + Label *l=memnew(Label(TTR("RGB"))); l->set_align(Label::ALIGN_RIGHT); hbc->add_child(l); gn->add_child(hbc); l = memnew( Label ); - l->set_text("Alpha"); + l->set_text(TTR("Alpha")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); @@ -2378,22 +2378,22 @@ void ShaderGraphView::_create_node(int p_id) { } break; // cubemap input (assignable in material) case ShaderGraph::NODE_DEFAULT_TEXTURE: { - gn->set_title("CanvasItemTex"); + gn->set_title(TTR("CanvasItemTex")); HBoxContainer *hbc = memnew( HBoxContainer ); hbc->add_constant_override("separation",0); if (graph->is_slot_connected(type, p_id, 0)) { - hbc->add_child(make_label("UV", Variant::VECTOR3)); + hbc->add_child(make_label(TTR("UV"), Variant::VECTOR3)); } else { Vector3 v = graph->default_get_value(type,p_id,0); - hbc->add_child(make_editor(String("UV: ")+v,gn,p_id,0,Variant::VECTOR3)); + hbc->add_child(make_editor(String(TTR("UV: "))+v,gn,p_id,0,Variant::VECTOR3)); } hbc->add_spacer(); - Label *l=memnew(Label("RGB")); + Label *l=memnew(Label(TTR("RGB"))); l->set_align(Label::ALIGN_RIGHT); hbc->add_child(l); gn->add_child(hbc); l = memnew( Label ); - l->set_text("Alpha"); + l->set_text(TTR("Alpha")); l->set_align(Label::ALIGN_RIGHT); gn->add_child(l); @@ -2404,7 +2404,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // screen texture sampler (takes UV) (only usable in fragment case Shader) case ShaderGraph::NODE_OUTPUT: { - gn->set_title("Output"); + gn->set_title(TTR("Output")); gn->set_show_close_button(false); List<ShaderGraph::SlotInfo> si; @@ -2412,22 +2412,22 @@ void ShaderGraphView::_create_node(int p_id) { Array colors; colors.push_back("Color"); - colors.push_back("LightColor"); + colors.push_back(TTR("LightColor")); colors.push_back("Light"); - colors.push_back("Diffuse"); - colors.push_back("Specular"); - colors.push_back("Emmision"); + colors.push_back(TTR("Diffuse")); + colors.push_back(TTR("Specular")); + colors.push_back(TTR("Emmision")); Array reals; - reals.push_back("Alpha"); - reals.push_back("DiffuseAlpha"); - reals.push_back("NormalMapDepth"); - reals.push_back("SpecExp"); - reals.push_back("Glow"); - reals.push_back("ShadeParam"); - reals.push_back("SpecularExp"); - reals.push_back("LightAlpha"); - reals.push_back("PointSize"); - reals.push_back("Discard"); + reals.push_back(TTR("Alpha")); + reals.push_back(TTR("DiffuseAlpha")); + reals.push_back(TTR("NormalMapDepth")); + reals.push_back(TTR("SpecExp")); + reals.push_back(TTR("Glow")); + reals.push_back(TTR("ShadeParam")); + reals.push_back(TTR("SpecularExp")); + reals.push_back(TTR("LightAlpha")); + reals.push_back(TTR("PointSize")); + reals.push_back(TTR("Discard")); int idx=0; for (List<ShaderGraph::SlotInfo>::Element *E=si.front();E;E=E->next()) { @@ -2448,7 +2448,7 @@ void ShaderGraphView::_create_node(int p_id) { } break; // output (case Shader type dependent) case ShaderGraph::NODE_COMMENT: { - gn->set_title("Comment"); + gn->set_title(TTR("Comment")); TextEdit *te = memnew(TextEdit); te->set_custom_minimum_size(Size2(100,100)); gn->add_child(te); @@ -2512,8 +2512,8 @@ void ShaderGraphView::_sg_updated() { return; switch(graph->get_graph_error(type)) { case ShaderGraph::GRAPH_OK: status->set_text(""); break; - case ShaderGraph::GRAPH_ERROR_CYCLIC: status->set_text("Error: Cyclic Connection Link"); break; - case ShaderGraph::GRAPH_ERROR_MISSING_CONNECTIONS: status->set_text("Error: Missing Input Connections"); break; + case ShaderGraph::GRAPH_ERROR_CYCLIC: status->set_text(TTR("Error: Cyclic Connection Link")); break; + case ShaderGraph::GRAPH_ERROR_MISSING_CONNECTIONS: status->set_text(TTR("Error: Missing Input Connections")); break; } } @@ -2573,7 +2573,7 @@ void ShaderGraphView::add_node(int p_type, const Vector2 &location) { break; } UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Add Shader Graph Node"); + ur->create_action(TTR("Add Shader Graph Node")); ur->add_do_method(graph.ptr(),"node_add",type,p_type,newid); ur->add_do_method(graph.ptr(),"node_set_pos",type,newid,init_ofs); ur->add_undo_method(graph.ptr(),"node_remove",type,newid); @@ -2707,41 +2707,41 @@ void ShaderGraphEditor::_bind_methods() { const char* ShaderGraphEditor::node_names[ShaderGraph::NODE_TYPE_MAX]={ - "GraphInput:Input", // all inputs (shader type dependent) - "GraphScalar:Scalar Constant", //scalar constant - "GraphVector:Vector Constant", //vec3 constant - "GraphRgb:RGB Constant", //rgb constant (shows a color picker instead) - "GraphXform:XForm Constant", // 4x4 matrix constant - "GraphTime:Time:", // time in seconds - "GraphTexscreen:Screen Sample", // screen texture sampler (takes uv) (only usable in fragment shader) - "GraphScalarOp:Scalar Operator", // scalar vs scalar op (mul", add", div", etc) - "GraphVecOp:Vector Operator", // vec3 vs vec3 op (mul",ad",div",crossprod",etc) - "GraphVecScalarOp:Scalar+Vector Operator", // vec3 vs scalar op (mul", add", div", etc) - "GraphRgbOp:RGB Operator:", // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc. - "GraphXformMult:XForm Multiply", // mat4 x mat4 - "GraphXformVecMult:XForm+Vector Multiply", // mat4 x vec3 mult (with no-translation option) - "GraphXformVecImult:Form+Vector InvMultiply:", // mat4 x vec3 inverse mult (with no-translation option) - "GraphXformScalarFunc:Scalar Function", // scalar function (sin", cos", etc) - "GraphXformVecFunc:Vector Function", // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc) - "GraphVecLength:Vector Length", // vec3 length - "GraphVecDp:Dot Product:", // vec3 . vec3 (dot product -> scalar output) - "GraphVecToScalars:Vector -> Scalars", // 1 vec3 input", 3 scalar outputs - "GraphScalarsToVec:Scalars -> Vector", // 3 scalar input", 1 vec3 output - "GraphXformToVecs:XForm -> Vectors", // 3 vec input", 1 xform output - "GraphVecsToXform:Vectors -> XForm:", // 3 vec input", 1 xform output - "GraphScalarInterp:Scalar Interpolate", // scalar interpolation (with optional curve) - "GraphVecInterp:Vector Interpolate:", // vec3 interpolation (with optional curve) - "GraphColorRamp:Color Ramp", // vec3 interpolation (with optional curve) - "GraphCurveMap:Curve Remap:", // vec3 interpolation (with optional curve) - "GraphScalarUniform:Scalar Uniform", // scalar uniform (assignable in material) - "GraphVectorUniform:Vector Uniform", // vec3 uniform (assignable in material) - "GraphRgbUniform:RGB Uniform", // color uniform (assignable in material) - "GraphXformUniform:XForm Uniform", // mat4 uniform (assignable in material) - "GraphTextureUniform:Texture Uniform", // texture input (assignable in material) - "GraphCubeUniform:CubeMap Uniform:", // cubemap input (assignable in material) - "GraphDefaultTexture:CanvasItem Texture:", // cubemap input (assignable in material) - "Output", // output (shader type dependent) - "GraphComment:Comment", // comment + ("GraphInput:Input"), // all inputs (shader type dependent) + ("GraphScalar:Scalar Constant"), //scalar constant + ("GraphVector:Vector Constant"), //vec3 constant + ("GraphRgb:RGB Constant"), //rgb constant (shows a color picker instead) + ("GraphXform:XForm Constant"), // 4x4 matrix constant + ("GraphTime:Time:"), // time in seconds + ("GraphTexscreen:Screen Sample"), // screen texture sampler (takes uv) (only usable in fragment shader) + ("GraphScalarOp:Scalar Operator"), // scalar vs scalar op (mul", add", div", etc) + ("GraphVecOp:Vector Operator"), // vec3 vs vec3 op (mul",ad",div",crossprod",etc) + ("GraphVecScalarOp:Scalar+Vector Operator"), // vec3 vs scalar op (mul", add", div", etc) + ("GraphRgbOp:RGB Operator:"), // vec3 vs vec3 rgb op (with scalar amount)", like brighten", darken", burn", dodge", multiply", etc. + ("GraphXformMult:XForm Multiply"), // mat4 x mat4 + ("GraphXformVecMult:XForm+Vector Multiply"), // mat4 x vec3 mult (with no-translation option) + ("GraphXformVecImult:Form+Vector InvMultiply:"), // mat4 x vec3 inverse mult (with no-translation option) + ("GraphXformScalarFunc:Scalar Function"), // scalar function (sin", cos", etc) + ("GraphXformVecFunc:Vector Function"), // vector function (normalize", negate", reciprocal", rgb2hsv", hsv2rgb", etc", etc) + ("GraphVecLength:Vector Length"), // vec3 length + ("GraphVecDp:Dot Product:"), // vec3 . vec3 (dot product -> scalar output) + ("GraphVecToScalars:Vector -> Scalars"), // 1 vec3 input", 3 scalar outputs + ("GraphScalarsToVec:Scalars -> Vector"), // 3 scalar input", 1 vec3 output + ("GraphXformToVecs:XForm -> Vectors"), // 3 vec input", 1 xform output + ("GraphVecsToXform:Vectors -> XForm:"), // 3 vec input", 1 xform output + ("GraphScalarInterp:Scalar Interpolate"), // scalar interpolation (with optional curve) + ("GraphVecInterp:Vector Interpolate:"), // vec3 interpolation (with optional curve) + ("GraphColorRamp:Color Ramp"), // vec3 interpolation (with optional curve) + ("GraphCurveMap:Curve Remap:"), // vec3 interpolation (with optional curve) + ("GraphScalarUniform:Scalar Uniform"), // scalar uniform (assignable in material) + ("GraphVectorUniform:Vector Uniform"), // vec3 uniform (assignable in material) + ("GraphRgbUniform:RGB Uniform"), // color uniform (assignable in material) + ("GraphXformUniform:XForm Uniform"), // mat4 uniform (assignable in material) + ("GraphTextureUniform:Texture Uniform"), // texture input (assignable in material) + ("GraphCubeUniform:CubeMap Uniform:"), // cubemap input (assignable in material) + ("GraphDefaultTexture:CanvasItem Texture:"), // cubemap input (assignable in material) + ("Output"), // output (shader type dependent) + ("GraphComment:Comment"), // comment }; |