Skip to content

Commit

Permalink
Merge pull request #2314 from KhronosGroup/fix_custom_prop_apply_modi…
Browse files Browse the repository at this point in the history
…fier

Fix custom prop when apply modifier
  • Loading branch information
julienduroure authored Aug 30, 2024
2 parents 4979c6b + dd58f36 commit a658dbc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions addons/io_scene_gltf2/blender/exp/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,16 @@ def __gather_mesh(vnode, blender_object, export_settings):
depsgraph = bpy.context.evaluated_depsgraph_get()
blender_mesh_owner = blender_object.evaluated_get(depsgraph)
blender_mesh = blender_mesh_owner.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph)
for prop in [p for p in blender_object.data.keys() if p not in BLACK_LIST]:
blender_mesh[prop] = blender_object.data[prop]
# Seems now (from 4.2) the custom properties are Statically Typed
# so no need to copy them in that case, because overwriting them will crash
if len(blender_mesh.keys()) == 0:
# Copy custom properties
for prop in [p for p in blender_object.data.keys() if p not in BLACK_LIST]:
blender_mesh[prop] = blender_object.data[prop]
else:
# But we need to remove some properties that are not needed
for prop in [p for p in blender_object.data.keys() if p in BLACK_LIST]:
del blender_mesh[prop]

if export_settings['gltf_skins']:
# restore Armature modifiers
Expand Down

0 comments on commit a658dbc

Please sign in to comment.