fix: greace pencil object vertexgroup dump crash by adding a warning
This commit is contained in:
@ -376,29 +376,32 @@ class BlObject(BlDatablock):
|
|||||||
|
|
||||||
# VERTEx GROUP
|
# VERTEx GROUP
|
||||||
if len(instance.vertex_groups) > 0:
|
if len(instance.vertex_groups) > 0:
|
||||||
points_attr = 'vertices' if isinstance(
|
if isinstance( instance.data, bpy.types.GreasePencil):
|
||||||
instance.data, bpy.types.Mesh) else 'points'
|
logging.warning("Grease pencil vertex groups are not supported yet. More info: https://gitlab.com/slumber/multi-user/-/issues/161")
|
||||||
vg_data = []
|
else:
|
||||||
for vg in instance.vertex_groups:
|
points_attr = 'vertices' if isinstance(
|
||||||
vg_idx = vg.index
|
instance.data, bpy.types.Mesh) else 'points'
|
||||||
dumped_vg = {}
|
vg_data = []
|
||||||
dumped_vg['name'] = vg.name
|
for vg in instance.vertex_groups:
|
||||||
|
vg_idx = vg.index
|
||||||
|
dumped_vg = {}
|
||||||
|
dumped_vg['name'] = vg.name
|
||||||
|
|
||||||
vertices = []
|
vertices = []
|
||||||
|
|
||||||
for i, v in enumerate(getattr(instance.data, points_attr)):
|
for i, v in enumerate(getattr(instance.data, points_attr)):
|
||||||
for vg in v.groups:
|
for vg in v.groups:
|
||||||
if vg.group == vg_idx:
|
if vg.group == vg_idx:
|
||||||
vertices.append({
|
vertices.append({
|
||||||
'index': i,
|
'index': i,
|
||||||
'weight': vg.weight
|
'weight': vg.weight
|
||||||
})
|
})
|
||||||
|
|
||||||
dumped_vg['vertices'] = vertices
|
dumped_vg['vertices'] = vertices
|
||||||
|
|
||||||
vg_data.append(dumped_vg)
|
vg_data.append(dumped_vg)
|
||||||
|
|
||||||
data['vertex_groups'] = vg_data
|
data['vertex_groups'] = vg_data
|
||||||
|
|
||||||
# SHAPE KEYS
|
# SHAPE KEYS
|
||||||
object_data = instance.data
|
object_data = instance.data
|
||||||
|
Reference in New Issue
Block a user