Should bevy_transform
be two crates?
#2187
finegeometer
started this conversation in
Ideas
Replies: 2 comments
-
As an FYI, we're in the process of making hierarchical structures and more generally, graph-like data structures a core ECS feature with #1627 (rfc: bevyengine/rfcs#18). This kind of split could still be useful however, as it would enable |
Beta Was this translation helpful? Give feedback.
0 replies
-
I no longer think this suggestion is a good idea. See the comments on pull request #2789. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I almost posted this as an issue, before I noticed the "Discussions" button. I'm still not sure which I should have done.
Question
In Bevy's
README.md
, it states that one of the design goals is to be modular; a user can choose to use only those features they need.Yet the crate
bevy_transform
seems to bundle two unrelated concerns:Transform
, roughly a similarity transformation of Euclidean space.bevy_transform
's description inCargo.toml
even admits this — "Provides hierarchy and transform functionality for Bevy Engine"! (Emphasis mine.)Why aren't these two separate crates, with the latter depending on the former?
Why I'm Asking
I discovered this issue while exploring the possibility of using Bevy to make games that take place in curved space.
The concept of a parent-child hierarchy is still completely applicable. But
Transform
, at least as implemented in Bevy, is not.Details of Code Splitting
To ensure that this crate splitting would actually work, I tried it in a clone of the repository. Here are the results.
The crate
bevy_transform
was split into two:bevy_hierarchy
andbevy_transform
.bevy_hierarchy
contains these things:components::{children, parent}
.hierarchy
and its submodules, except for the test inhierarchy::hierarchy_maintenance
.It has dependencies
bevy_ecs
,bevy_reflect
,bevy_utils
, andsmallvec
.It does not need
bevy_app
orbevy_math
.bevy-transform
contains everything else:components::{transform, global_transform}
.transform_propagate_system
.hierarchy::hierarchy_maintenance
.It depends on the new
bevy-hierarchy
, as well asbevy_app
,bevy_ecs
,bevy_math
, andbevy_reflect
.It does not need
bevy_utils
orsmallvec
.A few changes were necessary to get
bevy_transform
to compile again:children.0.iter()
started failing, because the fieldchildren.0
is private, and is now defined in a different crate. This was easily fixable; just dochildren.iter()
(using theDeref
impl) instead.Finally, the dependent crates needed to be adjusted.
bevy_scene
depends onbevy_hierarchy
, but notbevy_transform
.bevy_gltf
andbevy_ui
depend on bothbevy_hierarchy
andbevy_transform
.bevy_internal
neededbevy_hierarchy
added to its reexports and prelude.bevy_pbr
,bevy_render
,bevy_sprite
, andbevy_text
, despite depending onbevy_transform
, seem to need no changes.cargo --test
passes. The fewexamples
I tried seem to still work. I did not do any performance testing.Beta Was this translation helpful? Give feedback.
All reactions