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

Overhaul Node2D documentation #89256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mickeon
Copy link
Contributor

@Mickeon Mickeon commented Mar 7, 2024

Meant to address godotengine/godot-docs#4681

This PR is a placeholder and a counterpart to #87440, until that PR is merged, so that I can use it as a point of reference for consistency.

Related to several other past efforts, but especially the #87175 and #87334 ones.

This PR aims to completely overhaul Node2D's class reference in an attempt to make it more easy to digest. Reasons are the same as prior PRs so I'm not sure I should explain myself too much here.

@Mickeon Mickeon added this to the 4.x milestone Mar 7, 2024
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Node2D" inherits="CanvasItem" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
A 2D game object, inherited by most 2D-related nodes.
Copy link
Member

Choose a reason for hiding this comment

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

What exceptions are there? It also contradicts below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CanvasItem is actually what the original description claims to be.

It also contradicts below

Yeah I didn't change anything there yet...

Copy link
Member

@AThousandShips AThousandShips Mar 7, 2024

Choose a reason for hiding this comment

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

No, 2D nodes are a distinct things, Controls are different, 2D nodes doesn't just mean "nodes drawn in 2D" I'd say, it's related to them being transformable etc. I'd say

Also if you include all canvas items then fewer than half of all those nodes are 2D nodes, there's more Controls than 2D nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CanvasItem's description states.

Abstract base class for everything in 2D space.

Would you say that is the misleading description, then?

Copy link
Member

@AThousandShips AThousandShips Mar 7, 2024

Choose a reason for hiding this comment

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

That's different I'd say, that's true too

Also the manual talks about 2D as a distinct thing, so if we change this terminology that needs changing too

@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch from e0f4ee7 to 2671a63 Compare March 7, 2024 18:19
@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch 2 times, most recently from e1befa0 to 84633b3 Compare November 30, 2024 19:55
@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch 2 times, most recently from 08e97c3 to cab7c73 Compare March 16, 2025 18:05
@Mickeon Mickeon marked this pull request as ready for review March 16, 2025 18:05
@Mickeon Mickeon requested a review from a team as a code owner March 16, 2025 18:05
Copy link
Contributor Author

@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.

The PR has actually been fine for a while. Mainly a few pain points I can't get through.

Comment on lines 6 to 7
<description>
A 2D game object, with a transform (position, rotation, and scale). All 2D nodes, including physics objects and sprites, inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control of the node's render order.
The [Node2D] node is the base representation of a node in 2D space. All other 2D nodes inherit from this class.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for consistency with #87440 .
However, in hindsight, I can't help but notice loss of information. I personally think it's fine, given the very generic and oddly written nature of them ("also... gives... control of...").

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, imo the previous version is better here, this change is in danger of removing all the "documentation" from the documentation...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I elaborate more on types that inherit Node2D. The rest is... true, but it actually applies to CanvasItem as a whole, and it feels wrong to mention it here, especially because of the [b]Note:[/b] Since both [Node2D] and [Control] inherit from [CanvasItem], below.

Comment on lines 79 to +88
<description>
Transforms the provided local position into a position in global coordinate space. The input is expected to be local relative to the [Node2D] it is called on. e.g. Applying this method to the positions of child nodes will correctly transform their positions into the global coordinate space, but applying it to a node's own position will give an incorrect result, as it will incorporate the node's own transformation into its global position.
Returns the [param local_point] converted from this node's local space to global space. This is the opposite of [method to_local].
</description>
</method>
<method name="to_local" qualifiers="const">
<return type="Vector2" />
<param index="0" name="global_point" type="Vector2" />
<description>
Transforms the provided global position into a position in local coordinate space. The output will be local relative to the [Node2D] it is called on. e.g. It is appropriate for determining the positions of child nodes, but it is not appropriate for determining its own position relative to its parent.
Returns the [param global_point] converted from global space to this node's local space. This is the opposite of [method to_global].
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for consistency with #87440
However, it's a pretty nasty loss of information here. The corresponding 3D methods are not as verbose as this. At the moment I don't know what to make of it.

@Mickeon Mickeon requested a review from aaronfranke March 16, 2025 18:18
@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch from cab7c73 to c40d135 Compare March 16, 2025 18:55
Copy link
Contributor

@radiantgurl radiantgurl left a comment

Choose a reason for hiding this comment

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

Finally some much needed changes, LGTM.

@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch from c40d135 to 1bb843a Compare March 20, 2025 12:33
@Mickeon Mickeon requested a review from lawnjelly March 20, 2025 12:33
@Mickeon Mickeon force-pushed the doc-peeves-Node2D-I-am-running-out-of-puns-help branch from 1bb843a to 8c51259 Compare March 20, 2025 12:35
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.

4 participants