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

Add necessary elaboration to documentation for Node3D::get_parent_node_3d #88841

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

MajorMcDoom
Copy link
Contributor

This method returns null if the node has top_level set to true, and as such its behaviour is different from simply calling get_parent() as Node3D. This important detail was not mentioned in the docs.

@MajorMcDoom MajorMcDoom requested a review from a team as a code owner February 25, 2024 22:00
@Mickeon Mickeon added this to the 4.3 milestone Feb 25, 2024
@Mickeon Mickeon added cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Feb 25, 2024
Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

I would've solved this differently in #87440 but it is good to have sooner than later.

doc/classes/Node3D.xml Outdated Show resolved Hide resolved
@ryevdokimov
Copy link
Contributor

ryevdokimov commented Feb 25, 2024

This is true, but this is also a weird function IMO. It's probably too late now, but at least the code that it seems to be used for in the engine (which isn't in that many places) would be better understood if it were more explicit in its intention to use transforms it's dependent on or not.

Like:

Node3D *parent = Object::cast_to<Node3D>(node->get_parent());

if(parent && !parent.is_set_as_top_level()){
   //blah
}

@Mickeon
Copy link
Contributor

Mickeon commented Feb 25, 2024

Indeed, the question the method asks/answers is "Which Node3D does my transformation directly depend on, if any?"

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

I do approve of this as is, but I do agree it could be worded better.

@akien-mga
Copy link
Member

Could you squash the commits? See PR workflow for instructions.

@akien-mga akien-mga merged commit d8cfc5e into godotengine:master Mar 1, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.
Cherry-picked for 4.1.4.

@akien-mga akien-mga removed cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Mar 11, 2024
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.

5 participants