-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Cleanup 3-to-4 renames, prevent common words replacements, handle project.godot settings #74040
Conversation
ebf87bb
to
e307048
Compare
@@ -456,7 +466,6 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { | |||
{ "post_import", "_post_import" }, // EditorScenePostImport | |||
{ "print_stray_nodes", "print_orphan_nodes" }, // Node | |||
{ "property_list_changed_notify", "notify_property_list_changed" }, // Object | |||
{ "raise", "move_to_front" }, // CanvasItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as possibly conflicting with comments / user-defined methods.
{ "clamped", "limit_length" }, // Vector2 | ||
{ "get_rotation_quat", "get_rotation_quaternion" }, // Basis | ||
{ "grow_margin", "grow_side" }, // Rect2 | ||
{ "invert", "reverse" }, // Array -- Give it a check. Be careful, this will be used everywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too common.
{ "is_abs_path", "is_absolute_path" }, // String | ||
{ "is_valid_integer", "is_valid_int" }, // String | ||
{ "linear_interpolate", "lerp" }, // Color | ||
{ "find_last", "rfind" }, // Array, String | ||
{ "to_ascii", "to_ascii_buffer" }, // String | ||
{ "to_utf8", "to_utf8_buffer" }, // String | ||
{ "to_wchar", "to_utf32_buffer" }, // String -- utf32 or utf16? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong (will be fixed by #73225).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, shouldn't it be changed to convert to to_wchar_buffer
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not merged yet, because production folks are stingy on their merges :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, right right, the vermin of this world get in our way again!
// NOTE: Commented out renames are disabled because deemed not suitable for | ||
// the current way the regex-based converter works. | ||
// When uncommenting any of those as suitable for conversion, please move it | ||
// to the block with other enabled conversions, ordered alphabetically, and | ||
// make sure to add it to the C# rename map too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this blurb so we don't have to keep commented out stuff in sync too.
@@ -617,52 +623,6 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { | |||
|
|||
// gdscript_function_renames clone with CamelCase | |||
const char *RenamesMap3To4::csharp_function_renames[][2] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For properties I did a full comparative review of GDScript vs C#, but not for this one.
@@ -1155,6 +1118,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { | |||
{ "refuse_new_network_connections", "refuse_new_connections" }, // MultiplayerAPI | |||
{ "region_filter_clip", "region_filter_clip_enabled" }, // Sprite2D | |||
{ "reverb_bus_enable", "reverb_bus_enabled" }, // Area3D | |||
{ "scancode", "keycode" }, // InputEventKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems safe enough?
@@ -1170,49 +1134,29 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { | |||
{ "tab_align", "tab_alignment" }, // TabContainer | |||
{ "table_hseparation", "table_h_separation" }, // Theme | |||
{ "table_vseparation", "table_v_separation" }, // Theme | |||
{ "translation", "position" }, // Node3D -- Breaks GLTFNode | |||
{ "toplevel", "top_level" }, // Node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems safe enough?
{ "ExtraSpacingBottom", "SpacingBottom" }, // Font | ||
{ "ExtraSpacingTop", "SpacingTop" }, // Font | ||
{ "FocusNeighbourBottom", "FocusNeighborBottom" }, // Control | ||
{ "FocusNeighbourLeft", "FocusNeighborLeft" }, // Control | ||
{ "FocusNeighbourRight", "FocusNeighborRight" }, // Control | ||
{ "FocusNeighbourTop", "FocusNeighborTop" }, // Control | ||
{ "FollowViewportEnable", "FollowViewportEnabled" }, // CanvasItem | ||
{ "FileIconModulate", "FileIconColor" }, // Theme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if theme properties are actually capitalized or if they're used with their core snake_case identifier.
Either way, these shouldn't hurt as it will do nothing if they're not capitalized.
editor/renames_map_3_to_4.cpp
Outdated
// Too common. | ||
// { "Area", "Area3D" }, | ||
// { "Camera", "Camera3D" }, | ||
// { "World", "World3D" }, | ||
// { "Particles", "GPUParticles3D" }, | ||
// { "Reference", "RefCounted" }, | ||
// { "Tabs", "TabBar" }, | ||
// { "Shape", "Shape3D" }, | ||
// { "Path", "Path3D" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will lead to more manual work for users, as Reference, Area, Camera, Shape and Path are quite used. But those are also potential clashes with user comments and strings.
// Portal and room occlusion culling was replaced by raster occlusion culling. | ||
{ "CullInstance", "Node3D" }, | ||
{ "RoomGroup", "Node3D" }, | ||
{ "Room", "Node3D" }, | ||
{ "RoomManager", "Node3D" }, | ||
{ "Portal", "Node3D" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of renames was added as aliases in register_scene_types.cpp
to avoid scenes getting corrupted, but it makes no sense to do the same in scripts.
Removing Reference is a big downgrade, IMO. There is a decent possibility for conflicts, but it's also a core class in Godot, and can be used quite a lot. Not sure if it's better to avoid converting it and have users update it manually. |
That's fair. What about the others?
I think at least "World" can be kept commented out, currently it would replace stuff like using "Particles" probably doesn't make sense to convert like this because it's not going to be compatible anyway. The rest might be still worth it even if there's a high risk of doing wrong replacements in e.g. comments, strings and node paths? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the two notes above, LGTM. We can give it a go.
The rest might be still worth it even if there's a high risk of doing wrong replacements in e.g. comments, strings and node paths?
I agree that World is too commonplace (I have it in practically every project, and it's never the World
node). For the rest, it's a toss. We can go on with a safer option and re-evaluate later. I wouldn't worry too much about comments though.
e307048
to
5f5569c
Compare
Alright, re-added those aside from "World" (too common) and "Particles" (too common, and incompatible class). |
Feels good! |
72e2ea4
to
b02cbd0
Compare
In the ConfigFile format, the first subpath is the category and is not part of the line that the regex would match. Fixes godotengine#66125.
b02cbd0
to
7cf1ec1
Compare
A bit late but should help solve common pitfalls.
I'll put some inline comments on some relevant changes.
Fixes not 3-to-4 project converter changes instance of "Reference" in a comment to "RefCounted" #66061.