mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-27 05:46:59 +00:00
Compare commits
2 Commits
aa3bfa93b5
...
260663e38e
Author | SHA1 | Date | |
---|---|---|---|
|
260663e38e | ||
|
c2f09fbf22 |
@ -14,3 +14,7 @@ pub struct Animations {
|
|||||||
/// this is for convenience, because currently , Bevy's gltf parsing inserts `AnimationPlayers` "one level down"
|
/// 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
|
/// ie armature/root for animated models, which means more complex queries to trigger animations that we want to avoid
|
||||||
pub struct AnimationPlayerLink(pub Entity);
|
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::<MaterialInfo>()
|
||||||
.register_type::<SpawnHere>()
|
.register_type::<SpawnHere>()
|
||||||
.register_type::<Animations>()
|
.register_type::<Animations>()
|
||||||
|
.register_type::<Animated>()
|
||||||
.register_type::<BlueprintsList>()
|
.register_type::<BlueprintsList>()
|
||||||
.register_type::<Vec<String>>()
|
.register_type::<Vec<String>>()
|
||||||
.register_type::<HashMap<String, 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)
|
get_sub_collections([object.instance_collection], root_node, children_per_collection)
|
||||||
empty_obj["BlueprintsList"] = f"({json.dumps(dict(children_per_collection))})"
|
empty_obj["BlueprintsList"] = f"({json.dumps(dict(children_per_collection))})"
|
||||||
#empty_obj["Assets"] = {"Animations": [], "Materials": [], "Models":[], "Textures":[], "Audio":[], "Other":[]}
|
#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)
|
copy_animation_data(object, empty_obj)
|
||||||
|
|
||||||
# we copy custom properties over from our original object to our empty
|
# 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)
|
copy = duplicate_object_recursive(object, None, destination_collection)
|
||||||
if parent_empty is not None:
|
if parent_empty is not None:
|
||||||
copy.parent = parent_empty
|
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 every sub-collection of the source, copy its content into a new sub-collection of the destination
|
||||||
for collection in source_collection.children:
|
for collection in source_collection.children:
|
||||||
|
Loading…
Reference in New Issue
Block a user