Selaa lähdekoodia

Merge pull request #59067 from akien-mga/3.x-cherrypicks

Cherry-picks for the 3.x branch (future 3.5) - 15th batch
Rémi Verschelde 3 vuotta sitten
vanhempi
commit
8c1bb5d5a9

+ 18 - 2
core/os/time.cpp

@@ -270,7 +270,7 @@ Dictionary Time::get_datetime_dict_from_string(String p_datetime, bool p_weekday
 	return dict;
 }
 
-String Time::get_datetime_string_from_dict(Dictionary p_datetime, bool p_use_space) const {
+String Time::get_datetime_string_from_dict(const Dictionary p_datetime, bool p_use_space) const {
 	ERR_FAIL_COND_V_MSG(p_datetime.empty(), "", "Invalid datetime Dictionary: Dictionary is empty.");
 	EXTRACT_FROM_DICTIONARY
 	// vformat only supports up to 6 arguments, so we need to split this up into 2 parts.
@@ -283,7 +283,7 @@ String Time::get_datetime_string_from_dict(Dictionary p_datetime, bool p_use_spa
 	return timestamp;
 }
 
-int64_t Time::get_unix_time_from_datetime_dict(Dictionary p_datetime) const {
+int64_t Time::get_unix_time_from_datetime_dict(const Dictionary p_datetime) const {
 	ERR_FAIL_COND_V_MSG(p_datetime.empty(), 0, "Invalid datetime Dictionary: Dictionary is empty");
 	EXTRACT_FROM_DICTIONARY
 	VALIDATE_YMDHMS
@@ -298,6 +298,21 @@ int64_t Time::get_unix_time_from_datetime_string(String p_datetime) const {
 	return day_number * SECONDS_PER_DAY + hour * 3600 + minute * 60 + second;
 }
 
+String Time::get_offset_string_from_offset_minutes(int64_t p_offset_minutes) const {
+	String sign;
+	if (p_offset_minutes < 0) {
+		sign = "-";
+		p_offset_minutes = -p_offset_minutes;
+	} else {
+		sign = "+";
+	}
+	// These two lines can be optimized to one instruction on x86 and others.
+	// Note that % is acceptable here only because we ensure it's positive.
+	int64_t offset_hours = p_offset_minutes / 60;
+	int64_t offset_minutes = p_offset_minutes % 60;
+	return vformat("%s%02d:%02d", sign, offset_hours, offset_minutes);
+}
+
 Dictionary Time::get_datetime_dict_from_system(bool p_utc) const {
 	OS::Date date = OS::get_singleton()->get_date(p_utc);
 	OS::Time time = OS::get_singleton()->get_time(p_utc);
@@ -389,6 +404,7 @@ void Time::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_datetime_string_from_dict", "datetime", "use_space"), &Time::get_datetime_string_from_dict);
 	ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime_dict", "datetime"), &Time::get_unix_time_from_datetime_dict);
 	ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime_string", "datetime"), &Time::get_unix_time_from_datetime_string);
+	ClassDB::bind_method(D_METHOD("get_offset_string_from_offset_minutes", "offset_minutes"), &Time::get_offset_string_from_offset_minutes);
 
 	ClassDB::bind_method(D_METHOD("get_datetime_dict_from_system", "utc"), &Time::get_datetime_dict_from_system, DEFVAL(false));
 	ClassDB::bind_method(D_METHOD("get_date_dict_from_system", "utc"), &Time::get_date_dict_from_system, DEFVAL(false));

+ 3 - 2
core/os/time.h

@@ -86,9 +86,10 @@ public:
 	String get_date_string_from_unix_time(int64_t p_unix_time_val) const;
 	String get_time_string_from_unix_time(int64_t p_unix_time_val) const;
 	Dictionary get_datetime_dict_from_string(String p_datetime, bool p_weekday = true) const;
-	String get_datetime_string_from_dict(Dictionary p_datetime, bool p_use_space = false) const;
-	int64_t get_unix_time_from_datetime_dict(Dictionary p_datetime) const;
+	String get_datetime_string_from_dict(const Dictionary p_datetime, bool p_use_space = false) const;
+	int64_t get_unix_time_from_datetime_dict(const Dictionary p_datetime) const;
 	int64_t get_unix_time_from_datetime_string(String p_datetime) const;
+	String get_offset_string_from_offset_minutes(int64_t p_offset_minutes) const;
 
 	// Methods that get information from OS.
 	Dictionary get_datetime_dict_from_system(bool p_utc = false) const;

+ 1 - 1
doc/classes/Curve2D.xml

@@ -17,7 +17,7 @@
 			<argument index="2" name="out" type="Vector2" default="Vector2( 0, 0 )" />
 			<argument index="3" name="at_position" type="int" default="-1" />
 			<description>
-				Adds a point to a curve at [code]position[/code], with control points [code]in[/code] and [code]out[/code].
+				Adds a point to a curve at [code]position[/code] relative to the [Curve2D]'s position, with control points [code]in[/code] and [code]out[/code].
 				If [code]at_position[/code] is given, the point is inserted before the point number [code]at_position[/code], moving that point (and every point after) after the inserted point. If [code]at_position[/code] is not given, or is an illegal value ([code]at_position &lt;0[/code] or [code]at_position &gt;= [method get_point_count][/code]), the point will be appended at the end of the point list.
 			</description>
 		</method>

+ 1 - 1
doc/classes/Curve3D.xml

@@ -17,7 +17,7 @@
 			<argument index="2" name="out" type="Vector3" default="Vector3( 0, 0, 0 )" />
 			<argument index="3" name="at_position" type="int" default="-1" />
 			<description>
-				Adds a point to a curve at [code]position[/code], with control points [code]in[/code] and [code]out[/code].
+				Adds a point to a curve at [code]position[/code] relative to the [Curve3D]'s position, with control points [code]in[/code] and [code]out[/code].
 				If [code]at_position[/code] is given, the point is inserted before the point number [code]at_position[/code], moving that point (and every point after) after the inserted point. If [code]at_position[/code] is not given, or is an illegal value ([code]at_position &lt;0[/code] or [code]at_position &gt;= [method get_point_count][/code]), the point will be appended at the end of the point list.
 			</description>
 		</method>

+ 7 - 0
doc/classes/Time.xml

@@ -97,6 +97,13 @@
 				If [code]use_space[/code] is true, use a space instead of the letter T in the middle.
 			</description>
 		</method>
+		<method name="get_offset_string_from_offset_minutes" qualifiers="const">
+			<return type="String" />
+			<argument index="0" name="offset_minutes" type="int" />
+			<description>
+				Converts the given timezone offset in minutes to a timezone offset string. For example, -480 returns "-08:00", 345 returns "+05:45", and 0 returns "+00:00".
+			</description>
+		</method>
 		<method name="get_ticks_msec" qualifiers="const">
 			<return type="int" />
 			<description>

+ 9 - 7
editor/animation_track_editor.cpp

@@ -1724,13 +1724,6 @@ void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseMotion> mm = p_event;
 
 	if (mm.is_valid()) {
-		if (hsize_rect.has_point(mm->get_position())) {
-			// Change the cursor to indicate that the track name column's width can be adjusted
-			set_default_cursor_shape(Control::CURSOR_HSIZE);
-		} else {
-			set_default_cursor_shape(Control::CURSOR_ARROW);
-		}
-
 		if (dragging_hsize) {
 			int ofs = mm->get_position().x - dragging_hsize_from;
 			name_limit = dragging_hsize_at + ofs;
@@ -1752,6 +1745,15 @@ void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
 	}
 }
 
+Control::CursorShape AnimationTimelineEdit::get_cursor_shape(const Point2 &p_pos) const {
+	if (dragging_hsize || hsize_rect.has_point(p_pos)) {
+		// Indicate that the track name column's width can be adjusted
+		return Control::CURSOR_HSIZE;
+	} else {
+		return get_default_cursor_shape();
+	}
+}
+
 void AnimationTimelineEdit::set_use_fps(bool p_use_fps) {
 	use_fps = p_use_fps;
 	update_values();

+ 2 - 0
editor/animation_track_editor.h

@@ -119,6 +119,8 @@ public:
 
 	void set_hscroll(HScrollBar *p_hscroll);
 
+	virtual CursorShape get_cursor_shape(const Point2 &p_pos) const;
+
 	AnimationTimelineEdit();
 };
 

+ 10 - 7
editor/animation_track_editor_plugins.cpp

@@ -1051,12 +1051,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
 				len_resizing_index = i;
 			}
 		}
-
-		if (use_hsize_cursor) {
-			set_default_cursor_shape(CURSOR_HSIZE);
-		} else {
-			set_default_cursor_shape(CURSOR_ARROW);
-		}
+		over_drag_position = use_hsize_cursor;
 	}
 
 	if (len_resizing && mm.is_valid()) {
@@ -1068,7 +1063,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && over_drag_position) {
 		len_resizing = true;
 		len_resizing_start = mb->get_shift();
 		len_resizing_from_px = mb->get_position().x;
@@ -1105,6 +1100,14 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
 	AnimationTrackEdit::_gui_input(p_event);
 }
 
+Control::CursorShape AnimationTrackEditTypeAudio::get_cursor_shape(const Point2 &p_pos) const {
+	if (over_drag_position || len_resizing) {
+		return Control::CURSOR_HSIZE;
+	} else {
+		return get_default_cursor_shape();
+	}
+}
+
 ////////////////////
 /// SUB ANIMATION ///
 

+ 3 - 0
editor/animation_track_editor_plugins.h

@@ -119,6 +119,7 @@ class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
 	int len_resizing_index;
 	float len_resizing_from_px;
 	float len_resizing_rel;
+	bool over_drag_position = false;
 
 protected:
 	static void _bind_methods();
@@ -134,6 +135,8 @@ public:
 	virtual bool is_key_selectable_by_distance() const;
 	virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
 
+	virtual CursorShape get_cursor_shape(const Point2 &p_pos) const;
+
 	AnimationTrackEditTypeAudio();
 };
 

+ 0 - 5
editor/plugins/animation_player_editor_plugin.cpp

@@ -898,11 +898,6 @@ void AnimationPlayerEditor::_update_player() {
 }
 
 void AnimationPlayerEditor::_update_animation_list_icons() {
-	List<StringName> animlist;
-	if (player) {
-		player->get_animation_list(&animlist);
-	}
-
 	for (int i = 0; i < animation->get_item_count(); i++) {
 		String name = animation->get_item_text(i);
 

+ 22 - 23
editor/plugins/animation_state_machine_editor.cpp

@@ -343,29 +343,21 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 		state_machine_draw->update();
 	}
 
-	//put ibeam (text cursor) over names to make it clearer that they are editable
 	if (mm.is_valid()) {
 		state_machine_draw->grab_focus();
 
-		bool over_text_now = false;
 		String new_over_node = StringName();
 		int new_over_node_what = -1;
 		if (tool_select->is_pressed()) {
-			for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
-
-				if (node_rects[i].name.has_point(mm->get_position())) {
-					over_text_now = true;
-					break;
-				}
-
+			for (int i = node_rects.size() - 1; i >= 0; i--) { // Inverse to draw order.
 				if (node_rects[i].node.has_point(mm->get_position())) {
 					new_over_node = node_rects[i].node_name;
 					if (node_rects[i].play.has_point(mm->get_position())) {
 						new_over_node_what = 0;
-					}
-					if (node_rects[i].edit.has_point(mm->get_position())) {
+					} else if (node_rects[i].edit.has_point(mm->get_position())) {
 						new_over_node_what = 1;
 					}
+					break;
 				}
 			}
 		}
@@ -375,16 +367,6 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 			over_node_what = new_over_node_what;
 			state_machine_draw->update();
 		}
-
-		if (over_text != over_text_now) {
-			if (over_text_now) {
-				state_machine_draw->set_default_cursor_shape(CURSOR_IBEAM);
-			} else {
-				state_machine_draw->set_default_cursor_shape(CURSOR_ARROW);
-			}
-
-			over_text = over_text_now;
-		}
 	}
 
 	Ref<InputEventPanGesture> pan_gesture = p_event;
@@ -394,6 +376,23 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 }
 
+Control::CursorShape AnimationNodeStateMachineEditor::get_cursor_shape(const Point2 &p_pos) const {
+	// Put ibeam (text cursor) over names to make it clearer that they are editable.
+	Transform2D xform = panel->get_transform() * state_machine_draw->get_transform();
+	Point2 pos = xform.xform_inv(p_pos);
+	Control::CursorShape cursor_shape = get_default_cursor_shape();
+
+	for (int i = node_rects.size() - 1; i >= 0; i--) { // Inverse to draw order.
+		if (node_rects[i].node.has_point(pos)) {
+			if (node_rects[i].name.has_point(pos)) {
+				cursor_shape = Control::CURSOR_IBEAM;
+			}
+			break;
+		}
+	}
+	return cursor_shape;
+}
+
 void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) {
 	file_loaded = ResourceLoader::load(p_file);
 	if (file_loaded.is_valid()) {
@@ -1295,6 +1294,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
 
 	panel = memnew(PanelContainer);
 	panel->set_clip_contents(true);
+	panel->set_mouse_filter(Control::MOUSE_FILTER_PASS);
 	add_child(panel);
 	panel->set_v_size_flags(SIZE_EXPAND_FILL);
 
@@ -1303,6 +1303,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
 	state_machine_draw->connect("gui_input", this, "_state_machine_gui_input");
 	state_machine_draw->connect("draw", this, "_state_machine_draw");
 	state_machine_draw->set_focus_mode(FOCUS_ALL);
+	state_machine_draw->set_mouse_filter(Control::MOUSE_FILTER_PASS);
 
 	state_machine_play_pos = memnew(Control);
 	state_machine_draw->add_child(state_machine_play_pos);
@@ -1354,8 +1355,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
 	open_file->connect("file_selected", this, "_file_opened");
 	undo_redo = EditorNode::get_undo_redo();
 
-	over_text = false;
-
 	over_node_what = -1;
 	dragging_selected_attempt = false;
 	connecting = false;

+ 1 - 1
editor/plugins/animation_state_machine_editor.h

@@ -136,7 +136,6 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
 	StringName selected_transition_from;
 	StringName selected_transition_to;
 
-	bool over_text;
 	StringName over_node;
 	int over_node_what;
 
@@ -183,6 +182,7 @@ public:
 	static AnimationNodeStateMachineEditor *get_singleton() { return singleton; }
 	virtual bool can_edit(const Ref<AnimationNode> &p_node);
 	virtual void edit(const Ref<AnimationNode> &p_node);
+	virtual CursorShape get_cursor_shape(const Point2 &p_pos) const;
 	AnimationNodeStateMachineEditor();
 };
 

+ 2 - 0
editor/plugins/canvas_item_editor_plugin.cpp

@@ -1241,6 +1241,8 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
 					}
 				}
 			}
+			snap_target[0] = SNAP_TARGET_NONE;
+			snap_target[1] = SNAP_TARGET_NONE;
 			drag_type = DRAG_NONE;
 			viewport->update();
 			return true;

+ 17 - 9
modules/csg/csg_shape.cpp

@@ -296,17 +296,19 @@ void CSGShape::_update_shape() {
 		ERR_CONTINUE(mat < -1 || mat >= face_count.size());
 		int idx = mat == -1 ? face_count.size() - 1 : mat;
 
-		Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]);
+		if (n->faces[i].smooth) {
+			Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]);
 
-		for (int j = 0; j < 3; j++) {
-			Vector3 v = n->faces[i].vertices[j];
-			Vector3 add;
-			if (vec_map.lookup(v, add)) {
-				add += p.normal;
-			} else {
-				add = p.normal;
+			for (int j = 0; j < 3; j++) {
+				Vector3 v = n->faces[i].vertices[j];
+				Vector3 add;
+				if (vec_map.lookup(v, add)) {
+					add += p.normal;
+				} else {
+					add = p.normal;
+				}
+				vec_map.set(v, add);
 			}
-			vec_map.set(v, add);
 		}
 
 		face_count.write[idx]++;
@@ -1597,6 +1599,9 @@ CSGBrush *CSGTorus::_build_brush() {
 			for (int i = 0; i < sides; i++) {
 				float inci = float(i) / sides;
 				float inci_n = float((i + 1)) / sides;
+				if (i == sides - 1) {
+					inci_n = 0;
+				}
 
 				float angi = inci * Math_PI * 2.0;
 				float angi_n = inci_n * Math_PI * 2.0;
@@ -1607,6 +1612,9 @@ CSGBrush *CSGTorus::_build_brush() {
 				for (int j = 0; j < ring_sides; j++) {
 					float incj = float(j) / ring_sides;
 					float incj_n = float((j + 1)) / ring_sides;
+					if (j == ring_sides - 1) {
+						incj_n = 0;
+					}
 
 					float angj = incj * Math_PI * 2.0;
 					float angj_n = incj_n * Math_PI * 2.0;

+ 1 - 1
modules/visual_script/visual_script_expression.cpp

@@ -172,7 +172,7 @@ PropertyInfo VisualScriptExpression::get_output_value_port_info(int p_idx) const
 }
 
 String VisualScriptExpression::get_caption() const {
-	return TTR("Expression");
+	return RTR("Expression");
 }
 String VisualScriptExpression::get_text() const {
 	return expression;

+ 14 - 14
modules/visual_script/visual_script_flow_control.cpp

@@ -68,7 +68,7 @@ PropertyInfo VisualScriptReturn::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptReturn::get_caption() const {
-	return TTR("Return");
+	return RTR("Return");
 }
 
 String VisualScriptReturn::get_text() const {
@@ -197,11 +197,11 @@ PropertyInfo VisualScriptCondition::get_output_value_port_info(int p_idx) const
 }
 
 String VisualScriptCondition::get_caption() const {
-	return TTR("Condition");
+	return RTR("Condition");
 }
 
 String VisualScriptCondition::get_text() const {
-	return TTR("if (cond) is:");
+	return RTR("if (cond) is:");
 }
 
 void VisualScriptCondition::_bind_methods() {
@@ -275,11 +275,11 @@ PropertyInfo VisualScriptWhile::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptWhile::get_caption() const {
-	return TTR("While");
+	return RTR("While");
 }
 
 String VisualScriptWhile::get_text() const {
-	return TTR("while (cond):");
+	return RTR("while (cond):");
 }
 
 void VisualScriptWhile::_bind_methods() {
@@ -354,11 +354,11 @@ PropertyInfo VisualScriptIterator::get_output_value_port_info(int p_idx) const {
 	return pinfo;
 }
 String VisualScriptIterator::get_caption() const {
-	return TTR("Iterator");
+	return RTR("Iterator");
 }
 
 String VisualScriptIterator::get_text() const {
-	return TTR("for (elem) in (input):");
+	return RTR("for (elem) in (input):");
 }
 
 void VisualScriptIterator::_bind_methods() {
@@ -465,11 +465,11 @@ PropertyInfo VisualScriptSequence::get_output_value_port_info(int p_idx) const {
 	return PropertyInfo(Variant::INT, "current");
 }
 String VisualScriptSequence::get_caption() const {
-	return TTR("Sequence");
+	return RTR("Sequence");
 }
 
 String VisualScriptSequence::get_text() const {
-	return TTR("in order:");
+	return RTR("in order:");
 }
 
 void VisualScriptSequence::set_steps(int p_steps) {
@@ -572,11 +572,11 @@ PropertyInfo VisualScriptSwitch::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptSwitch::get_caption() const {
-	return TTR("Switch");
+	return RTR("Switch");
 }
 
 String VisualScriptSwitch::get_text() const {
-	return TTR("'input' is:");
+	return RTR("'input' is:");
 }
 
 class VisualScriptNodeInstanceSwitch : public VisualScriptNodeInstance {
@@ -699,14 +699,14 @@ PropertyInfo VisualScriptTypeCast::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptTypeCast::get_caption() const {
-	return TTR("Type Cast");
+	return RTR("Type Cast");
 }
 
 String VisualScriptTypeCast::get_text() const {
 	if (script != String()) {
-		return vformat(TTR("Is %s?"), script.get_file());
+		return vformat(RTR("Is %s?"), script.get_file());
 	} else {
-		return vformat(TTR("Is %s?"), base_type);
+		return vformat(RTR("Is %s?"), base_type);
 	}
 }
 

+ 27 - 25
modules/visual_script/visual_script_func_nodes.cpp

@@ -32,6 +32,7 @@
 
 #include "core/engine.h"
 #include "core/io/resource_loader.h"
+#include "core/local_vector.h"
 #include "core/os/os.h"
 #include "scene/main/node.h"
 #include "scene/main/scene_tree.h"
@@ -261,13 +262,13 @@ String VisualScriptFunctionCall::get_text() const {
 	String text;
 
 	if (call_mode == CALL_MODE_BASIC_TYPE) {
-		text = vformat(TTR("On %s"), Variant::get_type_name(basic_type));
+		text = vformat(RTR("On %s"), Variant::get_type_name(basic_type));
 	} else if (call_mode == CALL_MODE_INSTANCE) {
-		text = vformat(TTR("On %s"), base_type);
+		text = vformat(RTR("On %s"), base_type);
 	} else if (call_mode == CALL_MODE_NODE_PATH) {
 		text = "[" + String(base_path.simplified()) + "]";
 	} else if (call_mode == CALL_MODE_SELF) {
-		text = TTR("On Self");
+		text = RTR("On Self");
 	} else if (call_mode == CALL_MODE_SINGLETON) {
 		text = String(singleton) + ":" + String(function) + "()";
 	}
@@ -1028,26 +1029,27 @@ PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptPropertySet::get_caption() const {
-	static const char *opname[ASSIGN_OP_MAX] = {
-		TTRC("Set %s"),
-		TTRC("Add %s"),
-		TTRC("Subtract %s"),
-		TTRC("Multiply %s"),
-		TTRC("Divide %s"),
-		TTRC("Mod %s"),
-		TTRC("ShiftLeft %s"),
-		TTRC("ShiftRight %s"),
-		TTRC("BitAnd %s"),
-		TTRC("BitOr %s"),
-		TTRC("BitXor %s")
-	};
+	static LocalVector<String> opname;
+	if (opname.empty()) {
+		opname.push_back(RTR("Set %s"));
+		opname.push_back(RTR("Add %s"));
+		opname.push_back(RTR("Subtract %s"));
+		opname.push_back(RTR("Multiply %s"));
+		opname.push_back(RTR("Divide %s"));
+		opname.push_back(RTR("Mod %s"));
+		opname.push_back(RTR("ShiftLeft %s"));
+		opname.push_back(RTR("ShiftRight %s"));
+		opname.push_back(RTR("BitAnd %s"));
+		opname.push_back(RTR("BitOr %s"));
+		opname.push_back(RTR("BitXor %s"));
+	}
 
 	String prop = property;
 	if (index != StringName()) {
 		prop += "." + String(index);
 	}
 
-	return vformat(TTRGET(opname[assign_op]), prop);
+	return vformat(opname[assign_op], prop);
 }
 
 String VisualScriptPropertySet::get_text() const {
@@ -1055,13 +1057,13 @@ String VisualScriptPropertySet::get_text() const {
 		return "";
 	}
 	if (call_mode == CALL_MODE_BASIC_TYPE) {
-		return vformat(TTR("On %s"), Variant::get_type_name(basic_type));
+		return vformat(RTR("On %s"), Variant::get_type_name(basic_type));
 	} else if (call_mode == CALL_MODE_INSTANCE) {
-		return vformat(TTR("On %s"), base_type);
+		return vformat(RTR("On %s"), base_type);
 	} else if (call_mode == CALL_MODE_NODE_PATH) {
 		return " [" + String(base_path.simplified()) + "]";
 	} else {
-		return TTR("On Self");
+		return RTR("On Self");
 	}
 }
 
@@ -1759,18 +1761,18 @@ String VisualScriptPropertyGet::get_caption() const {
 		prop += "." + String(index);
 	}
 
-	return vformat(TTR("Get %s"), prop);
+	return vformat(RTR("Get %s"), prop);
 }
 
 String VisualScriptPropertyGet::get_text() const {
 	if (call_mode == CALL_MODE_BASIC_TYPE) {
-		return vformat(TTR("On %s"), Variant::get_type_name(basic_type));
+		return vformat(RTR("On %s"), Variant::get_type_name(basic_type));
 	} else if (call_mode == CALL_MODE_INSTANCE) {
-		return vformat(TTR("On %s"), base_type);
+		return vformat(RTR("On %s"), base_type);
 	} else if (call_mode == CALL_MODE_NODE_PATH) {
 		return " [" + String(base_path.simplified()) + "]";
 	} else {
-		return TTR("On Self");
+		return RTR("On Self");
 	}
 }
 
@@ -2281,7 +2283,7 @@ PropertyInfo VisualScriptEmitSignal::get_output_value_port_info(int p_idx) const
 }
 
 String VisualScriptEmitSignal::get_caption() const {
-	return vformat(TTR("Emit %s"), name);
+	return vformat(RTR("Emit %s"), name);
 }
 
 void VisualScriptEmitSignal::set_signal(const StringName &p_type) {

+ 26 - 26
modules/visual_script/visual_script_nodes.cpp

@@ -201,7 +201,7 @@ PropertyInfo VisualScriptFunction::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptFunction::get_caption() const {
-	return TTR("Function");
+	return RTR("Function");
 }
 
 String VisualScriptFunction::get_text() const {
@@ -725,7 +725,7 @@ PropertyInfo VisualScriptComposeArray::get_output_value_port_info(int p_idx) con
 }
 
 String VisualScriptComposeArray::get_caption() const {
-	return TTR("Compose Array");
+	return RTR("Compose Array");
 }
 String VisualScriptComposeArray::get_text() const {
 	return "";
@@ -1079,11 +1079,11 @@ PropertyInfo VisualScriptSelect::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptSelect::get_caption() const {
-	return TTR("Select");
+	return RTR("Select");
 }
 
 String VisualScriptSelect::get_text() const {
-	return TTR("a if cond, else b");
+	return RTR("a if cond, else b");
 }
 
 void VisualScriptSelect::set_typed(Variant::Type p_op) {
@@ -1176,7 +1176,7 @@ PropertyInfo VisualScriptVariableGet::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptVariableGet::get_caption() const {
-	return vformat(TTR("Get %s"), variable);
+	return vformat(RTR("Get %s"), variable);
 }
 void VisualScriptVariableGet::set_variable(StringName p_variable) {
 	if (variable == p_variable) {
@@ -1283,7 +1283,7 @@ PropertyInfo VisualScriptVariableSet::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptVariableSet::get_caption() const {
-	return vformat(TTR("Set %s"), variable);
+	return vformat(RTR("Set %s"), variable);
 }
 
 void VisualScriptVariableSet::set_variable(StringName p_variable) {
@@ -1388,7 +1388,7 @@ PropertyInfo VisualScriptConstant::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptConstant::get_caption() const {
-	return TTR("Constant");
+	return RTR("Constant");
 }
 
 void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
@@ -1513,7 +1513,7 @@ PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptPreload::get_caption() const {
-	return TTR("Preload");
+	return RTR("Preload");
 }
 
 void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) {
@@ -1592,7 +1592,7 @@ PropertyInfo VisualScriptIndexGet::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptIndexGet::get_caption() const {
-	return TTR("Get Index");
+	return RTR("Get Index");
 }
 
 class VisualScriptNodeInstanceIndexGet : public VisualScriptNodeInstance {
@@ -1657,7 +1657,7 @@ PropertyInfo VisualScriptIndexSet::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptIndexSet::get_caption() const {
-	return TTR("Set Index");
+	return RTR("Set Index");
 }
 
 class VisualScriptNodeInstanceIndexSet : public VisualScriptNodeInstance {
@@ -1716,7 +1716,7 @@ PropertyInfo VisualScriptGlobalConstant::get_output_value_port_info(int p_idx) c
 }
 
 String VisualScriptGlobalConstant::get_caption() const {
-	return TTR("Global Constant");
+	return RTR("Global Constant");
 }
 
 void VisualScriptGlobalConstant::set_global_constant(int p_which) {
@@ -1801,7 +1801,7 @@ PropertyInfo VisualScriptClassConstant::get_output_value_port_info(int p_idx) co
 }
 
 String VisualScriptClassConstant::get_caption() const {
-	return TTR("Class Constant");
+	return RTR("Class Constant");
 }
 
 void VisualScriptClassConstant::set_class_constant(const StringName &p_which) {
@@ -1925,7 +1925,7 @@ PropertyInfo VisualScriptBasicTypeConstant::get_output_value_port_info(int p_idx
 }
 
 String VisualScriptBasicTypeConstant::get_caption() const {
-	return TTR("Basic Constant");
+	return RTR("Basic Constant");
 }
 
 String VisualScriptBasicTypeConstant::get_text() const {
@@ -2090,7 +2090,7 @@ PropertyInfo VisualScriptMathConstant::get_output_value_port_info(int p_idx) con
 }
 
 String VisualScriptMathConstant::get_caption() const {
-	return TTR("Math Constant");
+	return RTR("Math Constant");
 }
 
 void VisualScriptMathConstant::set_math_constant(MathConstant p_which) {
@@ -2181,7 +2181,7 @@ PropertyInfo VisualScriptEngineSingleton::get_output_value_port_info(int p_idx)
 }
 
 String VisualScriptEngineSingleton::get_caption() const {
-	return TTR("Get Engine Singleton");
+	return RTR("Get Engine Singleton");
 }
 
 void VisualScriptEngineSingleton::set_singleton(const String &p_string) {
@@ -2290,7 +2290,7 @@ PropertyInfo VisualScriptSceneNode::get_output_value_port_info(int p_idx) const
 }
 
 String VisualScriptSceneNode::get_caption() const {
-	return TTR("Get Scene Node");
+	return RTR("Get Scene Node");
 }
 
 void VisualScriptSceneNode::set_node_path(const NodePath &p_path) {
@@ -2480,7 +2480,7 @@ PropertyInfo VisualScriptSceneTree::get_output_value_port_info(int p_idx) const
 }
 
 String VisualScriptSceneTree::get_caption() const {
-	return TTR("Get Scene Tree");
+	return RTR("Get Scene Tree");
 }
 
 class VisualScriptNodeInstanceSceneTree : public VisualScriptNodeInstance {
@@ -2566,7 +2566,7 @@ PropertyInfo VisualScriptResourcePath::get_output_value_port_info(int p_idx) con
 }
 
 String VisualScriptResourcePath::get_caption() const {
-	return TTR("Resource Path");
+	return RTR("Resource Path");
 }
 
 void VisualScriptResourcePath::set_resource_path(const String &p_path) {
@@ -2647,7 +2647,7 @@ PropertyInfo VisualScriptSelf::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptSelf::get_caption() const {
-	return TTR("Get Self");
+	return RTR("Get Self");
 }
 
 class VisualScriptNodeInstanceSelf : public VisualScriptNodeInstance {
@@ -2783,7 +2783,7 @@ String VisualScriptCustomNode::get_caption() const {
 	if (get_script_instance() && get_script_instance()->has_method("_get_caption")) {
 		return get_script_instance()->call("_get_caption");
 	}
-	return TTR("CustomNode");
+	return RTR("CustomNode");
 }
 
 String VisualScriptCustomNode::get_text() const {
@@ -2985,7 +2985,7 @@ PropertyInfo VisualScriptSubCall::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptSubCall::get_caption() const {
-	return TTR("SubCall");
+	return RTR("SubCall");
 }
 
 String VisualScriptSubCall::get_text() const {
@@ -3194,7 +3194,7 @@ PropertyInfo VisualScriptConstructor::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptConstructor::get_caption() const {
-	return vformat(TTR("Construct %s"), Variant::get_type_name(type));
+	return vformat(RTR("Construct %s"), Variant::get_type_name(type));
 }
 
 String VisualScriptConstructor::get_category() const {
@@ -3309,7 +3309,7 @@ PropertyInfo VisualScriptLocalVar::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptLocalVar::get_caption() const {
-	return TTR("Get Local Var");
+	return RTR("Get Local Var");
 }
 
 String VisualScriptLocalVar::get_category() const {
@@ -3410,7 +3410,7 @@ PropertyInfo VisualScriptLocalVarSet::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptLocalVarSet::get_caption() const {
-	return TTR("Set Local Var");
+	return RTR("Set Local Var");
 }
 
 String VisualScriptLocalVarSet::get_text() const {
@@ -3532,7 +3532,7 @@ PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptInputAction::get_caption() const {
-	return vformat(TTR("Action %s"), name);
+	return vformat(RTR("Action %s"), name);
 }
 
 String VisualScriptInputAction::get_category() const {
@@ -3686,7 +3686,7 @@ PropertyInfo VisualScriptDeconstruct::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptDeconstruct::get_caption() const {
-	return vformat(TTR("Deconstruct %s"), Variant::get_type_name(type));
+	return vformat(RTR("Deconstruct %s"), Variant::get_type_name(type));
 }
 
 String VisualScriptDeconstruct::get_category() const {

+ 16 - 11
modules/visual_script/visual_script_yield_nodes.cpp

@@ -67,7 +67,7 @@ PropertyInfo VisualScriptYield::get_output_value_port_info(int p_idx) const {
 }
 
 String VisualScriptYield::get_caption() const {
-	return yield_mode == YIELD_RETURN ? TTR("Yield") : TTR("Wait");
+	return yield_mode == YIELD_RETURN ? RTR("Yield") : RTR("Wait");
 }
 
 String VisualScriptYield::get_text() const {
@@ -76,13 +76,13 @@ String VisualScriptYield::get_text() const {
 			return "";
 			break;
 		case YIELD_FRAME:
-			return TTR("Next Frame");
+			return RTR("Next Frame");
 			break;
 		case YIELD_PHYSICS_FRAME:
-			return TTR("Next Physics Frame");
+			return RTR("Next Physics Frame");
 			break;
 		case YIELD_WAIT:
-			return vformat(TTR("%s sec(s)"), rtos(wait_time));
+			return vformat(RTR("%s sec(s)"), rtos(wait_time));
 			break;
 	}
 
@@ -333,13 +333,18 @@ PropertyInfo VisualScriptYieldSignal::get_output_value_port_info(int p_idx) cons
 }
 
 String VisualScriptYieldSignal::get_caption() const {
-	static const char *cname[3] = {
-		TTRC("WaitSignal"),
-		TTRC("WaitNodeSignal"),
-		TTRC("WaitInstanceSignal"),
-	};
-
-	return TTRGET(cname[call_mode]);
+	switch (call_mode) {
+		case CALL_MODE_SELF: {
+			return RTR("WaitSignal");
+		} break;
+		case CALL_MODE_NODE_PATH: {
+			return RTR("WaitNodeSignal");
+		} break;
+		case CALL_MODE_INSTANCE: {
+			return RTR("WaitInstanceSignal");
+		} break;
+	}
+	return String();
 }
 
 String VisualScriptYieldSignal::get_text() const {