Skip to content

Commit

Permalink
Export Paper Model: fix ambient occlusion
Browse files Browse the repository at this point in the history
  • Loading branch information
addam committed Dec 22, 2021
1 parent c08568c commit 8e194b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions io_export_paper_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# This script is Free software. Please share and reuse.
# ♡2010-2020 Adam Dominec <[email protected]>
# ♡2010-2021 Adam Dominec <[email protected]>

## Code structure
# This file consists of several components, in this order:
Expand All @@ -13,7 +13,7 @@
"name": "Export Paper Model",
"author": "Addam Dominec",
"version": (1, 2),
"blender": (2, 83, 0),
"blender": (3, 0, 0),
"location": "File > Export > Paper Model",
"warning": "",
"description": "Export printable net of the active mesh",
Expand Down Expand Up @@ -253,7 +253,7 @@ def save(self, properties):
bk = rd.bake
recall = store_rna_properties(rd, bk, sce.cycles)
rd.engine = 'CYCLES'
for p in ('ambient_occlusion', 'color', 'diffuse', 'direct', 'emit', 'glossy', 'indirect', 'transmission'):
for p in ('color', 'diffuse', 'direct', 'emit', 'glossy', 'indirect', 'transmission'):
setattr(bk, f"use_pass_{p}", (properties.output_type != 'TEXTURE'))
lookup = {'TEXTURE': 'DIFFUSE', 'AMBIENT_OCCLUSION': 'AO', 'RENDER': 'COMBINED', 'SELECTED_TO_ACTIVE': 'COMBINED'}
sce.cycles.bake_type = lookup[properties.output_type]
Expand All @@ -266,7 +266,7 @@ def save(self, properties):
sce.cycles.samples = properties.bake_samples
if sce.cycles.bake_type == 'COMBINED':
bk.use_pass_direct, bk.use_pass_indirect = True, True
bk.use_pass_diffuse, bk.use_pass_glossy, bk.use_pass_transmission, bk.use_pass_ambient_occlusion, bk.use_pass_emit = True, False, False, True, True
bk.use_pass_diffuse, bk.use_pass_glossy, bk.use_pass_transmission, bk.use_pass_emit = True, False, False, True

if image_packing == 'PAGE_LINK':
self.mesh.save_image(printable_size * ppm, filepath)
Expand Down

0 comments on commit 8e194b4

Please sign in to comment.