Skip to content

Commit

Permalink
Fix indirect + ao bake
Browse files Browse the repository at this point in the history
  • Loading branch information
Naxela committed Mar 9, 2022
1 parent ad51429 commit ae1b910
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 14 additions & 1 deletion addon/utility/build.py
Expand Up @@ -30,7 +30,20 @@ def prepare_build(self=0, background_mode=False, shutdown_after_build=False):

print("Building lightmaps")

if bpy.context.scene.TLM_EngineProperties.tlm_lighting_mode == "combinedao":
if bpy.context.scene.TLM_EngineProperties.tlm_lighting_mode == "combinedao":

scene = bpy.context.scene

if not "tlm_plus_mode" in bpy.app.driver_namespace or bpy.app.driver_namespace["tlm_plus_mode"] == 0:
filepath = bpy.data.filepath
dirpath = os.path.join(os.path.dirname(bpy.data.filepath), scene.TLM_EngineProperties.tlm_lightmap_savedir)
if os.path.isdir(dirpath):
for file in os.listdir(dirpath):
os.remove(os.path.join(dirpath + "/" + file))
bpy.app.driver_namespace["tlm_plus_mode"] = 1
print("Plus Mode")

if bpy.context.scene.TLM_EngineProperties.tlm_lighting_mode == "indirectao":

scene = bpy.context.scene

Expand Down
4 changes: 3 additions & 1 deletion addon/utility/cycles/lightmap.py
Expand Up @@ -137,8 +137,10 @@ def bake(plus_pass=0):
print("IndirAO")

if bpy.app.driver_namespace["tlm_plus_mode"] == 1:
bpy.ops.object.bake(type="DIFFUSE", pass_filter={"DIRECT","INDIRECT"}, margin=scene.TLM_EngineProperties.tlm_dilation_margin, use_clear=False)
print("IndirAO: 1")
bpy.ops.object.bake(type="DIFFUSE", pass_filter={"INDIRECT"}, margin=scene.TLM_EngineProperties.tlm_dilation_margin, use_clear=False)
elif bpy.app.driver_namespace["tlm_plus_mode"] == 2:
print("IndirAO: 2")
bpy.ops.object.bake(type="AO", margin=scene.TLM_EngineProperties.tlm_dilation_margin, use_clear=False)

elif scene.TLM_EngineProperties.tlm_lighting_mode == "complete":
Expand Down

0 comments on commit ae1b910

Please sign in to comment.