mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 11:50:53 +00:00
Compare commits
2 Commits
a618e0035e
...
6bc0ec0782
Author | SHA1 | Date | |
---|---|---|---|
|
6bc0ec0782 | ||
|
be0f4f1377 |
@ -156,41 +156,43 @@ pub(crate) fn blueprints_prepare_spawn(
|
|||||||
/* prefetch attempt */
|
/* prefetch attempt */
|
||||||
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();
|
||||||
for scene in gltf.scenes() {
|
for scene in gltf.scenes() {
|
||||||
let scene_extras = scene.extras().clone().unwrap();
|
if let Some(scene_extras) = scene.extras().clone()
|
||||||
let lookup: HashMap<String, Value> = serde_json::from_str(scene_extras.get()).unwrap();
|
{
|
||||||
if lookup.contains_key("BlueprintAssets") {
|
let lookup: HashMap<String, Value> = serde_json::from_str(scene_extras.get()).unwrap();
|
||||||
let assets_raw = &lookup["BlueprintAssets"];
|
if lookup.contains_key("BlueprintAssets") {
|
||||||
//println!("ASSETS RAW {}", assets_raw);
|
let assets_raw = &lookup["BlueprintAssets"];
|
||||||
let all_assets: BlueprintAssets =
|
//println!("ASSETS RAW {}", assets_raw);
|
||||||
ron::from_str(assets_raw.as_str().unwrap()).unwrap();
|
let all_assets: BlueprintAssets =
|
||||||
// println!("all_assets {:?}", all_assets);
|
ron::from_str(assets_raw.as_str().unwrap()).unwrap();
|
||||||
|
// println!("all_assets {:?}", all_assets);
|
||||||
|
|
||||||
for asset in all_assets.assets.iter() {
|
for asset in all_assets.assets.iter() {
|
||||||
println!("ASSET {}",asset.path);
|
println!("ASSET {}",asset.path);
|
||||||
let untyped_handle = asset_server.load_untyped(&asset.path);
|
let untyped_handle = asset_server.load_untyped(&asset.path);
|
||||||
let asset_id = untyped_handle.id();
|
let asset_id = untyped_handle.id();
|
||||||
let loaded = asset_server.is_loaded_with_dependencies(asset_id);
|
let loaded = asset_server.is_loaded_with_dependencies(asset_id);
|
||||||
if !loaded {
|
if !loaded {
|
||||||
asset_infos.push(AssetLoadTracker {
|
asset_infos.push(AssetLoadTracker {
|
||||||
name: asset.name.clone(),
|
name: asset.name.clone(),
|
||||||
path: asset.path.clone(),
|
path: asset.path.clone(),
|
||||||
id: asset_id,
|
id: asset_id,
|
||||||
loaded: false,
|
loaded: false,
|
||||||
handle: untyped_handle.clone(),
|
handle: untyped_handle.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: dang, too early, asset server has not yet started loading yet
|
// FIXME: dang, too early, asset server has not yet started loading yet
|
||||||
// let path_id = asset_server.get_path_id(&asset.path).expect("we should have alread checked for this asset");
|
// let path_id = asset_server.get_path_id(&asset.path).expect("we should have alread checked for this asset");
|
||||||
let path_id = asset.path.clone();
|
let path_id = asset.path.clone();
|
||||||
// TODO: make this dependant on if hot reload is enabled or not
|
// TODO: make this dependant on if hot reload is enabled or not
|
||||||
if !assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.contains_key(&path_id) {
|
if !assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.contains_key(&path_id) {
|
||||||
assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.insert(path_id.clone(), vec![]);
|
assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.insert(path_id.clone(), vec![]);
|
||||||
}
|
}
|
||||||
// only insert if not already present in mapping
|
// only insert if not already present in mapping
|
||||||
if !assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids[&path_id].contains(&entity) {
|
if !assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids[&path_id].contains(&entity) {
|
||||||
println!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
|
println!("adding mapping between {} and entity {:?}", path_id, all_names.get(entity));
|
||||||
assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.get_mut(&path_id).unwrap().push(entity);
|
assets_to_blueprint_instances.untyped_id_to_blueprint_entity_ids.get_mut(&path_id).unwrap().push(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,6 @@ type_mappings = {
|
|||||||
"bevy_color::linear_rgba::LinearRgba": lambda value: parse_color_rgba(value, float, "LinearRgba"),
|
"bevy_color::linear_rgba::LinearRgba": lambda value: parse_color_rgba(value, float, "LinearRgba"),
|
||||||
"bevy_color::hsva::Hsva": lambda value: parse_color_hsva(value, float, "Hsva"),
|
"bevy_color::hsva::Hsva": lambda value: parse_color_hsva(value, float, "Hsva"),
|
||||||
|
|
||||||
|
|
||||||
'bevy_ecs::entity::Entity': lambda value: int(value),
|
'bevy_ecs::entity::Entity': lambda value: int(value),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
69
tools/blenvy/blender_manifest.toml
Normal file
69
tools/blenvy/blender_manifest.toml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
schema_version = "1.0.0"
|
||||||
|
|
||||||
|
id = "Blenvy"
|
||||||
|
version = "0.1.0"
|
||||||
|
name = "Blenvy"
|
||||||
|
tagline = "Tools to add/edit components of objects, collections etc & create blueprints & levels for the Bevy Engine in Blender"
|
||||||
|
maintainer = "kaosat-dev <https://github.com/kaosat-dev/>"
|
||||||
|
type = "add-on"
|
||||||
|
|
||||||
|
# Optional link to documentation, support, source files, etc
|
||||||
|
# website = "https://extensions.blender.org/add-ons/my-example-package/"
|
||||||
|
website = "https://github.com/kaosat-dev/Blenvy"
|
||||||
|
|
||||||
|
# Optional list defined by Blender and server, see:
|
||||||
|
# https://docs.blender.org/manual/en/dev/advanced/extensions/tags.html
|
||||||
|
tags = ["Game Engine", "User Interface", "Import-Export"]
|
||||||
|
|
||||||
|
blender_version_min = "4.2.0"
|
||||||
|
# # Optional: Blender version that the extension does not support, earlier versions are supported.
|
||||||
|
# # This can be omitted and defined later on the extensions platform if an issue is found.
|
||||||
|
# blender_version_max = "5.1.0"
|
||||||
|
|
||||||
|
# License conforming to https://spdx.org/licenses/ (use "SPDX: prefix)
|
||||||
|
# https://docs.blender.org/manual/en/dev/advanced/extensions/licenses.html
|
||||||
|
license = [
|
||||||
|
"SPDX:MIT"
|
||||||
|
]
|
||||||
|
copyright = [
|
||||||
|
"2023-2024 kaosat-dev",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Optional list of supported platforms. If omitted, the extension will be available in all operating systems.
|
||||||
|
# platforms = ["windows-x64", "macos-arm64", "linux-x64"]
|
||||||
|
# Other supported platforms: "windows-arm64", "macos-x64"
|
||||||
|
|
||||||
|
# Optional: bundle 3rd party Python modules.
|
||||||
|
# https://docs.blender.org/manual/en/dev/advanced/extensions/python_wheels.html
|
||||||
|
# wheels = [
|
||||||
|
# "./wheels/hexdump-3.3-py3-none-any.whl",
|
||||||
|
# "./wheels/jsmin-3.0.1-py3-none-any.whl",
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# # Optional: add-ons can list which resources they will require:
|
||||||
|
# # * files (for access of any filesystem operations)
|
||||||
|
# # * network (for internet access)
|
||||||
|
# # * clipboard (to read and/or write the system clipboard)
|
||||||
|
# # * camera (to capture photos and videos)
|
||||||
|
# # * microphone (to capture audio)
|
||||||
|
# #
|
||||||
|
# # If using network, remember to also check `bpy.app.online_access`
|
||||||
|
# # https://docs.blender.org/manual/en/dev/advanced/extensions/addons.html#internet-access
|
||||||
|
# #
|
||||||
|
# # For each permission it is important to also specify the reason why it is required.
|
||||||
|
# # Keep this a single short sentence without a period (.) at the end.
|
||||||
|
# # For longer explanations use the documentation or detail page.
|
||||||
|
#
|
||||||
|
[permissions]
|
||||||
|
# network = "Need to sync motion-capture data to server"
|
||||||
|
files = "Export Gltf files to disk, read registry files, etc"
|
||||||
|
# clipboard = "Copy and paste bone transforms"
|
||||||
|
|
||||||
|
# Optional: build settings.
|
||||||
|
# https://docs.blender.org/manual/en/dev/advanced/extensions/command_line_arguments.html#command-line-args-extension-build
|
||||||
|
# [build]
|
||||||
|
# paths_exclude_pattern = [
|
||||||
|
# "__pycache__/",
|
||||||
|
# "/.git/",
|
||||||
|
# "/*.zip",
|
||||||
|
# ]
|
Loading…
Reference in New Issue
Block a user