fix: material animation support
This commit is contained in:
parent
ad795caed5
commit
9f381b44c8
@ -219,7 +219,7 @@ def load_fcurve(fcurve_data, fcurve):
|
|||||||
def dump_animation_data(datablock):
|
def dump_animation_data(datablock):
|
||||||
animation_data = {}
|
animation_data = {}
|
||||||
if has_action(datablock):
|
if has_action(datablock):
|
||||||
animation_data['action'] = datablock.animation_data.action.name
|
animation_data['action'] = datablock.animation_data.action.uuid
|
||||||
if has_driver(datablock):
|
if has_driver(datablock):
|
||||||
animation_data['drivers'] = []
|
animation_data['drivers'] = []
|
||||||
for driver in datablock.animation_data.drivers:
|
for driver in datablock.animation_data.drivers:
|
||||||
@ -241,8 +241,10 @@ def load_animation_data(animation_data, datablock):
|
|||||||
for driver in animation_data['drivers']:
|
for driver in animation_data['drivers']:
|
||||||
load_driver(datablock, driver)
|
load_driver(datablock, driver)
|
||||||
|
|
||||||
if 'action' in animation_data:
|
action = animation_data.get('action')
|
||||||
datablock.animation_data.action = bpy.data.actions[animation_data['action']]
|
if action:
|
||||||
|
action = resolve_datablock_from_uuid(action, bpy.data.actions)
|
||||||
|
datablock.animation_data.action = action
|
||||||
elif datablock.animation_data.action:
|
elif datablock.animation_data.action:
|
||||||
datablock.animation_data.action = None
|
datablock.animation_data.action = None
|
||||||
|
|
||||||
|
@ -411,8 +411,6 @@ class BlMaterial(ReplicatedDatablock):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(data: dict, datablock: object):
|
def load(data: dict, datablock: object):
|
||||||
load_animation_data(data.get('animation_data'), datablock)
|
|
||||||
|
|
||||||
loader = Loader()
|
loader = Loader()
|
||||||
|
|
||||||
is_grease_pencil = data.get('is_grease_pencil')
|
is_grease_pencil = data.get('is_grease_pencil')
|
||||||
@ -428,6 +426,7 @@ class BlMaterial(ReplicatedDatablock):
|
|||||||
if datablock.node_tree is None:
|
if datablock.node_tree is None:
|
||||||
datablock.use_nodes = True
|
datablock.use_nodes = True
|
||||||
|
|
||||||
|
load_animation_data(data.get('animation_data'), datablock.node_tree)
|
||||||
load_node_tree(data['node_tree'], datablock.node_tree)
|
load_node_tree(data['node_tree'], datablock.node_tree)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -497,7 +496,7 @@ class BlMaterial(ReplicatedDatablock):
|
|||||||
elif datablock.use_nodes:
|
elif datablock.use_nodes:
|
||||||
data['node_tree'] = dump_node_tree(datablock.node_tree)
|
data['node_tree'] = dump_node_tree(datablock.node_tree)
|
||||||
|
|
||||||
data['animation_data'] = dump_animation_data(datablock)
|
data['animation_data'] = dump_animation_data(datablock.node_tree)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -512,7 +511,7 @@ class BlMaterial(ReplicatedDatablock):
|
|||||||
if datablock.use_nodes:
|
if datablock.use_nodes:
|
||||||
deps.extend(get_node_tree_dependencies(datablock.node_tree))
|
deps.extend(get_node_tree_dependencies(datablock.node_tree))
|
||||||
|
|
||||||
deps.extend(resolve_animation_dependencies(datablock))
|
deps.extend(resolve_animation_dependencies(datablock.node_tree))
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user