kaosat-dev / Blenvy

Bevy Code & Blender addon for a simple workflow to add & edit Bevy components in Blender
Other
600 stars 55 forks source link

Add support for full component paths, to avoid collisions from short_names #166

Closed janhohenheim closed 3 months ago

janhohenheim commented 8 months ago

Say I have two quests Foo and Bar. They might both have a component Objective, but in order to disambiguate them in the Blender addon, I have to name them FooObjective and BarObjective. If we instead had some kind of collapsible groupings, I would not have to do this.

kaosat-dev commented 8 months ago

Sorry @janhohenheim , I reread your message a few times, and I still don't understand either the issue or what you mean with the "collapsible grouping" ?

janhohenheim commented 8 months ago

This:

Foo - Objective
Bar - Objective
kaosat-dev commented 8 months ago

Ok, but what is the actual issue ?

janhohenheim commented 8 months ago

It doesn't really matter, as long as there is a way to register and differentiate two components with the same name. One guaranteed unique identifier would be the full namespace, which would end up like this in the Blender UI:

bevy_core_pipeline
core_2d
camera_2d Camera2d

other_bevy_crates stuff
my_game
foo Objective
bar Objective

the obvious issue here is that the nesting can get quite deep for Bevy types. Maybe we'd have to filter those and put them all into a single flat group called "Bevy".

Alternatively, I can also imagine passing a group along as metadata for the registry export, e.g. as extension methods on App:

app
  .group_type::<foo::Objective>("Foo")
  .group_type::<bar::Objective>("Bar")

The downside here is that the registry is no longer a simple dump of reflection data.

janhohenheim commented 8 months ago

My core issue is that I want to organize my Rust code into different modules that all don't know about each other. However, the Blender addon effectively forces me to use only unique names for components that I wish to use in the Blender UI, so there is a weird coupling between modules now. My modules quests::kill_the_rich_baron and quests::steal_the_money_from_the_vault cannot each have a component named Objective, even though in the context of their respective scopes, this is exactly what I'd want. Instead I have to have quests::kill_the_rich_baron::KillTheRichBaronObjective and quests::steal_the_money_from_the_vault::StealTheMoneyFromTheVaultObjective. This is repetitive, reads worse and is harder to refactor.

janhohenheim commented 8 months ago

Does this make sense now? Sorry if what I wrote before was confusing :)

kaosat-dev commented 8 months ago

Ah yes, It makes sense now ! :) Sadly this is way more than just a UI issue, it essentially boils down to the use of Component "short names", and it would be insanely hard to get away from it: (because I hit the limitations below multiple times)

janhohenheim commented 8 months ago

Good point :/

kaosat-dev commented 8 months ago

Some more thoughts:

janhohenheim commented 8 months ago

Apparently the same limit exists for other names as well: https://blenderartists.org/t/material-name-character-limit-63/1146620/18 This is really really dumb on Blender's side

janhohenheim commented 8 months ago

As far as I can tell, the 63 char limit only exists on the names of the properties. What if the addon used only a single property called "bevy_components" that contained a RON array of all components with their full paths? At least on the Bevy side that shouldn't be too much work.

kaosat-dev commented 8 months ago

Apparently the same limit exists for other names as well: https://blenderartists.org/t/material-name-character-limit-63/1146620/18 This is really really dumb on Blender's side

Yep, ran into that one multiple times while developing bevy_components (and the reason for the first breaking change), sigh

As far as I can tell, the 63 char limit only exists on the names of the properties. What if the addon used only a single property called "bevy_components" that contained a RON array of all components with their full paths? At least on the Bevy side that shouldn't be too much work.

...hmm packing it all into one could work, but yeah, waay too much work for now for all the rest. I am already close to burning out on this whole project :D

janhohenheim commented 8 months ago

Fair enough, it's not that important. As I said on Discord, I'm very happy with the workflow as-is, even if it never supported any additional features from now on ❤️