Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more missing properties/methods to the Godot converter #70913

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion editor/project_converter_3_to_4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ static const char *gdscript_function_renames[][2] = {
// { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D
// {"get_points","get_points_id"},// Astar, broke Line2D, Convexpolygonshape
// {"get_v_scroll","get_v_scroll_bar"},//ItemList, broke TextView
// { "get_stylebox", "get_theme_stylebox" }, // Control - Will rename the method in Theme as well, skipping
{ "_about_to_show", "_about_to_popup" }, // ColorPickerButton
{ "_get_configuration_warning", "_get_configuration_warnings" }, // Node
{ "_set_current", "set_current" }, // Camera2D
Expand Down Expand Up @@ -665,6 +666,7 @@ static const char *csharp_function_renames[][2] = {
// { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D
// {"GetPoints","GetPointsId"},// Astar, broke Line2D, Convexpolygonshape
// {"GetVScroll","GetVScrollBar"},//ItemList, broke TextView
// { "GetStylebox", "GetThemeStylebox" }, // Control - Will rename the method in Theme as well, skipping
{ "AddSpatialGizmoPlugin", "AddNode3dGizmoPlugin" }, // EditorPlugin
{ "RenderingServer", "GetTabAlignment" }, // Tab
{ "_AboutToShow", "_AboutToPopup" }, // ColorPickerButton
Expand Down Expand Up @@ -1078,6 +1080,7 @@ static const char *gdscript_properties_renames[][2] = {
// { "zfar", "far" }, // Camera3D
// { "znear", "near" }, // Camera3D
// { "filename", "scene_file_path" }, // Node
// { "pressed", "button_pressed" }, // BaseButton - Will also rename the signal, skipping for now
{ "as_normalmap", "as_normal_map" }, // NoiseTexture
{ "bbcode_text", "text" }, // RichTextLabel
{ "bg", "panel" }, // Theme
Expand Down Expand Up @@ -1113,6 +1116,7 @@ static const char *gdscript_properties_renames[][2] = {
{ "gravity_vec", "gravity_direction" }, // Area2D
{ "hint_tooltip", "tooltip_text" }, // Control
{ "hseparation", "h_separation" }, // Theme
{ "icon_align", "icon_alignment" }, // Button
{ "iterations_per_second", "physics_ticks_per_second" }, // Engine
{ "invert_enable", "invert_enabled" }, // Polygon2D
{ "margin_bottom", "offset_bottom" }, // Control broke NinePatchRect, StyleBox
Expand All @@ -1137,7 +1141,7 @@ static const char *gdscript_properties_renames[][2] = {
{ "rect_position", "position" }, // Control
{ "rect_global_position", "global_position" }, // Control
{ "rect_size", "size" }, // Control
{ "rect_min_size", "minimum_size" }, // Control
{ "rect_min_size", "custom_minimum_size" }, // Control
{ "rect_rotation", "rotation" }, // Control
{ "rect_scale", "scale" }, // Control
{ "rect_pivot_offset", "pivot_offset" }, // Control
Expand Down Expand Up @@ -1192,6 +1196,7 @@ static const char *csharp_properties_renames[][2] = {
// { "WrapEnabled", "WrapMode" }, // TextEdit
// { "Zfar", "Far" }, // Camera3D
// { "Znear", "Near" }, // Camera3D
// { "Pressed", "ButtonPressed" }, // BaseButton - Will also rename the signal, skipping for now
{ "AsNormalmap", "AsNormalMap" }, // NoiseTexture
{ "BbcodeText", "Text" }, // RichTextLabel
{ "CaretBlinkSpeed", "CaretBlinkInterval" }, // TextEdit, LineEdit
Expand Down Expand Up @@ -1221,6 +1226,7 @@ static const char *csharp_properties_renames[][2] = {
{ "GravityVec", "GravityDirection" }, // Area2D
{ "HintTooltip", "TooltipText" }, // Control
{ "Hseparation", "HSeparation" }, // Theme
{ "IconAlign", "IconAlignment" }, // Button
{ "IterationsPerSecond", "PhysicsTicksPerSecond" }, // Engine
{ "InvertEnable", "InvertEnabled" }, // Polygon2D
{ "MarginBottom", "OffsetBottom" }, // Control broke NinePatchRect, StyleBox
Expand Down Expand Up @@ -3880,11 +3886,33 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
if (line.contains("OS.set_window_title")) {
line = line.replace("OS.set_window_title", "get_window().set_title");
}

// get_tree().set_input_as_handled() -> get_viewport().set_input_as_handled()
if (line.contains("get_tree().set_input_as_handled()")) {
line = line.replace("get_tree().set_input_as_handled()", "get_viewport().set_input_as_handled()");
}

// Fix the simple case of using _unhandled_key_input
// func _unhandled_key_input(event: InputEventKey) -> _unhandled_key_input(event: InputEvent)
if (line.contains("_unhandled_key_input(event: InputEventKey)")) {
line = line.replace("_unhandled_key_input(event: InputEventKey)", "_unhandled_key_input(event: InputEvent)");
}
}

void ProjectConverter3To4::process_csharp_line(String &line, const RegExContainer &reg_container) {
line = line.replace("OS.GetWindowSafeArea()", "DisplayServer.ScreenGetUsableRect()");

// GetTree().SetInputAsHandled() -> GetViewport().SetInputAsHandled()
if (line.contains("GetTree().SetInputAsHandled()")) {
line = line.replace("GetTree().SetInputAsHandled()", "GetViewport().SetInputAsHandled()");
}

// Fix the simple case of using _UnhandledKeyInput
// func _UnhandledKeyInput(InputEventKey @event) -> _UnhandledKeyInput(InputEvent @event)
if (line.contains("_UnhandledKeyInput(InputEventKey @event)")) {
line = line.replace("_UnhandledKeyInput(InputEventKey @event)", "_UnhandledKeyInput(InputEvent @event)");
}

// -- Connect(,,,things) -> Connect(,Callable(,),things) Object
if (line.contains("Connect(")) {
int start = line.find("Connect(");
Expand Down