refactor: change has_action, has_driver location to utils
fix: wrong transform update behavior for animated object Related to #39, #18
This commit is contained in:
parent
2666444007
commit
b1f5ca5660
@ -6,18 +6,6 @@ from ..libs.replication.replication.data import ReplicatedDatablock
|
||||
from ..libs.replication.replication.constants import UP
|
||||
|
||||
|
||||
def has_action(target):
|
||||
return (hasattr(target, 'animation_data')
|
||||
and target.animation_data
|
||||
and target.animation_data.action)
|
||||
|
||||
|
||||
def has_driver(target):
|
||||
return (hasattr(target, 'animation_data')
|
||||
and target.animation_data
|
||||
and target.animation_data.drivers)
|
||||
|
||||
|
||||
def dump_driver(driver):
|
||||
dumper = utils.dump_anything.Dumper()
|
||||
dumper.depth = 6
|
||||
@ -91,12 +79,12 @@ class BlDatablock(ReplicatedDatablock):
|
||||
|
||||
def dump(self, pointer=None):
|
||||
data = {}
|
||||
if has_action(pointer):
|
||||
if utils.has_action(pointer):
|
||||
dumper = utils.dump_anything.Dumper()
|
||||
dumper.include_filter = ['action']
|
||||
data['animation_data'] = dumper.dump(pointer.animation_data)
|
||||
|
||||
if has_driver(pointer):
|
||||
if utils.has_driver(pointer):
|
||||
dumped_drivers = {'animation_data':{'drivers': []}}
|
||||
for driver in pointer.animation_data.drivers:
|
||||
dumped_drivers['animation_data']['drivers'].append(dump_driver(driver))
|
||||
@ -133,7 +121,7 @@ class BlDatablock(ReplicatedDatablock):
|
||||
def resolve_dependencies(self):
|
||||
dependencies = []
|
||||
|
||||
if has_action(self.pointer):
|
||||
if utils.has_action(self.pointer):
|
||||
dependencies.append(self.pointer.animation_data.action)
|
||||
|
||||
return dependencies
|
||||
|
@ -141,7 +141,7 @@ class BlObject(BlDatablock):
|
||||
"instance_collection",
|
||||
"instance_type"
|
||||
]
|
||||
if not pointer.animation_data:
|
||||
if not utils.has_action(pointer):
|
||||
dumper.include_filter.append('matrix_world')
|
||||
|
||||
data = dumper.dump(pointer)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit de24d35afeef583802eca1fe002b3efc171a7ffe
|
||||
Subproject commit 56cf86f05d1bb5fab9c3491945bbd5f7f207325b
|
@ -16,6 +16,16 @@ from .libs import dump_anything
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.ERROR)
|
||||
|
||||
def has_action(target):
|
||||
return (hasattr(target, 'animation_data')
|
||||
and target.animation_data
|
||||
and target.animation_data.action)
|
||||
|
||||
|
||||
def has_driver(target):
|
||||
return (hasattr(target, 'animation_data')
|
||||
and target.animation_data
|
||||
and target.animation_data.drivers)
|
||||
|
||||
def find_from_attr(attr_name, attr_value, list):
|
||||
for item in list:
|
||||
|
Loading…
x
Reference in New Issue
Block a user