Skip to content

Commit c1c2c95

Browse files
alice-i-cecilecart
andcommitted
Split bevy_hierarchy out from bevy_transform (#4168)
# Objective - Hierarchy tools are not just used for `Transform`: they are also used for scenes. - In the future there's interest in using them for other features, such as visiibility inheritance. - The fact that these tools are found in `bevy_transform` causes a great deal of user and developer confusion - Fixes #2758. ## Solution - Split `bevy_transform` into two! - Make everything work again. Note that this is a very tightly scoped PR: I *know* there are code quality and docs issues that existed in bevy_transform that I've just moved around. We should fix those in a seperate PR and try to merge this ASAP to reduce the bitrot involved in splitting an entire crate. ## Frustrations The API around `GlobalTransform` is a mess: we have massive code and docs duplication, no link between the two types and no clear way to extend this to other forms of inheritance. In the medium-term, I feel pretty strongly that `GlobalTransform` should be replaced by something like `Inherited<Transform>`, which lives in `bevy_hierarchy`: - avoids code duplication - makes the inheritance pattern extensible - links the types at the type-level - allows us to remove all references to inheritance from `bevy_transform`, making it more useful as a standalone crate and cleaning up its docs ## Additional context - double-blessed by @cart in bevyengine/bevy#4141 (comment) and bevyengine/bevy#2758 (comment) - preparation for more advanced / cleaner hierarchy tools: go read bevyengine/rfcs#53 ! - originally attempted by @finegeometer in #2789. It was a great idea, just needed more discussion! Co-authored-by: Carter Anderson <[email protected]>
1 parent d4b567e commit c1c2c95

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bevy_app = { path = "../bevy_app", version = "0.6.0" }
1414
bevy_asset = { path = "../bevy_asset", version = "0.6.0" }
1515
bevy_core = { path = "../bevy_core", version = "0.6.0" }
1616
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0" }
17+
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.6.0" }
1718
bevy_pbr = { path = "../bevy_pbr", version = "0.6.0" }
1819
bevy_reflect = { path = "../bevy_reflect", version = "0.6.0", features = ["bevy"] }
1920
bevy_render = { path = "../bevy_render", version = "0.6.0" }

src/loader.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use bevy_asset::{
44
};
55
use bevy_core::Name;
66
use bevy_ecs::world::World;
7+
use bevy_hierarchy::{BuildWorldChildren, WorldChildBuilder};
78
use bevy_log::warn;
89
use bevy_math::{Mat4, Vec3};
910
use bevy_pbr::{
@@ -24,11 +25,8 @@ use bevy_render::{
2425
view::VisibleEntities,
2526
};
2627
use bevy_scene::Scene;
27-
use bevy_transform::{
28-
hierarchy::{BuildWorldChildren, WorldChildBuilder},
29-
prelude::Transform,
30-
TransformBundle,
31-
};
28+
use bevy_transform::{components::Transform, TransformBundle};
29+
3230
use bevy_utils::{HashMap, HashSet};
3331
use gltf::{
3432
mesh::Mode,

0 commit comments

Comments
 (0)