Skip to content

Commit

Permalink
Fix headless mode for atlas mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Naxela committed Mar 16, 2021
1 parent 349e8c9 commit 8308f58
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions addon/utility/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,21 @@ def manage_build(background_pass=False):
for obj in bpy.context.scene.objects:
if obj.type == 'MESH' and obj.name in bpy.context.view_layer.objects:
if obj.TLM_ObjectProperties.tlm_mesh_lightmap_use:
img_name = obj.name + '_baked'
Lightmapimage = bpy.data.images[img_name]
obj["Lightmap"] = Lightmapimage.filepath_raw

if obj.TLM_ObjectProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroupA":
atlasName = obj.TLM_ObjectProperties.tlm_atlas_pointer
img_name = atlasName + '_baked'
Lightmapimage = bpy.data.images[img_name]
obj["Lightmap"] = Lightmapimage.filepath_raw
elif obj.TLM_ObjectProperties.tlm_postpack_object:
atlasName = obj.TLM_ObjectProperties.tlm_postatlas_pointer
img_name = atlasName + '_baked' + ".hdr"
Lightmapimage = bpy.data.images[img_name]
obj["Lightmap"] = Lightmapimage.filepath_raw
else:
img_name = obj.name + '_baked'
Lightmapimage = bpy.data.images[img_name]
obj["Lightmap"] = Lightmapimage.filepath_raw

for image in bpy.data.images:
if image.name.endswith("_baked"):
Expand Down

0 comments on commit 8308f58

Please sign in to comment.