#Blenvy
1 messages · Page 2 of 1
As for the second, I feel I’m not familiar enough with how the new system will work to make a judgement here
I don’t understand the second point. Could you explain what the options are? Is the issue how you store it on disk? Or in terms of how you organize the Rust structs?
For your first issue: what kind of shortcoming do you want to address by moving some data into external files?
My bad ! I should have posted more on the context:
- the next release has asset management & automatic asset loading
- blueprints are assets (as they are gltf files), but you can also add any asset that you need to be using together with a blueprint
So the two options are - gltf only, assets list embeded in it
- <blueprint_name>.gltf + <blueprint_name>.assets.ron
So is this about storing which additional assets need to be spawned with a blueprint?
About the second point, it is mostly about how to structure the data (currently it is just another custom property/gltf extra), but I actually answered my own question when writing it out : there is no use case as far as I can see where you would only need the direct assets of a blueprint.
I'll get to the first point in a sec
For example, I have a blueprint that references a Yarn Spinner dialog file. Is this an indirect asset covered by the new asset management?
Whatever the answer, if you use external files, please pretty-format them so that git can do nice diffs with them
It would be a direct asset of that blueprint, but an indirect asset of the level you are using the blueprint (and thus the asset ) in
That is exactly one of the points 😄
Ok so hopefully the image can make things a bit clearer
- Blueprints can be be made of multiple instances of other blueprints
- Blueprints themselves are exported as gltf/glb files
- These files are assets (You need to load them inside Bevy) that are automatically added to the assets list .
- You can also "add" any other asset you want to your blueprints (I call them user asset), what you are adding is actually just
pathsto assets, and telling Blenvy "please load these assets together with my blueprint"
Ah, got it! So, what's the rationale behind moving these into own files instead of leaving them on the GLTF?
Oh that’s cool
I think it will be easier on the end user to store data in the gltf, and have one file to load.
That is the main advantage of that approach yes 🙂
Oooooh, the pre-loading is a good point, I see
That chart has very much convinced me that an external file is the way to go
The issue can be summarised as such : there is currently (as far as I know), NO way to read just the gltf extras (for assets in this case) of a gltf file in Bevy so you need absurd pre-spawn, load, spawn complexity
Also nicer for refactoring. It's currently a pain to change stuff on Bevy's side and then not really being able to do a big CTRL-F on Blender's side
As for dependencies: I can't find the link, but I remember Alice and Nikl are on board with upstreaming bevy_common_assets at some point
So I wouldn't consider it an additional dependency, really
Haha yes, I will not even get started on that, it is the ultimate irony for someone working on a graphical tooling, because I actually usually prefer "code based" approach for pretty much everything, including 3D modeling (well, for CAD stuff, doesn't work that well for more artistic modeling) 😄
Ohh that would be so great ! I use bevy_common_assets pretty much in all my projects
Even if I have already implemented the gltf based solution, I am also leaning towards the external file one, because at this time I do not see a way to do this really cleanly using gltf in Bevy
Plus, you open the way to pack more metadata or Bevy stuff into the external files in the future if you find it to be beneficial
Exactly this ! This is also why I originally hoped to use bevy's .meta files to store the assets
Btw , waaay back I also thought about storing the actual components in an external text file beside the .blend file , as a single source of (text-based) truth...
Would you consider going back to that design?
Not against it , if it makes sense overall and if it does not add too much complexity ?
But before that, I need to make a decision on the internal vs external assets file
My vote goes to external 🙂
not sure how much my vote counts since I'm very much inexperienced, but to me an external human readable format is preferred, because it's much easier to debug issues than having to look inside the gltf. I think I would even prefer the component info being stored externally somehow.
Your feedback is appreciated, experienced or not, it is still valuable information to know what people prefer and why 🙂 Thanks !
My thoughts on the issue:
to me the problem seems to be between complexity on the dev side, and complexity on the user side.
separate files means slightly more complexity on the users end, requiring the managing of multiple files per asset. this isnt exactly new though as we often have to manage models, textures, sounds ... adding another file onto that doesn't seem like too much of an ask but it is more likely in the code that you forget to load something.
combined gltf while it guarantees dependencies will be loaded correctly without the need for an extra dependency defining the dependencies ... It does present a problem for debugging. if you want human readable/editable you are forced into gltf, and there is no way to switch to glb with out changing every file reference.
loading While the gltf solution totally works, it feels just a little bit hacky to me, thats entirely subjective and not necessarily a bad thing, just my perspective. Do the assets need to be spawned or just loaded?
general thoughts i think the external file approach is the better options, primarily for the reasons listed in your chart. but also an external file allows us to more easily parse it, allowing others to create their own load order/pipeline in a way that gltf would make difficult.
Thanks for the detailed feedback ! 🙂 I pretty much agree with all the points you made. Trying to change things now to see how they feel.
which ever option you go with, im super excited for the next update. you're bringing some seriously big things to the table
A few things I had not considered hit me while trying to implement the external file option
- having a file both be editable manually and auto generated by blender is ...meh and a shotgun:
- what if the information is contradictory ?
- also this means I have to parse ron files in Blender , which is not supported natively, so either having to add a ron parser, write my own, or switch to json, (meh)
- what is the source of truth? what you do in the Blender ui or whatever you edit in text format outside of it ?
- also purely subjectively, I am not a fan of all the additional files (could be my lack of sleep bringing out my grumpy side 😄 )
Thanks a lot 🙂 It is getting ever closer, fundamentally , everything works already, but still needs polish 😉
Can we place the files in an own folder? assets/models/meta?
Can't you just use a RON Python library? Idk how addons work in terms of dependencies
Can you lock the files while open in Blender? That way you can't manually edit them while Blender is running.
yes I could, however in the next release each Blender project can specify its blueprints/levels paths already to avoid naming clashes (for example blueprintsLib1/Chair.glb, blueprintsLib2/Chair.glb), which is also the reason Blueprints now also use a path, and not just a name
The thing is, the Bevy side would need to get the information on where the metadata is stored, so I wanted to keep things simple and always store it next to the gltf file for simplicity
as far as I know you cannot ask Blender to install dependencies with an add-on (could be wrong, but that is what I remember), so I would have to include one manually either way
How about just assuming it's a subdir called meta? You can still make it configurable in a later release
Not as far as I know, I already had problems with the registry file updates because of the inability to either lock or even detect locks edit: not sure anymore about locking, but I am sure there is no reliable way to detect locks
@ebon zealot I just gave a talk about Bevy at RustFest 2024 and highlighted the Blender workflow. Some people came to me specifically to tell me that they love the Blender workflow, so I wanted to pass that on 🙂
Some people said they couldn't figure out how to set it up properly because the examples were confusing
But those who managed to use it really love it 🙂
Some asked me if I knew about if there's plans for hot reloading and I passed on what you've been sharing here
Wow , cool that you made a talk about Bevy, will check it out online !
Thanks for the feedback 🙂
Simplifying & streamlining the examples is also on the menu for the release + the simplified crate & Blender side tooling should also help greatly !
Hot reload should be relatively trivial to add settled on the assets format;) (would love to ALSO include that in the next release)
Btw I realised something : I can actually parse the gltf extras without spawning by using the gltf crate (& since it is already a dependency of Bevy's gltf crate, should be not too hard)
btw @dawn shell , as far as hot reloading goes, off the top of my head, since I now track the loading state of assets per blueprints/level , I normally just need to check for 'AssetEvent::Modified` & re-run the spawning process right ? (this is a simplified view , off the top of my tired head 😄 )
Bit too tired rn, I'll get back to you tomorrow 💤
Oh wow, I didn't think about that, but you're right of course!
No worries 🙂 always take your time , I am also nowhere near done with the changes I wanted to include before giving the green light for "hey this is testable" 😄
Thanks !
I think so, but Asset V2 changed quite a few things that are still not fully documented. For Yarn Spinner at least, I do exactly that
In my case, I also needed to be a bit careful because the hot reloading should be triggered when the files we started the game with changed, but the user could in theory also add their own in-memory assets at runtime, which would also trigger AssetEvent::Modified
So I need to check whether this asset that just changed is actually one that we started the game with, otherwise my state gets a bit weird
dunno if that's relevant for the Blender workflow, but I thought you should be aware of that
BTW, I want to test out the newest Blender workflow today. Which branch should I look at? main? Is there anything special I need to keep in mind when setting up a new project?
Sorry Jan , but please wait just a bit more before testing it out, I broke a few things while debuging / improving things yesterday and still am in the process of making changes 😦
Thanks for the very usefull information !
I think the issue in Blenvy will be very similar to the one you had in Yarnspinner, as users can add / remove Blueprints, levels & so on at runtime
While cleaning up & upgrading the scene components, I added support to get the ToneMapping, exposure & gamma from Blender to Bevy, not perfect but getting there !
(don't mind the debug overlay in Bevy)
Oh great! I was considering opening a PR for that 😄
A bit of a status update:
- managed to get pre-loading of assets working using the
gltfcrate, was rather simple to do - it makes for a more coherent and less brain-breaking logical flow
- you can track the loading progress of a level (or any blueprint instance really)
- still unsure about this solution ( I am trying out both this and the external asset files one, but that one requires more significant changes)
The flow goes like this: (simplified obviously !!)
- spawn your level
BlueprintName("World".into()),
BlueprintPath("levels/World.glb".into()), // etc
))```
- bevy picks up the added "BlueprintPath" component
* read the list of assets in the gltf file
* add both the file of `BlueprintPath` (in this case *levels/World.glb*) and the list of all its assets & sub assets to the list of assets to load for the entity (untyped handles at this point)
- a system checks for the **loading state** of all assets
* updates the progress & "loaded" flag
* when all assets of a given entity/blueprint instance are done, it adds a `BlueprintAssetsLoaded` component
- another system checks for that entities that have `Added<BlueprintAssetsLoaded>` (might switch to events, but system piping might also be a solution, although not sure about the coupling)
* this means all the assets are ready, so we inject all data from the blueprint , do some post processing, and its done
- IF the world/ blueprint contains entities that are themselves BlueprintInstances (so have `BlueprintPath` components), the process starts again for those child entities, & so and so on until everything has been spawned
Honestly it works but every step raises more questions
- what if you want to override what assets to load for a given Blueprint instance ? (not really supported right now, and it makes things even more complicated)
- when do you consider a Blueprint instance to be "ready" ? when all its children & their children have loaded their assets, and have spawned ? (this would require way for an entity to know of all its hierarchy in advance), does this even make sense ? (I can think of a few use cases at the very least)
this is a response to a conversation we had last week re instancing in gltf files:
sorry it took me a hot minute to check, but blenders standard gltf exporter does do proper instancing of objects. I think the issue is caused by the same mechanism that creates the strange naming changes (ie cube.001 gets exported as cube.00x when using the workflow plugin). I'm not certain but it seems like part of how you manage the export involves creating a duplicate of the scene, exporting that, and deleting the duplicate. I'm pretty sure this duplicating is whats causing the meshes to become "de-instanced"
Thanks for checking that out !
Is that enabled by default in V4.0 ? Because if it is not , the current version of Blenvy is not using it.
Could very well be that the duplicating process is causing an issue, no idea at this stage to be honest 😄 The duplication process is much more streamlined in the next release, but still works on the same principle (no way around it sadly, because of blender's limitations), but will keep this on my radar 🙂
Yes that’s the 4.0 exporter with default settings
Ok, thanks ! I'll be honest, I'll likely fix this (if possible) either after the next release, or before it, if I still have the energy, I am really getting exhausted by my endless TODO list for the release 😄
In part because I feel like some of the stuff I am implementing for assets is overlapping some of the work done on bevy scenes/ the bsn format , but I am lacking clarity on what is already possible or not 😦
I get waiting a release or two on this (I had no idea about the bsn format, I can see how that changes things). Ngl I have kinda noticed the growing feature set for this next release and I get the need to actually release the release XD. I’ll be very excited to see the fix when it comes
Yes, you are spot on, it is starting to look a lot like feature creep (and burn out :D) and I just need to release things (mostly as 99% of things have been working well for a while now), the last additional thing I want to look into (and not a single additional feature more) is hot reloading (since I am already dealing with this mess of assets , might as well use it for hot reload too )
Hot reloading would be absolutely crazy!
In case you don't get through that gigantic feature list: is it possible to do a release that is just the Bevy 0.13 version of the plugins updated to 0.14? This would be nice in general for being able to upgrade my projects bit-by-bit
Uff, I think I just hit a weird edge case. I'm using commands.entity(foo).set_parent_in_place(bar); to make foo a child of bar. Both foo and bar are blueprints that have been placed side-by-side in the same world. I'm getting this crash because of that.
(Don't think it's relevant, but foo is using the <name>_components feature as well)
This also happens with commands.entity(foo).set_parent(bar), and commands.entity(bar).add_child(foo)
It is already planned 🙂 Basically taking inspiration from bevy_xpbd/Avian with the "first just update to V0.14, and then release new version with rebrand"
Perfect! Thanks!
Got a hotfix:
for entity in [foo, bar]
.into_iter()
.chain(q_children.iter_descendants(foo))
.chain(q_children.iter_descendants(bar))
{
commands.entity(entity).remove::<SpawnHere>();
}
where q_children: Query<&Children>
Ok, have not touched that part for a while, but it seems like a timing issue , since SpawnHere is supposed to be removed onces a blueprint is "ready" ?
I just removed SpawnHere to avoid being picked up by the spawned_blueprint_post_process system
Because that one is indirectly causing the crash
I am doing .after(GltfBlueprintsSet::AfterSpawn), so I wouldn't have guessed so
Hrrm, the Transform on foo ends up being Transform::default() after set_parent_in_place, which should not be the case. Something funky is going on now.
Let me try to do the opposite of removing SpawnHere from the hierarchy and instead wait with my system until SpawnHere gets removed by the blueprint systems
Update: yeah, that works. Transform is also correct now
I'm now doing the following:
for entity in [foo, bar]
.into_iter()
.chain(q_children.iter_descendants(foo))
.chain(q_children.iter_descendants(bar))
{
if q_spawn_here.contains(entity) {
return;
}
}
commands.entity(foo).set_parent_in_place(bar);
Is there a nicer way to wait for this? I thought .after(GltfBlueprintsSet::AfterSpawn) would be enough, but apparently not
Note that I don't know if the iter_descendants is necessary, I just placed it there defensively. Let me check if I can remove it.
Update: yeah, checking if foo specifically has no SpawnHere is enough, which can of course be done in the query already.
@ebon zealot it seems weird to me that I need to do this after GltfBlueprintsSet::AfterSpawn, but I'm working around my actual issue anyways. I've got the following setup right now:
This is in my main world scene. Cat and Cat Quest Tree are both scene instances / blueprints of Cat and Palm Tree, respectively
Is there a way to make Cat a child of Cat Quest Tree? I tried doing it how I would normally in Blender, like this:
but the resulting objects in Bevy end up being siblings:
I know that I could make them both children of an empty, but:
- Doing so is broken on the current release. I think I remember you fixed this on
main - That is not quite the right hierarchy I need anyway
Hi @dawn shell ! Thanks for the investigation I'll try to reproduce on my end & add tests either later tonight or tomorrow 🙂
Really weird , but hey, good find !!
Do you mean the one about SpawnHere, or the one about the parenting in Blender? ^^
My bad, need to re-read, I thought they where one & the same 😄
Btw , code is beyond horrible, but .... hot reload works 😄
Woooooah this is so cool 😄
Also works with duplicating objects/Blueprints, adding instances of blueprints etc
Thanks 😄
It is horribly brutal in what it does ("oh , a change, how about I nuke everything and reload everything") but hey, it works
THAT IS AMAZING!!!!
Oh and it seems to work for editing meshes too : (not much of a surpise, but still nice to see it works !)
Really really cool stuff 😄
I assume adding a bevy component also hot-reloads?
that's amazing
and for how it's implemented, I would have no idea how to do it any other way without introducing way too much complexity, so I'd say that's fine?
Oh yes 🙂
Thanks ! 🙂 I can strip down the complexity by a lot I think. I need to have a better understanding of some of Bevy's innards to reduce it even further
Btw Jan, I looked a bit closer at the issues, and I think I have an idea where it comes from (also fundamentally, I think sets such as GltfBlueprintsSet::AfterSpawn are not enough, since we are operating across multiple entities).
I still would love to avoid the two tiered spawn + post process , though I am not sure how. (If you have ideas, I am all ears).
In the meantime I will set up some additional tests for the "Blueprint Instance as a child of another blueprint instance" to fix this.
Have you looked into 0.14 component lifecycle hooks?
Thanks for looking into the blueprint-blueprint child thing 🙂 In my case, there are different permutations of parent and child using _components, idk if that’s relevant
I had a superficial look at lifecycle hooks & observers , but nothing in depth. Not sure yet how/when to use them :mostly in this specific case of "post processing", as it boils down to being able to change hierarchy & components only once a blueprint has been completely spawned
- For the blueprint-blupeint child issue, still investigating , I do not think the use of _components hase any impact on it.
- I am "ripping" apart the spawning process anyway to have a clearer vision on the various aspects so your bug fits right in 😄
Can we test? This is becoming excruciating to wait 😅
Any hope for this weekend when we can “help” to find some bugs?
I mean, you can always just checkout the working branch
is that the bevy_main branch?
Sorry to keep you waiting 😄 I am making steady progress but It still not quite ready for testing: I will be honest, I tend to be overwhelmed easilly , so I am being a bit selfish and wait to give the green light for testing because right now I am still changing a ton of things, breaking things, and feedback at this stage would be too much and not really help. I hope you understand, and I do not mean to be a mean tease
Normally yes, but in this specific case, as the re-structure was born out of another set of fixes it is the animation-fixes-and-improvements branch (very ironically, the changes with the animation graph in Bevy 0.14 broke all the animation logic)
I fully understand, but I still can’t wait to try it out!
Take all the time you need!
@ebon zealot dunno if you're aware of this, but it seems useful: https://github.com/KhronosGroup/glTF-Blender-IO/issues/1456
Little edge-case I found: Vec3 expects to be deserialized from (f32, f32, f32), but Blenvy doesn't know about this quirk and tries to deserialize it from a regular struct, resulting in a panic.
This means that a component like struct Foo { dir: Vec3 } can currently not be used from the Blender plugin
Don't know if you want to hard-code this case, since Vec3 is a very common type. Should I open an issue?
Yes please 🙂
I thought it was already covered and hard coded, but I'll have to take a look
I was aware of the option but not that they use empties too 🙂
I would need to check out if it fits the bill, or if it conflicts with the way Blenvy does internally
Very short status update: completely swamped with IRL things this week, but still managed to make some progress on the complete restructuring of the Blueprint spawning, which makes things WAY more reliable (a blueprint instance is only ready when all of its sub blueprints are also ready ie, assets loaded, AND blueprint scenes spawned) .
- Even if it adds a bit of internal complexity, it makes the Blueprints process more deterministic. (ie you will always know when you can actually use a Blueprint instance withouth worrying that some things are not done processing)
- It also fixes issues with blueprint instances as children of blueprint instances as in your case @dawn shell
- Still have some issues with it that I need to sort out with deeper nesting levels , but the logic is sound, and the code is getting cleaner.
The logic now boils down to this:
BlueprintSpawning
- Blueprint Load Assets
- Blueprint Assets Ready: spawn Blueprint's scene
- Blueprint Scene Ready (SceneInstance component is present):
- get list of sub Blueprints if any, inject sub blueprints spawn tracker
- Blueprint copy components to original entity, remove useless nodes
- Blueprint post process
- generate aabb (need full hierarchy in its final form)
- inject materials from library if needed
- Blueprint Ready
- bubble information up to parent blueprint instance
- if all sub_blueprints are ready => Parent blueprint Instance is ready ```
Could be like that on main? I'm referring to the 0.13 versions of the workflow
Could you elaborate on Blueprint copy components to original entity? I assume this is an evolution of what _components does currently? The useless nodes don’t actually spawn with the components, right?
IRL is more important, take care ❤️
It is essentially what the xxx_post_process system did until now, and yes those do not contain components, they are just (as far as I could tell) an artefact of blender's gltf export
it is already in the 0.13 version (and not changed in v0.14 unless something changed in the way Vec3s are reflected), but I might have missed something 🙂
Ah, I see. The little logic list you posted would probably be good in some readme as well, maybe next to the diagram.
For reference, this is the exact struct that failed to deserialize when starting the game:
#[derive(Debug, Clone, Copy, PartialEq, Reflect, Component, Serialize, Deserialize)]
#[reflect(Component, Serialize, Deserialize)]
enum RedirectPropHitImpulse {
Local(Vec3),
}
Changed it to this for now:
#[derive(Debug, Clone, Copy, PartialEq, Reflect, Component, Serialize, Deserialize)]
#[reflect(Component, Serialize, Deserialize)]
/// Uses (x, y, z) instead of `Vec3` because `Vec3` expects to be deserialized as (x, y, z)
enum RedirectPropHitImpulse {
Local((f32, f32, f32)),
}
Awesome, thanks for sharing, I can add this to the list of testing components !
Hi @dawn shell ! I tested this out in the Blenvy version, and it does not seem to be an issue.
Although I did remove Serialize, Deserialize as I do not have the serde imports in my test setup
I sadly also found a Blender (or at least Blender's gltf exporter) bug: I was having weird issues with blueprint instances inside blueprint instances (the issue you reported @dawn shell ), with levels of nesting > 2..
I ripped everything apart on the Bevy side, and the issue did not stem from there, so I tried exporting gltf files without the workflow (standard export) and those nested cases are not even exported correctly at all , and when toggling the gltf exporter's "export full collection hierarchy" that is buggy as well :
- first screenshot is the blender scene that I exported with that option
- second screenshot (blueish tint) is the exported gltf imported back into Blender: the "Cone" object is not correct exported as a child of the "Test_Collection" collection instance
Sigh ... it REALLY does not help to diagnose & fix issues with the workflow when hitting issues with Blender
Oh heck, that sounds really really annoying. The GLTF exporter codebase is not easy to debug either, is it? At least the times I checked it, it tended to just confuse me
Yeah that screenshot is pretty much exactly what I need :/ It's not a blocker or anything, I can still reparent them at runtime like I do now, but still a bummer
I think you've already hit quite a few Blender bugs since you started the project, didn't you?
Good to hear! I'll try it out when I move my project to Blenvy and 0.14, which will probably still take ages because of all of my dependencies 😄
is there a branch for the blueprints lib pointing to 0.14?
yeah , it is hard to grok, but once you get used to it, it is not so bad. My Pr from a few month ago was ignored though, so I am not sure how reactive they are (I am not that great in that regard so I cannot say anything)
The good news is, it actually almost works with Blenvy: the way I handle collections does not seem to have that issue. But there is something weird going on, cannot pinpoint exactly where, will post in a few seconds.
yes 😄 Bugs and limitations
Do you mean just the bevy_gltf_blueprints crate or the whole workflow ?
Now that i think of it, the whole workflow, since as I understand it the bevy_gltf_components` is wrapped by blueprints
There is a branch, but not ready for use yet sorry ! Will post here when it is ready to be tested
What could cause transforms to be correct , hierarchy to be correct but entities to still be in the wrong place ?
I'd like to add support for bevy_gltf_blueprints to an editor prototype, so I am also interested in a 0.14 branch
The Bevy 0.14 Branch should be at least ready for testing this week, still have a few things to iron out, will share the branch & infos very soon 🙂 Btw there will only be a single add-on & a single crate going forward, for simplicity & convenience
Also , I am curious, do you have some infos on the editor prototype you are working on ?
So , good news everyone ! I managed to get the basics of animation support working today (amongst MANY other things).
This was one of the last major blockers for the upcoming release ! So it is really getting ever closer to release (or to be ready for testing at least 😄 )
- support for animations using Bevy's new animation graph &
AnimationTransitionsapi : in practice it all happens under the hood, so the user facing api when using it for blueprints is barely different from the previous version, but it gets out of your way if you want to use more complex features - built in support for level/ scene animations ! Ie if for example, animating a group of spaceships (all blueprint instances , with animated reactors: aka
Blueprintanimations) , flying in your level (aka the flying animation of the group is aSceneAnimation) - I managed to track down and fix the nasty positioning/ transforms issue that impacted nested blueprints & empties (thanks Blender for some weird as hell internals once again)
- You now have the option to hide Blueprints during their spawn process until they are ready, this is very practical for blueprints which contain lights for example (you might have noticed an unpleasant "flashing" effect in previous versions)
- Fixed up & improved the spawning logic some more
- Blueprint Instances' & their children now have a
BlueprintDisabledcomponent during the spawn process until they are ready, so you can easily filter them out from your queries (highly advisable !) - a ton more minor improvements
Edit : the first video showcases SceneAnimations and the second one a mix of blueprint level & instance level animations by using tag components,
And yes, you can mix & match per blueprint & per level/scene animations ! (thanks to Bevy 0.14's support for multiple AnimationPlayers)
@queen trellis this took ages sorry , but it is around the corner 😉
What is next:
- fixing of a critical bug dealing with how instance components override blueprint components
- fixing some issues with how hot reload is handled both on the Blender & Bevy side
- double checking some potential non obvious issues in the Blender side
- cleanup & more cleanup and some simplification for the Bevy side ! (although I already started on this)
- documentation
- examples overhaul (wip)
- minor QOL improvements
- release preparation (The dual release ie basic update to the existing crates + rebranding to Bevy is giving me headaches)
Huge 🤯 Thanks for all the hard work!
here is where my prototype is currently living https://github.com/knutsoned/beverage
there is currently a client and a server. the server would be the game being developed + remote plugin. I want to be able to load blueprints using the client UI and have them appear in the server window and be able to be arranged and saved as scenes
Wow this is awesome, I was confused by bevys animation system, this will probably make it much easier to implement
Another status update !
- fixed the a critical bug dealing with how instance components override blueprint components
- significantly improved how hot reload is works both on the Blender & Bevy side:
- tracks which blueprint instances are using which asset, to avoid useless & costly loops
- detects & does not attempt to respawn entities whose parents / ascendants also need respawning
- batches / regroups changes to assets (happens if you change gltf settings & blender re-exports all blueprints) to avoid chaotic re-spawning all over the place
- better tracking of parent / child blueprints, so if you change a blueprint in Blender it only impacts the direct instances & their parents
- a whole lotta minor bugifxes !
- Also , bonus video showcasing a nested blueprint instance being hot-reloaded: as you can see the only thing that "flashes" (de/respawn) is the instance & its parent, if the whole level was hot reloaded you would see a short "black" screen as the camera would also get respawned
Holy cow!!! That’s amazing, I’m so excited to work with it! Hot reload is going to completely change my workflow, being able to model things and have an immediate perspective of what that looks like in game is very cool and I can’t wait to see what processes that gives rise to/what things it makes possible
The first thing I’m doing is getting that working with physics, I want to be able to run around my levels in first person
@ebon zealot do you think blenvy will see a release before the game jam?
I hope to at least get a usable version out before that, with basic docs & co. It might "only" be a branch, or perhaps even an RC crate, but should be usable .
Testable version should be out in the next 2 days.
Awesome, looking forward to getting my hands on it 🎉
Thanks ! Other than an overall cleanup pass, screenshots for the docs & some minor fixes, the main thing I need to try out is taking it for a spin on a new "blank" project to see if things work as well as in the test environment and it should be ready for "public testing"
i just noticed, theres a typo in the blenvy branch readme, the blenvy link takes you to
https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/blenvy/crates/blenvu
instead of /blenvy at the end :D
Good catch ! Thanks 🙂
i updated my game to use the new blenvy crate but how can i use the new single blender addon? in the tools/blenvy/add_ons directory theres still the two addons
okay i figured it out, i just had to clone the repo and execute the internal_generate_example_gltf_files.py file with python
Let me know how it goes, I’m curious to try as well
i'm just now adding components to the blender objects, lets see
Heeey, it is not ready yet 😄
Jokes aside, cleaner (albeit alpha) release for testing is out today, as well as a "barebones" bump of the old crates to v0.14 so that people who do not want/ cannot update to Blenvy , have the option
i'm getting a panic from this
let scene_extras = scene.extras().clone().unwrap();
``` in blenvy\src\blueprints\spawn_from_blueprints.rs:159:55
oh i know why
nevermind i dont know why
2024-07-18T10:57:59.563348Z INFO blenvy::blueprints::spawn_from_blueprints: BLUEPRINT: to spawn detected: "ak47" path:"blueprints/ak47.glb"
thread 'Compute Task Pool (2)' panicked at C:\Users\bugoLMAO\.cargo\git\checkouts\blender_bevy_components_workflow-51132dc31e81c4ca\3a8844b\crates\blenvy\src\blueprints\spawn_from_blueprints.rs:159:55:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `blenvy::blueprints::spawn_from_blueprints::blueprints_prepare_spawn`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
error: process didn't exit successfully: `target\debug\cs_went.exe` (exit code: 101)
this iss the full error
here's how i spawn the ak47, seems like thats where the error is from
.with_children(|p| {
p.spawn((
BlueprintInfo::from_path("blueprints/ak47.glb"),
SpawnBlueprint,
TransformBundle::from_transform(Transform::from_xyz(0.5, -0.3, -1.0)),
AK47,
));
});
and its not just the ak's fault, once i removed it now it causes the error on "character.glb"
@glass abyss & @dawn shell I do mean this part though, please just a tiny bit more patience, it will be in an alpha state first, so you will have plenty of time to find bugs 😄
it's alright, you'll fix em :]
ok i finally loaded the character and ak but now the world isnt loading, i'm pretty sure its my fault and not blenvy's though, since i dont have time right now i will do this later and well if there's a bug in blenvy, i'll let you know
Fyi, just at a glance: you both found a small issue in Blenvy AND it shows me you did not export the scenes using the new Blender add-on 😄
I'll add a note in the README somewhere , that you must re-export /save your blend files otherwise the metadata that gets insert in Blenvy will not be present, and break things
Yeah lol that was the issue at first, now gotta figure out what's wrong with the level
Maybe it's that I use BlueprintInfo
Instead of the old way
Ok, this is very odd, I am trying to update the old crates to v0.14 and running into an issue (not aware of any changes in this area in v0.14)
.add_systems(
Update,
(
camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn),
camera_track,
),
)
Can you implement that trait for GltfBlueprintsSet?
I just noticed that that example still had a dep on v0.13 🤦♂️ don"t mind me, exhausted, sorry
Sure 🙂
I seem to be getting linking errors whenever I include the latest GitHub release into my project. But the error messages say it has something to do with wgpu, and the dep tree doesn't show wgpu as coming from here.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Any ideas?
Can you show want the basic error looks like and not the full trace? Full trace is good to have but I just want to know the basics of what we’re looking at
That's just it. I'm not using a full trace.
Want my Cargo.toml?
Yeah, also Are you trying to build to wgpu?
no
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Note, it only seems to happen when I uncomment bevy_gltf_components
you're mixing bevy versions, and all of those * versions are suspect tbh.
What makes you think this problem is coming from the components workflow
^^^ actually what they said is best place to start
current github release of blender/bevy/etc is 0.13 but a lot of the other deps are 0.14 in the cargo.toml
I have bevy version 0.14 specified, and the "*" have been mostly recently added as I try and debug the issue. I've been ensuring each crate that I don't uncomment is 0.14. Also the latest commit on the github does say it's using bevy 0.14.
the latest commit on github does, but you said you were using the latest github release, which doesn't
does the "git" option only use the latest release, and not the latest commit?
also the latest commit on github does not use 0.14 -- https://github.com/kaosat-dev/Blender_bevy_components_workflow/blob/06403153c310cf9343ac22813d11e5394d32a486/crates/bevy_gltf_components/Cargo.toml#L22
Huh, I might be getting it confused. I thought the 0.14 version got pushed to the main branch already.
gimmie a sec to test something
https://github.com/kaosat-dev/Blender_bevy_components_workflow/pull/195 is the 0.14 afaict
not yet
Yeah, it was the branch. I must have got mixed up somewhere about the status.
thanks
Soooo, it is all much more annoying than I thought:
- "old" individual crates etc are ready for V0.14 (not yet on main or on crates.io , see why below)
- the assets however are not which causes some of the examples to crash
- Would anybody be mad at me if I do not update all assets as this is only a stop gap until Blenvy alpha is released ? It is tedious (god I love the relative simplicity of Blenvy for pretty much everything)
I think if you’re doing a major architectural change there’s no point in updating the examples for an architecture that won’t be used
- rotten cherry on top: Blender 4.2 completely breaks how add-on installation works, so while I was able to test Blenvy on it thanks to dev tools, I would need to overhaul some parts of the old add-ons to work on Blender 4.2 😢
oh is that related to that new extensions stuff
yes 🙂
I would honestly rather spend the time & energy on Blenvy, as this is yet another thing I have to juggle with
I would absolutely be ok with you cutting anything you need to cut, personally
solo maintenance is no joke, and I'm definitely not about to tell you you have to do extra work 😆
put it simply, rather spend the time having one working new add-on /extension rather than juggling with multiple versions of multiple tools in multiple languages with incompatibilities 😄
Way I see it is the old workflow is becoming legacy. You’re making major changes to the work flow that just aren’t compatible with the old way. I think that’s ultimately going to be a good thing. And I don’t think it makes sense to maintain an old version when you aren’t supporting like 100,000 devs who have projects they’ve been working on for years.
Music to my ears 😄 This is a rather painfull birthing process as it is 😄
On the plus side, having had to go back to the old version of workflow felt horrible, like nails on a chalkboard bad, compared to Blenvy so that is a good sign 😄
Sound good to me ! 🙂 Since the v0.14 compatible version of the old tooling will be on main and have a commit + release, anybody that REALLY wants to fix those things can and I can always release a patch or two. (but would rather not if I can help it 😄 )
Btw, for anybody trying out Blenvy in Blender 4.2 in the next few days (NO , the alpha is not out yet :D), so you do not get as confused as I did : you can just drag & drop the add-on zip file onto blender to install it
oh that's not so bad at all
That’s wild, I like it
As always with Blender, was well hidden 3 levels down in the documentation 😄
Definitely, I'd do the same.
Would somebody kindly be willing to take a quick look at the PR for last release of the "old" crates (https://github.com/kaosat-dev/Blender_bevy_components_workflow/pull/195) to see If I haven't forgotten something / made a major mistake somewhere (Mostly the README / cargo files) befor I publish to crates.io ? exhausted , can't think straight, so mistakes sneak in 😉
all the version bumps look right to me
I saw one commented out piece of code that looked like it could go either way as I was scanning down
readme links to blenvy are dead, but I assume you know that and its because the repo is private
Much appreciated ! Thanks !
Btw, the links are dead because I will rename the current repo to Blenvy once the legacy crates & tools have released 😉
So some good news !
- the Bevy 0.14 versions of all legacy crates have been released as well as a patch for the legacy Blender add-ons !
- repo has been renamed to
Blenvy - release of Blenvy alpha is tomorrow, after some docs & cleanup work 🙂
HYPE HYPE HYPE!!! I know what I’m doing tomorrow after work XD
I honestly hope it will be more of a pleasant experience than a bug ridden nightmare (yes, I am completely stressed out) because ...well, still alpha, lots of minor things to iron out
This part in particular might be divisive, as Blenvy is more opionated than the previous tooling : the various folders !
By default, it expects you to separate your art/sources (blendfiles), from your assets (what you actually deliver with Bevy)
I was really happy with the 0.13 workflow, and I’m really excited to see what the new alpha has in store. Despite the likely bugs I’m still really hyped to get running with the new workflow. I think you need to give yourself credit for all this amazing work so far. I am more interested in this project than any other bevy project, and im sure im not the only one. You deserve a little celebration after the release!
Makes sense to me. The only reason I currently have them at the same place is that it’s fewer clicks to export 😄
honestly in the projects I'm using blend files in I already have my blender files and art sources separate from my assets folder
so no problem here 😆
xD
i got a wgpu error too with bevy 0.14, it was from gta5 (rockstar's) vulkan stuff and to fix it i had to delete some of its stuff from regedit
btw i figured out my issue from yesterday, the scene wasn't spawning because i didn't use SpawnBlueprint component 🤦♂️
you should also rename this thread
@glass abyss , honestly, sorry to be a bit harsh, but I already said a few times that Blenvy is NOT released ! This is honnestly not helping
i'm sorry, i just thought it was funny and pointed it out, i don't really care if it stays in or not
and i don't mind if there's any bugs either, i prefer to have the new blenvy with bugs than not have it at all
That would be @simple arrow 🙂
I think this is less "this is bad" and more "this made me smile" 🙂
(At least I think it’s funny and definitely the kind of debug message I put in my own stuff, haha)
(Although mine probably contain more swear words 😄)
exactly
Sorry if I overreacted , I usually like to release things in a clean state, and not have this mess of debug messages in there
There might still be a number of those in there 😄
its alright :D
I am doing my best to get the alpha out before the Jam, and I am stressed out like mad (I am stressed out like mad for IRL stuff too, so I just add to the pile :D)
Yes, please @simple arrow , could you rename this group (?) to Blenvy ? 🙂
I have already found my peace with the fact that I won’t be able to use Blenvy for the jam. It’s probably not worth it to try to get an alpha out in time since a jam is so time constrained that the tools involved should be familiar to you and reliable. Since the rework, by definition no one is familiar with it yet and an alpha is probably not bug-free enough to not cause significant time loss.
My advice to you is to ignore the jam timeline for now
Blenvy
Since I need to work on the docs & disliked scrolling to find the settings for common/components/export, they are now tabbed as well !
Very pleased about the new name: much more memorable 🙂
As always, you are spot on 🙂
A lot of Blenvy is "no configuration needed"/ sane defaults but as with any tool there is still a learning curve.
I will get the basic docs ready today, and release alpha1 in the current state, (with a huge disclaimer somewhere :D) then everybody can decided if they want to take a stab or not.
But you are right, will not stress out too much. Thanks Jan
Thanks Alice 🙂 and thanks for changing the group name so fast !
want to voice my agreement with this as well. I would rather you got some sleep or got whatever rest you needed instead of pushing to ship before the jam and adding unnecessary stress.
Tossing my encouragement onto the pile, you're project is great and offers a wonderful pipeline to bevy devs, def get some rest and people will test/use the crate when it's ready!
@ebon zealot would GLTF / Blender allow you to place a component on a bone?
Honestly I don't know: you can take a look at the gltf spec for the gltf side https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html
For Blender I will take a look
I think the spec just targets generic nodes as bones, and these can have extras, so that should be okay from that side
The reason I ask is that often you'll want to designate special attachment bones in your armature, e.g. an attachment bone for the camera, another for where a weapon goes, etc.
Currently, I just give these a special name and then search them on spawn in the hierarchy to add my tag component, but it would of course be nicer to have the component directly there
Not a blocker or anything 🙂
Good use case ! I just tested it, and bone custom properties are exported as custom properties to gltf !
Woah that's nice!
I honestly didn't expect Blender to support that 😅
I noticed after doing the PR for the additional Gltf***Extras that I was not complete in my additions, so this might need another PR at the Bevy level
Hahaha me neither to be honest, Blender keeps getting better (despite the horrible api / internals sometimes)
I think we should test it first: I don't have time right now, but a very basic Bevy project loading a gltf with custom properties on a bone should tell us if we indeed need yet another specific gltf extra
(ie , they might already be exported as the basic / node level gltf extras if we are lucky)
I can check it next week when I'm testing Blenvy anyways 👍
is there an official Blenvy team for the jam?
Gonna be hard when there is no stable Blenvy yet 😄
I accept
I... volunteer as tribute?
(all my game jam participation thus far has been 100% experimental)
Sooo, still working on docs, cleanups & co, and while trying out some "from scratch" projects using Blenvy, I think I might have under-evaluated the state of the project.
Yes, there are some bugs for some rare cases, and there are a few missing features, things are working much better than I feared
Also: would anybody have an issue if automatic aabb calculation for blueprint instances would always be turned on ?
Aabbs have always been cached anyway, and worse case, I could always pre-compute it on the Blender side.
Because if I remove that setting, there would be no settings left to set 😄
Which would mean:
- on the Blender side : you would only need to tell Blenvy what your level & library scenes are (everything else has defaults that are good enough that I do not touch them most of the time)
- on the Bevy side no settings at all , just add the plugin, spawn your levels & done !
Unfortunately the only input I can give is that I haven’t needed to work with aabb’s before. Sorry that’s not helpful
not a problem 🙂 (btw I saw your previous message before you deleted it , but I'll just say I haven't seen it 😉
Is there a reason why I wouldn’t want AABBs? Doesn’t the rendering pipeline compute them anyways?
Sooo you’re saying I can do a 3D game for the jam after all? 😄
I don't know if it is still the case, but in v0.13, & v0.12 only some were computed, and I personally often needed to have the aabb of parent entities/full scenes (for some shader effects like vertex animation )
Updating my Blender right now, gonna try to get Blenvy working now 💪
I would say, use at your own risk, but unless I missed a huge, glaring issue, then it is "so crazy it might just work" 😄
Jokes aside , I am fixing some things currently & adding more docs, but I'll have something better in around 1 hour
I'll try to get a very simple 3D scene with colliders going in the meantime, nothing crazy
I'll be honest, I have not tried it together with Avian for now, but hey, if other components work ?
I really want to have Avian integration behind a feature flag for the final release
What’s avian ?
I think it should work fine out of the box. I designed the ColliderConstructor intentionally such that it should work without Blenvy knowing anything about Avian
The next evolution of bevy_xpbd
@ebon zealot mind uploading a zip of the current Blenvy addon?
Otherwise I can build it myself, no problem
And yes, I know there may be bugs, I'm prepared 😉
Sure Uploading it here or ?
Should be good as long as automod is not too angry 😄
Worse case, I do a pre-release on Github (if it works from non main branches ?), can always remove later
Is there any issue I'm likely to encounter that I should not report because it's already known?
Or something like "don't report anything related to hierarchies, I'm fixing that code right now"
Off the top of my head
- save & load feature has not been upgraded yet
- I broke some examples (but honestly , they are not even needed most of the time)
- take a look at the TODO.md file and scream at the number of unchecked check-boxes (anything unchecked is not done)
- scene renaming in Blender + change detection is not great as it will consider renames to be new scenes
- there is wonkyness in hot reload
Give me 10-15 mins before trying out , I have a lot of cleanups & fixes done, just need a bit
perfect, that is exactly the list I wanted 🙂
Sure, no stress, feel free to tell me to bugger off until tomorrow if you want as well 😄
Oh and do not use it on an existing / important blend file yet
nah not stressing out, they are done, and was planning to push before bed
Got it, working on a fresh project
fresh blends only ™️
ahh forgot two :
- since I cannot disable physics on currently spawning blueprint instances, there might be some weirdness
- hot reloading assets other than gltf is not yet done
Took a look at the TODO.md file. Pretty sure that if I run Blenvy without hot reloading I should be good, all those unimplemented things don't seem relevant for simple testing 🙂
I cannot disable physics on currently spawning blueprint instances what does that mean?
Oh, I remember
No RigidbodyDisabled exists
Hot reloading works fine for a lot of cases (and its like a drug 😄 )
Exactly !
Yeah I'll count any bugs from that as Jondolf's fault 😛
I'm doing the jam with him, so if he runs into enough problems with it, he will have an incentive to just implement it right away, hehe
@ebon zealot do you want feedback on the docs already or would that just stress you out?
Bevy side of docs are still a mess , give it a few days please 😉
Oh not the code docs, but the setup stuff at https://github.com/kaosat-dev/Blenvy/tree/blenvy/crates/blenvy
But yeah, I'll wait then 👍
That is also a part of the changes I'll push in a few minutes 😉 Corrected setup etc
I'll ping you once I pushed & put the zip up
😄 very good strategy
thanks!
Preparing my new Blender file in the meantime. Naming things _components is no longer needed, right?
nope 🙂
The Blender docs & the migration guide have infos on this & other changes 🙂
changes pushed, zip uploaded, if you run into issues with even a basic setup, please let me know
awesome!
perfect opportunity to stop trying to figure out tnua animations and try something else 😆
Can't activate the addon unfortunately :/
is that in Blender v4.2 ?
seems to be working for me in 4.0
Normally no, just a sec let me check with a fresh Blender
Yeah they changed the whole addon process in 4.2
But now there is finally an addon marketplace: https://extensions.blender.org/
I have updated Blenvy to use the new manifest format a few days ago, and have been using 4.2 with Blenvy withouth issues, but I have a suspission, let me check
I have time 🙂
ok , I think I know a workaround: can you try deleting the blender_manifest.toml file from your zip file & try to install it again ?
I updated the zip file in the pre-release to remove the manifest, but oh boy, that means some of the weird (and unclear) requirements for the new extensions (specifically "only relative imports", I suspect), might be breaking things
Btw à propos animations, and also for @dawn shell I just pushed an update to the Blenvy(crate) readme with information about blueprint & instance animation if you need it 🙂
Thanks! Not gonna touch animation for a while, but I'll get back to it
some ui missing in 4.0 I think. gonna upgrade to 4.2
unless I've done something wrong which is very possible
Hmm very weird, normally you cannot do much wrong, I have not tested 4.0 (or used it in a long time), 4.1 is a sure bet, 4.2 with the updated zip should work too
thread 'main' panicked at C:\Users\conta\.cargo\git\checkouts\blenvy-b36e3bfafcd31d12\09d1218\crates\blenvy\src\components\ronstring_to_reflect_component.rs:76:17:
failed to deserialize component BlueprintInfo with value: String("(name: \"ColliderCube\", path: \"blueprints\\ColliderCube.glb\")")
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library\std\src\panicking.rs:665
1: core::panicking::panic_fmt
at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e/library\core\src\panicking.rs:74
2: blenvy::components::ronstring_to_reflect_component::ronstring_to_reflect_component
at C:\Users\conta\.cargo\git\checkouts\blenvy-b36e3bfafcd31d12\09d1218\crates\blenvy\src\components\ronstring_to_reflect_component.rs:26
3: blenvy::components::process_gltfs::add_components_from_gltf_extras
at C:\Users\conta\.cargo\git\checkouts\blenvy-b36e3bfafcd31d12\09d1218\crates\blenvy\src\components\process_gltfs.rs:78
4: core::ops::function::FnMut::call_mut
at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e\library\core\src\ops\function.rs:166
5: core::ops::function::impls::impl$3::call_mut
at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e\library\core\src\ops\function.rs:294
6: bevy_ecs::system::exclusive_function_system::impl$2::run::call_inner
at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\system\exclusive_function_system.rs:218
7: bevy_ecs::system::exclusive_function_system::impl$2::run
at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\system\exclusive_function_system.rs:221
8: bevy_ecs::system::exclusive_function_system::impl$1::run::closure$0
at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\system\exclusive_function_system.rs:111
9: bevy_ecs::world::World::last_change_tick_scope
at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\world\mod.rs:2215
10: bevy_ecs::system::exclusive_function_system::impl$1::run<void (*)(),void (*)(ref_mut$<bevy_ecs::world::World>)>
at C:\Users\conta\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\system\exclusive_function_system.rs:103
11: core::hint::black_box
at /rustc/5affbb17153bc69a9d5d8d2faa4e399a014a211e\library\core\src\hint.rs:389
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `blenvy::components::process_gltfs::add_components_from_gltf_extras`!
2024-07-21T00:23:05.235592Z INFO blenvy::blueprints::spawn_from_blueprints: Done spawning blueprint scene for entity named Some("World") (track root: None)
2024-07-21T00:23:05.236528Z INFO blenvy::blueprints::spawn_from_blueprints: Cleaning up spawned scene Some("World")
2024-07-21T00:23:05.237802Z INFO blenvy::blueprints::aabb: generating aabb for "World"
2024-07-21T00:23:05.238021Z INFO blenvy::blueprints::spawn_from_blueprints: Finalizing blueprint instance Some("World")
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
error: process didn't exit successfully: `target\debug\bike-game.exe` (exit code: 101)
Is that something known?
ColliderCube is just an empty
(Screenshot of my Library)
That is a weird one, does it work if you do not use an empty ?
Just tried the same case with a blueprint that only contains an empty, but did not get any issues
oooooh dang
I see you are using windows
could it be a path issue ?
I know, I'm comitting a beginner mistake 😄
hahaha 😄 that is not what I meant, (but it is a good one ! )
I'll try again when I'm done compiling. Added avian3d to my dependencies and now I get to recompile a bunch.
Ok i'm off for tonight but just to be sure:
- how do you spawn your blueprint instance ? Dynamic or part of of a world ?
- does spawning your level without that specifc blueprint instance work ?
- Part of the world
- I'll try after compilation is done
good night, I'll report what I find later 👍
(4.2 is working so far)
have a good night! thanks for the prelease 🙂
yeah thanks a bunch @ebon zealot ❤️
hmmm , might really be a pathing issue (although I thought Windows also accepted linux type path seperators, but haven't used Windows in ages)
You are all welcome 🙂 Thanks for taking it for a spin !
Yeah that was pretty much my setup
blueprint spawning 😄
Update: spawning just the world without any blueprints works, but as soon as the world contains a blueprint, I get that error. Note that the blueprints don't contain any components yet
This is my branch in case you want to try for yourself: https://github.com/Bevy-Jam-5/bike-game/tree/setup-blenvy-avian
Addendum: When loading a world without any blueprints, it does not crash the game, but I do get the following:
2024-07-21T01:28:55.532374Z ERROR bevy_asset::server: Failed to load asset 'materials\bike_game_materials.glb' with asset loader 'bevy_gltf::loader::GltfLoader': invalid glTF file: missing field `nodes` at line 1 column 122
I'm seeing the same for materials glb for levels
gltf looks like this
{
"asset": {
"generator": "Khronos glTF Blender I/O v4.2.57",
"version": "2.0"
},
"scene": 0,
"scenes": [
{
"name": "__materials_scene"
}
]
}
That’s not the entire gltf is it? What’s contained in it?
that's the whole thing
Just to confirm this is an export of an empty scene in blender you titled __material_scene with no default cube or lights or camera?
this is the <scene_name>_materials.glb file that is automatically created if you have a level.
I don't believe it is supposed to have nodes, because its only for material references or something like that
the python script looks like it might generate fake cubes that should live in that file
If you’re expecting an empty file this is the gltf you’re expecting. If you’re expecting material data you expect to see at least a material key. Not sure on the spec but gltf might also require a mesh key and node key which would be the reason for the “fake cubes”
I think you think that I have an empty scene I'm trying to export. I do not
this is a fake glb file created by blenvy to house material data
That’s was my question
That is a bug 🙂 When there are no materials it should not export the materials file . (For coherence I hoped empty gltf files are valid but that is not the case)
Exactly this
there's an error at the end but I'm not sure its relevant yet
oh I think that's just swapping the names for the export, not relevant
Btw there was a discussion in the gltf ranks a while back about having special gltf files for materials only but it never landed, so I turned it into "one Cube per material " idea Also practical for debugging 😁
oh that's interesting historical info
Thanks but it won't be needed, I just need to "filter out" the creation of material files when there are no materials around
oh it happens with materials too
Wait , an empty materials file despite having materials?
I originally had a checkerboard texture on a material for a plane in the level and was seeing the issue
I'll reconfirm
yeah plane still has a material actually
Ok that is weirder. The plane is part of either a level or a blueprint I assume?
I think that shows all the info. Scene is a level, there's a material on the Plane. This is Scene in the tree
I think the cube never gets added for some reason in the python make_cube. I tried using the function by itself in the scripting tab. I got as far as finding this function which successfully made a cube, but I don't know how to recover the reference to it that make_cube returns.
bpy.ops.mesh.primitive_cube_add(location=([0,0,0]))
heading to bed for the night though. 👋
It works correctly as far as I have seen , will take a closer look later
Gnight, thanks for taking it for a spin😁
I'll try running the same thing on Linux later to see if it is a Windows pathing issue
Thanks ! I have an idea how to test things beforehand on windows: if you change the gltf settings to .gltf + bin instead of .glb you should be able to edit the path manually
Also I wonder if switching the path field in the blueprintInfo to a pathbuf might allow to solve this on the Bevy side (my brain Is mush, so I might be off)
@dawn shell I am able to reproduce the issue if I force the paths to be windows-like , so it is a problem with windows paths + double backslashes
So is that an issue with how the paths are stored inside the .glb?
Or how the Bevy side tries to read them?
Asking because I can try patching it myself and then submit a PR
Update: yeah, running this from Linux reveals that the GLBs contain a mix of / and \
The problem comes from how the path ends up getting formatted by format!() Ie the double backslashes provided by path joining on the Blender side end up being a single one, on the Bevy side, which breaks the formatting.
No access to the PC right now , will try to solve this evening. But if you have time to take a stab at it @dawn shell please do 👍
Is it possible to check if it’s running on Linux or windows, and then format the bath based on that?
Pretty sure the glb should have only / always
It is already using the correct libs to format paths (os.path.join in Python for ex) the problem seems to be with escaping
But that is not against the platform specific path formatting rules ?
Hmm? What do you mean?
Slashes for Linux, backslashes for windows
Then again, if slashes work on windows as well...
Ah, got you. GLB is a data interchange format, so it would be very strange imo if the OS I ran Blender on had an influence. If I share my GLB with a user running Linux, it’s weird that they have backslashes.
For cases like these, usually all frontslashes are used and the application can still use backslashes for looking up the files later
Agreed. In that case I can just either override the platform for os.path.join or "manually" join the paths to always use slashes
As an example, the Bevy asset server expects only forward slashes
In the end, Bevy ends up doing the lookup for the correct path
Even on windows?
Manually using forward slashes seems easiest
At least in 0.13, the asset server would not find your assets if you used backslashes in your path on Windows
Sorry I am kind of laughing internally, this is one of the first times using slashes manually is the right choice 😁
Hehehe
I will patch this later tonight
It makes sense for the asset server. Imagine if I had a string literal that said "foo\bar" and gave you the code to compile it on Linux.
If you tell me how I build my own zip for the addon, I can try patching it myself and submit a PR
Do I just execute that magic python file that’s laying around?
Update: I'm really struggling to find the right place in the Python code :/
Update 2: Alright, I've added a really ugly hack to my fork and now I can run the scene in Bevy! Hurray!
However, adding ColliderConstructor from avian to a mesh in Blenvy results in this. Any clue?
Update: I've reloaded the registry and it works fine now 🙂
Such a joy to see all the colliders!
you can use internal_generate_release_zips.py in tools/Blenvy or, you can just zip the whole Blenvy folder in tools (the script is literally just zips the folder, and cleans up a few un-needed files, but for local development a bigger zip file is no issue)
understandable !
Avian colliders are working perfectly!
@hollow dove this explanation is relevant for you as well
As long as it works 🙂
I'll go over all path generation over on the Blender side & replace the path joining
I'm using an empty ColliderCube with a ColliderConstructor and display it as a cube
Then, I use a collection instance of that empty as a child of an object that needs a collider. The parent in this case is holding a RigidBody.
Since the ColliderCube is setup as a 1x1x1 collider, I can scale and rotate it however I want and I get this nice visualization:
When running this on the Bevy side, avian correctly applies all transforms and the effective collider looks the same as my Blender preview 🙂
re: my own materials issue from yesterday. I had a level and a blueprint in separate scenes. It seems that my blueprint needed a material, but only once I introduced a level. The blueprints alone worked by themselves before the level was introduced
Ok, that is really awesome ! Very nice solution with the currently available tooling ! Well done ! 🙂
(Also I might steal some of those ideas at some point 😄 )
A very very rudimentary "Avian support" for Blenvy could be to just have a menu for adding an empty with a ColliderConstructor and the correct visuals
Too bad Blender does not have "capsule" empties ! I vaguely recall there being a very well hidden way of creating custom "gizmos", will look into it down the line
Yeah it's weird. Bones can have arbitrary meshes, but somehow empties are stuck with a couple of default ones
live reload on a new scene
See https://github.com/waylow/boneWidget for an awesome plugin for bone widgets
heck yeah!
I'm still seeing the nodes field missing, but the new .blend's levels load now. As long as I don't use built-in textures or whatnot the shading seems to work
Materials handling needs a biiig cleanup, should solve that issue & a few others, will ping you once it is ready (just to be clear, not tonight, likely this week )
totally. (and again, no rush on doing any work or fixing anything. just sharing my progress)
What do you mean by nodes field ?
2024-07-21T20:26:58.717998Z ERROR bevy_asset::server: Failed to load asset 'materials/test_scenes_materials.glb' with asset loader 'bevy_gltf::loader::GltfLoader': invalid glTF file: missing field `nodes` at line 1 column 122
no worries, I made my peace with the slow but steady release for Blenvy 🙂 but thanks !
ahh ok !
btw, have you tried just turning the export materials library feature off for now, it means no deduping of materials (and mostly , textures!!) if multiple blueprints share the same ones (so perf impact), but less issues
yeah I did in my last blend file. I'll try it in this new one.
doesn't seem to make a difference in the error showing up
I wiped out all the produced assets and re-generated them too
Ok, that is weirder, but it narrows it down !
@ebon zealot you probably want to hide "bevy/file_watcher" behind a feature flag called "file_watcher", as it breaks on Wasm builds
(no rush, I'm patching that on my fork so I can continue working)
Unrelated: looking for naming advice for the following:
- each level and blueprint has a
BlueprintAssetscomponent that stores the direct assets (any manually added assets + its children blueprints ) NOT any deeply nested assets- this is needed for example for hot reload etc as you only care about asset changes that affect the immediate parent
- I need a good name for this: I need to also store (separately as otherwise, the day Blueprint assets can be defined manually by users in git-able files, it would be a mess), the whole tree of assets & sub assets: you need this for example to preload ALL the assets of levels , dynamic blueprints etc : I
Wait, I thought that using asset_server.watching_for_changes() & creating a resource for it (just like in your YarnSpinner crate), would account for these types of scenarios ?
Just activating the feature causes a compile error
You'll notice that in my Yarn Spinner Cargo.toml, I don't activate the feature
Instead, I leave it up to the user to activate it
hmm sorry still confused, should asset_server.watching_for_changes() not be simply false ?
Yes, but it won't even compile
sec
Here's your offending line: https://github.com/kaosat-dev/Blenvy/blob/blenvy/crates/blenvy/Cargo.toml#L17
doh''' just checked Blenvys cargo.toml
Simply remove file_watcher from there and you're good 😉
forgot to remove it after testing 😄
I assumed you had a very good reason to depend on that feature, that's why I suggested adding a feature in Blenvy. In this case, disregard my prior advice and just remove the dependency on bevy/file_watcher 🙂
nah', should be up to the users 🙂
Btw, I know it is still fresh but how does (bugs aside) Blenvy "feel" so far @dawn shell & @round cove ? (subjective, I know)
love it. absolutely wonderful addition to the ecosystem.
I'm just very happy ColliderConstructor works 😄
It's lovely
ColliderConstructor has been great too
I like that it's just one crate and addon
Plus, you were right: everything has very nice defaults out of the box
yeah single vs the old multiple makes it much less confusing, especially with the "Blueprint", etc terminology
@ebon zealot exporting types will also not work on Wasm. Is there already an option to disable this or should I patch it for now?
dang, how would the user be able to use the Blender ui at all in that case ?
run it in non wasm mode first ?
Yep
At least, that's how it worked with the old workflow
wasm is a target, so we should be able to detect it right ?
was tempted to say it should only be dependent on the target, but for release build you would want to disable it as well
Probably 😄
I think for an initial release it's fine to just expose the setting to the user imo
Sure, you can be smart about it and do it automatically, but that's easy to implement at a later stage
BTW, I know android is rather restrictive in what it allows on the file system, so maybe you'd need to deactivate it there as well.
That way, at least I could just do export_registry = cfg!(feature = "dev_native") for now.
oh cool ! good stop gap !
So, for the record, my fork contains hacks for the following things currently:
- Windows pathing landing up in GLTFs. Ideally GLTFs should be completely OS agnostic.
- Remove feature
bevy/file_watcher - Disable
app.add_systems(Startup, export_types);conditionally.
But I'm supremely happy with how well Blenvy is working in general 🎉
ok folks, so I just did an update: (the Blenvy add-on zip has also been regenerated)
Bevy crate:
- removed file_watcher feature, should be user settable
- added root blueprintInfo path to the list of assets to watch for hot reload (fixes issues of scene level changes not being seen )
- removed settable aabb calculation: they will now always be done
- added "export_registry" setting to be able to disable registry export for wasm & co (automate later)
- cleanups
Blender add-on:
- changed the paths generation for BlueprintInfos (amongst other things), it should hopefully fix the spawning issues on windows @dawn shell
- restructured & improved materials export: now uses same logic as blueprints, with separate determining of
what materials changed & the export itself, I do not think it will solve all issues but at least some of them
😄 pretty much all of those things should now be solved (hopefully)
Great! I'll check it right now.
Thanks for the very precious feedback ! It really helps a lot for solving issues I would have completely missed otherwise !
My pleasure 🙂
try removing & re-installing, it did that once for me too
Dang, no , same issue
Works from the dev environment ??
uninstalled it, now back to this 😄
removing the toml now
Aaand the addon works now 🎉
ahhhhhh that one again
I'll rename it, commit it so It does not skip my brain again
But I get this on save
ok , these issues are very annoying, as they did not show up while testing
Wait a sec
Maybe it's easier if you take a look at our simple setup yourself
Let me know if there's anything I can do to help testing
Are you perhaps not using change detection ?
I don't know 👀
everything is at default
ok, one last attempt to fix, then I am off, will take a look at your project tomorrow
yep, there it is
No problem, I can easily work with the previous addon version as I got my magic silver bullet
Fix is out, zip is updated, and if still fails, will have to take a look tomorrow 🙂
newest zip is working just as well for me
Everything is still working 🎉
@ebon zealot next Wasm error
It's here:
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
Yep, that looks like it's doing a regular filesystem access.
Dunno if you can instead leverage the asset server to read it with the gltf crate?
Otherwise, here is how the Bevy Wasm IO is implemented. If nothing else works, we could just replicate that method in Blenvy.
its interesting to see the hash in the ui for Name
I get that objects in a scene are getting names from their in-blender names (which is great). but I'm using a pattern a bit like this for CollisionLayer definitions too.
pub struct BlenvyHelpersPlugin;
impl Plugin for BlenvyHelpersPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.register_type::<NameFromBlender>();
}
}
#[derive(Reflect, Debug, Clone)]
#[reflect(Debug, Component)]
pub struct NameFromBlender {
name: String,
}
impl Component for NameFromBlender {
const STORAGE_TYPE: StorageType = StorageType::Table;
fn register_component_hooks(
hooks: &mut ComponentHooks,
) {
hooks.on_add(
|mut world: DeferredWorld,
entity: Entity,
_id: ComponentId| {
let NameFromBlender { name } = world
.get::<NameFromBlender>(entity)
.unwrap()
.clone();
world
.commands()
.entity(entity)
.insert(Name::new(name))
.remove::<NameFromBlender>();
},
);
}
}
Its kind of a hack for component blender-ui customization
avian CollisionLayers vs custom CollisionGrouping example
Unfortunately not as far as I could tell as:
- we want to avoid using the standard gltf loader as we want to preload data in this specific case, before we use Bevy's standard gltf loader
- not sure if it is even possible to create & register a second gltf loader for preloading ?
- alternatively (we discussed it a bit here while back) storing assets outside of gltf files : likely option for long term, but it does not solve all issues, and opens a lot of other cans of worms.
- so short term stop gap seems to be to replicate how Bevy does it, which ...also feels meh
Very interesting use of hooks !
Would you also mind sharing the code for CollisionGrouping as well please ? Curious to see it all fit together
use avian3d::prelude::*;
use bevy::{
app::Plugin,
ecs::{
component::{
ComponentHooks, ComponentId, StorageType,
},
world::DeferredWorld,
},
prelude::{Component, Entity, ReflectComponent},
reflect::Reflect,
};
pub struct CollisionLayersPlugin;
impl Plugin for CollisionLayersPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.register_type::<CollisionGrouping>();
}
}
#[derive(PhysicsLayer)]
pub enum GameLayer {
Player, // Layer 0
Enemy, // Layer 1
Ground, // Layer 2
}
#[derive(Reflect, Debug)]
#[reflect(Debug, Component)]
pub enum CollisionGrouping {
Environment,
Player,
}
impl Component for CollisionGrouping {
const STORAGE_TYPE: StorageType = StorageType::Table;
fn register_component_hooks(
hooks: &mut ComponentHooks,
) {
hooks.on_add(
|mut world: DeferredWorld,
entity: Entity,
_id: ComponentId| {
let value = world
.get::<CollisionGrouping>(entity)
.unwrap();
match value {
CollisionGrouping::Environment => {
world
.commands()
.entity(entity)
.insert(CollisionLayers::new(
GameLayer::Ground,
[
GameLayer::Enemy,
GameLayer::Player,
],
))
.remove::<CollisionGrouping>();
}
CollisionGrouping::Player => {
world
.commands()
.entity(entity)
.insert(CollisionLayers::new(
GameLayer::Player,
[
GameLayer::Enemy,
GameLayer::Ground,
],
))
.remove::<CollisionGrouping>();
}
}
},
);
}
}
jeez only 4 edits to get that paste to work lmao
@ebon zealot can you help me out on this? i selected the registry.json and clicked reload registry and that popped up
i'm pretty sure its because of the double slashes but how can i fix it? in the blender file view its single slashes
it worked fine the last time i used it though
that should not be causing any issues, do you have the latest version from the Blenvy branch ?
Are you 100% sure that the registry.json file is present at that location ?
yeah, i selected the registry.json from the blender file view thing, and idk if im on the latest version let me check
yep
that was b4 u renamed the repo btw
oh wait im dumb
thats the rust crate
hold on
the blender plugin is 0.1.0
i built it on my own with python
it worked before though
actually i dont think i built it, i think it just put some files in a zip lol
after reinstalling it when i try to enable it this happens
Ok, please try to use the Blenvy.zip file from the releases here: https://github.com/kaosat-dev/Blenvy/releases/tag/blenvy_v0.1.0_pre_alpha
okay i think my blender 4.1 install is broken
and it isn't blenvys fault
i tried to install my zip again in blender 4.0 and it worked
i might aswell install the newest 4.2
Got it. Will patch it into my fork then
@round cove did you get textures working in the end?
I'm having an issue where my materials are broken if they are defined for objects in a "Library" scene and used as collection instances in the actual game world's scene. Is that expected and would someone happen to know a way to fix that?
I did not, I stopped looking into it and focused on other things after @ebon zealot said they were looking at doing a decent refactor of that system over the next few days so as to not overlap.
I forget the wording they used exactly but it seemed like "materials needed a rework. it'll happen soonish"
Are the wrong materials applied to the wrong objects, or is it another issue ?
@round cove is the issue still present after yesterday's release btw ?
Like, if I copy the actual collection into the world scene, the material works, but if I create an instance of that collection from the library scene, it renders a white default material on the Bevy side
works (just copying the actual Player object)
doesn't work (using a collection instance from "Library")
Can I ask how you’re spawning the scene, are you using “path/scene.gltf#Scene0”
spawning an entity with BlueprintInfo::from_path("levels/World.glb"),
which is the same as the examples in the repo
Unfortunately I don’t have a solution
ok , I see the issue
this means that the actual material is not being injected.
Do you have an error / warning message when spawning ?
not that I can see
This is not recommended btw, the examples in the repo BlueprintInfo should be used instead, as there is a lot of boilerplate behind the scenes
ok, that is weirder, are the material files generated correctly ?
You can drag & drop a material gltf file into any gltf viewer and you should have all your materials/colors visible as little cubes
I was curious about what path they used, if they were trying to grab the mesh directly, bevy will add the default material to it
I can have both versions at the same time, the one that works and the one that doesn't work, both using the same material. Only one of them gets the material on the Bevy side
just some cuboids here, the left one is the object manually copied into "World", and the other one is using a collection instance
both have the same material on the Blender side
Work around (ugly work around) if you know the name of the material you can rip it directly from the file and apply it manually (again very ugly)
ah ok, my bad 🙂
That is essentially what Blenvy does, as there is no nicer way currently 😄
Ok, that seems to point towards missing materials or bad linking of blueprints to materials: could you please check the materials files to see if your material is in there ? (you can just use https://gltf-viewer.donmccurdy.com/)
It has two materials, but not the ones that show up in Bevy 🤔
I don’t know another way to do it, when I say ugly I just mean that would be cumbersome to deal with on the user dev side, but in the back end (your code) it makes perfect sense
o_O that is even weirder, the process to export the materials is really just iterating over the list of materials in use and exporting them.
Sorry, two more questions:
- if you delete the material files & let Blenvy regenerate them, are the materials still wrong ?
- are you using the latest version of the blender add-on (I uploaded it last night) ?
There is an issue on the Bevy repo for this , but I think nobody found a nicer solution yet (I had some ideas, never had time to test it :))
Can’t promise I’ll figure it out but I’ll take a look when I get home in a couple hours
at the moment I'm seeing the blueprints and materials not being exported, so the error from the bevy crate is currently "Path not found" for materials.glb. so I might try with a clean .blend and see if it changes.
should your "level" scene also be a "library" scene?
yeah, looks like the materials export is crashing for some reason: https://gist.github.com/ChristopherBiscardi/760cba65ee50dd6df3a32af47bb1d7bd
- It's not generating any material files for some reason anymore (but one of the materials is still being rendered in Bevy)
- Yes, assuming you mean latest main? I didn't see a new release of the Blender addon
I sent @hollow dove the newest addon, yeah
Getting this when copy-pasting a ColliderConstructor component FYI. The component got pasted, just with all values set to 0.0
i get this when i try to run my bevy app outside of the root dir, or without cargo, how can i fix it?
run it in the root dir or with cargo 😆
release build
oh you mean if you do a release build. Then you should disable the registry writeout option in the plugin for your release build
how?
I forget what the option is but you should be able to autocomplete the BlenvyPlugin fields to see it
for a first try just turn the option to false and let the others be default, then see if that fixes your release build issue
it worked, thanks
BlenvyPlugin {
export_registry: false,
..default()
}
yeah, i did that but i added cfg not debug_assertions above export_registry line
alternative:
BlenvyPlugin {
export_registry: cfg!(debug_assertions),
..default()
}
finally home. i havent actually gotten a chance to look at the update yet. am i pulling from the main branch or the blenvy brancy?
blenvy branch
and the zip from the pre/alpha github release
thank you ✨
You generally don't need a clean blend for Blenvy settings 🙂
- materials not being exported is really weird (even more so as I cannot reproduce this at all), is the
export materials libraryoption still toggled on the Blender side ?
I've tested with it on and off (since I turned it off yesterday)
level scenes are mutually exclusive with library scenes, you cannot have a scene that is both (normally the UI does not allow you to have a scene that is both, unless there is a bug there)
Thanks for the feedback ! This issue with materials not being generated seems to be present for multiple users, I am digging into it
interesting is that a reproducible error ?
let me try
yep
this is the copied component
And this is the pasted component
accompanied by this
Just checked the custom properties and they're off
{"avian3d::dynamics::rigid_body::RigidBody": "Static", "avian3d::collision::collider::constructor::ColliderConstructor": "Sphere(radius: 0.0)"}
ok, thanks ! Is that the only component so far you have had issues with copy pasting ?
Only tried rigid body otherwise and that seems to work
Although when I copy-paste RigidBody::Static onto an object with RigidBody::Dynamic, it does not seem to overwrite the component with the new Static
Ok, for future tests, please leave it always on (I am already on the fence about removing the option altogether IF it works reliably)
will do 👍
ok, and are they both objects or is one an object and another a collection or something else ?
Let me check
Btw for all the bugs for the alpha, I will add a specific tag on github, so that the issues can be reported there too 😉
Can't reproduce it 😄
That was with the "old" Blenvy addon though, so it's possible you fixed it already
BTW if you need a reproducible example for the material thing, see https://github.com/Bevy-Jam-5/bike-game/tree/main/art
All of these colors show up as white on the Bevy side
Let me know if there's anything I can test to help out
Ok , that gets even weirder, since I tried it out yesterday and did not run into the issue 😄
Pulling it again
Huh, weird. We are on Blender 4.2, but that should not matter.
I'll patch this on my fork now in the meantime
Ok, that is a bit worrisome as it is an error in Blender's gltf exporter itself (not fun to debug :D) . I will try to change the "materials cube" generation to see if it changes anything (but weird, as the cube generation is extremely basic)
I really would love to hear how you want to patch it: I still want a clean solution for the pre-loading so I am open to suggestions
yeah I'm planning to dig into the python and build my own zip to test what's happening later, so if I figure anything out I'll say something too
Good idea, even if you can witness even more of the insane workarounds I had to add & my messier code on the Blender side 😄 You are on btw 4.2 right ? (4.1 had some very nasty bugs in the gltf exporter)
I am 4.2, yes.
I'll first try to see if I can get an own asset loader for the gltf going somehow. If that does not work, I'll need to replicate the Wasm code from Bevy :/
@ebon zealot why are you using RawGltf over Bevy's Gltf in the first place? Do you need access to some internals that are not exposed?
I need to access the raw values of the gltf extras, without triggering any of Bevy's gltf processing, as this is done only to get access to the list of assets to preload them before Bevy does its thing 🙂
Ah, I see
It is a sub-optimal solution (because it means gltfs are parsed twice) for extracting the assets lists from gltf files without the clutter.
Sort of like extracting metadata from a file header
I think this PR should enable us to use our own AssetLoader for Gltf, which would do stuff with the gltf crate
Ahhh I was looking for that one !!!
That would theoretically enable a micro parser that would just extract the gltf extras
Oh, you're right. Good idea!
A part of me thinks that even this is not the perfect solution :
I still think a user editable text format for assets might be better. Unfortunately, all the possible solutions I came up with have one major flaw: there should be a clear distinction between
- what assets a user defines (text format: good)
- "generated" assets: the list of blueprints to pre-load, any deeply nested assets etc (user editable text format: not so great)
Then again... perhaps with the "extras parser" the problem could be partially resolved by having both embedded asset lists (the generated ones) and user defined ones
But is that not too complicated ?
While I'm editing away, I just noticed this. You might want to slap a #[non_exhaustive] on these kinds of structs 😉
I don't really know how a user defined asset in a text format would look like. Would I define my blueprint in there?
Not for blueprints, just assets 🙂 something like the Ron files from Bevy_asset_loader
Oh, I remember now!
I think I have very few thoughts on that. I'd probably have to see it in action. I can imagine that a handwritten text (or BSN) file would be a really good match and I can imagine that would be very confusing. Hard to tell.
Good match and confusing sums it up pretty well 😂
Alright, I think I have a custom asset loader going!
Dunno if it works with Wasm yet, but this is at least a good step
Do you happen to know of any other raw filesystem access in Blenvy?
Update: heck, it never actually loads anything
Awesome!
FYI if you double load the Gltf, the memory cannot be deallocated in Wasm. Something to keep in mind.
Hmm no good, would that still apply if you unload your asset from the "extras loader"?
Looking awesome, even more for a quick hack!
Well, memory previously allocated can be used by other processes then, but if you load 30 MiB worth of assets when the apps starts, your app will never go under 30 MiB RAM
Now keep in mind that Wasm is still 32 bit, so it has a maximum memory usage of 4 GiB, and you quickly hit the ceiling with Gltfs
Oh, I'm dropping the handle instantly. No wonder it never loads 😄
Yeah that is not so great ! But as a stop gap better than nothing.
Yeah, it's an ecosystem problem, not a Blenvy problem
Oh dang ! Yeah that was one of the Other reasons why I used direct file system access , totally forgot 🤦♂️
It means needing another system/ flags to wait for the asset...
Then again, that would be an issue if the assets list was exported to a Ron file that needs to be loaded as well
alright, this works on native at least!
compiling for wasm takes a few years on my machine, so maybe I'll need to leave that for tomorrow
You don't happen to know of any other filesystem access, I take it?
Discord scrapped my response apparently: no there is no other filesystem access, off the top of my head (no access to the pc right now)
Update: works on local Wasm deployments, yay!
I'll report tomorrow whether itch.io is also happy with the deployment, but I see no reason it shouldn't be
link if it's happy, just to make sure it works for everyone
I think its the materials change detection code that's the issue currently
materials_to_export = list(set(bpy.data.materials))
unfortunately the checker/noise/etc textures don't work, but I'm not sure if they're meant to yet. The materials file writes out and is usable with this change though
Yes, you are spot on, there is a set of fixes for materials comming up later today 🙂
im getting a bunch or errors in "testing" and the "demo" and "save load" examples. is this expected? or have i maybe done something wrong?
im on nixos cause i cant get into windows rn (drive issues) so it could be a problem with my nix setup
Those don’t even compile for me, I don’t think they’re ported yet
how do you get around that? it doesnt seem like rust will compile my projects if the examples arent working. should i just delete them?
@dawn shell
ive ignored the test and examples in the cargo.toml file but now i get a bunch of errors in the blueprints folder. specifically animation, mod, and spawn_from_blueprints
ive double checked im on the right branch
[strange@nixos:~/bevy/Blenvy]$ git branch -a
* (HEAD detached at origin/blenvy)
blenvy
main
remotes/origin/HEAD -> origin/main
remotes/origin/animation-fixes-and-improvements
remotes/origin/bevy-0.14
remotes/origin/bevy_main
remotes/origin/blenvy
remotes/origin/crate_tests
remotes/origin/main
Why would you need to compile the examples?
I just have a dependency like this blenvy = { path = "../blenvy/crates/blenvy" } in my game.
@ebon zealot @open steeple @hollow dove here's the game successfully running Blenvy and Avian in Wasm: https://janhohenheim.itch.io/bike-game 🎉
You alternate pressing A and D to pedal your bike and move
Note that the ramp physics are broken, the mouse is not yet locked to the screen and sometimes the camera is upside down when starting the game.
But the important part is: Blenvy works on Wasm with my changes 😄
im doing the same but when i try to build my project the errors say they come from blenvy (lib)
almost exactly this ! I broke some stuff while getting the pre-alpha ready, and others are not ported yet.
I have a break from the irl construction working at the end of the week, so cleanup & upgrade time !
this is exactly what I use for testing outside of Blenvy to replicate a "user environment"
That is awesome ! Thanks a lot for working on the fixes 🙂 Would you mind doing a PR for the Blenvy branch with your changes ? Or I can copy the changes over later tonight 🙂
Can do later! The caveats of the solution are the same as before, so you know them already (clunky preloading for the user, archetype moves from the insert and deletes. Although my solution has an extra archetype move than before.)
Note to self: use sparse storage
im getting errors that look like this:
Compiling blenvy v0.1.0-alpha.1 (/home/strange/bevy/Blenvy/crates/blenvy)
error[E0412]: cannot find type `AnimationGraph` in this scope
--> crates/blenvy/src/blueprints/spawn_from_blueprints.rs:340:31
|
340 | mut graphs: ResMut<Assets<AnimationGraph>>,
| ^^^^^^^^^^^^^^ not found in this scope
|
help: you might be missing a type parameter
|
317 | pub(crate) fn blueprints_assets_loaded<AnimationGraph>(
| ++++++++++++++++
which looks like a bunch of types arent being found? i get im the only one with this issue but im seriously confused as to what might have gone wrong.
Your spawn_from_blueprints.rs is importing bevy::prelude::*, right? Asking because AnimationGraph is a Bevy type. Are you accidentally pulling in different versions of Bevy? cargo tree -i bevy
A graph structure that describes how animation clips are to be blended together.
There you go: https://github.com/kaosat-dev/Blenvy/pull/199
@sly fulcrum I forgot to make my message a reply, so I'm pinging you manually 🙂
I’ve checked the spawn_from_blueprints.rs and it is importing bevy::prelude. When I check the blenvy crate itself with cargo tree, I get bevy version 0.14.0. But when I check the larger Blenvy project it says bevy 0.13.2 and 0.14.0
What about your own project?
The one that imports blenvy
This is just building blenvy, not even in my own project
If I run in my own project, I get the same errors coming from blenvy
So, what does cargo tree -i bevy report in your own project?
Assuming you use exactly this dependency
Thanks a lot !
14.0 and 13.2
Where does 13.2 come from?
cargo tree -i [email protected]
Oh, is your local blenvy on the correct branch?
Ah shoot. I’m using other outdated deps in my project, egui and rapier. Let me see if that helps
So on the topic of materials , I think the system might need some fundamental change:
- Currently there is one material library file per blend file that contains * all materials * in use by blueprints in the blend file
- So even if a blueprint does not use a given material it will have a link to a material library containing all materials
- On the plus side this means a single materials file per blend file
- But it makes knowing which materials are used by which blueprint/level unclear
However...
- I think it might make more sense to export individual materials , each to their own file
- Have blueprints/levels have a list of material files they need
- It makes it clearer and cleaner which materials are used by which blueprint/level uses which materials
- As materials are cached by blenvy I don't think there would be much overhead
yep, it worked but only after resetting it once
there's going to be an issue with materials that use custom shaders, so you can't rely on blender for them
This whole thing only applies to materials exported from Blender, doesn’t it? For ExtendedMaterials, just add them at runtime
Materials get exported as far as supported by the gltf spec + extensions allow (don't remember the exact details). I have long term plans for exporting shaders and modifiers (geometry nodes mostly) but that is still quite a bit in the future
If you use the principled bsdf shaders with regular textures, this matches the gltf material format and is exported by blender as such. Gltf does not support procedural textures like noise or wave. Bevy will import the materials from a gltf correctly as a standard material.
Not sure how exactly blenvy handles this but that’s the general concept
In general, expect Blender to not export anything beyond normal textures, roughness and metallic maps and ambient occlusion
But you can do fancy Blender shading stuff and bake it manually
i don't need them to be exported, i have a mockup of bevy shader, can blenvy not export it, and instead point to correct thing right away?
I think you’d need a dummy in blender shader, then replace that dummy with the real deal in rust
Hmm, I guess the addon could read the Blender shader graph, remove the shader in the exported copy, then write some metadata into the custom properties? I think it should be possible to implement, just sounds rather unpleasant if you’re not already acquainted with the Blender python API
why not just "export material[i] as [ select from a list of materials/shaders ]"?
or whatever this would use
I think it might make more sense to export individual materials , each to their own file
Have blueprints/levels have a list of material files they need
It makes it clearer and cleaner which materials are used by which blueprint/level uses which materials
The more insane version (which I experimented with in my own engine pre Bevy, and it was a nightmare) would be
- convert blender shader to Bevy shader
- export it alongside the material+ additional metadata to help Bevy
- boilerplate in Bevy to replace the standardmaterial with a custom material with shader
I think in a theoretical Bevy/Blender future Bevy is looking at supporting things like MaterialX and Blender supports USD/MaterialX so could theoretically export spec defnitions from bevy to blender and back
but that's way theoretical and sounds like a lot of edge casey work anyway lol
awesoommmeee. Thanks for doing that, and for putting the patch up.
@spiral trellis is doing an initial implementation of MaterialX 🙂
that's what I was referring to 😄
Hehe
Short FYI:
- @dawn shell 's fix has been merged into the Blenvy branch (thanks Jan!)
- there is also an updated Blender add-on zip on the pre-release page , that sadly only solves a part of the material issues: I have found the core of the problem, but I will be switching to one material per material file & related changes as part of the fix, thanks for your patience
I upgraded to the new zip and am not sure what a "cycles" component is. I assume its related to the baking I was doing somehow.
also when clicking X
I can file an issue if that's helpful but it doesn't seem to be actually affecting anything. I fully regenerated all the files and ran the app without issue.
Yup! It’s slowly taking shape. Currently on vacation but I hope I’ll have to time work on it again from end of next week 🙂
@ebon zealot I managed to reliably reproduce the error from a few days ago
I copy this from a regular object in World, no blueprint involved
And paste it onto an empty that is also in World, again no blueprint involved. The result is the above error message, with the resulting component looking like this
But the custom properties reveal that what actually got pasted is this:
{"avian3d::collision::collider::constructor::ColliderConstructor": "Sphere(radius: 0.0)"}
Is the error
- for that component only ?
- for any enum ?
- this is a general FYI that I need to put in the docs somewhere: the components system is totally independent from Blueprints, exports & co 🙂
Hmm so there is no full distinction between components & Blender's custom properties. And as you see with "cycles", Blender adds its own components to objects sometimes (so do some add-ons, other tools etc)
I think the best solution for this would be to add an "ignore list" so that users can just add the custom properties they do not wish to be displayed in the rename/fix/upgrade screen , what do you think ?
ah so potentially anything from any addon could end up there 🤔
yeah maybe "ignore all of this type" as an additional button then, and some way to get back and view that list of ignores. Doesn't feel great, but removing them probably isn't what I want either and that was my natural reaction.
feels a lot like "warning messages" in the console. if they're always there, then people are trained to not look there for actual issues
I can check later 👍
Noticed this with retopoflow as well, as that one controls some logic through custom props 👀
An "ignore this type" button would definitely be appreciated, but probably low priority
yeah deff low priority. easy to just ignore
This pretty much exactly what I thought about adding as soon as I saw your bug report 🙂
Btw, all this is only really needed for a while: starting with Blenvy, the components are all stored inside a single custom property , so this tooling to upgrade from custom properties (the legacy tooling) was kept for backward compatibility reasons mostly.
oh that's cool
This type of stuff is trivial to add, so will likely add it soon. I have more time available starting Friday for a few days so I'll fix & add a lot of stuff
Components that trigger this:
bevy_render::mesh::morph::MorphWeights(struct containing an enum)avian3d::collision::collider::constructor::ColliderConstructorHierarchy(struct that containsColliderConstructor)bevy_core_pipeline::bloom::settings::BloomSettings(struct containing an enum)
Components that do not trigger this:bevy_render::primitives::Aabb(struct)avian3d::dynamics::rigid_body::RigidBody(simple enum)
Looks like a case of structs containing enums? Not sure
In case the materials fix is not out by the time the jam ends, do you know of any workaround to get materials working on blueprints?
That is a very good starting point ! Thanks for that, I'll double check if the tests contain Structs containing enums & go from there.
Enums are handled quite a bit differently from the other components, as there is an additional field added on the blender side that contains the "selected enum variant"
Interesting how avian3d::dynamics::rigid_body::RigidBody, itself being an enum, does not exhibit this bug 🤔
Wooah, I am very confused, I thought the jam was only last weekend ? Doh' ! Just checked, ends on 2024-08-12 !
That is plenty of time 🙂 I am 100% sure that the materials fix will be out before the end of this weekend (so before 29th)
I already have the algorithm layed out, and a part of the boilerplate ready.
Great 😄
Yeah, that's the reason I did all of those Wasm tests in the first place 😄
I don't care about Wasm at all when outside a jam, haha
Nesting of components can make a difference in this area, I had some really weird issues way back with vecs withing structs within structs 😄
Submissions are due a bit earlier 😉
That makes a lot more sense 😄
I'll still have it out earlier 😉 Likely friday (do not quote me on that though 😄 )
Great, but please don't worry to much if you can't make it in time. I'm sure I can find a hack otherwise 🙂
(or embrace the grey block aesthetic)
I am not worried 😄 For me outside of releasing something in a timely manner, Blenvy is a relaxing, evolving puzzle that I love solving
"it's not a bug it's a feature"
"cycles" as in "take it into blender yourself and render the materials if you want to play with some"
fits the theme!
@round cove & @dawn shell I just pushed & updated a fix for materials before I start changing things around. Now the MaterialInfo component is being inserted normally again on the Blender side.
@round cove I don't think this will solve your strange error with the standard gltf exporter being unable to export the material Library (still unable to reproduce that one), but the next, more radical update might.
the material library was fixed by the last zip for me
sorry if I didn't make that clear
Just tried it out and it does not fix the materials not being applied. But it also doesn't break anything 🎉
huh. I wonder if my ad-hoc changes stuck around somehow then
will have to clean it up and check
Hmm bummer, did you regenerate all your gltf files ? (just remove all blueprints, levels, & material folders, blenvy will regenerate)
Did you perhaps set it to not use the material library ?
nope. I've kept that checkbox checked since our last mention of it
Nope, no changes
blender
bevy
Ok this is getting more & more confusing 😄
Could you please check if you have any BlueprintInfo component on the object that is supposed to have the material applied
I wonder if you can reproduce this? I recently sent the link to the project
sure
sec
I just tried the project, I get this error :
Wayland requires some more dependencies
Either download them from your package manager to run Bevy wayland apps in general or disable the wayland feature on the bevy dependency
That is just as confusing as the issue @dawn shell , the previous version should NOT have been working (well, unless you did not regenerate the gltf files since before that one, then it makes sense)
Yup , I just did not have time to deal with the Wayland side of things yet 😉
I think sudo apt-get install libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev installs everything
But yeah, feel free to disable Wayland here
Btw, any reason in particular to favor wayland ? (I haven't checked it out in ages)
I just regenerated my materials file successfully, fwiw. remove -> save it blender -> its there again. and unpacking it to a gltf reveals the texture file that I baked even
(this is with the last zip, not the current one)
And it shows up correctly in Bevy too ?
Btw I feel like I have not been clear about this:
- every change to the export part of the Blender add-on, is very likely to change the output files (for example the previous version was not writing the
MaterialInfocorrectly), so it can potentially impact ALL the gltf files - so I highly recommend deleting the various Blenvy generated asset folders before trying out a new version
this is the textures working from a build right before the current (non-blenvy) change I'm working on.
a build of my app that is
checkerboard is the texture
@dawn shell I just checked in your project, there is no BlueprintInfo. Going to try & regenerate the files with my local changes to see if it changes anything
What the heck ? it does not insert the MaterialInfo ? Changed the output to gltf instead of gltf instead of glb to peek into the file, and it clearly is not there
Eeeh I'm out of the loop, but IIRC many desktops will completely ditch X11 in the future in favor of it, so you should probably switch
Yep, the Ramp has a BlueprintInfo
name: Ramp path: blueprints/Ramp.glb
o.O
But... I have it?
Just so we are looking at the same thing, I reexported everything and commited it to https://github.com/Bevy-Jam-5/bike-game/tree/1aca7c0b4b44a9462ba2014f34e8d508be41f7ef
Note that the addon is not generating a assets/materials/bike_game_materials.glb
Oh, that's better!
I assume you manually changed the colors?
Otherwise, something else that is weird is going on 😄
So this is very confusing, going to call it a night,
- I had to change your fork of Blenvy to the original Blenvy branch
- I removed all levels, blueprints, materials & regenerated it
👀 that is confusing indeed. Maybe the only issue is that materials are somehow not generated for me?
I changed the colors multiples time now, and it regenerates the files correctly (this is using a local version of the add-on, that is almost the same as the one I just uploaded a few minutes ago)
You are on Blender 4.2 as well right ?
yep
my original issue was that the change detection was not picking up any materials
it was a one-line patch to "fix" and return all of them
Huh, that sounds plausible
Which line?
I can try to see if that fixes it
I think hot reloading might just have crashed my game
But not important, the player is never going to be able to hot reload anyways 😄
Not going to fix it I think, I just tried installing the add-on as a normal user , (instead of my Blender add-on python env) and it is back to grayscale !!
Yay, so at least you can reproduce it!
Btw, in better news: I found a fix for the empties not allowing arbitrary shapes
except it does not make sense at all, the code running in my dev environment and the zip I literally just created is exactly the same code o_O
ok this keeps getting weirder: now the MaterialInfo is gone again
#1174712142314876959 message
So this is an empty holding a collider. As you can see, it's a cylinder collider, which is a shape not supported by empty. To still support it, I did the following
Btw that is why it is not displaying the correct material, for me at least, neither wall nor ramp have the component
I added a child mesh in the form of a cylinder and removed all the faces, so only lines and vertices remain
Ohh nice !
And then set it to not be renderable
That way, the cylinder debug mesh will never be exported 🙂
Make sure the cylinder collider and the generated cylinder mesh have the same height and radius, and your blender setup will perfectly match your avian setup no matter how much you scale and rotate everything 🎉
Is that supposed to be a component on the blueprint entity?
No, on each object that has a Material
Let me rephrase it: is Ramp supposed to hold it?
Yes, right?
no, the mesh inside Ramp that has the material
Aaah got it, thanks
I can confirm that I don't have it in my version either
With the addon installed in "user mode", does it also not generate a materials directory for you?
That part works for me (if I delete the directory first of course)
AHHH, ok , it seems there is a caching issue in Blender
I tried out @round cove's hack and still no materials dir
I closed Blender (user mode) , and re-tried it , and the colors are back
Ok this is the local version that works for me (user mode too), just disregard the additional material files, part of experiments
Calling it a day, will re-try again tomorrow with a fresh brain & a fresh clone of your project @dawn shell
Sure, good night 🙂
Oh, I think I didn't save it properly, let me try again
The zip above should also generate the folder correctly 😉
Alright, I'll try yours first then
No dice. Maybe it's a Windows issue?
Nope, this does not work either
But hey, as long as someone can generate the materials file, this is at least not a blocker for the jam 😄
@ebon zealot how do I best check if my World has finished loading, including all sub blueprints?
Observe Trigger<OnAdd, BlueprintInstanceReady> and see if the entity holds GameWorldTag?
That is a good option , otherwise using the BlueprintEvent::InstanceReady and checking for the name / path or entity fields against GameWorlTag
FYI my Blenvy randomly started generating the material files. They still don't show up ingame, but at least they exist 😄
Relevant branch: https://github.com/Bevy-Jam-5/bike-game/tree/main
@ebon zealot is there anything I can help with regarding the materials not showing up ingame?
are you seeing any errors or is it just blanking?
No errors. I checked the materials loaded by Bevy and they all have the right name, but only carry the default StandardMaterial.
Looking at the generated material files, they seem correct to me, but I'm not sure how they should look like, so idk
My guess so far is that something is going wrong while importing the material files.
I cause issue using various things in blender all the time, but I always get specific loading warning and such
specifically for material exports and such
Agreed. That kinda corroborates my hypothesis that the Bevy import is the part failing.
Now it randomly loaded some materials
For reference, this is how it should look
Seems like the red color of the car is coming from the material belonging to the car's lights?
The road and the bike are looking correct. Notably, these two use only one material. The buggy objects in the scene are using multiple materials per mesh.
So it seems like when an object uses multiple materials, a random one is picked for the whole object
I had this random materials bug a few times but could never reproduce it reliably.
It should be fixed with the upcoming "split materials" change, however multiple materials for the same mesh do not work, because as far as I know, gltf itself does not support it .
The way blender exports that is by exporting multiple meshes, each with a single material
Do you have MaterialInfos on the objects / entities that should have materials ?
I am still surprised by the randomness you are seeing in the materials export itself from Blender, it is a relatively straightforward process : are you running blender from the command line btw ?
Nope, regular Blender 4.2 on Windows.
ah , that is the part you mean, sorry my bad
is there any way to run it from command line on windows ? some error messages might get swallowed
No clue, probably? But does the addon still work when executed like that?
MaterialInfo is present on the bike's mesh, but not on the building's meshes
at least on linux it does, I use it like that regularly for debugging
Bike mesh
in that case, there is still an export issue on the Blender side: without that component, the Bevy side has no way of knowing there is a material that needs to be applied
One of the building meshes
Do you have a handy command I can copy-paste?
Before my materials go away again, I commited everything I have right now: https://github.com/Bevy-Jam-5/bike-game/tree/1551acc218c80c2854650f3f7e408816a9272022
In case you want to take a look yourself
I usually download a copy of Blender from their site & just
- unpack it
- go into the folder
- launch it using
./blender
here in the official docs
https://docs.blender.org/manual/en/latest/advanced/command_line/launch/windows.html
I googled, it works the same 🙂
yesss found that
btw, you need to install Blenvy on that copy of Blender too of course 🙂
I misunderstood what you meant. I thought I had to do something like blender --save-scene World because I assumed it would be in headless mode, that's why I asked for a command 😅
It's reusing the same addons for me
ok 😄 strange, but add-ons might be stored differently either on Windows/ V4.2
the addons on mac are all stored in a single version directory too