Skip to content

Commit

Permalink
Add fixes for background baking atlas groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Naxela committed Jun 1, 2023
1 parent 6ddaa60 commit ad2a4f3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions addon/utility/cycles/lightmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,19 @@ def bake(plus_pass=0):
bpy.ops.object.bake(type="DIFFUSE", pass_filter={"DIRECT","INDIRECT"}, margin=scene.TLM_EngineProperties.tlm_dilation_margin, use_clear=False)

#Save between baking (to avoid lost textures)
for image in bpy.data.images:
if image.name.startswith(obj.name):
print("Saving texture " + image.name)
image.save()
#TODO! ATLASGROUP!

if obj.TLM_ObjectProperties.tlm_mesh_lightmap_unwrap_mode == "AtlasGroupA" or obj.TLM_ObjectProperties.tlm_postpack_object:
for image in bpy.data.images:
if image.name != "Render Result":
image.file_format = "HDR"
image.save() #FIX
else:
for image in bpy.data.images:
if image.name.startswith(obj.name):
print("Saving texture " + image.name)
image.file_format = "HDR"
image.save()

bpy.ops.object.select_all(action='DESELECT')
currentIterNum = currentIterNum + 1
Expand Down

0 comments on commit ad2a4f3

Please sign in to comment.