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

Remove redundant non-trivial Variant types initializations #68657

Merged

Conversation

Sauermann
Copy link
Contributor

As mentioned in #68627 (comment).

@Sauermann Sauermann requested review from a team as code owners November 14, 2022 17:23
@KoBeWi KoBeWi added this to the 4.0 milestone Nov 14, 2022
@akien-mga
Copy link
Member

akien-mga commented Nov 14, 2022

While at it, there's also:

scene/resources/skeleton_modification_2d_fabrik.h
71:     Transform2D target_global_pose = Transform2D();
72:     Transform2D origin_global_pose = Transform2D();

And some more for other types, e.g. Transform3D:

$ rg "Transform3D .* = Transform3D\(\);" --sort path
core/variant/variant_call.cpp
2441:   Transform3D identity_transform = Transform3D();

drivers/gles3/rasterizer_scene_gles3.h
102:    Transform3D cam_transform = Transform3D();
103:    Transform3D inv_cam_transform = Transform3D();

editor/plugins/node_3d_editor_plugin.cpp
3495:           Transform3D axis_angle = Transform3D();

editor/plugins/skeleton_3d_editor_plugin.cpp
1291:   Transform3D original_to_local = Transform3D();
1299:   Transform3D t = Transform3D();

scene/resources/skeleton_modification_3d_fabrik.h
71:     Transform3D target_global_pose = Transform3D();
72:     Transform3D origin_global_pose = Transform3D();

And all other non-trivial Variant types such as Vector*, String, Color, StringName, etc. all have similar occurrences. But I guess that's out of scope for this PR :)

@Sauermann
Copy link
Contributor Author

And all other non-trivial Variant types such as Vector*, String, Color, StringName, etc. all have similar occurrences. But I guess that's out of scope for this PR :)

I can simply rename the PR to "Remove redundant initialization" to change the scope ;-)
Will see what I can find.

@Sauermann Sauermann force-pushed the fix-redundant-initialization branch from 2ef5d3e to 3b14f03 Compare November 14, 2022 18:38
@Sauermann Sauermann requested review from a team as code owners November 14, 2022 18:38
@Sauermann Sauermann changed the title Remove redundant Transform2D initializations Remove redundant non-trivial Variant types initializations Nov 14, 2022
@@ -420,7 +420,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
if (mm.is_valid()) {
state_machine_draw->grab_focus();

String new_over_node = StringName();
String new_over_node;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing a String with StringName() was probably not intentional.

@akien-mga akien-mga merged commit 80dbcfd into godotengine:master Nov 14, 2022
@akien-mga
Copy link
Member

Thanks!

@Sauermann Sauermann deleted the fix-redundant-initialization branch November 14, 2022 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants