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_transformseems to bundle two unrelated concerns:Transform, roughly a similarity transformation of Euclidean space.bevy_transform's description inCargo.tomleven 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_transformwas split into two:bevy_hierarchyandbevy_transform.bevy_hierarchycontains these things:components::{children, parent}.hierarchyand its submodules, except for the test inhierarchy::hierarchy_maintenance.It has dependencies
bevy_ecs,bevy_reflect,bevy_utils, andsmallvec.It does not need
bevy_apporbevy_math.bevy-transformcontains 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_utilsorsmallvec.A few changes were necessary to get
bevy_transformto compile again:children.0.iter()started failing, because the fieldchildren.0is private, and is now defined in a different crate. This was easily fixable; just dochildren.iter()(using theDerefimpl) instead.Finally, the dependent crates needed to be adjusted.
bevy_scenedepends onbevy_hierarchy, but notbevy_transform.bevy_gltfandbevy_uidepend on bothbevy_hierarchyandbevy_transform.bevy_internalneededbevy_hierarchyadded to its reexports and prelude.bevy_pbr,bevy_render,bevy_sprite, andbevy_text, despite depending onbevy_transform, seem to need no changes.cargo --testpasses. The fewexamplesI tried seem to still work. I did not do any performance testing.Beta Was this translation helpful? Give feedback.
All reactions