-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863
Comments
Too tedious for me, but Godspeed to whoever fixes |
Sprite.set_region(val) -> Sprite.set_region_enabled(val) |
TileMap.set_y_sort_mode(val) -> TileMap.set_y_sort_enabled(val) |
rect_min_size There are many more in Control class the get/set should all have the same name as the variable it is annoying to check the docks every time when you know the variable name. |
The |
Animation.track_remove_key_at_position should be |
Methods
|
LineEdit has a parameter new_text on "text_changed" but TextEdit does not. https://github.com/godotengine/godot/blob/master/scene/gui/text_edit.cpp#L6104 |
I would like if VBoxContainer/HBoxContainer/GridContainer is renamed to simple VBox/HBox/Grid... |
And later it will be renamed again because it is too short like pos->position :D They are a bit long you are right. |
I noticed that Godot currenly has two different naming conventions in its method names. Sometimes, it follows a common convention that can be found in APIs of such languages like C# or Java, like
However, in other places, it follows a different convention of
They are just a few examples out of many. If we can afford to do sweeping compatibility breaking changes sometime in future, I'd like to see they can be renamed to follow a single, well defined naming convention (hopefully the former, as it's more often used both inside and outside Godot). |
I didn't double check all usages, but from what I've seen this style of method naming, though a bit awkward, also follows a specific convention. For example the
The "prefix" refers to the first argument, and the part after Same story for the
Or the
|
I've updated the OP with most of the suggestions given so far.
I'm not convinced, in Godot we try to give everything explicit names, and for example
I don't think it would be useful to add |
Shouldn't it be |
This is a debatable issue. In one case, the advantage is that the name corresponds more to the English language, and in the other case, the advantage is that similar properties have one prefix and are located next to each other. It's necessary to bring all such cases to consistency. |
Personally, I find english-sounding variable names lead to much more readable code. |
Likewise, I prefer it when reading the reference or using the autocompletion of a scripting API keeps all related things together (which you get when they all have a |
When working on converter from Godot 3.x to Godot 4 I found, that renaming this functions(first string) to another one(second string), works for some classes, but broke others.
|
@qarmin Can you elaborate on what you mean by "broke"? What exactly happened to your project when you renamed those methods? Did you rename every method without using any context and therefore accidentally renamed unrelated, similarly named methods as well? PS. Also, I'm pretty sure that "_unhandled_input" and "_unhandled_key_input" are both valid existing methods. |
Broke means that renaming e.g. all occurrences of I listed all functions which I found and I know, that some are valid and don't need to be changed |
@qarmin What do you mean by "I think that this should be unified"? We don't want the OS name to be I think I do see what you mean - we should, for example, rename those methods in GLTFNode and GLTFCamera. |
I assume @qarmin meant that it should be collected in one place for everyone to be aware 🙃 But yes, most of those should not be renamed in the other classes. Instead when doing a rename one should pay attention to the context and the class that those methods belong to. |
We should probably rename RID_Owner's Edit: Done in #53227. |
Is there a convention as to whether the name of the base class should be prefixed or postfixed in the names of derived classes? It looks like this is the most inconsistent part in the project. Postfixes:
Prefixes:
And there are even exceptions with special naming logic:
These are not complete lists, but examples only. Should we do something about it? Or should we defer this to 5.0 since we already have enough renames in 4.0? Even so, perhaps we should adopt a naming convention for future classes now. Postfixes look more natural and prefixes more logical. |
@dalexeev That's a good topic for a dedicated proposal on godot-proposals, it will be easier to follow than on an issue with 515 comments :) I'll close this issue as superseded by #54161 as this one is too big to still be useful. Most proposed changes have been done, others might not be consensual yet or should be moved to #54161 or dedicated proposals if they are far reaching. |
Maybe it's worth opening a new issue that mirrors this one. There's a lot of history here. |
The YSort renames were tracked in godotengine/godot#16863. This closes godotengine/godot-proposals#814.
This issue is meant to keep track of awkwardly named or deprecated methods, properties and signals that we would like to rename next time we have the opportunity.
This can't be done lightly as it breaks compatibility for users using their old names, so any such change has to be done:
To properly deprecate methods, properties and signals, we need #4397 implemented.
A 🎉 reaction added by @akien-mga or @Calinou means the suggestion in the comment was incorporated into this post.
Classes
- [ ](See #47789 (comment))OS*
could be renamed toPlatform*
#16863 (comment)- [ ](see #40124 (comment))Label
: Consider renaming toTextLabel
#16863 (comment)PHashTranslation
should be renamed toCompressedTranslation
OptimizedTranslation
(matching its header) PR:Rename PHashTranslation to OptimizedTranslation #45234ResourceFormat*
: review all classes inheritingResourceFormatLoader
,ResourceFormatSaver
andImageFormatLoader
to check that they follow the same naming convention (both class and filename)ShortCut
should be renamed toShortcut
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Rename ShortCut to Shortcut which is more grammatically correct #41926TCP_Server
andIP_Unix
should be renamed toTCPServer
andIPUnix
PR:RenameIP_Unix
,IP_Address
andTCP_Server
to remove underscores #37700Viewport
should be looked over, it is very complex and could likely be simplified [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Methods
@GDScript
(and several other places):instance
when used as a verb/action should beinstantiate
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Renameinstance()
->instantiate()
when it's a verb #49693@GDscript
:decimals
should be renamed tostep_decimals
Make "decimal" functions more consistent #21425@GDscript
:stepify
should be renamed tosnapped
for consistency with vectors [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Math::stepify to snapped #44586AcceptDialog
andConfirmationDialog
:get_ok
andget_cancel
should beget_ok_button
andget_cancel_button
(matchingWindowDialog.get_close_button
) [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename AcceptDialog get_ok() to get_ok_button() #44389AnimatedSprite2D
andAnimatedSprite3D
:stop
should bepause
Rename the method stop() to pause() in AnimatedSprite. #31168 PR:Implement AnimatedSprite pause() and resume() #44369Animation
:track_remove_key_at_position
should betrack_remove_key_at_time
PR:Rename Animation::track_remove_key_at_position to track_remove_key_at_time #44372AnimationPlayer
:play_backwards
could be removed [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Implement AnimationPlayer pause() and resume() #44345Area
:set_audio_bus
andget_audio_bus
should be renamed toset_audio_bus_name
andget_audio_bus_name
to match the related property and theirArea2D
counterparts Area2D and Area use same functions, but with different names #29670 PR:Rename Area3D audio_bus_name getter and setter #44260Array
(some changes also apply to PackedArrays) [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment):remove
toremove_at
(remove by index) to avoid ambiguityerase
toremove_value
(remove by value) to avoid ambiguityinvert
toreverse
to use more established naming PR:Rename Array.invert() to Array.reverse() #46991Rename(See Rename Array, Dictionary and Variant.duplicate() to copy() #46996 (comment))duplicate
toclone
to use more established namingempty
tois_empty
to clearly indicate it's a boolean check and not an operation emptying the array PR:Rename empty() to is_empty() #44401Camera
:set_znear
andset_zfar
should be renamed to match thenear
andfar
properties [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Camera3D near and far getters and setters #44434Control
: Discrepancy between property names and their setter/getter names [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Control getters and setters to match properties #47248CollisionShape
:make_convex_from_brothers
should bemake_convex_from_siblings
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Implement CollisionShape3D.make_convex_from_siblings() #41044EditorInterface
:get_editor_viewport
could beget_editor_main_screen
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) + 2 following comments PR:Rename EditorInterface get_editor_viewport to get_editor_main_control #44524GridMap
:set_cell_item
(3int
s) should be replaced by a version withVector3i
Update GridMap to use Vector3i instead of three ints #39958InputMap
:load_from_globals
should beload_from_project_settings
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:load_from_globals() -> load_from_project_settings() #43661ItemList
:unselect
andunselect_all
should bedeselect
anddeselect_all
, matching other classes with similar methods. There's alsodeselect_items
inFileDialog
, harmonize this ItemList.unselect() should be ItemList.deselect() #28558 PR:Rename unselect to deselect #44569JSON
:print
should be rename to something else [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) + the following 6 comments PR:Rename JSON::print() to to_json() #44574Consolidate JSON, JSONParseResults and JSONParser into JSON #44806KinematicBody
andKinematicBody2D
: The API grew organically and is becoming quite convoluted, a refactor/reorder of some method arguments might be welcome (see e.g. Improved kinematic body, Now can move rigid body #16757 API compatibility broken for KinematicBody and KinematicBody2D #19648).MainLoop
:_iteration
should be renamed to_physics_process
,_idle
should be_process
. Non virtual methods should be unexposed, andinput_text
does nothing and should be removed doc: Proofread and complete various nodes #30096 PR:Rename MainLoop methods to match Node methods #44593- [ ]See [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Mesh
:surface_get_material
->get_surface_material
andsurface_set_material
->set_surface_material
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Node
:get_index
andget_position_in_parent
are synonyms, one should be removed Node get_position_in_parent() and get_index() do the same #21802 Remove Node.get_position_in_parent() #37556Node
:is_a_parent_of
should be replaced byis_ancestor_of
oris_descendant_of
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Node
:set_as_toplevel
could beset_as_top_level
, but its behavior may also need tweaking [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) set_as_toplevel() affects child nodes as well #24154 Renamed toplevel to be top_level #42451Node2D
andNode3D
: Inconsistency with object-local translation code [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)- [ ]See [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)OptionButton
:get_selected_id
might be obsolete after OptionButton fix remove and select #21837OS
:can_draw
would be better suited in theEngine
singletonOS
:execute
should be split in two different methods, one blocking and the other non-blocking.e.g. names:
execute
/exec_process
(blocking) andspawn_process
(non-blocking) Split OS.execute into blocking and non-blocking method #19302 PR:Split OS::execute into two methods #44514add_force
andapply_impulse
methods need harmonization of their arguments order [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Refactor physics force and impulse code to use (force, position) order #37350Quat
: Consider deprecating set methods [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Rect2
: Renameclip
tointersection
for consistency withAABB
. [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PRs: Rename Rect2 and Rect2i clip() to intersection() #44521 Update Rect intersection documentation, and rename method on Mono #44582RichTextLabel
:set_use_bbcode
andset_bbcode
should be renamed toset_use_fixed_bbcode
andset_fixed_bbcode
. Warnings should be thrown if bbcode is modified by another function Fix RichTextLabel bug which clears its content when theme changed #19118Skeleton
:set_bone_global_pose
should be renamed toset_bone_skeleton_pose
(same for the getter).get_bone_transform
should also be renamed, or dropped if unnecessary Skeleton::get_bone_global_pose function should be renamed #19551Sprite
,Sprite3D
:set_region
andis_region
should be renamed toset_region_enabled
andis_region_enabled
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Sprite.region_enabled getter and setter methods to match properties #47001String
:ord_at
considered unclear, proposal to rename it tounicode_at
Rename String::ord_at to String::unicode_at #15519 PR: Renamed String.ord_at to unicode_at #43790String:
right
behaviour is unintuitive and mostly duplicate ofsubstr
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Fix String.right(count) not returning the last count characters of a string #47434Change behavior of String.right #36180String
: Renamehttp_escape
touri_encode
,http_unescape
touri_decode
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Unify URI encoding/decoding, handle spaces-are-pluses, and handle hex/bin prefix automatically #43978String
: Renameempty
tois_empty
PR: Rename empty() to is_empty() #44401Texture2D
:get_data
should beget_image
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR: Rename Texture.get_data() to get_image() #47435TileMap
:set_y_sort_mode
andis_y_sort_mode_enabled
should be renamed toset_y_sort_enabled
andis_y_sort_enabled
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Rename various TileMap methods/properties for clarity and consistency #38635TileMap
: Discrepancy between property names and their setter/getter names [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)TileMap
:set_cell
(2int
s) andset_cellv
(Vector2
) should be replaced by a version withVector2i
Update TileMap to use Vector2i #39976Tree
:get_selected
should be renamed to something likeget_active
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Tween
: Many methods returnbool
for no reason, should be changed tovoid
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Removed boolean return type from majority of method in Tween #36844UndoRedo
:is_commiting_action
has a typo, should be "committing"VisualServer
:sync
anddraw
bindings should be deprecated in favour of the existingforce_sync
andforce_draw
Added all missing VisualServer bindings #15892Vector2
:tangent
is considered ambiguous/inaccurate, it should beperpendicular
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR: Renamed Vector2.tangent to perpendicular #39685 or Rename Vector2.tangent() to Vector2.orthogonal() #44149XRPositionalTracker
:get_type
->get_tracker_type
andget_name
->get_tracker_name
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Multiple C# classes hiding inherited members in GodotSharp #15763 (comment) Unhide hidden members by renaming them and rebind Mesh enums #36382 [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Properties
BoxShape
,CubeMesh
andCSGBox
: their dimension properties are inconsistent, andCubeMesh
should maybe be renamed toBoxMesh
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename CubeMesh to BoxMesh #44091 and Use a size Vector for adjusting the size of Rectangles and Boxes #44183Camera2D
:offset
andoffset_h
/offset_v
are confusingly named as they refer to completely different things. It should likely be harmonized withCamera
too which hash_offset
andv_offset
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Camera2D offset issues #7489 PR:Rename Camera2D offset_h and offset_v properties #44232Camera2D
:limit_
values could be changed to aRect2i
or similar [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Control:
Renamemargin
tooffset
now that they can be negative? [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Control margin to offset #44605Control:
rect_rotation
is in degrees, so it should be renamed torect_rotation_degrees
to matchNode2D
'srotation_degrees
, and a newrect_rotation
property should be added which uses radians. PR:Rename Control rotation to rotation_degrees #44607- [ ]Removed as part of Refactored 2D shader and lighting system #43052CPUParticles2D
: Renamenormalmap
tonormal_map
for consistency [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)Engine
: Renameiterations_per_second
tophysics_fps
to match the project setting of the same name [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Renameiterations_per_second
tophysics_ticks_per_second
#41956ImageTexture
:lossy_quality
should be changed to an enum (low, mid, high, etc.) instead of a float ratio interpreted as arbitrary plateaus (same inImage::compress()
) Support higher-quality S3TC compression modes #21167 (comment)LightOccluder2D
:light_mask
->occluder_light_mask
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Multiple C# classes hiding inherited members in GodotSharp #15763 (comment) Unhide hidden members by renaming them and rebind Mesh enums #36382Label
andButton
:clip_text
is not necessary anymore, as all Controls haverect/clip_content
Fix Label autowrap clips text #20228LineEdit
:cursor_*
properties should be renamed tocaret_*
LineEdit caret blink method name #16116 PR:Rename LineEdit getters and setters to match property names #47448LineEdit
andTextEdit
: Their respective APIs could be homogenized as far as possible [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Why are LineEdit and TextEdit two separate nodes? #20611Node2D
,Spatial
: inconsistency betweenposition
(2D) andtranslation
(3D) Rename "translation" to "position" in Spatial? #9128 PR:Rename Node3D's property translation to position #44198NoiseTexture
: Renameas_normalmap
toas_normal_map
for consistency [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Consistently use normal_map #44614RayCast
: Renamecast_to
totarget_position
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)RayCast
and others: Changedisabled
properties toenabled
ones [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) + the following 2 comments PR:Change physics disabled booleans to enabled #44141Resource
:resource_name
is not used, should be dropped Script.resource_name always contains blank string #13358TileMap
:collision_friction
property should be renamed tofriction
Rename collision_friction to friction in TileMap #18191Signals
CanvasItem
:hide
should be renamed tohidden
PR:Rename CanvasItem's hide signal to hidden #44189Tabs
:tab_close
andtab_hover
should be spelledtab_closed
andtab_hovered
PR:Rename Tabs close and hover signals to tab_closed and tab_hovered #44188Tree
:item_activated
(label double-click) anditem_double_clicked
(icon double-click), names don't properly convey what they do Tree's "item_activated" and "item_double_clicked" signals #16839: PR:Rename tree item double-click signal to match the actual behaviour #44185XRController
:button_release
should be spelledbutton_released
(likebutton_pressed
) PR:Rename XRController signal button_release to button_released #44184Enums
ArrayMesh
:ArrayType
enum is a duplicate, delete it [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Multiple C# classes hiding inherited members in GodotSharp #15763 (comment) Unhide hidden members by renaming them and rebind Mesh enums #36382CPUParticles
:Flags
enum ->ParticleFlags
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Multiple C# classes hiding inherited members in GodotSharp #15763 (comment) Unhide hidden members by renaming them and rebind Mesh enums #36382Mesh
:BlendShapeMode
enum is only used byArrayMesh
, so give toArrayMesh
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) Multiple C# classes hiding inherited members in GodotSharp #15763 (comment) Unhide hidden members by renaming them and rebind Mesh enums #36382Viewport
:ClearMode
andUpdateMode
enums should use the same suffixes (Align naming of Viewport Clear Mode and Update Mode Enums #19404) PR:Rename Viewport::ClearMode::CLEAR_MODE_ONLY_NEXT_FRAME to CLEAR_MODE_ONCE #44267XRPositionalTracker
:TRACKER_LEFT_HAND
->TRACKER_HAND_LEFT
etc [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename TrackerHand enums #44261ButtonList
enum toMouseButton
[TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename many global enums relating to input #38054Constants
PROPERTY_USAGE_STORE_IF_NONZERO
andPROPERTY_USAGE_STORE_IF_NONONE
should be fully dropped, also from GDNative Remove obsolete enums #37693Theme items
ItemList
,LineEdit
,RichTextLabel
,TextEdit
andTree
:font_color_selected
should be renamed tofont_selected_color
to match other_color
properties. TextEdit: Correct typo that broke custom selected font color #30018 PR:Change themes font_color_selected to font_selected_color #44194Objects
CapsuleShape
should be vertical by default Changed default capsule axis to vertical #36488Shading language
WORLD_MATRIX
is actually a model-view matrix and should be renamed. @reduz suggests to replace it (andCAMERA_MATRIX
, which is a view matrix) by actual view and model matrices, e.g.CANVAS_MATRIX
andITEM_MATRIX
.Project settings
display/window/size/test_width
andtest_height
should be renamed towindow_width
andwindow_height
. We should also consider renaming thewidth
andheight
settings, mayberender_width
andrender_height
. [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment) PR:Rename Project Settings, Display, Window width and height, and test_width and test_height settings to match their function #47522File formats
RES_BASE_EXTENSION
) [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863 (comment)The text was updated successfully, but these errors were encountered: