mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 20:00:53 +00:00
feat(): added 'animated' flag component (wip) to mark any worlds/blueprints entities that have animations
* allows to not be restricted by bevy's a bit weird logic for AnimationPlayers * updated crate & tooling * updated testing example with a bit more complex nesting cases for testing
This commit is contained in:
parent
7584078f6d
commit
c2f09fbf22
@ -14,3 +14,7 @@ pub struct Animations {
|
||||
/// this is for convenience, because currently , Bevy's gltf parsing inserts `AnimationPlayers` "one level down"
|
||||
/// ie armature/root for animated models, which means more complex queries to trigger animations that we want to avoid
|
||||
pub struct AnimationPlayerLink(pub Entity);
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct Animated;
|
@ -120,6 +120,7 @@ impl Plugin for BlueprintsPlugin {
|
||||
.register_type::<MaterialInfo>()
|
||||
.register_type::<SpawnHere>()
|
||||
.register_type::<Animations>()
|
||||
.register_type::<Animated>()
|
||||
.register_type::<BlueprintsList>()
|
||||
.register_type::<Vec<String>>()
|
||||
.register_type::<HashMap<String, Vec<String>>>()
|
||||
|
Binary file not shown.
@ -112,6 +112,15 @@ def copy_hollowed_collection_into(source_collection, destination_collection, par
|
||||
get_sub_collections([object.instance_collection], root_node, children_per_collection)
|
||||
empty_obj["BlueprintsList"] = f"({json.dumps(dict(children_per_collection))})"
|
||||
#empty_obj["Assets"] = {"Animations": [], "Materials": [], "Models":[], "Textures":[], "Audio":[], "Other":[]}
|
||||
if object.animation_data:
|
||||
print("I have animation data")
|
||||
ad = object.animation_data
|
||||
if ad.action:
|
||||
print(object.name,'uses',ad.action.name)
|
||||
for t in ad.nla_tracks:
|
||||
for s in t.strips:
|
||||
print(object.name,'uses',s.action.name)
|
||||
empty_obj['Animated'] = '()'
|
||||
copy_animation_data(object, empty_obj)
|
||||
|
||||
# we copy custom properties over from our original object to our empty
|
||||
@ -126,6 +135,8 @@ def copy_hollowed_collection_into(source_collection, destination_collection, par
|
||||
copy = duplicate_object_recursive(object, None, destination_collection)
|
||||
if parent_empty is not None:
|
||||
copy.parent = parent_empty
|
||||
if object.animation_data:
|
||||
copy['Animated'] = '()'
|
||||
|
||||
# for every sub-collection of the source, copy its content into a new sub-collection of the destination
|
||||
for collection in source_collection.children:
|
||||
|
Loading…
Reference in New Issue
Block a user