Fix stale packed textures in summit marker export
This commit is contained in:
@@ -15,6 +15,16 @@ for obj in [marker,*marker.children_recursive]:obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active=marker
|
||||
location=marker.location.copy();marker.location=(0,0,0)
|
||||
photo_body=bpy.data.objects.get('Photo matched summit boulder')
|
||||
# Repacking an already-packed image after baking can retain its old PNG bytes.
|
||||
# Refresh from the saved bake before glTF copies those bytes into the GLB.
|
||||
if photo_body and photo_body.get('paintedInscription'):
|
||||
images={n.image for mat in photo_body.data.materials for n in mat.node_tree.nodes
|
||||
if n.type=='TEX_IMAGE' and n.image and n.image.filepath}
|
||||
for image in images:
|
||||
path=Path(bpy.path.abspath(image.filepath))
|
||||
data=path.read_bytes()
|
||||
image.pack(data=data,data_len=len(data))
|
||||
image.reload()
|
||||
restore=None
|
||||
if photo_body and not photo_body.get('paintedInscription'):
|
||||
mat=photo_body.data.materials[0]
|
||||
|
||||
Reference in New Issue
Block a user