2023-08-11 22:35:14 +00:00
[![Bevy tracking ](https://img.shields.io/badge/Bevy%20tracking-released%20version-lightblue )](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
2023-09-28 14:53:21 +00:00
[![License ](https://img.shields.io/crates/l/bevy_gltf_components )](https://github.com/kaosat-dev/Blender_bevy_components_workflow/blob/main/LICENSE.md)
2024-01-23 21:09:59 +00:00
[![ko-fi ](https://ko-fi.com/img/githubbutton_sm.svg )](https://ko-fi.com/F1F5TO32O)
2023-07-25 20:58:08 +00:00
2024-06-10 12:08:16 +00:00
# Blenvy: a Blender <=> bevy components workflow
2023-07-25 20:58:08 +00:00
2023-12-04 13:48:52 +00:00
![demo ](./docs/blender_bevy.png )
2023-07-25 20:58:08 +00:00
2023-09-28 12:10:45 +00:00
Crates & tools for adding components from gltf files in the [Bevy ](https://bevyengine.org/ ) game engine.
2023-08-01 23:45:57 +00:00
It enables minimalistic [Blender ](https://www.blender.org/ ) (gltf) centric workflow for Bevy, ie defining entites & their components
inside Blender using Blender's objects **custom properties** .
Aka "Blender as editor for Bevy"
It also allows you to setup 'blueprints' in Blender by using collections (the recomended way to go most of the time), or directly on single use objects .
## Features
* Useful if you want to use Blender (or any editor allowing to export gltf with configurable gltf_extras) as your Editor
2023-09-28 12:10:45 +00:00
* define Bevy components as custom properties in Blender (some visually , some using RON, though an older JSON version is also available)
2024-06-10 12:08:16 +00:00
* now also with an UI tool to add & edit Bevy components, automatically export gltf blueprints & more in [Blender ](./tools/blenvy/README.md )
2023-08-01 23:45:57 +00:00
* define components in Blender Collections & override any of them in your collection instances if you want
2023-09-28 12:10:45 +00:00
* ability to automatically turn your Blender collections into [gltf Blueprints ](./crates/bevy_gltf_blueprints/README.md ) for reuse
2023-08-01 23:45:57 +00:00
* minimal setup & code, you can have something basic running fast
2023-09-28 12:10:45 +00:00
* minimal dependencies: Bevy, Serde & Ron only !
* opensource
2023-08-01 23:45:57 +00:00
2023-07-25 20:58:08 +00:00
2023-09-28 12:10:45 +00:00
## Crates
2023-07-25 20:58:08 +00:00
2023-09-28 14:53:21 +00:00
- [bevy_gltf_components ](./crates/bevy_gltf_components/ ) This crate allows you to define components direclty inside gltf files and instanciate/inject the components on the Bevy side.
2024-02-05 22:01:19 +00:00
There is a [video tutorial/explanation ](https://youtu.be/-lcScjQCA3c ) if you want, or you can read the crate docs.
The examples for the crate are [here ](./examples/bevy_gltf_components/ )
2023-09-29 23:22:08 +00:00
2023-11-13 13:36:42 +00:00
- [bevy_gltf_blueprints ](./crates/bevy_gltf_blueprints/ ) This crate adds the ability to define Blueprints/Prefabs for Bevy inside gltf files and spawn them in Bevy. With the ability to override and add components when spawning, efficient "level" loading etc
2024-02-05 22:01:19 +00:00
There is a [video tutorial/explanation ](https://youtu.be/CgyNtwgYwdM ) for this one too, or you can read the crate docs
The examples for the crate are [here ](./examples/bevy_gltf_blueprints/ )
> Note: this is the recomended crate to use and uses ```bevy_gltf_components``` under the hood
2023-07-25 20:58:08 +00:00
feat(Save & load): new crate bevy_gltf_save_load + lots of upgrades & improvements (#95)
* feat(bevy_gltf_save_load): saving & loading implemented
* created new crate for save & load features, uses & filters out blueprints for efficient loading
* saving & loading, even with dynamically spawned nested hierarchies works
* component filter , resource filter & save path root are configurable
* for saving: added removal & cleanup logic for children component with children
that have been filtered out: ie no more invalid children getting stored in the save files !
* added sending of event once saving is done
* feat(examples/save-load): example for the new crate
* loading level static & dynamic data as blueprints
* added a bit of ui when entering saving & loading states & cleanup when exiting
* feat(bevy_gltf_blueprints): significant rewrite of how the crate works
* simplified spawning process, no more spawning children containing blueprints etc
* simplified post process : instead of copying original entity into blueprint root
we now copy blueprint root data (components & children) into the original entity ! fixes #96
* much simpler code wise
* solves issue with needing to register components that we only use on the bevy side (not gltf)
since we are not copying the bevy data into the blueprints data
* added **copyComponents** helper to copy components from one entity to another, excluding existing
components on the target entity, & some bells & whistles
* **Name** is now optional when spawning a blueprint: closes #97
* **Transform** is now optional when spawning a blueprint: closes #98
* removed transform from bundle (BREAKING change)
* added (optional) **NoInBlueprint** component to have finer control over whether to inject the **InBlueprint** component inside spawned blueprint entities
* added (optional) **Library** component, so we can override library path when we want
* added (optional) **AddToGameWorld** component for convenience to automatically add entities to the game world, if there is one
* chore(bevy_gltf_components): removed verbose output, cleaned it up a bit
* feat(tools/auto_export): added option to split out "dynamic" objects in main scenes
* ie if a collection instance (or its original collection) has a "dynamic" (aka mutable, saveable etc)
flag it can get exported to a seperate gltf file (essentially acting like an "initial save")
* the rest of the levels (the "static" data) is exported without the dynamic objects and
can be reused with save files !
2024-01-10 13:49:29 +00:00
- [bevy_gltf_save_load ](./crates/bevy_gltf_save_load/ ) This crate adds the ability to save & load your game state in a relatively simple way, by leveraging the blueprint functionality of
bevy_gltf_blueprints to only save a minimal subset of dynamic data, seperating dynamic & static parts of levels etc.
The examples for the crate are [here ](./examples/bevy_gltf_save_load/ )
2024-02-05 22:01:19 +00:00
> Note: this uses ```bevy_gltf_blueprints``` under the hood
2024-06-10 12:08:16 +00:00
- [bevy_registry_export ](./crates/bevy_registry_export/ ) This crate adds the ability to export your project's Bevy registry to json, in order to be able to generate custom component UIs on the Blender side in the Blender [blenvy ](./tools/blenvy/README.md ) add-on
2024-02-05 22:01:19 +00:00
2023-07-27 00:08:57 +00:00
2023-09-28 12:10:45 +00:00
## Tools
2023-08-01 23:45:57 +00:00
2024-06-10 12:08:16 +00:00
### Blender: blenvy
2023-08-11 22:35:14 +00:00
2024-06-10 12:08:16 +00:00
- an all in one [Blender addon ](./tools/blenvy/README.md ) for the Blender side of the workflow:
- allow easilly adding & editing Bevy components , using automatically generated UIs for each component
- automatically exports your level/world from Blender to gltf whenever you save your Blend file
- it also supports automatical exports of collections as [Gltf blueprints ](./crates/bevy_gltf_blueprints/README.md ) &
2023-08-01 23:45:57 +00:00
2024-06-10 12:08:16 +00:00
Please read the [README ]((./tools/blenvy/README.md )) of the add-on for installation & use instructions
2024-02-05 22:01:19 +00:00
2023-07-27 00:08:57 +00:00
2023-09-28 12:10:45 +00:00
## Examples
2023-07-27 00:08:57 +00:00
2023-11-13 13:36:42 +00:00
you can find all examples, by crate as seperate crates for clearer dependencies in [here ](./examples/ )
- [bevy_gltf_components ](./examples/bevy_gltf_components/ )
* [basic ](./examples/bevy_gltf_components/basic/ ) use of ```bevy_gltf_components``` only, to spawn entities with components defined inside gltf files
- [bevy_gltf_blueprints ](./examples/bevy_gltf_blueprints/ )
* [basic ](./examples/bevy_gltf_blueprints/basic/ ) more advanced example : use of ```bevy_gltf_blueprints``` to spawn a level and then populate it with entities coming from different gltf files, live (at runtime) spawning of entities etc
* [animation ](./examples/bevy_gltf_blueprints/animation/ ) how to use and trigger animations from gltf files (a feature of ```bevy_gltf_blueprints```)
2024-02-05 22:01:19 +00:00
* & lots more
- [bevy_gltf_save_load ](./examples/bevy_gltf_save_load/ )
- [bevy_registry_export ](./examples/bevy_registry_export/ )
2023-07-27 00:08:57 +00:00
2023-09-28 12:10:45 +00:00
## Workflow
2023-07-27 00:08:57 +00:00
2023-09-28 12:10:45 +00:00
The workflow goes as follows (once you got your Bevy code setup)
2023-07-25 20:58:08 +00:00
- create & register all your components you want to be able to set from the Blender side (this is basic Bevy, no specific work needed)
2023-07-26 23:53:48 +00:00
![component registration ](./docs/component_registration.png )
2023-07-25 20:58:08 +00:00
2024-02-05 22:01:19 +00:00
- then you have two options
- add your components to objects in Blender **manually** as **custom properties** : see [here ](./README-workflow-classic.md ) for more details
- add your components to objects in Blender **with a nice UI** see [here ](./README-workflow-ui.md ) for more details
2023-07-25 20:58:08 +00:00
## Limitations / issues
2023-11-13 13:36:42 +00:00
- Some of `bevy_rapier` /physics code / ways to define colliders could perhaps be done better/visually within Blender (currently it also goes via RON)
2023-07-25 20:58:08 +00:00
## Future work
- I have a number of other tools/ code helpers that I have not yet included here, because they need cleanup/ might make this example too complex
## Credits
- somebody I cannot recall helped me originally with the gltf loading tracker in the Bevy Discord, so thanks ! And if it was you, please let me know so I can give credit where credit is due :)
2023-10-10 20:18:47 +00:00
## Contributors
Thanks to all the contributors helping out with this project ! Big kudos to you, contributions are always appreciated ! :)
- [GitGhillie ](https://github.com/GitGhillie )
2023-11-08 07:13:22 +00:00
- [Azorlogh ](https://github.com/Azorlogh )
2024-02-05 22:01:19 +00:00
- [BSDGuyShawn ](https://github.com/BSDGuyShawn )
- [yukkop ](https://github.com/yukkop )
- [killercup ](https://github.com/killercup )
2024-02-19 21:43:27 +00:00
- [janhohenheim ](https://github.com/janhohenheim )
2023-10-10 20:18:47 +00:00
2023-07-25 20:58:08 +00:00
## License
2023-09-28 12:10:45 +00:00
This repo, all its code, contents & assets is Dual-licensed under either of
2023-07-27 00:08:57 +00:00
2023-09-28 12:10:45 +00:00
- Apache License, Version 2.0, ([LICENSE-APACHE](./LICENSE_APACHE.md) or https://www.apache.org/licenses/LICENSE-2.0)
2023-09-29 23:22:08 +00:00
- MIT license ([LICENSE-MIT](./LICENSE_MIT.md) or https://opensource.org/licenses/MIT)