Skip to content

Commit

Permalink
disable DEPTH AOV by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Theverat committed Feb 15, 2018
1 parent bdba93a commit b8ad8af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ def blendluxcore_exit():
def luxcore_load_post(_):
""" Note: the only argument Blender passes is always None """

# Update OpenCL devices if .blend is opened on a different computer than it was saved on
for scene in bpy.data.scenes:
# Update OpenCL devices if .blend is opened on
# a different computer than it was saved on
scene.luxcore.opencl.update_devices_if_necessary()

if pyluxcore.GetPlatformDesc().Get("compile.LUXRAYS_DISABLE_OPENCL").GetBool():
# OpenCL not available, make sure we are using CPU device
scene.luxcore.config.device = "CPU"

# Disable depth pass by default
if not scene.luxcore.aovs.depth:
scene.render.layers.active.use_pass_z = False

# Run converters for backwards compatibility
compatibility.run()

Expand Down
11 changes: 9 additions & 2 deletions properties/aovs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@

# Note: currently attached to scene because we don't support render layers
class LuxCoreAOVSettings(PropertyGroup):
def toggle_depth(self, context):
# Enable/disable Blender's Z pass along with our DEPTH AOV
# because we use the Blender-defined Z pass instead of a custom one
# (it is better integrated in the image editor)
context.scene.render.layers.active.use_pass_z = self.depth

# Basic Information
rgb = BoolProperty(name="RGB", default=False,
description="Raw RGB values (HDR)")
rgba = BoolProperty(name="RGBA", default=False,
description="Raw RGBA values (HDR)")
alpha = BoolProperty(name="Alpha", default=False,
description="Alpha value [0..1]")
depth = BoolProperty(name="Depth", default=True,
description="Distance from camera (Z-Pass)")
depth = BoolProperty(name="Depth", default=False,
description="Distance from camera (Z-Pass)",
update=toggle_depth)

# Material/Object Information
material_id = BoolProperty(name="Material ID", default=False,
Expand Down

0 comments on commit b8ad8af

Please sign in to comment.