Skip to content

Add ability to transform parent nodes without affecting global transform of its children#109680

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
Open-Industry-Project:preserve-children-transform
Mar 12, 2026
Merged

Add ability to transform parent nodes without affecting global transform of its children#109680
Repiteo merged 1 commit into
godotengine:masterfrom
Open-Industry-Project:preserve-children-transform

Conversation

@ryevdokimov
Copy link
Copy Markdown
Contributor

@ryevdokimov ryevdokimov commented Aug 16, 2025

Partially addresses: godotengine/godot-proposals#9930 (for 3D)

2025-08-16.23-28-02.mp4

TODO:

  • Make it work with transforms via the inspector dock.
  • Find/Make a better icon?

@ryevdokimov ryevdokimov requested a review from a team August 16, 2025 20:47
@ryevdokimov ryevdokimov requested a review from a team as a code owner August 16, 2025 20:47
@AThousandShips AThousandShips modified the milestones: 4.5, 4.x Aug 18, 2025
@Calinou
Copy link
Copy Markdown
Member

Calinou commented Aug 18, 2025

This makes sense to have when working with certain setups that rely on a certain parent-child structure, e.g. CSG nodes. I've wanted this multiple times when prototyping with CSG.

Closes: godotengine/godot-proposals#6511

Note that the discussion requested the feature in the 2D editor, but this proposal only implements it in 3D currently.

@ryevdokimov
Copy link
Copy Markdown
Contributor Author

Note that the discussion requested the feature in the 2D editor, but this proposal only implements it in 3D currently.

Good point out, updated the post.

@Calinou
Copy link
Copy Markdown
Member

Calinou commented Aug 18, 2025

Good point out, updated the post.

Note that "Partially closes #xxxx" would still close the issue when the PR is merged, as GitHub sees "closes #xxxx" only, so you have to use another word like "addresses" instead. I went ahead and edited OP for this.

@Repiteo Repiteo requested review from a team as code owners February 17, 2026 20:10
@ryevdokimov ryevdokimov force-pushed the preserve-children-transform branch from b43efbc to e209d51 Compare March 4, 2026 02:10
@ryevdokimov
Copy link
Copy Markdown
Contributor Author

This works with inspector now.

2026-03-03.21-12-10.mp4

@fire
Copy link
Copy Markdown
Member

fire commented Mar 4, 2026

I haven’t had time to test or review but the design proposal is something I’ve always wanted

Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally (rebased on top of master c53c5a1), it mostly works as expected. This will be a nice usability boost for CSG in particular 🙂

csg_relative_root_node.mp4

Some feedback:

  • When using relative positioning, CSG gizmos don't update until you move your mouse over one of the handles:
csg_relative_root_node_gizmos.mp4

@ryevdokimov ryevdokimov force-pushed the preserve-children-transform branch from e209d51 to ebc6da0 Compare March 5, 2026 01:09
@ryevdokimov
Copy link
Copy Markdown
Contributor Author

Should be fixed:

2026-03-04.20-14-05.mp4

@ryevdokimov ryevdokimov force-pushed the preserve-children-transform branch from ebc6da0 to 67e39db Compare March 5, 2026 02:08
@ryevdokimov
Copy link
Copy Markdown
Contributor Author

Changed it to the pin icon since I think it makes slightly more sense if we had to use something existing.

image

Copy link
Copy Markdown
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Works great now 🙂 Code looks good to me.

I think the Pin icon is a better choice for now. Ideally, we'll want a custom design but I am not sure what would convey the idea of "parent is transformed without affecting children" well.

PS: As an aside, modifying position/rotation/scale properties in the inspector while this mode is enabled does affect the properties in the same way as if you were using the gizmos. This is probably not a bug and can be useful for manual entry, but it can be a little surprising. Maybe it should be denoted in the tooltip.

@Jesusemora While testing this PR, I noticed CSG autosmooth is affected by non-uniform scaling:

csg_autosmooth_non_uniform_scale.mp4

Notice how the house (which is a child of the Ground node I'm editing) has its wall being autosmoothed, even though it shouldn't at the default angle of 50°.

I'm not sure if this can be fixed, but I thought I'd report it just in case. The issue doesn't seem to occur with uniform scaling. To test this, use the MRP I posted in #116749, move the ground away from the house and scale it non-uniformly with parent transforms enabled using this PR.

@Jesusemora
Copy link
Copy Markdown
Contributor

Jesusemora commented Mar 6, 2026

Works great now 🙂 Code looks good to me.

I think the Pin icon is a better choice for now. Ideally, we'll want a custom design but I am not sure what would convey the idea of "parent is transformed without affecting children" well.

PS: As an aside, modifying position/rotation/scale properties in the inspector while this mode is enabled does affect the properties in the same way as if you were using the gizmos. This is probably not a bug and can be useful for manual entry, but it can be a little surprising. Maybe it should be denoted in the tooltip.

@Jesusemora While testing this PR, I noticed CSG autosmooth is affected by non-uniform scaling:

csg_autosmooth_non_uniform_scale.mp4
Notice how the house (which is a child of the Ground node I'm editing) has its wall being autosmoothed, even though it shouldn't at the default angle of 50°.

I'm not sure if this can be fixed, but I thought I'd report it just in case. The issue doesn't seem to occur with uniform scaling. To test this, use the MRP I posted in #116749, move the ground away from the house and scale it non-uniformly with parent transforms enabled using this PR.

My best guess is something to do with CSG operations (pack/unpack?)? It probably uses the transform of the Node when doing the operations.
People should not use scaling with CSGs in the first place, but this is a bug, altough depending on who you ask it could be seen as a feature.
Edit: line 478 CSGShape3D::_get_brush()

CSGBrush::copy_from() takes the transform of the children and uses xform on the vertices.

@ryevdokimov ryevdokimov force-pushed the preserve-children-transform branch from 67e39db to 5b2a543 Compare March 6, 2026 20:45
@ryevdokimov
Copy link
Copy Markdown
Contributor Author

Maybe it should be denoted in the tooltip.

image

Done.

@AdriaandeJongh AdriaandeJongh requested a review from a team March 7, 2026 05:46
@passivestar
Copy link
Copy Markdown
Contributor

Tested, found a bug where if you cancel transform operation by pressing right mouse button it moves the children

@github-project-automation github-project-automation Bot moved this to For team assessment in Usability Team Review Tracker Mar 7, 2026
@passivestar passivestar moved this from For team assessment to In Progress in Usability Team Review Tracker Mar 7, 2026
@ryevdokimov ryevdokimov force-pushed the preserve-children-transform branch from 5b2a543 to e8e3cf1 Compare March 7, 2026 14:25
@ryevdokimov
Copy link
Copy Markdown
Contributor Author

found a bug where if you cancel transform operation by pressing right mouse button it moves the children

Fixed.

2026-03-07.09-27-00.mp4

@Calinou
Copy link
Copy Markdown
Member

Calinou commented Mar 7, 2026

@Jesusemora I've opened a separate issue to track CSG: #117190

@ryevdokimov ryevdokimov modified the milestones: 4.x, 4.7 Mar 9, 2026
@Repiteo Repiteo merged commit fcb7c06 into godotengine:master Mar 12, 2026
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Mar 12, 2026

Thanks!

@ryevdokimov ryevdokimov deleted the preserve-children-transform branch March 12, 2026 14:27
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.

Add a way to modify node's transform in the editor without affecting node's children's ones

8 participants