#Blenvy
1 messages Β· Page 4 of 1
I see it was just renamed π
Installed it, got no errors, but the N menu seems to be incomplete
Let's close and restart
Aaand Blenvy is gone
ah, it was disabled
cannot enable
that concludes my testing π
Using blenvy from the current blenvy branch
And Blender 4.2.0
I'm using this hook to add input actions with Leafwing Input Manager but getting a crash inside blenvy thread 'main' panicked at ~/.cargo/git/checkouts/blenvy-b36e3bfafcd31d12/c4d8e02/crates/blenvy/src/blueprints/copy_components.rs:73:60
#[derive(Reflect)]
#[reflect(Component)]
struct Player;
impl Component for Player {
const STORAGE_TYPE: StorageType = StorageType::Table;
fn register_component_hooks(hooks: &mut ComponentHooks) {
hooks.on_add(|mut world, entity, _| {
world
.commands()
.entity(entity)
.insert(InputManagerBundle::with_map(
PlayerAction::default_input_map(),
));
});
}
}
Is this the wrong way to go about something like this?
I'm wondering if the issue is
A: because the blueprint is still being constructed while this happens and blenvy doesn't like that
B: InputMap doesn't have a #[reflect(Component)] (should it? I haven't really understood yet how the reflection works)
Guess I have to modify the libraries and see.
in this scenario you aren't sending the input map or any leafwing stuff to/from blender, its being added after you spawn a blueprint with the Player component, so that's all bevy-side afaik.
I've seen some copy warnings before but never a crash
Yeah true I just mean it looks like the hook is called before the blueprint of the world has been spawned yet. I'm getting this warning as well WARN bevy_ecs::world::command_queue: CommandQueue has un-applied commands being dropped. right before the crash.
Or "right before the crash" is maybe ambiguous. The panic happens before that, it's just the last log.
Looks legit to me. I've done the exact same thing before and that worked, although in a slightly older version of Blenvy.
I just tried to trigger the crash and couldn't
I'm on commit #d08c2351 right now
(from cargo tree -i blenvy)
Tried reverting to that commit and it's crashing there as well.
I looked at your PlayerAction and cannot see any obvious difference.
This error message in general means that something internal has gone Very Very Wrong and the ECS is supremely unhappy
did you register the type?
or could it be caused by a different type
the code in blenvy is trying to fetch data from the registry: https://github.com/kaosat-dev/Blenvy/blob/c4d8e02a9d121429da31a3fa5fa6c333afc3ea71/crates/blenvy/src/blueprints/copy_components.rs#L73
I registered both PlayerAction and InputMap<PlayerAction> (although looking through leafwing input manager it registers InputMap<A>).
It doesn't crash if I swap out with another component at insert.
Found it. It was the #[reflect(Component)] on the Player that caused it.
And that probably makes sense I guess... I'm deriving behavior reflection while implementing it as well. π€
(I didn't understand what #[reflect(Component)] meant until half an hour ago)
isn't reflect(component) required for it to show up in blender though?
pretty sure your registry.json will show Player as no longer being a component without it
Yeah have to check. It changed isComponent to false in the registry.
the component reflection is the data that blenvy is trying to access in the above source link
Oh I see... Yeah now it disappeared from Blender...
My component looks like this:
#[derive(Debug, Clone, Copy, Reflect)]
#[reflect(Debug, Component)]
pub struct Player;
so I don't think that should be it.
Could you try adding the other derives I have that you're missing?
I have components without Clone/Copy that this approach is working with, so I don't think its that
It cannot be the Debug, right? right???
Still crashing with those.
I removed Debug from mine earlier to check lol
definitely at the "wtf, maybe its this set of characters" debugging level
I'd start putting in some extra logs when its fetching the component reflection data at this point
But it's the PlayerAction more like causing the issues I think because when I printed in blenvy it was the InputMap<PlayerAction> showing up as None. And it's not a Component. Should it be? I added the reflects on PlayerAction just in case but it didn't help.
Currently looking like this
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug, Reflect)]
enum PlayerAction {
Move,
Jump,
}
Tried this as well
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug, Reflect, Component)]
#[reflect(Component)]
enum PlayerAction {
Move,
Jump,
}
Where's your ActionLike?
impl Actionlike for PlayerAction {
fn input_control_kind(&self) -> InputControlKind {
match self {
PlayerAction::Move => InputControlKind::DualAxis,
PlayerAction::Jump => InputControlKind::Button,
}
}
}
Ah, alright
I tried just deriving that one as well.
This is some spooky stuff we're getting into π
I tried every permutation I could think of about an hour ago π
have you enabled the debug level logging yet?
there's a number of debug-level logs right before the blenvy line that panics
you'll probably want to filter it to exclude wgpu and such
something like
RUST_LOG=none,blenvy=debug
It's not giving me anything more.
There doesn't seem to be that many debug! in blenvy.
Ok there were some really long ones above
DEBUG blenvy::blueprints::copy_components: cloning: component: "leafwing_input_manager::action_state::ActionState<squash_the_creeps::PlayerAction>" TypeId(0x7245a2970c27aa0a8018f94f98411672)
This got too long for discord but it's dbg! for the InputData component that is failing. Not sure if it's useful.
that looks cut off, which debug log is that?
if its too long for discord, throw it in a gist or similar
ah shoot I was on the wrong branch to link to that 
luckily it doesn't look like it changed all that much -- https://github.com/kaosat-dev/Blenvy/blob/c4d8e02a9d121429da31a3fa5fa6c333afc3ea71/crates/blenvy/src/blueprints/copy_components.rs#L48
No it's not cut off. I just added a dbg! to https://github.com/kaosat-dev/Blenvy/blob/blenvy/crates/blenvy/src/blueprints/copy_components.rs#L72 for the failing component.
oh gotcha, so you don't actually see any of the debug logs
I see them as well but some of them are huge. I can post them in another text file. Just a sec.
the docs say that .data should only fail if the "no such value exists"
Runtime storage for type metadata, registered into the TypeRegistry.
I have a hunch, gonna try it out in my project
I am unable to make it crash
what is the Player component attached to in your scene?
is it on a blueprint that is then instanced into the scene?
aha!
that is the way to make it crash
workaround is to place the Player component on the instance, not the blueprint for now
Quick question, if my game doesn't have a physical "Player" its just a camera that moves through the sky should i just spawn it in code and not bother with adding it with Blenvy
its up to you I think. I could see valid reasons for both
my game using blenvy currently uses a code-spawned camera and it works fine that way
but I could imagine if I needed many fixed perspectives or something like that that I would want to set them up in blender
Yeah, i can't really see a reason i'd need it in blender, its a City-Builder type game that may eventually spin-off into a seperate RTS game.. the camera just needs to move from edge to edge and have a x/y limit and maybe simple rotation.
Could you create an issue for this scenario?
yeah, I modified blenvy and it seems to be working, but it's not a solution I understand. I asked for some context in #1034547742262951966 -- #1034547742262951966 message
FWIW I find it very useful to get idea of how the game will look by going into the camera view in Blender with numpad 0. Gives you a good idea of scale and such
If I just filter out any components that don't have .data, the relevant components still show up anyway
so I'm not even sure that we'd need the data because this would be already handled by the component hook adding the components
Beware that the camera in Blender has a different FOV than in Bevy, you need to change it in Blender.
I think blenvy is "instantiating" the blueprint somehow, which results in the components being applied via the hook, which then attempts to copy the component info for all components on the entity, which can't be done because there's no .data, but if you just skip that then the hook adds the needed components anyway
is blenvy using a separate world for spawning blueprints and then copying them over?
what are we calling blenvy marker component hooks?
I guess "blenvy marker component with hooks" isn't bad.
tldr it feels like there are two points that can customize the active component set for an entity: when loading the blueprint and when instantiating it. Right now component hooks run at both times, but it may be worth adding a BlueprintInstantiated observer event to only customize the instantiation phase component set.
Holy moly ! Thanks for the investigation @round cove , @dawn shell , @steel vortex I will have to re-read that multiple times & dive back into the copy component logic to make sense of it all , but you did an amazing job at finding the source of the issue !
Re our discussion yesterday: I was able to override components on linked blueprints just fine. Yesterday I tried to add the components onto the linked sub-collection itself, but today I added it onto the parent and everything worked OK. Thanks for the help!
Thanks for trying it out !
So I tested it again after seeing your results and it now also fails on my end because ...I closed blender and restarted it again π so the bad news is , Blender 4.2 does not seem to clean up things correctly, and it would indeed be a good idea to tell users to restart Blender after installing the add-on ...sigh
In the mean time I will be working on this specific issue (4.2 + manifest)
All of my game prototypes so far have been top down/ semi isometric, but I still used Blender's camera for convenience : the camera just gets changed/ manipulated on the Bevy side after it has spawned (for example adding "follow the player at distance x")
in this case, it doesn't look like blenvy will have to update anything. The leafwing components were missing reflect(Component)
I suppose Blenvy could maybe have some diagnostics with nice error messages for it?
it does have the panic, so we could just change the message
I'll write a PR for that at least
I closed the investigation issue, since blenvy doesn't have to do anything right now, but it may be useful to consider that there could be an observer event to separate instantiation from loading if its ever needed
I wonder if the loaded blueprint would get added to a spatial index, for example, when using hooks
thread 'main' panicked at /Users/chris/github/kaosat-dev/Blenvy/crates/blenvy/src/blueprints/copy_components.rs:78:29:
type "leafwing_input_manager::action_state::ActionState<wash_cycle::leafwing_test::PlayerAction>"'s ReflectComponent data was not found in the type registry, this could be because the type is missing a #[reflect(Component)]
Yeah that's perfect π
Did that get resolves on LWIM's side?
I have a PR up that looks like it'll get merged and included in the next point release
https://github.com/Leafwing-Studios/leafwing-input-manager/pull/586 is the leafwing pr
thanks a bunch π
I'm still getting the issues as mentioned here: #1034547742262951966 message
after doing what?
What that PR does except for reflecting on Resource which I assume is not needed for this to work?
you locally modified the leafwing-input-manager code to reflect Component and it didn't work? or you reflected your own code's types?
I modified LWIM. I also reflected everything I could in my local project.
Oh wait nevermind. It's crashing on something else now. I just saw it crashing and didn't even look at the message. That part seems to work fine then.
Hey all, I'm trying to follow the quickstart guide and the add-on menu seems to be a bit weird for me
Clicking most of the icons doesn't seem to change anything for me
Can you try closing and restarting Blender?
Tried a couple times, no dice πΏ
Are you using Blender 4.2 on English?
Ope, I'm on 4.0.2, let me update
Only 4.1 and 4.2 are reported to work. 4.2 is more stable, in my experience.
What does that mean exactly? Does that mean whatever I'm setting in Blender is not correct in Bevy world? My FOV does not look like I expect it in game but I'm not sure if the difference is between Blender and Bevy or if Bevy/Blender handles FOV differently than Godot where I'm porting a game from.
Sec, I'll show you a screenshot
@ebon zealot, correct if what I'm about to write is outdated
But AFAIK, Blenvy does not set your Bevy camera's FOV at all, so you'll have to manually set it if you want it to match Blender
However
there values are not really useful for that
So first, you change the Lens Unit to "Field of View"
Then set that to match your angle in Bevy
Do you know what the default FOV is in Bevy on the top of your head?
Note that Bevy uses radians and blender degrees
No, but I can look it up
Source of the Rust file src/camera/projection.rs.
Which makes it 180 / 4 = 45, which is pretty low
Now, second caveat, and this one is not documented anywhere AFAIK
Yeah weird that it looks different then when it should be 40 but it's way too zoomed in from the same distance.
this setting here does not correspond to Bevy
Set it to Vertical!
I think the default height is correct, but don't quote me on that
(Might also be Horizontal in case I misremembered. One thing that is certain is that Blender's default at least used to be wrong)
let me experiment real quick
Yeah, my memory was correct
this setup will match Bevy's default
Blender (the orange rectangle is the camera)
Bevy
Ignore the fact that the physics objects fell down π
I should probably put that in the quickstart
Ok now I see what's going on. When I switch to vertical the FOV jumps to a lower value. So putting it back to 40 after the switch looks more reasonable.
It should look identical to Bevy now
If not, I made a mistake somewhere
(If you've set your FOV in Bevy to 40. The default is 45)
Blender's default settings for the camera are real whacky imo
Added an issue so I don't forget: https://github.com/kaosat-dev/Blenvy/issues/223
The camera FOV and all the lighting βstrengthsβ in Blender sure are confusing when trying to match Bevy π
Yeah, trying to match the ambient light was so annoying I had to give up. According to Google'd filament, Blender's background shader should be the same as Bevy's ambient light, but it is clearly not
I upstreamed my experiments to make the ambient color somewhat match Blender, but itβs still obviously not the same
Here's the issue in case someone else wants to try: https://github.com/bevyengine/bevy/issues/12280
Isn't the registry.json file supposed to update every time I add a component and do cargo run?
if you do app.register_type::<Foo>(); with it, then yes
...can I also ask questions about the codebase here? π
Pretty sure, but probably no one but @ebon zealot will be able to answer π
Right, register_type is the bane of my existence. Always forget it. :p
first of all, python is, in my eyes, objectivelybad
I wish there was a cross-platform way of registering everything automatically 
Yes π (btw great set of issues on github !)
There is a nested check for fields but it's always set on True?
I think that is fairly uncontroversial in these circles π
Hmm , it feels like it would be a good match for another "BlenderSettingToBevy" component to have matching FOVs ?
Agreed
With the caveat that Blender's default are, in my humble opinion, completely bonkers
@ebon zealot ||no, I havent edited this in, this is here from the original message||
and how does this propertyGroup stuff work?
I have a bool in process_components that is true, checked it via print statements, how else of course. I also store it in the dict down below.
but when I get that bool in draw_propertyGroup, it is always false... is there any intermediate step that I am not seeing?
also, with that dict, does that mean that having a field named with_enum bricks the system?
Same π lost 45 minutes the other day wondering why something was not working on the Blender side until I realised "doh', not registered"
So a user innocently starting a Bevy app that uses a camera placed in Blender may be confused which everything is so zoomed in.
Probably worth it, though
Or maybe it should be an opt-in?
Idk
All the "try to match Blender stuff" is already opt in so it would fit
Wait, it is? π
TIL
Aaah, the "export scene settings" stuff, right?
Not sure what you mean by a "bool in process components" ? What is it assigned to ?
I honestly do not remember of the top of my head, the python code is convoluted to say the least (thank you Blender), so there might still be remains of a previous versions (that part changed a LOT recently) , it is pre alpha for a reason π
so my plan is to try relations, e.g. for an Entity field, have the option to either still specify an integer, or drop in a reference, and then somehow resolve that reference when loading the gltf.
I now check for is_entity = long_name == "bevy_ecs::entity::Entity" and put that in the dict, but getting getattr(propertyGroup, "is_entity") will never get me true
Exactly ! Thinking of renaming that to something more clear like "try to match the Blender look as much as possible"
rust -> wasm -> python should be a thing
actually, now I wanna know if i can write rust addons for blender
by "the dict" , which one do you mean ?
I was considering removing the ambient light stuff from there
Why ? It at least give a good enough approximation for now π
My issue is that it never quite matches Blender.
In my own projects, I want the lighting to go for a very specific feeling / vibe that can get usually gets lost in that approximation.
So I noticed that I preferred to disable the approximation and manually tweak AmbientLight until I hit the right mood.
Which is a bit worrying, given that I added that feature in the first place
For example, in Crazy Bike, I wanted to have a 14:00 sunny day, blue sky kind of mood
but setting that in Blender and exporting it results in something either too dark or too bright in Bevy
@grim lance suggested moving the registry.json file out of assets into art which ... I find makes a lot of sense, as it is only used at dev time as far as I recall ?
I'm interested in your thoughts here though
Of course, we could add a toggle for each "match Blender" option, but I imagine setting that up would be a bit annoying
I 100% agree with you on the "vibe part" , I remember a few months ago that I believed I found the "missing link" to have something that matches much closer (based on your work), and ... I got totally sidetracked & forgot about it π
Tweaking the values in Bevy is tedious (even more so without an editor), so even if it is not a 100% match I find it better than nothing.
My investigations here really lead me to belief that either Bevy or Blender is not doing what they are documented to do
Really? I just used bevy_inspector_egui and moved the color picker around, then wrote down the value.
Yeah , I am all for fewer options, but perhaps this is one case where it makes sense ? (at least until we are able to really match things)
I found it annoying to have to do it for every single project, every single time I wanted to change the mood tbh π
that's fair
could you please share the code where you are setting it, and the part where you are trying to access it please ? π
Yeah, I'd also like fewer options, but here I'd love to opt-out of that one in particular but opt-in with the others, as the code to do so manually is quite annoying (You have to wait until Blenvy inserts the color resources and then override them again. Simply initializing your color on a screen transition as you would normally won't work).
There is the (bad) option of eyeballing it, but just to be sure: your issue is only with ambient, not with the rest of the light colors ?
exactly
At least, as far as I could tell
If the rest of the lights are wrong, the ambient is at least more obviously wrong
But I've found the match to be quite good so far
(except for the shadows)
Ok, in that case, give me a bit of time, I think I should be able to trace down what I found a few months ago, (I tend to use very strong colors, so I should be able to find it again)
That would be great, but it's also not a high priority, so feel free to take your time π
just create a registry with AStruct(Entity) and add it, it should be empty instead of showing the number selector, that's all I want π
I generally struggle with making Bevy's shadows look neat, so I don't think this is Blenvy's fault.
Color wise , light/dark, or quality ?
Quality
The shadow cascade settings are still a bit of a mystery to me
Thanks for sharing ! It seems like it should work at a glance, I'll try it out locally and figure it out
Ah yes π That is why I tend to crank the resolution WAAY high (4096)
Unrelated to the other issues, but would love to hear your opinion on this @dawn shell & @round cove if you do not mind π
For the jam, I just didn't bother at all and simply accepted the shitty quality π
that kinda makes sense, yeah
I am one of the people who does NOT like soft shadows , so there is that π
hahaha π well I did not even notice it at all ! so it might be "creator's obsession with details" (I know the feeling :D)
The movement in the game is so frantic that many small things are extremely hard to notice.
On one hand, the issues with the character models and the shadows are not noticeable at all
On the other hand, my little environmental details I carefully placed are not noticeable either π
For instance, I bet most players did not notice that there are quite a few posters on the walls in alleyways
I think I'll add this one to the release too : https://github.com/kaosat-dev/Blenvy/issues/226
I am BAD at anything animation related (I do not understand most of it) , but separating animations for reuse, makes WAY more sense than the current implementation
I wouldn't mind the registry file moving. It gets read in by blenvy but I don't really know exactly when. if it truly has no runtime usage then yeah we can move it. Does everyone actually have an art directory?
Thanks for the feedback ! The issue with the "art" directory is exactly the only reason I am hesitating a bit
I guess if its dev-time only I shouldn't be comitting it either
π I did not notice the posters indeed
Your game is fun, that is way more important imho π
For my personal stuff, I only commit the .blend file (no .glbs or such). For collab, I commit everything in case people don't understand the Blenvy stuff.
hmm that is a good point as well !
Would it be bad to just create that dir if it does not exist?
only if its going to be a requirement to use blenvy
Be like "Blenvy expects .blend files to be in the art dir." and allow configuring it in the future if people need it and you have time
feels weird to force a directory for .blend when you can configure locations anyway
git isn't great at large assets, so what if you do some alternative storage for art assets
Wouldn't other storages also allow placing stuff in whatever folder you like?
other storages are flexible so force them to be art/?
Idk π€·ββοΈ
seems like unnecessary restriction
I mean, from a point of view where configuration is free, totally
But from the point of view where that means dealing with things like "where can the registry go" and such, it's worth questioning if that is something Blenvy needs for an alpha
Imo it's better to start simple and then expand configuration options
Often you find a simpler solution along the way
its already configurable? so is no work to leave it the way it is right?
I guess then we put registry.json into art by default and allow overriding it in the Plugin struct?
You mean directly in target/registry.json?
anywhere in target/. target/blenvy/registry.json would work too
if we're saying its a dev-time-only build artifact is my thought process
That's fair, but you can override cargo's output dir
yeah, and that's available via an env var right?
No clue actually
it is in build scripts at least
Ah, true
I like that idea
Kinda fits, because a user doesn't even need to see that file in their working environment
Is there any case where it might NOT be available ? want to avoid any footguns on the Blender side
Hmm in that case it might even make sense to remove the option to choose the location on the Blender side ?
target does not need to exist
I can output my builds to deployment if I want
Blender might not be able to find it automatically, same as today I would imagine
So if Blenvy on Bevy's side exports it to the output dir, Blender needs to be told its location
Secret option: just create a .blenvy dir that contains files managed by blenvy that the user shouldn't manually touch
I think if you're configuring the location of target/ you can be expected to configure the location of target/ for blenvy right?
totally agree
Just saying that that configuration needs to be present on the Blender side as well
(I'm not against .blenvy either, but the js ecosytem has so many root-level dotfiles)
yeah that is horrible, I agree
meh , I was hoping for a solution to nuke some more options π
oh right, the automatic generation of the assets folder was removed a while back ?
I believe so, yes
The more I think about it, the more I like @round cove's idea of using the target (or whatever output) dir
Is there any guide to setup bevy_rapier3d similar to https://github.com/kaosat-dev/Blenvy/blob/blenvy/docs/avian/readme.md ? I'm just trying to find how I can add the colliders on the Blender side.
#general message
Maybe for context: Avian had the same (lack of) ergonomics in this regard as rapier, so I added ColliderConstructor in a PR to it in order to use colliders more easily in Blenvy, haha
If you feel like it, I'm sure @agile bear would appreciate upstreaming something like that type in bevy_rapier π
Yeah I might try my hand at that tomorrow then. I just actually wanted rapier instead for the character controller and I only need the sphere and cube shapes currently. Looking at the code it looks somewhat straightforward but I'll start with the simple shapes first and see how far I get.
@ebon zealot just upgraded to Blenvy and just wanted to say nice work. it works amazingly
hrmm... that could be a reason why I hadn't had success yesterday.... did the ID change somehow?
now the question.... which one is which? :p
good news: I now use the correct blender addon
bad news: still doesn't work :c
What was your issue again?
this patch file, tried to replace the number picker with something different for bevy_ecs::entity::Entity
but the getattr("is_entity") is always false, even when the one I put in the dict is true for one entity
Haven't been able to get this to work since Collider is not reflected in bevy_rapier and that depends on SharedShape inside parry which obviously is not reflected. Is a newtype around SharedShape with manual impl of Reflect (and TypePath) needed in this situation? Seems you cannot put #[reflect(Component)] unless you derive the Reflect trait? Is there some good reference to see anywhere to see how this is generally done?
That's exactly what the ColliderConstructor component in Avian is for; it's essentially a reflectable enum that describes what the Collider should look like and how it should be built, without storing the actual SharedShape from Parry. This gets around Collider not being directly reflectable.
Oh right yeah. The problem is that copy_components in blenvy yells at me when it tries to copy the shape at some point. I've looked at how ColliderConstructor is done in Avian and it seems to create colliders once it finds ColliderConstructor components in Update. I tried to do it with a hook instead. Maybe that's causing the difference here then. I don't see explicitly how avian gets around this problem with blenvy so that's why I got confused about the Collider reflection.
Ok yeah it doesn't complain anymore if I do it in Update instead.
(One thing I noticed before with Avian is that dropping a box straight down causes it to almost topple over. Now I can see with Rapier that it just drops straight down as I imagine is more physically accurate. I'm sure you're already aware of this but just wanted to mention it since it was pretty apparent right away that something was off.)
(Also rapier objects seem to become twice the size with the same params, which I guess would be slightly annoying for users switching back and forth between the two. No my bad, it was just the cuboid API using half extents in rapier.)
Yeah Rapier/Parry is the outlier here, Avian's colliders match Bevy's shape constructors while Rapier's don't
Do they? I had to use double the radius for a sphere IIRC
(This can be fixed by increasing the number of restitution iterations in SolverConfig. The current default is 1, so the bounce isn't split as evenly between the contact points. But that's getting off-topic for Blenvy)
Collider::sphere takes a radius in both Avian and Rapier, just like Bevy's Sphere::new. So that should match everywhere
*or Rapier has Collider::ball which is also different from Bevy
I would imagine that an on_add hook should work for primitive shapes, but for the variants that generate colliders from Bevy meshes it doesn't work, because it needs to wait for the mesh to be available. Not sure what the Blenvy error is about though
@ebon zealot that sounds like a bug. I'd like to use a hook for ah, Jondolf is right, we need to wait until the mesh is loaded, so a hook wouldnβt work. Still, these errors seem fishy to me.ColliderConstructor as well if possible.
Oh, I remember. No idea how to help thought π
i'm going to assume this to be a blenvy specific issue, if i use cargo run the game will launch just fine, if however i directly launch the game executable from the debug target it will fail to find the World file becaused its looking for it in ../target/debug/assets/level/World.gllb and clearly it isn't there am i expect to manually copy it over and if so that presents a interation challenge because it means everytime i build the game the assets could chance and need to be copied
That is the case for Bevy in general. You can use a symlink for dev workflows.
π π i was just about to say, i worked around it with a symlink but yeah i wasn't aware if it was expected functionality or not
yeah np, I hope kaosat can help me out when he has time to take a look at it
Haven't forgotten π Will get back to you asap
This error was for a primitive shape though. I'm not waiting on a mesh. I guess the worrisome part is if it is due to some race condition.
I know, I know. I'm saying that fixing this wouldnβt change anything for Avian π But yes, that definitely looks like a bug!
What's interesting also is that the colliders didn't work when I got the warning but adding a KinematicCharacterController in a hook and getting the same warning, that controller seems to work. The hooks are for two different components (Player hook works but "MyColliderConstructor" doesn't). Something strange seems to be going on.
2024-08-11T18:57:17.744200Z WARN blenvy::blueprints::copy_components: cannot clone component: component: "bevy_rapier3d::control::character_controller::KinematicCharacterController" is not registered
2024-08-11T18:57:17.744521Z WARN blenvy::blueprints::copy_components: cannot clone component: component: "bevy_rapier3d::geometry::collider::Collider" is not registered
Maybe it has something to do with the ordering of how things are added with regards to rigid body and collider? I'm guessing you always have to add the rigid body first (or the other way around)? So the hypothesis might be that collider was added to an object first which is not allowed.
What is actually not working in the MyCollisionConstructor case is that the rigid body isn't moving and the not the collider either. So presumably it is the rigid body component that breaks.
Actually there is a slight complication because the working example has the collider on a child entity of the rigid body entity. But assuming the parent is spawned first (?) that shouldn't change what I said above.
Hey all, I'm just now getting Blenvy set up in a project (the improvements are all great btw) and I had a question about some components used in the quickstart
Just wondering what HideUntilReady and GameWorldTag actually do
My assumption is that HideUntilReady is just waiting until the scene has loaded to toggle visibility, but I'm a bit lost on GameWorldTag
That is correct. I myself don't know exactly what GameWorldTag does and simply copied it from @ebon zealot for the guide π Would like to know as well. I mean, I know that it stands for the "outermost" blueprint that corresponds to your World scene in Blender, but idk what would happen if you just omitted it.
For that reason, does it make more sense to just use the blueprint bundle for things that aren't a full world?
You should use a simple BlueprintBundle for things coming from your Library scene
And something not related, have you guys taken a crack at building animation graphs for blueprints that contain an armature? If not I may take a crack at a PR
It is just a helper Tag , only useful in very few cases , mostly when coupled with the AddToGameWorld
So you use GameWorldTag on your "world" , and AddToGameWorld in any entity that should be automatically added to the "world"
Pretty sure no one has done so. That sounds amazing, though π
By "added to the world", do you mean that it will be inserted into the hierarchy correctly?
I wouldn't get too excited, i'm still a fledgling rust dev, but I would love to help out with such a great crate (and hopefully an upstream candidate)
In most cases you don't even need the bundle since blenvy, 99% of the time, you can just BlueprintInfo::from_path("xxxx")
exactly this !
I have so little time, so much hidden features to document π’
I was going to default to the bundle just to make sure I don't miss a SpawnBlueprint and lose my mind debugging haha
That is awesome ! My understanding of animation related stuff is ... bad so any help in that area would be fantastic
hahaha yes, that is a good point π
also @ebon zealot do you have github sponsor set up?
nope , just "ko-fi" got sidetracked with Blenvy while setting github sponsor up π
Ping me when you have GH sponsor stuff
I just gained a sponsor recently and would like to funnel some of that to you
Speaking of animations ... one reason why I still haven't release an actual alpha is being sidetracked (yes, there is a pattern there, mostly when I am dead tired like in the past 2 months) π
The lack of reusability of animations has been bugging the hell out of me for ages . And someone mentionned this issue on Github.
(Don't get your hopes up just yet, have not tackled the Bevy side yet, but it will be based on the way materials work)
Btw does anybody know if non-armature based animations are also reusable ?
I don't know for certain but my guess would be no
ouff, no clue
Dang , that complicates things quite a lot if it is the case π¦
Let me dig around and see If i can find a more concrete answer
I've never worked with non-armature animations
What are they used for?
Are they like morph targets?
just moving objects around, like having a cube move across your level, anything really, or rotations etc
Ooooh those things
Like for making a cube follow a line?
have not tried that specicially, but any transform (as in pos, rot, scale) can be animated
I didn't know those could be exported
I remember specifically not using them because I thought "yeah, sounds like some Blender-specific thing that's not supported anywhere else"
Good to know that is apparently not the case!
I've been staring at morph targets intending to figure them out for about a week, so might look into that soon
please report back if you do, I'd love to get into that as well at some point
on that topic, Blenvy has support for both blueprint level AND instance level animation triggering (oh boy, so much boilerplate there) so you could have for example !
- a robot with various animations (jump, move, scan etc) => blueprint level animations
- you could move your robot instances A & B across the level and rotate them etc => instance level animations
The latter sounds supremely nice for cutscenes
That was exactly the idea π Requested by a user waaay back
Honestly I 100% get why Bevy has per domain (assets, animation etc) "specialists", my brain is splitting from all these specific topics
I can imagine
I can be your SME for finding bugs that donβt happen on your machine π
π hahaha, that is pretty much already your official role, init' ? π
Hi ! I took your code for a spin, but realised something: you want to display the entities/bevy_ecs::entity::Entity in a different way right ?
For testing, you likely added a special component containing an entity ?
||I think that enough people are downloading/trying to use it that directing them towards an alpha release is effectively already happening. so having a single crates.io/zip to point to would be helpful more than hurtful. Then bugs don't have to stream in constantly, but rather people who aren't comfortable with main-branch dev can just wait for a release too.||
spoilered because its technically a vote
||Fully agree. Also, buggy unfinished releases are what alpha prereleases are for. Just tag it 0.1.0-alpha.1 or something.||
maybe 0.0.1? π
i think what's more important is making a video that explains how to use and what's unfinished/bugged
that gives me the impression of "this person has just reserved the crate name but didn't actually code anything"
it wouldn't have a version if there was no code
I intentionally wrote the quickstart in text format in order to make it easier to update, seeing as breaking changes in Blenvy are inevitable during an alpha
Yeah, just have a Testtt(Entity). And when I print in the components loader thingy, is_entity is true one time, so the entity does get recognized correctlyβ¦
For the animation, I am currently using single bone armatures, linking the bone to the object and modifying the bone in the animation. Never thought of doing that directly but I dont think it works with bevy..
Having the animations split up will be interesting.. I was planning to do an βasset chainβ where I would load the gltf, get animations by name and construct them together there. Having the possibility to load them directly makes this much easier
Oh wait you export every single armature, right? So animations are still packed together :c
I am currently just experimenting with splitting animations/ armatures out, so not opposed to exporting each animation out , if it makes sense and mostly if it is even possible. Not sure if I could even extract them out on the Blender side. My understanding was that most people want to reuse armatures and their animations.
There is also the issue with non armature animations, which I have no idea how to handle atm π
Non armature animations might not even work with bevy soβ¦
They work without any issues π
Thanks a lot π
Huuhhhhhhh
Either way, I am so confused with blender animations, there are like 4 editors for different things but everything feels like one timeline when you not found that special hidden button that lets you seperate clips⦠meh
So I dug into your issue, and it is not trivial at all : I'll get into the details in a minute, but first : how do you want to display the Entity Id ? with a custom UI ?
my idea was to have an object picker with layout.prop_search and a button next to it to toggle between manual entity and object selection mode. Later I want to store an additional attribute with the gltf node index as a link and restore the entity on spawn on the bevy side
Ok, that sound like a good idea, in practice it will not be easy (hurray for Blender's convoluted internals)
- so the reason why you are not seeing the
is_entityin the UI, is becauseEntityis considered a value type by Blenvy (as it is just an id), and handled differently : ie yourEntityis just a field so it is displayed here - value types are handled differently when processed: see here for example
- value types are currently essentially hardcoded for convenience see here and here
prepares to read a trilogy
huh? But for it to get down there it has to recursively call draw_propertyGroup first, doesn't it?
TLDR : to achieve at least a custom display would mean:
- removing
Entitiesfrom the hardcoded values - generating a specific propertyGroup that can use layout.prop_search
- a whole lota boilerplate π¦
yes, but the recursion stops at value types , and the place you are seing true for is_entity during processing is at a level that gets discarded for value types
but doesn't it in the end need more boilerplate when you stop at value types?
so
struct Testtt {
lol: Entity,
}
would work?! π
also, the default for bool is false in rust π€
thanks for the links, lets see how much good I can do this π
funny how you change so often between presets=, and "presets":
Sadly, same logic there. π¦
glad if it can help a bit.
The code is horribly convoluted for two reasons:
- Blender
- Me trying to figure things out and dancing around the internals & limitations of Blender π¦
The whole Blender side would need YET ANOTHER overall cleanup
yeah π
so I now can get rid of the integer, but it should already display a picker :c
honestly not a priority at this point, I already removed 90% of things with a chainsaw, but its ...meh
oh I got an error π didn't even know python has those
wait... my is_entity gets triggered now? whut ._.
so... I got collapsing back... from removing the is_entity check.... that makes no sense at all
YEEEEEEEEEESSSS π
thanks for your help π
it was trivial at the end, some cleanup made it way easier π
oh heck yeah, is that for entity relations?
references, yes
somehow gotta refer to my closet door as a rigidbody π
why does conversions_to_prop_group exist and what does it do / is it used for?
to convert "ron" / text representations of components to property group (values) . Used for example to generate the correct UI values from the ron values.
huh? blender doesn't directly store the property groups on the objects? O.o
"jaein" π it does, but it can loose the values stored inside the property groups & revert to default (don't ask, Blender logic)
"oh no, I dropped a value.. meh, it's only 12 cents" or what π
also keep in mind , originally (pre Blenvy), there where just standard custom properties , with no custom UI , so I also added boilerplate to make migration easier
you mean a reference to an object inside a blend file ? .... I have bad news :
- references to objects are not stable in Blender, so you need to use ....their names
- oohh but then again, names can be changed ! , so that is not reliable or requires a ton of workarounds
- perhaps objects have an immutable ID that could be used ? NOPE
(in case that was not clear, this is an issue I hit over and over and over again ....) π±
So I am currently still looking for a way to generate unique ids for objects (and scenes , need that there too) that do not get copied when an object is duplicated
There are a few possible solutions that I have not yet had time to try out, I am off for now but I can share the links later
I should just rename the Blender part of Blenvy to "I suffered through months of illogical design and code so you won't have to " π
well I found a help forum post that says since 2.79 it's possible via PointerProperty, which is what I use, so no direct name. It behaves like a Pointer, but no clue what it does on the inside
actually, I'll try to rename the mesh I picked
lets see what happens
name gets updated, they are really related π
noice
it comes with a lot of caveats, (It is used in a few places in Blenvy for example for selecting level/library scenes ), but it works ...until it does not
so no saving of relations? :c
or should I save the name because it can't change as long as it's not open?
still, the "values sometimes get dropped" seem weird to me.. is there any article / forum thingy about this?
you would need the name to inject it into the Gltf right ?
not really
I would store 0 as the entity and add an additional prop that relates to the other gltf node...
they can get dropped for example when you reload the registry and the propertyGroups get regenerated
hmm... maybe I need to think about that for a bit longer, what about multiple entities?
how would you relate to another gltf node ? (genuine question)
can't we just.. keep the non-chaning ones?:
there is no trivial way to detect if something has changed or not (at least to my knowledge) and that part of the code is already horribly complex
know what objects relate to each other, generate the gltf and keep track of the node index of each, then iterate over all objects with relations and, query the index of the target and add that
no I have no idea if this works
but you cannot get any information about the node index from the Blender side as it is a gltf generation artefact ?
π
I honestly do not see how you can get this working without using either the name or some id π¦
?
for conversions_to_prop_group, should I use the name of the object? but then id when exporting
ok so.... I don't have any clue why it works.. but it works..
now I just need to actually make the id system export and bevy side work π
it can be pretty rough, the NLA editor in particular is very finicky to work with
Tweaking a few minor things before the release.
As part of the release I will:
- merge the Blenvy branch into main
- close a ton of tickets in the process ( a bit unorthodox for an alpha but will allow me to have a better overview of the current issues, not ones already resolved)
- tag & release the Bevy crate & the Blender add-on
Could somebody kindly try to create a zip file of the Blender add-on from the Blenvy branch & try it out under Blender 4.2 ? Double checked a few times, but want to be 100% sure it works out of the box before releasing . Thanks !
Lots of bugs & missing features (save-load broken, split animations unfinished, lacking docs etc) , should I still release the alpha1 as it is and continue working from there ?
(ie crate on crates.io with the alpha1 version, matching Blender add-on)
10
10
1
Release alpha1 now as it is
Stupid idea for post-Alpha, we could introduce bevy as a render engine.. will not be easy, because we somehow get to get all resources etcβ¦ and when thereβs custom renderers whooops.. we would basically have to link to the game, add all our controls and hope that players donβt just use Camera, but Camera, With<PlayCamera> queries instead
i feel like at this point we just make a bevy editor lol
Sorry to ping all of you again, but this is the last check I need before I release the alpha π
Removed previous blenvy version from blender and added latest blenvy from blenvy branch. Blender 4.2 windows 11. Reload registry and auto export works.
And don't be sorry) You did a huge amount of work singlehandedly. Thanks.
Adding/removing components also works
Will try later, not at home rn
Awesome ! Thanks for testing it out π
And thanks for the kind words π
Btw now that it works correctly on 4.2 with the manifest file I can confirm, for whatever reason, Blender expects all imports to be relative π€¦ββοΈ
Just built the zip, restarted blender, deleted/re-saved all of my generated objects, and ran successfully with the updated branch code
Everything works great on 4.2 on macOS π
Can confirm the "copy paste ColliderContructor fails" bug is still there, but I assume you didn't try fixing that
Contrary to what we suspected before, it seems like the target doesn't need to be an empty, as you can see from my selection
And this was what I copied
These are all old news, just used the opportunity to test out different targets to gain a bit of information on the bug π
But yes, the addon itself is working splendid!
I also notice that the addon is now called Blenvy instead of blenvy in my list, which is a nice confirmation that I indeed installed the right thing π
Does this mean you can publish the addon on https://extensions.blender.org/ now? π
ls
What will happen when a user will try to use the newest blender blenvy plugin and older bevy blenvy library? Or vice versa. There should probably be some compatibility check implemented before the stable blenvy release (not alpha) to prevent some weird bugs or maby mentioning this in a readme is enough.
Nope had no time for that yet, sorry π
I might try to release it on the extensions platform once the stable (not alpha etc) release is out π
I added a small mention of this in the README already that I can only guarantee for things to work when match Blender <=> Bevy versions of addon/crate are used, would get completely unmanageable otherwise π
So folks, you might have noticed that the alpha is STILL not out : I found a nasty bug yesterday that could "brick" your Blenvy setup on the Blender side (not really brick it, but reseting things would be tedious until I add "reset to factory defaults"), and I have a little cherry on top feature I wanted to squeeze in , but it is almost all ready π
Can we export the Blenvy addon version somewhere so that the Bevy side can verify compatibility?
hmm, there is not "central" place, but I could add it to the meta file ?
I think that would work, yeah
Otherwise, cargo update could result in undefined behavior
If only the exact same versions are guaranteed to work together, updating the Bevy side from 0.1.0 to 0.1.1 without updating the Blender addon is undefined behavior
good point, so we need the same kind of semver validation as with crates
Imo itβs fine if you just specify that the bevy and blender version must be EXACTLY the same, semver be damned
Just need to make a user aware that they need to update their Blender version after they innocently did a cargo update and accidentally (and correctly!) updated Blenvy through that
This is very similar to how wasm-bindgen works, btw
Their crate and CLI will refuse to work unless they have the exact same version, and they always release both in perfect lockstep
Good point ! I'll cross that bridge when we get there π
I'll add an issue for this on GH
Hmm, what could these features be ? π²
"Start editing blueprint" on selected blueprint instance switched scene and allows more easily to edit blueprint?
Bingo ! It was an awesome feature created by @jolly crypt in a fork of Blenvy, which I made a few QOL changes to (you can jump between the main scene & editing a blueprint and back using the same keyboard shortcut)
it also :
- if nothing is selected it will automatically a new empty Blueprint & an instance & start edit mode
- it selects the root collection of your blueprint automatically to make it even easier to place components
- it saves & resets your viewport camera when jumping between main scene & editing scene
- a lot more !
@jolly crypt your idea and implementation were absolutely fabulous, I just had to make a few changes and streamline it, but it feels AMAZING
Nice features!!
Waiting for the alpha release, raleeeeseeeesee...π
Any minute now π a few final checks
Woooow that's supremely cool
No more searching my giant library for the right thingy!
Can the camera save and reset trick be used for the bug where saving the file causes you to exit the numpad zero view?
BINGO !
Oh did I mention it also automatically adds new blueprints to the first Library scene it finds and if not even creates a library scene for you ?
oooh that is an idea !
You mean we can shave that entire scene creation stuff off the quickstart?
I would wait a bit for that, but yes, theoretically it should be possible
So , I 'm done with the last few tweaks & testing, pushing them & releasing
Disclaimer: I am dead tired, so I might make a huge mistake somewhere, so there might be another alpha realy fast if I mess up π
(also , nope , not STRESSED at all to do a first release after so many months, even if it is an alpha)
Damn
Heck π
publish dry run no happy !
crap, I just saw I forgot to update the quickstart to match the release too π¦
Now that the jam is over, I can try updating Crazy Bike to the released alpha on the weekend or so π
Ah, the git part?
The hyperlink on docs.rs is probably broken anyways since itβs local, so you can just change it on GitHub
yep
Oh that reminds me of a question I had, I currently use 4.2 for blenvy and 4.1 for normal stuff, is it safe to use blenvy in non-blenvy files and/or could there be an initial "Create/Init blenvy project" in the menu so normal blender files don't get modified in any way?
(I assume you wanted to type 4 instead of 3?)
I am stumped on this, I added bevy_animation to the features (was missing and never caused problems ? odd) but the problems with publish are still the same
also seems coherent ?
good point, but does publish not go with the latest sem-ver compatible versions anyway ?
Interesting !
But then again, cargo install only does that when adding --locked, so π€·ββοΈ
ok , so I stand corrected, it seems to have fixed almost all problems:
Still odd, normally the named_animations fields depends on the bevy_animations crate/feature ?
Ok this is hilarious, found the answer in one of my own posts from last year π
Bingo !
Hahahaha
@dawn shell for the quickstart, cargo add blenvy should suffice now for the alpha right ? (sorry if these questions are basic, I have to leave for a day in a few minutes π )
yes π
Do you wanna fix the links in the readme to be absolute while you're on it?
Otherwise I think someone clicking on quickstart will get a 404 on docs.rs
could you point me to the right place please ?
- [quickstart guide](./docs/quickstart/readme.md)
+ [quickstart guide](https://github.com/kaosat-dev/Blenvy/blob/main/docs/quickstart/README.md)
Assuming the quickstart will land on main
Same goes for all links really
Waaait you mean my doc links were wrong this whole time ?π
Oh, I see that you're not doing #![doc = include_str!("../../../readme.md")] or so in lib.rs
Maybe consider that for the release @ebon zealot
Too late π
Otherwise your readme only lands on crates.io and not docs.rs
The release is out !
https://crates.io/crates/blenvy
https://github.com/kaosat-dev/Blenvy/releases/tag/blenvy_v0.1.0-alpha.1
Thanks !
Release is out, and so am I , I hope I did not break things somehow, have fun !
could you please add an issue for that π
Thank you!!!
I installed alpha. It works.
@ebon zealot hold up, type registry filtering works now?
that's cool!
Yes π has been in there a few months I think π
I guess now that we have a nice search bar it's not that important anymore 
Some links on the Quickstart page https://github.com/kaosat-dev/Blenvy/tree/main/docs/quickstart are broken:
- "Download blenvy.zip from the release page"
- "Read about the Avian Physics Integration"...
Page https://github.com/kaosat-dev/Blenvy/blob/main/docs/avian/README.md also contains broken links.
Nothing critical. Alpha release.
so i'm trying to implement a skybox from the bevy examples but its causing a problem with blenvy.
type annotations needed for blenvy::Handle<_>
The skybox shouldn't really be interacting with Blenvy at all
based on this code
Add it to your camera from an observer on OnAdd, Camera
i'll have to look into that because my camera goes through the smooth_bevy_cameras crates plugin which means for the moment its done in code in a specific way
pub(super) fn plugin(app: &mut App) {
app.observe(insert_skybox);
app.register_type::<IngameCamera>();
}
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
struct IngameCamera;
fn insert_skybox(
trigger: Trigger<OnAdd, IngameCamera>,
mut commands: Commands
) {
commands
.entity(trigger.entity())
.insert(Skybox {
...
});
}
Then just make sure that IngameCamera is placed on your camera, no matter if you spawn it through Blenvy or code @brazen ermine π
(Note that a hook would be slightly more performant in this case, but a lot more boilerplate)
i'll have to tinker with it the code they give in the example is a lot different and being new to rust i'm going to have to figure out how to translate that
Let me know if you have any specific questions. I just recently implemented a skybox in a project using Blenvy, so itβs very fresh in my mind π
the reason the camera is done is code is i couldn't figure out how to specify a specifc cameracontroller as provided by the bevy_smooth_cameras plugin inside blenvy
Is there/should there be a "blenvy component hooks" doc page?
its kind of a general bevy thing, but seems very relevant if its going to be a repeated pattern for new users
Probably, yeah
ok, I'll take a crack at writing one
Can you not add a marker component to your camera in Blenvy and then add all relevant things, including the smooth camera stuff, in an observer just like the one I posted above?
.spawn(Camera3dBundle::default())
.insert(UnrealCameraBundle::new(
UnrealCameraController::default(),
Vec3::new(-2.0, 5.0, 5.0),
Vec3::new(0., 0., 0.),
Vec3::Y,
));
}
Specifically this is how i spawn the camera i want the unreal style fly camera but i couldn't figure out how to implement that inside blenvy which i would have preferred.
Add the IngameCamera component through Blenvy, then insert that unreal controller in the observer
(Along with the skybox)
to be honest, the nomenclature might as well be greek to me, i don't really know rust yet..
at least not great
No problem π which words are an issue?
well the observer what is that in refernece to
The insert_skybox function is an observer
It will get called when the event in its Trigger is happening
In this case, whenever the IngameCamera component is added to an entity
The idea is that you add the IngameCamera component to an object in Blender using Blenvy. Then, on the Bevy side, Blenvy will build that entity and insert an IngameCamera for you.
The observer then reacts to that happening and inserts further stuff into the entity
so, one thing i saw was the abality to add again unsure the nomenclature but compoenents with blevy:::something here to the camera inside blenvy but i couldn't find anything that wasn't a built-in like i couldn't just create my own function and get it to call inside blenvy that i could find so i couldn't figure it out, are you saying that there is a way to do that or that there are specific funtions that it can call
?
it'd have been epic if blenvy could have indexed (parsed?) additional calls from our custom code but i don't think it does that
See the line saying app.observe(insert_skybox)? That is the way in which you register observers
This is a way for you to tell Bevy to call stuff when Blenvy is done building an object, essentially
The UI will show any component that you register via app.register_type
If you go through the Blenvy quickstart, you can see how that is done for a custom component called Player
i see, well that clarify's it a bit, still its gonna be a lot of tinkering to figure out how to get it to work but i think in the long run it'd be better to have the camera inside blenvy and to figure out how to call observers
Yep, agreed that is the better option π
The code should be fairly small, I think youβll figure it out quickly π
Also, observers are a great tool to know in general!
question
pub(super) fn plugin(app: &mut App) {
app.observe(insert_skybox);
app.register_type::<IngameCamera>();
}
this, first time i've seen a pub(super) where does this get called is it added in setup as a system?
pub(super) fn foo means that foo is only visible to the parent module
It's a style of organizing your code into plugins, where nearly each file has its own plugin
In your case, your lib.rs or main.rs might look like this:
use bevy::prelude::*;
mod camera;
mod player;
pub fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins((camera::plugin, player::plugin))
.run()
}
And your camera.rs contains the code I wrote above:
pub(super) fn plugin(app: &mut App) {
app.observe(setup_camera);
app.register_type::<IngameCamera>();
}
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
struct IngameCamera;
fn setup_camera(
trigger: Trigger<OnAdd, IngameCamera>,
mut commands: Commands
) {
commands
.entity(trigger.entity())
.insert(
Skybox {
...
},
UnrealCameraController {
...
},
);
}
For organization, you could also have a mod blenvy where you add the Blenvy plugin with its configuration
i will eventually learn to seperate everyting into plugins i very much want to structure the project like that, but it's too much to learn at once kinda, right now everything is in main.rs
Sure, do whatever works best for you π
You will notice I use pub(super) fn plugin in nearly all examples I post because it's quicker than to say "add this to wherever you register your stuff for your app"
your way is better, it's just i've tried to create my own modules or plugins in bevy/rust before and it always failed so it's just overwhelming to try to learn that on top of learning the laanguage itself
Note that while this plugin organizational style is the one I personally like best, there are others who disagree, that's fine too. Do whatever fits your use-case best π
Yeah, I agree getting started in clean Bevy architecture is frustrating without any guidance π
That's a big reason why I wrote that document I linked above
I'll look through the quickstart again, i think i also kept getting mixed up which ones i was reading bevy_quickstart vs blenvy_quickstart and i think i stooped reading one w hen it wasn't finished yetπ
hehe, understandable
A suggestion, for the quickstart, because i'm not seeing it myself and by extension, it's not obvious for a beginning (your target audience), i'd add a section about how all the modules hook back into the main.rs or the main loop as it were
Good idea, thanks!
@ebon zealot amazing work on the release. have a good rest you earned it. π
wait, it's out? there's no post in #crates so i missed it 
Thanks a lot much appreciated βΊοΈ
Yet to post about it anywhere:) will do soon
its a sneaky alpha π
@ebon zealot mind help me figuring out where the gltf export happens in the blender site? It's in the auto_export folder, right? but what then?
Main function is here: https://github.com/kaosat-dev/Blenvy/blob/main/tools%2Fblenvy%2Fadd_ons%2Fauto_export%2Fcommon%2Fauto_export.py
But it really starts here : https://github.com/kaosat-dev/Blenvy/blob/main/tools%2Fblenvy%2Fadd_ons%2Fauto_export%2Fcommon%2Fprepare_and_export.py
thanks
other question: why copy the components from one entity to another?
on the rust side
wait.. is the whole serialization of components happening in the conversions_to_prop_group function?
In order to "merge" the components from the nested entity (as gltf files at least those from blender have an additional, useless nesting level) with the root entity (the one you actually care about as a user).
The children of the nested entity are also copied over to the root entity and finally the nested entity gets despawned.
I honestly don't remember of the top of my head, will check tomorrow when I am at the PC
Couldn't you just despawn the useless intermediate and set the useful entity as the child of the root entity?
nope, because as a user you expect the components to be where you placed them in Blender, not at a sub level, also it causes lots of incoherent results in queries (because your components would land on a child, not the root), also if you spawn a blueprint into an existing entity (like when spawning a level, or dynamic spawning of entities at run time), you want the components to be on the same level as the original entity. It might be hard to get it across in writing, but you are going to have to take my word for it, I tried many different versions of this, and the current one is the only one that "feels right" (regardless of implementation details)
Ooooh I see the issue
Fair enough
Idk if this is helpful but I just found out this exists: https://github.com/KhronosGroup/glTF-Blender-IO/tree/main/example-addons/example_gltf_exporter_extension
@dawn shell do you have a shader node/texture baking workflow that you like with blenvy. Not loving the qbaker setup I have at the moment.
Nope, been quite a while since I did that, mainly because the workflow for that was too unwieldy for my taste :/
Is that an area where I could help via Blenvy? (I have zero knowledge about baking in Blender so a link would be very much appreciated βΊοΈ)
theoretically yes, but it would increase scope a decent amount and there's already a number of baking plugins for blender.
the tldr; basics explanation is "have complicated/heavy-to-compute thing, need simpler thing", so for a shader you'd be writing the material output, or a specific node's output, to an image which you can then use. for example, baking the base color or displacement to a texture, and then using that texture in Bevy for the base color or parallax depth.
You can also bake a whole bunch of other stuff. mesh detail, shaders, physics sims, etc. Generally speaking its the act of "pre-compute and store information to a texture".
I'm using QuickBaker at the moment for baking and the workflow is... ok. it works for the most part
You can also bake global illumination lightmaps and such, so its a pretty wide topic and could potentially get very big in scope: https://github.com/Naxela/The_Lightmapper
ok yeah, it is π that makes stuff much more interesting :>
Current thoughts are:
I don't want to reference entities via their names, because that's bulky and feels unsafe, can't I just use IDs, they should be safer.
Well... every object has unique names, and they should only be able to change after the relations are already resolved..
And when having multiple instances of a collection, IDs won't be any safer than names...
@dawn shell I've been working on trying to convert my code to follow your quickstart. can you point me torwards why or more preceicecely where i'm suppose to call this compoenent its added to the camera in Blenvy but, its not being called.
Wherever you are adding your systems to your app, also do app.observe(setup_camera) π
and that should be done on the module level in the pub fn plugin or on the main level in App
?
sorry i'm still wraping my head around the whole module strcture in Bevy/Rust
If you are using the organization proposed here, that would be:
// camera.rs
use bevy::prelude::*;
pub(super) fn plugin(app: &mut App) {
app.observe(setup_camera);
}
fn setup_camera(...) {
// ...
}
Does that help?
Try to have about one plugin per file, where that plugin adds all of the things of that file to the app
There are exceptions of course, but that is the general rule of thumb
(But opinions vary! Not everyone uses that style)
a global observer can be added to any app
Yep, from a technical perspective it does not matter at all where you do this @brazen ermine. This is a purely stylistic choice.
Use whatever convention you personally think is best in that regard π
If you see me throwing around pub(super) fn plugin in any of my example snippets, that is just what I personally like π
i gotcha, well its tough to ask someone hey so i need you to sorta of abstract your guide for me so that i can take the modular parts but use it in my style. especially when your learning, you kinda have to follow the guide to the letter to get anything useful from it.. i'll decide how much l like the style later i guess.. but i knew i needed to seperate things into modules now..
And, nonetheless, i got it to work, i do however, put my camera on the player module, because, well technically the player itself is really just a camera in this game..
That makes perfect sense for your use-case π
I do have a question, the way i added IngameCamera to the camera inside Blenvy, is that the generally accecpted method to add logic to a entity that is pre-placed inside the scene? and if so is there any cost/overhead to doing it like that with a observer?
@dawn shell might have additional opinions, but I think the "ideal" situation is to put the UnrealCameraController on the object in blender and skip the observer entirely. The observer is a necessary workaround if you're attaching code like click handlers with bevy_mod_picking, or if the types aren't reflected and accessible in blender.
Completely agree with this. I'll also add that observers are preferable if an object would be accessible in Blender, but has a huge amount of default fields that you would have to manually set, as Blenvy has no concept of ..default()
No idea where UnrealCameraController falls
Observers are very low overhead in this specific case. You could squeeze out a bit more performance by using a marker struct with an on_add hook, but that's more of a "cherry on top" kind of thing imo
the controller is a bit of a pain to directly configure and it needs several fields. but it has a bundle that i don't quite understand yet, but this is how i set it up on the .insert
.insert(UnrealCameraBundle::new(
UnrealCameraController::default(),
Vec3::new(-2.0, 5.0, 5.0),
Vec3::new(0., 0., 0.),
Vec3::Y,
));;
}
And i couldn't figure out how to directly add this inside blenvy in stock form, but for the sake of learning if you can explain how i would do that i'd love to know, it's not avaliable in the component list and its not straightforward to figure out how to add logic to entitys otherwise
Looking at the source, you'd need to add these in Blender
Where ::new does this
Looking at UnrealCameraController, there are a huge number of default values that you'd have to copy-paste
So imo, I would use observers in this case
yeah its like 7 of them i think maybe more
7 is the correct number
but lets simply the question then, let's say i have a cube and i want to attache specific logic to that cube inside blender (blenvy) how would i attach it to that entity not using an observer lets say i have
fn cube {
do stuff;
}
Is there a way to call cube inside blender or am i looking at it from the wrong angle
Looking at one of the nested things inside the LookTransformBundle, Smoother has only private fields. You can set those in Blenvy through reflection, but doing so is naughty. Yeah, you should really stick to observers here
Preforms exponential smoothing on a LookTransform. Set the lag_weight between 0.0 and 1.0, where higher is smoother.
You add a Cube marker component inside Blender and then run your systems on entities with said component
pub(super) fn plugin(app: &mut App) {
app.register_type::<Cube>();
app.add_systems(Update, do_cube_stuff);
}
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
struct Cube;
fn do_cube_stuff(mut q_cube: Query<&mut Transform, With<Cube>>) {
for mut transform in &mut q_cube {
info!("Cube is at {transform:?}");
transform.translation += Vec3::X * 5.0;
}
}
ok so it's just a Struct and it'll appear in the componenet list at that point, if i understand correctly
Exactly!
Yeah you're just adding components to objects in blenvy
This kind of marker component pattern is very common in ECS in general and nothing Blenvy specific
The only Blenvy specific part is the fact that you insert that component through the UI in Blender as opposed to code
right, my reasoning for using Blenvy is i like to visually prototype, and it probably holds me back on becoming a better coder, but i like to add logic to actual object when i do my prototyping, so i guess i learn that workflow before anything else which may or many not be wrong LOL
especially in ECS workflow
Yeah, "adding logic to object" is usually something we donβt do in ECS land π
(There are exceptions, but that's more of a reactivity thing with callbacks)
Yeah i figured as much, but for someone new to ECS it's very difficult for someone to explain to them in text, this is how to convert your brain from object based system (most engines) it's hard for me to kinda figure out without trial and error without a full time tutor saying do it like this.. which isn't practical lol
It takes some time, agreed. But I'm confident youβll get there faster than you think π
@ebon zealot I am so confused.. the ronstring_to_reflect_component gets the whole gltf extra data, which is just one string (btw, is there any reason not making this a Key value hashmap, even the gltf specs suggest that, maybe bevy PR potential?) which you then parse as ron, and either the key is bevy_components, where you call an function to extract the components, or it's not, where you call another function which looks similar, but doesn't remove "component: ", from whereever that comes from..
What's going on there?
How can you even parse json as ron π€
what is wrong with blender..
I had it working to the Entity(name:Object.001) part, now wanted to make it between string brackets, it changed nothing, so I had to change the object it selected and now it's Entity(name: \\\"<bpy_struct, Object(\\\"Cube.002\\\") at 0x000002358336A408>\\\") π
when was the last time testing/bevy_example worked?
Hard to tell. Currently Blenvy is mostly developed by one developer. It takes a lot of effort to keep docs up to date, fix bugs and add new features.
Probably before the Blenvy PR?
could be
super interesting.. I really don't know if we need conversions_to_prop_group actually.. It always remembered the relations for me, also with reloading the registry, BUT: The parse_entity part never returned anything, I did a rust-style return, aka. I returned nothing from loading ._. but it still worked
yay they now work for named fields and lists and I start to understand some parts of the codebase π
that is supremely cool π
How do you link them on Bevy's side?
Name?
(I remember you discussed this, but I don't remember the takeaway)
it got worse
currently they're stored as Entity(name: Some("NAME")), which works because blender enforces unqiue names
I then have to search for the same name in the same scene instance, because they could be instanciated multiple times
I'm unsure if
- I'll go to the Scene root and traverse down there to search
or - search for name first and then look up it's SceneInstance
But first I have to get reflection working, waiting for answers in #1275079261463511092
Ok, another attempt: having the type first as a dynamic type, then modify the entity values, then make into real struct
meh.. it already fails on the type
First up: I got a strategy that works for reflection manipulation
Secondly: serialization is broken and I don't know why but pretty sure it's not my code (I'll test it with the normal addon right after this message)
I serialize the entity to Entity(name: (..)) successfully, and I've counted the parens multiple times, but the wrapping ( for the struct doesn't close at the end for some reason. With a 1-depth tuplestruct this isn't a problem, now I wanted to test it with Vec3 and this is the error I get on adding the component
weird.. on the normal addon it doesn't error..
but this is on the normal addon, with Option<String>...
both seem to happen only when I reload the registry, not on the first time ._.
Sorry, for the late reply !
So:
- storage as a string vs hashmap: you can thank Blender for that (again), I tried it, and Blender has a limit of 63 chars for the lenght of the keys !!! so you woud not be able to store full (long names) for components as keys ...
bevy_componentsis the canonical way to store ...well bevy components (the ones manipulated via Blender's ui), but I kept the simpler custom properties based components as an escape hatch (because Bevy components's keys NEED to be long_names (ie full paths of components for disambiguation)
Word of advice (because I hit that issue over and over again), is to first try with hard coded "fake ron" value before trying anything dynamic.
There is no built in RON parsing/writing in Python , and up until Blender 4.2 there was not even a half acceptable way of including external libraries (in this case for dealing with RON in a cleaner way)
Around two weeks ago , where I broke things with all the changes. It is not meant for external use at all by the way, it is just a testbed for ... tests, mostly for me, and for CI in the future
Thank you for understanding this π
This means the value for your Vec3 is an int, not an array/list like. Best way to check for validity of Ron stuff, is to output an example in Rust/Bevy
Btw, I really wish there were some online ron validators like there are for json
conversions_to_prop_group should not be needed in 99% of the cases , If I recall right .
You very rarely need to convert strings/ ron to property groups , as in most of the cases the property groups are already generated from the registry file
Folks, could somebody please try to switch Blender to any other language that is not English and try exporting with Blenvy ?
I am trying to track down & fix an issue, but for some reason changing languages has no effect at all on Blender's UI for me ?
using the alpha or does it have to be main branch?
either should work (or not work in this case π ) the same way
oh lmao it breaks because the keys change language
? the keys ?
Bingo thanks a lot ! Ok , that is hilarious in a way π
Thanks for trying it out !
I normally have a fix (at least as far as export goes, that special layer is also used in other less important parts)
But also, once again, wow Blender, having internal (non renamable) parts change based on language ..
reminds me of excel π
There is no ron stuff there to check, this happens when I add a Vec3 component, or try to, because it wonβt add with the error. I hope I can find an easy way to reproduce on the main alpha
Nothing makes sense, I can't reprod it no matter what I try, blender is dark magic
oh look, the tuplestruct closing param bug is not there anymore.. lets look at my changes
THERE ARE NO π
I wonder if that happened because of me changing how the serialization works while blender was running, me changing there stuff for testing + the change detection stuff playing with me
That is the consensus, yes π
Good news: i donβt need any thread_local hacks but have direct access to world
Bad news: Iβve just written 8 files, together around 350 lines of code or so, and opened 2 issues, just to manipulate reflection Type trees
Link to the issues?
yess!!! those are extracted from the reflect type hierarchy.
But I can't just apply a completely different kind of reflect item there, so I have to set it from the parent... that will be interesting
Bad news: I don't think it will be possible to do the stuff with how sparse the implementation of manipulating dynamic reflect types currently is.. 3 issues, which I'll later try to address/discuss in the reflection dev channel so that we can get better support in 0.15 (hopefully)
but i have one idea left :p
completely hacky (but it's already hacky so who cares)
YES π₯Ή
finally
the game doesn't panic anymore
@ebon zealot one question.. The thing where it copies over components.. when/for what does it happen? because i would need to know the new entities :p
because I see that Cube.001 exists twice..
love how they are all about bad ergonomics, haha
That is certainly how I felt coding parts of bevy_quickstart
Or getting a skybox working with something other than the one image that is already in the Bevy repo
not directly bad ergonomics, i was bumping from "impossible by api, ah found a loophole" to the next impossible api inside that loophole :p
like I had to make a mutable version of every iterator, which all had the same piece of "make this to a pointer and back to reference, yes this is safe like for all the other ones"
hmm sorry which one ? the copy and pasting of components between objects ?
Change detection is a brute force (costly ) approach that does not have any impact on the components π
Oh wait, or do you mean on the Bevy side ?
Yeah π
There is the removing of some nested entities, which I think is what is happening here, right?
Copying of components happens in order to "merge" the components from the nested entity (as gltf files at least those from blender have an additional, useless nesting level) with the root entity (the one you actually care about as a user).
The children of the nested entity are also copied over to the root entity and finally the nested entity gets despawned.
Yeah, there is that damn annoying useless nested entity below the root entity when spawning gltf files
The interesting stuff here is that I just have 3 cubes all at root, why are there 2 Cubes.001 summoned?
No clue, cannot determine that without seeing your blender setup, and/or your gltf files or your code, sorry π
Also it might NOT be actually the same entity twice, could just be named the same
Yeah, I hope when bsn gets more mainstream, the scene stuff doesnβt directly fit on bevy_gltf and that it will be easier
I am keeping a distant eye on bsn for this reason (amongst others π )
I cannot name multiple objects the same and just init once
Although, that is another complete rabbit hole, because both bsn and gltf are essentially scene description formats
(but gltf is not ONLY a scene description file)
I am always like βohh editor stuff will be so cool to helpβ but then there are just big PRs and not really easy helpβ¦ and I want to do graph stuff first, and school also will start soon.. meh
Wait i can send a link
It depends, not 100% from the Blender side , but even then , there are some corner cases
Huh? That would be? It is scene/level independent and I disallow to select stuff in other collections
I'll be honest, I currently won't have much time to look at things , I haven't even had time to post about the release of the crate in the crates channel or showcase , sorry.
I'll try to sneak a peak as soon as I can
No problem π
the mesh and the object containing it are both called cube π
not from your example btw π
(That wasnβt meant as βassβ, that was emoji completion with touchkeyboard)
No worries hahaha π
Yeah but the βobjectβ I can select is just the top oneβ¦ or are those two different entities on export?
There is also auto naming in Blenvy, where if you spawn a blueprint into an entity without a Name component will automatically be given one based on the blueprint's name
Ah that is why there is an entity called World :0
Thought that was some weird bevy scene shenanigan π
hmm , I honnestly am not sure anymore, I think Bevy treats them as seperate entities, (because I have queries with explicit mesh queries)
There is a ton of "quality of life"/ make your own work easier tooling in Blenvy
I mean vs higher level entity queries
Ah now I get it⦠nodes get normal GltfExtras and mesh, etc. are custom entities with GltfMeshExtras? O.o
If you have custom properties/ components at the mesh level then yes π
Undocumented quality of life
And you then merge the mesh on the node above?
Not really necessary kind of remark, but whatever, please refer to the "alpha" sticker π
I really sometimes have the wish to rewrite bevy_gltf at some places.. the extras could be a map, as they are in the specs, one could mark the nodes, meshes, etc. better with marker components, asset path queries with named references instead of indices, etc.
nope, the only hierarchy I touch is really the useless (and problematic extra empty entity below the root)
// IMPORTANT: this assumes that merging works this way, update this when merging works differently that will be then π
This has been a recuring theme for a loooong time, there are PRs underway that go in that direction
:0
At some point I should also try to implement my 3 issues for reflection
Itβs like βahh this is impossible currently, I need a really ugly workaround and open an issue, I donβt want to wait for bevy 0.15β but then I already have the workaround so why bother implementing it?
I think that comment was supposed to respond to
Undocumented quality of life
No, it is what Ill put on my code which finds the right entity with the name, and which entity is the correct is currently βalphaβ
But I kinda want to do it with ids now.. searching the whole tree, or even all names, seems really expensive
Alright, my bad π
Yeah, that seems really painful
but with an internal component, that isnβt loaded when other components load.. arghhh
yeah I now know where the other cubes come from.. not even named correctly, this will be fun
damn #13681 looks so promising
BLENVY RELATIONS WORKING
You don't know how lucky y'all are: no more messages from a lil kiddo crying about code every 5 minutes
OH. MY. GOD.
I did not expect that to ever work
holy heck, good job!
thanks π
Now it's time to test that with avian joints >:3
first, let me delete 8GiB of target folder or my PC won't have enough space to reboot again
OH MY GOD THANK YOU
finally had time to check out the new blenvy version, and the setup is so much faster now!
Just couldn't get hot reloading to work.
How does it work (I added the file-watchter to the bevy features.
It seems the Bevy v0.14 release broke hot reloading π¦ there is an issue on the Bevy github, I'll post it later.
It used to work well in the RC/ pre-release version, now it only partially works (+ most likely remaining bugs on the Blenvy side)
Bevy version 0.14.1 Relevant system information Tested on: Windows 10 Linux (Ubuntu) What you did Ran the hot_asset_reloading example on my Window 10 desktop, and Ubuntu laptop. CLI args: cargo run...
I think itβs this issue?
Exactly !
@ebon zealot I fixed the clippy errors on https://github.com/kaosat-dev/Blenvy/pull/232.
Additionally, I recommend https://github.com/kaosat-dev/Blenvy/pull/240 for merging (which also includes https://github.com/kaosat-dev/Blenvy/pull/241)
@ebon zealot hey, blenvy is a great tool that'd i'd like to contribute to as i start integrating it into my workflow
is there a tracking page anywhere besides the github issues page?
Pretty sure there is not
There's an easy first PR available with https://github.com/kaosat-dev/Blenvy/issues/223, if you need a place to get started 
That issue says "document", but you could also instead make the cameras spawned by Blenvy to inherit the settings from Blender. This should be a good first PR imo π
This here would be the correct module to put this functionality under.
Extra bonus points if you somehow manage to make new cameras in Blender have the same defaults as Bevy, but idk how hard that part is π
@ebon zealot could you help me out if you find time? I'd like to port Foxtrot to Blenvy and have started by adapting the bike game Blend file, which used to work with the pre-alpha plugin.
I installed the alpha plugin, went through the Blend file and removed all components other than Avian ones.
When I save the file, one of two things happens:
- The file saves, but nothing is generated by Blenvy, or
- Blenvy tries to generate stuff, but runs into the error below
This is the link to the blend file: https://github.com/janhohenheim/foxtrot/tree/rework/art
When I click on this funky button...
...I get this
Update on this: when I manually create the levels directory, the ron file gets created. No luck with the rest though
Update 2: I found the culprit. Blenvy is not able to export anything as long as one of my objects in my library has an Armature modifier.
If you want to test this yourself, the offending blueprint is Npc Pizza before this commit
Sidenote: can I make the generated RON files use LF on Windows?
I'm running dos2unix on them right now, but every time I save something in Blender, it reverts my line endings to CRLF π
yeah this is the sort of thing i was hoping to help smooth out
like for example if you use folders that aren't in the root folder the generated ron files mixes backslahes and forward slashes in the file paths and bevy can't parse it
Maybe just delete the asset folder completely and save?
Tried that, didnβt work. See my follow-up posts for what did work
Are there any notes on how the upcoming scene/bsn changes are going to affect Blenvy? From searching this thread, I get the feeling that Blenvy plans to stay gltf centric and that there is overlap between the blenvy crate and what bsn plans to support?
hard to say how it will impact without any implementation of bsn IMO. Blender exports gltfs, but you could theoretically use them in a bsn-described scene or whatnot. gltf != bsn even though gltf can be scenes.
just wondering how hard would it be to automaticly generate avain colliders from the mesh? but instead of using the mesh directly if possible use the shape.
i.e. if you make a cube and add a colider Blenvy would get the size of the cube and create a colider with same dimensions?
sounds like it leads to some "infer value from blender property" type functionality
Ok i think I now have a relatively clear plan for 0% unsafe (ok maybe not 0%, I want to experiment with making attributes unsafe :p) entity relations π Iβm excited for all the PRs to bevy I have in mind π but, should we wait for bevy 0.15 and modify my PR or merge (atleast review?) the hacky one first?
@dawn shellHIοΌDoes blenvy currently support importing point lights into bevy (or serializing them into ron)? I have a Blender scene with many point lights.π
i think it's supported yes
at least I think in my level the point lights get added to bevy automatically, but maybe I added a component on them, not sure though
Point, spot and directional lights (sun) get automatically added. You'll just have to figure out the intensities to match.
Why would you wait for 0.15? Do required components significantly change it?
Yeah, all lights are automatically added to Bevy π
Okay, thank you all.
No I donβt think required components will do anything to blenvy, but I will surely merge (or at least try to) a lot of stuff to make working with world and modifying reflection trees βeasierβ (in the sense that I donβt have to do unsafe shenanigans to achieve stuff)
Current list is
- directly put
Handle<GltfNode>on gltf nodes - make fake-reflect possible in-house (needs look at unsafe attributes)
- create/init multiple non-clashing system params from
DeferredWorldsafely - visit over reflection type tree
- replace contents of reflection fields entirely
- directly hook visiting into parsing (optional, not sure if performance impact is that big)
- edit and remove fields in dynamic types (optional, isnβt needed anymore but the issue currently kinda contains both replace values and replace whole fields so Iβll just list it here)
That should make all the pointer shenanigans to e.g. have multiple worlds because every query needs one, static threadlocals to pass data around etc. go away and the only βunsafeβ thing remaining would ideally be #[unsafe reflect(fake = bevy_ecs::entity::Entity)] but I have to test if I can just put an unsafe there with custom parsing π
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-attributes.html
Really..? Even more nesting in attributes π but funny how 1.82 βaddedβ something, did I miss anything?
1.81 is coming out tomorrow, so it'll be another 6 weeks before 1.82 π -- https://releases.rs/docs/1.81.0/
1.81.0 # Released on: 5 September, 2024 Branched from master on: 19 July, 2024 Language # Abort on uncaught panics in extern "C" functions. Fix ambiguous cases of multiple & in elided self lifetimes. Stabilize #[expect] for lints (RFC 2383), like #[allow] with a warning if the lint is not fulfilled. Change method resolution to constrain hidden ...
Isnβt it already out? releases.rs says so
it is now the 5th, yes. usually the announcements don't go out for another 10 hours or so
Or is it doing some weird local timezone shenanigan
Oh ok
I just look at releases.rs and when thereβs only 2 versions I know it released
@ebon zealot how does Blenvy's asset preloading work right now? What do I do if I want to properly wait in a state until every sub-gltf required by a world is done loading? I know I could just manually wait for all generated gltfs, but I remember you mentioned that Blenvy does something like that internally now. Note that I'd like to do this before actually spawning the blueprint.
Looking at the code, it seems like the preloading is happening while spawning. Can I somehow trigger that manually by sending an event?
Also, I'm getting these again with freshly generated blueprints. That's a bug, right?
And here it is in a glTF:
I'm less sure how this works for worlds since I've only been using blueprints, but from what I understand, Blenvy adds to the meta.ron file the list of GLTF blueprints that will be used in the blueprint. The blueprint then only spawns once all those handles are loaded. On the Blender side, collection instances are replaced with their own BlueprintInfo component and a SpawnHere component, which will cause those instances to get spawned on the next frame.
So in other words, a system takes BlueprintInfo, finds its meta file, then stores all those handles, waits for them all to be loaded, and then spawns the root after that.
And then child blueprints go through the same process over the course of the next frames (I think)
That matches what I've seen in the code. So the short answer is: Blenvy only loads stuff when spawning. I guess I could loop through the meta.ron file to get the paths to load
Hi folks ! Sorry for the lack of reply in the past few weeks, had barely any time and currently in the hospital for the birth of my son. Will reply to the various questions and issues as soon as I can. Sorry to keep you waiting.
All good 
Family > bevy
First time?
Ok back from vacation, tried something yesterday night but my lifetime-knowledge seems to be "rusty" (oh wow, a "dad" joke, I'm so funny...).
Tried it again today, and got rid of most of the unsafe code I didn't like π (what I was looking for already existed, just was hard to find)
so yeah, anyone bored, feel free to review :3
@ebon zealot I'm investigating a weird issue that is causing my objects to spawn with a wrong Transform on the first frame. During that, I noticed that GltfComponentsSet is never added to any schedule. This means that GltfBlueprintsSet is in fact not ordered after GltfComponentsSet::Injection, even if the code looks like it is. This is a really really subtle thing Bevy ignores without warning.
Do you think this might be causing some issues?
Update: that wasn't it, but I'll submit a tiny PR later anyways
Update 2: yeah, the issue is coming from Avian, not from Blenvy. Still, here's a little bugfix: https://github.com/kaosat-dev/Blenvy/pull/243 π
o.O
Ooh, you added a .blend and .glb. That seems less scary π
Why do you not just use Some? Same for Result, Box, into, etc.
Pretty sure clippy will yell about that once someone does a general linting pass.
This is a pretty cool trick though. That assert would hit at compile time, right?
Update 3: okay, Blenvy might still be part of the issue. I sometimes get entities with a valid GlobalTransform and an invalid Transform. I made sure Avian is not manipulating the Transform anymore, so maybe Blenvy is sometimes adding components in a weird order? Then again, Transform and GlobalTransform should be inserted by Bevy's scene spawning stuff, right?
As the comment states above, this is the output for cargo expand with minimal changes so changes to bevyβs derive macro can be done easier. You could suggest a clippy βshut upβ thing tho π
Yes π
Ooooh right, that makes sense
Wer lesen kann ist klar im Vorteil
Yes
IIRC blend and glb don't count as lines but theres a 14k registry.json π
I am currently trying blenvy and followed the quickstart. I have now a collection in Library with a Rotator Component that has a speed value. I want to instance two of these entities with different speed values, but changing one also changes the other. What can I do?
When you want the component on the root of the instance, you can remove the component completely from the library and put it on the collection instance in world i think. otherwise there currently is as far as i know no way of doing this with instances, so you would have to clone all of them
Thank you. I will try that
You can add the component on top of the spawned instance @grim lance
It's not very documented yet, but that will override the "inner" value, so to speak
Does that make sense? It's a bit hard to describe π
thats what I meant, but I would then also remove the old one and that doesn't work for nested stuff, does it?
Thats useful, ty
Unless I'm misunderstanding you, you don't have to remove the old / inner component.
IIRC Blenvy on the Rust side makes sure to overwrite the inner with the outer component while it is removing the intermediate entity in the hierarchy
(don't quote me on the implementation details, haha)
I know that you dont have to (because that would require more logic that definitely isn't there π ) but it seems like an common error source, and I'm not sure if it will overwrite changes or everything
also, what happened to the review? :3c
It will overwrite the component that is duplicated on the parent IIRC
ah heck, you're right! thanks for the reminder
I have tested it. It works perfectly
whut? parent?
No what I meant is that it probably stores all the properties, so "merging" will replace everything and then when users expect to be able to change some other value in the component in the library, it won't work.
Maybe my wording is not clear, sorry. I'll show a screenshot of what I mean π
In the library, I put the components on the collection named Box
got a rigidbody there
In the world, the object named Crate.001 can be used to override this specific instance
for example, like this I have just changed the rigid body of just one box
Hmm? I only have one collection in this example, namely Box.
The stuff in world looks like that when using a collection instance
oh Crate is the instance of Box, right?
Exactly!
yeah that's what I've meant the whole time π sorry- blender is confusing
haha, agreed
what i meant is that when rigidbody has two values, you can't easily just overwrite one because it will overwrite all of it
so it would be better to not have the same component on both
That is true
I mean, sure, but then you end up with 99 crates that all have the same component copy-pasted. Then I add a new field to the component and I have to change all 99 π
well then split the component apart π
But why, if I can already override specific instances? 
If my dialog component used to make sense with 2 fields, but now after a rework it only makes sense with 3 fields, it seems wrong to put that new field in its own component just to save time on updating the scene in Blender imo
when you know what you're doing.. but at the moment you want to change the field that is the same for all instances, you feel bad for that decision π
Yeah, thatβs completely true
Hejhej! Is the json the file that is constantly written to, when using blenvy? I would like to know what to ignore when using cargo watch π
Maybe I should default to ignoring assets anyway because of hot reloading π€
The json is being written to when starting the game, yes π
Is it possible to reference another mesh with Handle<Mesh> in blender with Blenvy?
Nope, Handle has no meaning before the app is actually running
But @grim lance's branch allows you to reference another Entity
mesh would involve even more shenanigans because of how it has a special meaning in gltf, sadly
you could try to put custom data on a mesh, reference that as handle<mesh> and resolve it in a fork of blenvy, just like I did for entities, but beware of blender hating you
Just use a marker component, it will save you the headache π
and I hate blender, currently waiting for a response in a half-dead seeming help forum for "how can I use 3rd party package in my addon" because I want wasmtime because my simple doing-nothing iterator is running and blocking the app since 20 minutes, the array would probably be finished in rust in 2 seconds
marker component on what? O.o
On the mesh they want to reference
Assuming they just want a relation to an entity holding a specific mesh
If they want a specific mesh out of all possible meshesβ¦ yeah, thatβs gonna be tough
Outside of just writing out the raw string
Thanks. How would I reference another entity then?
https://github.com/kaosat-dev/Blenvy/pull/236
This is currently my proposal for that
Thank you- SOunds really useful
how can i tell blenvy not to look for materials in rust since i unchecked the split out materials box in blender?
ERROR bevy_asset::server: Path not found: D:\Dev\Rust\horror_game\dev_assets\models\materials/Ch20_body.glb
also in blender can i make objects with different sizes without changing the transform scale? like for example making a Cuboid in bevy i can change the size but i can keep the transform scale the same (xyz at 1.0), how can i do the same with blender?
but thats exactly what i don't want to do, as it messes with physics and other components that rely on transform
did you try reading it?
oh... π€¦ββοΈ thanks
called `Option::unwrap()` on a `None` value
Encountered a panic in system `blenvy::blueprints::animation::trigger_blueprint_animation_markers_events`!
is blenvy messing with animations? and is there a way to turn it off?
What if Blenvy worked directly with blend format instead of exporting to GLTF? Saving changes would take lass time and resources. Working with blend format directly would also allow to support huge amount of features that are not included in GLTF. How hard it would be to make Blenvy work with blend directly? Godot for example has native blend support.
afaik godot just converts it to gltf
same as unity
Someone already tried to make bevy work with blend format https://github.com/jeraldamo/bevy_blender
(not sure if it works directly with blend or converts to GLTF internally)
Hi! Ive been using Blenvy to add meshes to the scene and attach Avian3d colliders to them. The mesh I add is a cube, the collider is also a cube with the same dimensions added via ColliderConstructor::Cuboid. Additionally, I add Sensor component, as I do not need the collider react physically to any interaction with it.
Later on I can query for this mesh from inside bevy, and I do indeed see collider attached to the mesh. The bevy_inspector_egui also shows it in the components hierarchy.
However, when I try to query for CollidingEntities, I dont have any entities in there. But when I do the same mesh + collider setup in Bevy programmatically, I do get CollidingEntities correctly. If I take a look at the components attached to meshes from Blender and from Bevy, they are identical, except for the Blender ones having additional Gltf-thingies.
Another interesting thing is that if I try to add collider in Blender via ColliderConstructor::ConvexHullFromMesh I do get CollidingEntities (the shape of collider is wrong, but thats a whole another issue).
I have enabled PhysicsDebugPlugin and I do see colliders with a proper shape in the rendered frame for both the mesh I have added through Blender and from inside Bevy.
What could be the reason for CollidingEntities being empty (i.e. no collisions being detected)?
ps: this is a repost from help channel, thought this place may be more appropriate for such a question.
Does Blenvy support Hot Reload, so when I change my blend file, bevy reloads the changes, like when changing the position of a model or adding a cube?
doesn't it mention hot-reload as a feature somewhere on main page?
It does, but it does not always work. When I edit a mesh or material it works. When I add a new mesh or change a parameter of a component, it doesn't. I also cannot detect changes in Queries with Changed<T>
I'm not completely sure about this, but I think gltf hot-reloading was broken in 0.14 somehow. I also don't get hot-reloading for the levels, but the meshes and materials are hot-reloaded correctly.
Unrelated: What is the recommended way to "preload" blueprints? I would like to load up the blueprint gltf during a loading screen so I can spawn instances of said blueprint without having to wait for any loading.
I don't know about "recommended" but there's been a few instances of using bevy-asset-loader to pre-load assets.
I'm just wondering whether it's enough to load the gltf blueprint once into memory during a loading step to have SpawnBlueprint work nicely. To me it seems like I get a one frame flash of a non-ready mesh or material when I spawn things directly with BlueprintInfo runtime - not only on the first object, but even when spawning further objects.
My question boils down to: What should I do, to get the nicest end user experience with no glitches?
A) Spawn stuff with (BlueprintInfo, SpawnBlueprint, HideUntilReady) during gameplay
OR
B) Spawn one blueprint during loading, and then clone this entity with all relevant components
is it possible to only apply this system to blender cameras and leave normal ones alone?
it's in src/components/blender_settings/lighting.rs
fn process_tonemapping(
tonemappings: Query<(Entity, &BlenderToneMapping), Added<BlenderToneMapping>>,
cameras: Query<Entity, With<Camera>>,
mut commands: Commands,
) {
for entity in cameras.iter() {
for (scene_id, tone_mapping) in tonemappings.iter() {
match tone_mapping {
BlenderToneMapping::None => {
//println!("TONEMAPPING NONE");
commands.entity(entity).remove::<Tonemapping>();
}
BlenderToneMapping::AgX => {
//println!("TONEMAPPING Agx");
commands.entity(entity).insert(Tonemapping::AgX);
}
BlenderToneMapping::Filmic => {
//println!("TONEMAPPING Filmic");
commands.entity(entity).insert(Tonemapping::BlenderFilmic);
}
}
commands.entity(scene_id).remove::<BlenderToneMapping>();
}
}
}
I would assume it leaves other cameras alone, unless they have the BlenderToneMapping component π€
Can you disable Blenvy overriding the DirectionalLightShadowMap? I want to control it myself with a settingmenu, but it gets overriden when i load a new level
Just in case. There is a crate https://github.com/lukebitts/blend for parsing blend files that should simplify making blenvy work directly with blend format instead of gltf.
Using blend files outside of blender seems to be heavily discouraged: https://devtalk.blender.org/t/blend-file-errors/15985/2
My first advice here is always, donβt write a .blend file reader or writer. Itβs Blenderβs internal file format and we make no guarantee that it remains stable or try to document all the quirks. Iβve fixed the crash with outlinertest.blend here: https://developer.blender.org/rB42f6aad There is no boolean type, the first type in that table is...
And it seems largely undocumented and unstable as a format (so including it in blenvy is probably not a good idea)
Blend is blender main format and from blender perspective blend is very stable. So if an external parser is written properly it should be stable. It seems that documentation is sparse but it shouldn't be an issue once you get acquainted with the structure and we can read blender source. Parser won't even need to parse the whole file structure. Only what's needed.
Export on save to gltf is expensive. For testing and small projects it works but it gets slow once the project grows, even on fast machines.
Plus gltf doesn't support a lot of features.
Do you know of a spec somewhere or something that I'm unaware of? I'm curious as to what makes you confident enough to say it would be stable when the core developers (from the link I posted) say it won't be and are actively saying "don't do this".
My first advice here is always, donβt write a .blend file reader or writer. Itβs Blenderβs internal file format and we make no guarantee that it remains stable or try to document all the quirks.
What makes me say it's stable is the fact that blend is not some alpha/beta testing format. It's blender main format. It's very stable from blender perspective. Blender reads and wires to it.
Of course there can and will be changes in the format structure with new blender versions but it shouldn't be hard to fix.
I don't know why the developer says it's unstable. Maybe they just don't want to write docs, migration guides and answer relented questions. But fact is a fact. If the blender works with it than something else can work too when written properly.
I think you're using a different definition of stable than they are. Typically "there was a released version of it that isn't being updated" is not what maintainers mean by stable. stable usually means something more like usable across versions: for example it would work across 4.1.0 and 4.1.1 (or 4.1 and 4.2, etc)
the fact that the .blend extension is used for the file across many blender versions does not mean all .blend files are compatible with all blender versions, for example
"it would need to be updated for potentially every single release, and maintained as different versions for each of those releases to work properly" is exactly what is meant by unstable.
truly the effort here would require tracking basically all applicable changes to the .blend file that make their way into the blender repo, which is imo a very large amount of work.
Parser can just check the blend version before parsing and use appropriate parser version or show an error if input blend version is not supported (in a similar way blender does it). Blenvy not necessarily need to support every blender version and for example only the latest version or LTS.
Blend file will also contain a lot of blender specific data that external parsers won't need.
I've checked this https://github.com/jeraldamo/bevy_blender parser and it is quite small (but it doesn't have a lot of features).
Also reading blender exporter to gltf and bevy gltf reader should help with some things.
One thing I'm not sure of is if we need to apply object modifiers (including geometry nodes) when parsing object data from blend or modifiers already stored in applied state. If we need to apply object modifiers when parsing objects it will probably complicate things.
I do not insist, just sharing info.
Whatβs the status of Blenvy right now? I can see many juicy PRs unreviewed and unmerged. Weβre building our blueprints and levels using it, so just wanna know if we should have a plan B.. π
status is maintainers are busy with life but its still a project that everyone is interested in maintaining
Hi new to blenvy here, am curious as to how to preload a material:
materials file materials/Ship.glb should have been preloaded skipping
.
Another question is what does injecting materials do:
Step 6: injecting/replacing materials
Hi! So I followed the quick start guide, and I've created a Library scene and a World scene. I create my blueprints in the Library scene, but they're never exported to assets/blueprints, unless I first instance them in the World scene. Which is tedious, because I don't want them in my world, I want to spawn them dynamically. Am I missing something, or is this the only way to get them to be exported as blueprints?