fix: reload object after mesh loading to prevent it from loosing vertex_group and shape_keys

This commit is contained in:
Swann 2021-02-16 21:58:26 +01:00
parent 0a96643a9f
commit a91bae3506
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
2 changed files with 6 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class BlMesh(BlDatablock):
bl_class = bpy.types.Mesh
bl_check_common = False
bl_icon = 'MESH_DATA'
bl_reload_parent = False
bl_reload_parent = True
def _construct(self, data):
instance = bpy.data.meshes.new(data["name"])

View File

@ -600,9 +600,14 @@ class SessionApply(bpy.types.Operator):
def execute(self, context):
logging.debug(f"Running apply on {self.target}")
try:
node_ref = session.get(uuid=self.target)
session.apply(self.target,
force=True,
force_dependencies=self.reset_dependencies)
if node_ref.bl_reload_parent:
for parent in session._graph.find_parents(self.target):
logging.debug(f"Refresh parent {parent}")
session.apply(parent, force=True)
except Exception as e:
self.report({'ERROR'}, repr(e))
return {"CANCELED"}