Compare commits
4 Commits
68eac8d320
...
5d7f633750
Author | SHA1 | Date |
---|---|---|
kaosat.dev | 5d7f633750 | |
kaosat.dev | 6bee4ae25b | |
kaosat.dev | d2e25a1a23 | |
kaosat.dev | e016b3ec7b |
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "bevy_gltf_blueprints"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
authors = ["Mark 'kaosat-dev' Moissette"]
|
||||
description = "Adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy."
|
||||
description = "Adds the ability to define Blueprints/Prefabs for Bevy inside gltf files and spawn them in Bevy."
|
||||
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
repository = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
keywords = ["gamedev", "bevy", "gltf", "blueprint", "prefab"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
# bevy_gltf_blueprints
|
||||
|
||||
Built upon [bevy_gltf_components](https://crates.io/crates/bevy_gltf_components) this crate adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy.
|
||||
Built on [bevy_gltf_components](https://crates.io/crates/bevy_gltf_components) this crate adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy.
|
||||
|
||||
* Allows you to create lightweight levels, where all assets are different gltf files and loaded after the main level is loaded
|
||||
* Allows you to spawn different entities from gtlf files at runtime in a clean manner, including simplified animation support !
|
||||
|
@ -15,7 +15,9 @@ A blueprint is a set of **overrideable** components + a hierarchy: ie
|
|||
* just a Gltf file with Gltf_extras specifying components
|
||||
* a component called BlueprintName
|
||||
|
||||
Particularly useful when using [Blender](https://www.blender.org/) as an editor for the [Bevy](https://bevyengine.org/) game engine, combined with the [Blender plugin](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/tools/gltf_auto_export) that does a lot of the work for you
|
||||
Particularly useful when using [Blender](https://www.blender.org/) as an editor for the [Bevy](https://bevyengine.org/) game engine, combined with the Blender add-ons that do a lot of the work for you
|
||||
- [gltf_auto_export](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/tools/gltf_auto_export)
|
||||
- [bevy_components](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/tools/bevy_components)
|
||||
|
||||
|
||||
## Usage
|
||||
|
@ -26,7 +28,7 @@ Here's a minimal usage example:
|
|||
# Cargo.toml
|
||||
[dependencies]
|
||||
bevy="0.13"
|
||||
bevy_gltf_blueprints = { version = "0.9"}
|
||||
bevy_gltf_blueprints = { version = "0.10"}
|
||||
|
||||
```
|
||||
|
||||
|
@ -64,7 +66,7 @@ fn spawn_blueprint(
|
|||
Add the following to your `[dependencies]` section in `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
bevy_gltf_blueprints = "0.9"
|
||||
bevy_gltf_blueprints = "0.10"
|
||||
```
|
||||
|
||||
Or use `cargo add`:
|
||||
|
@ -165,13 +167,10 @@ commands.spawn((
|
|||
|
||||
### BluePrintBundle
|
||||
|
||||
There is also a bundle for convenience , which just has
|
||||
There is also a ```BluePrintBundle``` for convenience , which just has
|
||||
* a ```BlueprintName``` component
|
||||
* a ```SpawnHere``` component
|
||||
|
||||
[```BluePrintBundle```](./src/lib.rs#22)
|
||||
|
||||
|
||||
## Additional information
|
||||
|
||||
- When a blueprint is spawned, all its children entities (and nested children etc) also have an ```InBlueprint``` component that gets insert
|
||||
|
@ -219,7 +218,7 @@ the ordering of systems is very important !
|
|||
|
||||
For example to replace your proxy components (stand-in components when you cannot/ do not want to use real components in the gltf file) with actual ones, which should happen **AFTER** the Blueprint based spawning,
|
||||
|
||||
so ```bevy_gltf_blueprints``` provides a **SystemSet** for that purpose:[```GltfBlueprintsSet```](./src/lib.rs#16)
|
||||
so ```bevy_gltf_blueprints``` provides a **SystemSet** for that purpose: ```GltfBlueprintsSet```
|
||||
|
||||
Typically , the order of systems should be
|
||||
|
||||
|
@ -281,8 +280,7 @@ pub fn animation_change_on_proximity_foxes(
|
|||
|
||||
see https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/animation for how to set it up correctly
|
||||
|
||||
particularly from https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/animation/game/in_game.rs#86
|
||||
onward
|
||||
particularly from https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/animation/game/in_game.rs
|
||||
|
||||
|
||||
## Materials
|
||||
|
@ -346,7 +344,7 @@ The main branch is compatible with the latest Bevy release, while the branch `be
|
|||
Compatibility of `bevy_gltf_blueprints` versions:
|
||||
| `bevy_gltf_blueprints` | `bevy` |
|
||||
| :-- | :-- |
|
||||
| `0.9` | `0.13` |
|
||||
| `0.9 - 0.10` | `0.13` |
|
||||
| `0.3 - 0.8` | `0.12` |
|
||||
| `0.1 - 0.2` | `0.11` |
|
||||
| branch `main` | `0.13` |
|
||||
|
|
|
@ -150,7 +150,7 @@ pub(crate) fn prepare_blueprints(
|
|||
commands.entity(entity).insert(BlueprintAssetsLoaded);
|
||||
}
|
||||
} else {
|
||||
// in case there are no blueprintsList
|
||||
// in case there are no blueprintsList, we revert back to the old behaviour
|
||||
commands.entity(entity).insert(BlueprintAssetsLoaded);
|
||||
}
|
||||
}
|
||||
|
@ -243,11 +243,14 @@ pub(crate) fn spawn_from_blueprints(
|
|||
let model_path = Path::new(&library_path).join(Path::new(model_file_name.as_str()));
|
||||
|
||||
// info!("attempting to spawn {:?}", model_path);
|
||||
let model_handle: Handle<Gltf> = asset_server.load(model_path); // FIXME: kinda weird now
|
||||
let model_handle: Handle<Gltf> = asset_server.load(model_path.clone()); // FIXME: kinda weird now
|
||||
|
||||
let gltf = assets_gltf
|
||||
.get(&model_handle)
|
||||
.expect("this gltf should have been loaded");
|
||||
let gltf = assets_gltf.get(&model_handle).unwrap_or_else(|| {
|
||||
panic!(
|
||||
"gltf file {:?} should have been loaded",
|
||||
model_path.to_str()
|
||||
)
|
||||
});
|
||||
|
||||
// WARNING we work under the assumtion that there is ONLY ONE named scene, and that the first one is the right one
|
||||
let main_scene_name = gltf
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "bevy_gltf_components"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
authors = ["Mark 'kaosat-dev' Moissette"]
|
||||
description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side."
|
||||
description = "Allows you to define Bevy components direclty inside gltf files and instanciate the components on the Bevy side."
|
||||
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
repository = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
keywords = ["gamedev", "bevy", "assets", "gltf", "components"]
|
||||
|
|
|
@ -13,9 +13,9 @@ This crate allows you to define [Bevy](https://bevyengine.org/) components direc
|
|||
***important*** : the plugin for processing gltf files runs in ***update*** , so you cannot use the components directly if you spawn your scene from gltf in ***setup*** (the additional components will not show up)
|
||||
|
||||
Please see the
|
||||
* [example](https://github.com/kaosat-dev/Blender_bevy_components_workflow/examples/basic)
|
||||
* or use [```bevy_asset_loader```](https://github.com/NiklasEi/bevy_asset_loader) for a reliable workflow.
|
||||
* alternatively, use the [```bevy_gltf_blueprints```](https://github.com/kaosat-dev/Blender_bevy_components_workflow/blob/main/crates/bevy_gltf_blueprints) crate, build on this crate's features,
|
||||
* [example](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_components/basic)
|
||||
* or use [```bevy_asset_loader```](https://github.com/NiklasEi/bevy_asset_loader) for reliable preloading of files, as this crate does not deal with loading your assets.
|
||||
* alternatively, use the [```bevy_gltf_blueprints```](https://crates.io/crates/bevy_gltf_blueprints) crate, built on this crate's features,
|
||||
that allows you to directly spawn entities from gltf based blueprints.
|
||||
|
||||
Here's a minimal usage example:
|
||||
|
@ -29,7 +29,7 @@ bevy_gltf_components = { version = "0.5"}
|
|||
```
|
||||
|
||||
```rust no_run
|
||||
//too barebones of an example to be meaningfull, please see https://github.com/kaosat-dev/Blender_bevy_components_workflow/examples/basic for a real example
|
||||
//too barebones of an example to be meaningfull, please see https://github.com/kaosat-dev/Blender_bevy_components_workflow/bevy_gltf_components/examples/basic for a real example
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
|
@ -84,7 +84,7 @@ Or disable the legacy mode: (enabled by default)
|
|||
ComponentsFromGltfPlugin{legacy_mode: false}
|
||||
```
|
||||
|
||||
You **need** to disable legacy mode if you want to use the [```bevy_components```](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/tools_bevy_blueprints/tools/bevy_components) Blender addon + the [```bevy_registry_export crate```](https://crates.io/crates/bevy_registry_export) !
|
||||
You **need** to disable legacy mode if you want to use the [```bevy_components```](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/tools/bevy_components) Blender addon + the [```bevy_registry_export crate```](https://crates.io/crates/bevy_registry_export) !
|
||||
As it create custom properties that are writen in real **ron** file format
|
||||
instead of a simplified version (the one in the legacy mode)
|
||||
|
||||
|
@ -98,7 +98,7 @@ For example to replace your proxy components (stand-in components when you canno
|
|||
|
||||
which should happen **AFTER** the components from the gltf files have been injected,
|
||||
|
||||
so ```bevy_gltf_components``` provides a **SystemSet** for that purpose:[```GltfComponentsSet```](./src/lib.rs#46)
|
||||
so ```bevy_gltf_components``` provides a **SystemSet** for that purpose:```GltfComponentsSet```
|
||||
|
||||
Typically , the order of systems should be
|
||||
|
||||
|
@ -116,7 +116,7 @@ Typically , the order of systems should be
|
|||
|
||||
## Examples
|
||||
|
||||
https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/basic
|
||||
https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_components/basic
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "bevy_gltf_save_load"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["Mark 'kaosat-dev' Moissette"]
|
||||
description = "Save & load your bevy games"
|
||||
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
|
@ -15,8 +15,7 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
||||
#bevy_gltf_blueprints = "0.9"
|
||||
bevy_gltf_blueprints = { version = "0.9", path = "../bevy_gltf_blueprints" }
|
||||
bevy_gltf_blueprints = { version = "0.10", path = "../bevy_gltf_blueprints" }
|
||||
|
||||
[dev-dependencies]
|
||||
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }
|
||||
|
|
|
@ -36,7 +36,7 @@ Here's a minimal usage example:
|
|||
[dependencies]
|
||||
bevy="0.13"
|
||||
bevy_gltf_save_load = "0.4"
|
||||
bevy_gltf_blueprints = "0.9" // also needed
|
||||
bevy_gltf_blueprints = "0.10" // also needed
|
||||
```
|
||||
|
||||
```rust no_run
|
||||
|
@ -133,7 +133,7 @@ pub fn setup_game(
|
|||
|
||||
```
|
||||
|
||||
take a look at the [example]('https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs) for more clarity
|
||||
take a look at the [example](https://github.com/kaosat-dev/Blender_bevy_components_workflow/blob/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs) for more clarity
|
||||
|
||||
|
||||
## Installation
|
||||
|
@ -142,12 +142,7 @@ Add the following to your `[dependencies]` section in `Cargo.toml`:
|
|||
|
||||
```toml
|
||||
bevy_gltf_save_load = "0.3"
|
||||
<<<<<<< HEAD
|
||||
bevy_gltf_blueprints = "0.8" // also needed, as bevy_gltf_save_load does not re-export it at this time
|
||||
=======
|
||||
bevy_gltf_blueprints = "0.6" // also needed, as bevy_gltf_save_load does not re-export it at this time
|
||||
>>>>>>> 9cb9dda5d35c635d367fa81ca1a6c752cda9bc02
|
||||
|
||||
bevy_gltf_blueprints = "0.10" // also needed, as bevy_gltf_save_load does not re-export it at this time
|
||||
```
|
||||
|
||||
Or use `cargo add`:
|
||||
|
@ -268,7 +263,7 @@ pub fn request_load(
|
|||
- ```LoadingFinished``` for loading
|
||||
|
||||
> Note: I **highly** recomend you change states when you start/finish saving & loading, otherwise things **will** get unpredictable
|
||||
Please see [the example]('https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs#77') for this.
|
||||
Please see [the example](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs) for this.
|
||||
|
||||
## Additional notes
|
||||
|
||||
|
@ -287,8 +282,8 @@ For convenience ```bevy_gltf_save_load``` provides two **SystemSets**
|
|||
Highly advised to get a better understanding of how things work !
|
||||
To get started I recomend looking at
|
||||
|
||||
- [world setup]('https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/in_game.rs#13')
|
||||
- [various events & co]('https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs#77')
|
||||
- [world setup](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/in_game.rs)
|
||||
- [various events & co](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_save_load/basic/src/game/mod.rs)
|
||||
|
||||
|
||||
All examples are here:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "bevy_registry_export"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Mark 'kaosat-dev' Moissette", "Pascal 'Killercup' Hertleif"]
|
||||
description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side."
|
||||
description = "Allows you to create a Json export of all your components/ registered types of your Bevy app/game"
|
||||
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
repository = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
|
||||
keywords = ["gamedev", "bevy", "assets", "gltf", "components"]
|
||||
keywords = ["gamedev", "bevy", "assets", "registry", "components"]
|
||||
categories = ["game-development"]
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
|
||||
```
|
||||
|
||||
take a look at the [example]('https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_registry_export/basic/src/core/mod.rs) for more clarity
|
||||
take a look at the [example](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_registry_export/basic/src/core/mod.rs) for more clarity
|
||||
|
||||
|
||||
## Installation
|
||||
|
|
|
@ -15,6 +15,7 @@ expected_custom_property_values = {'AComponentWithAnExtremlyExageratedOrMaybeNot
|
|||
'0.0, low_frequency_boost_curvature: 0.0, prefilter_settings: (threshold: 0.0, threshold_softness: '
|
||||
'0.0))',
|
||||
'BlueprintName': '(" ")',
|
||||
'BlueprintsList': '("")',
|
||||
'BorderColor': '(Rgba(red:1.0, green:1.0, blue:0.0, alpha:1.0))',
|
||||
'Button': '()',
|
||||
'CalculatedClip': '(clip: (max: Vec2(x:0.0, y:0.0), min: Vec2(x:0.0, y:0.0)))',
|
||||
|
@ -214,6 +215,7 @@ expected_custom_property_values_randomized = {'AComponentWithAnExtremlyExagerate
|
|||
'0.8133212327957153, prefilter_settings: (threshold: 0.8235888481140137, threshold_softness: '
|
||||
'0.6534725427627563))',
|
||||
'BlueprintName': '("sbnpsago")',
|
||||
'BlueprintsList': '("")',
|
||||
'BorderColor': '(Rgba(red:0.5714026093482971, green:0.42888906598091125, blue:0.5780913233757019, '
|
||||
'alpha:0.20609822869300842))',
|
||||
'Button': '()',
|
||||
|
|
|
@ -48,12 +48,12 @@ def test_components_should_generate_correct_custom_properties(setup_data):
|
|||
except Exception as error:
|
||||
errors.append(error)
|
||||
|
||||
'''pp = pprint.PrettyPrinter(depth=14, width=120)
|
||||
pp = pprint.PrettyPrinter(depth=14, width=120)
|
||||
print("CUSTOM PROPERTY VALUES")
|
||||
pp.pprint(custom_property_values)'''
|
||||
pp.pprint(custom_property_values)
|
||||
|
||||
assert len(errors) == 0
|
||||
assert len(added_components) == 158
|
||||
assert len(added_components) == 159
|
||||
|
||||
|
||||
def test_components_should_generate_correct_custom_properties_with_randomized_values(setup_data):
|
||||
|
@ -105,7 +105,7 @@ def test_components_should_generate_correct_custom_properties_with_randomized_va
|
|||
|
||||
print("error_components", error_components)
|
||||
assert len(errors) == 0
|
||||
assert len(added_components) == 158
|
||||
assert len(added_components) == 159
|
||||
|
||||
def test_components_should_generate_correct_propertyGroup_values_from_custom_properties(setup_data):
|
||||
registry = bpy.context.window_manager.components_registry
|
||||
|
@ -163,7 +163,7 @@ def test_components_should_generate_correct_propertyGroup_values_from_custom_pro
|
|||
for index, error in enumerate(errors):
|
||||
print("ERROR", error, failing_components[index])
|
||||
assert len(errors) == 0
|
||||
assert len(added_components) == 158
|
||||
assert len(added_components) == 159
|
||||
|
||||
|
||||
def test_remove_components(setup_data):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
bl_info = {
|
||||
"name": "gltf_auto_export",
|
||||
"author": "kaosigh",
|
||||
"version": (0, 15, 0),
|
||||
"version": (0, 16, 0),
|
||||
"blender": (3, 4, 0),
|
||||
"location": "File > Import-Export",
|
||||
"description": "glTF/glb auto-export",
|
||||
|
|
Loading…
Reference in New Issue