2011-04-27 11:58:34 +00:00
|
|
|
#
|
2013-08-18 14:16:15 +00:00
|
|
|
# Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
#
|
2013-08-18 14:16:15 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
#
|
2013-08-18 14:16:15 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
#
|
2013-08-18 14:16:15 +00:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
2014-12-25 02:50:24 +01:00
|
|
|
# limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
#
|
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
# <pep8 compliant>
|
|
|
|
|
2013-01-15 23:17:45 +00:00
|
|
|
|
2015-07-20 11:08:50 +02:00
|
|
|
def _is_using_buggy_driver():
|
|
|
|
import bgl
|
|
|
|
# We need to be conservative here because in multi-GPU systems display card
|
|
|
|
# might be quite old, but others one might be just good.
|
|
|
|
#
|
|
|
|
# So We shouldn't disable possible good dedicated cards just because display
|
|
|
|
# card seems weak. And instead we only blacklist configurations which are
|
|
|
|
# proven to cause problems.
|
|
|
|
if bgl.glGetString(bgl.GL_VENDOR) == "ATI Technologies Inc.":
|
|
|
|
import re
|
|
|
|
version = bgl.glGetString(bgl.GL_VERSION)
|
|
|
|
if version.endswith("Compatibility Profile Context"):
|
|
|
|
# Old HD 4xxx and 5xxx series drivers did not have driver version
|
2015-09-14 02:21:15 +10:00
|
|
|
# in the version string, but those cards do not quite work and
|
|
|
|
# causing crashes.
|
2015-07-20 11:08:50 +02:00
|
|
|
return True
|
2020-03-16 16:16:15 +01:00
|
|
|
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\\.[0-9]+)+)$")
|
2015-07-20 11:08:50 +02:00
|
|
|
if not regex.match(version):
|
|
|
|
# Skip cards like FireGL
|
|
|
|
return False
|
|
|
|
version = regex.sub("\\1", version).split('.')
|
|
|
|
return int(version[0]) == 8
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
def _workaround_buggy_drivers():
|
|
|
|
if _is_using_buggy_driver():
|
2015-07-23 12:08:19 +02:00
|
|
|
import _cycles
|
|
|
|
if hasattr(_cycles, "opencl_disable"):
|
|
|
|
print("Cycles: OpenGL driver known to be buggy, disabling OpenCL platform.")
|
|
|
|
_cycles.opencl_disable()
|
2015-07-20 11:08:50 +02:00
|
|
|
|
2015-09-01 03:51:50 +10:00
|
|
|
|
2017-03-15 15:36:40 +01:00
|
|
|
def _configure_argument_parser():
|
|
|
|
import argparse
|
2018-07-27 11:34:52 +02:00
|
|
|
# No help because it conflicts with general Python scripts argument parsing
|
|
|
|
parser = argparse.ArgumentParser(description="Cycles Addon argument parser",
|
|
|
|
add_help=False)
|
2017-03-15 15:36:40 +01:00
|
|
|
parser.add_argument("--cycles-resumable-num-chunks",
|
|
|
|
help="Number of chunks to split sample range into",
|
|
|
|
default=None)
|
|
|
|
parser.add_argument("--cycles-resumable-current-chunk",
|
|
|
|
help="Current chunk of samples range to render",
|
|
|
|
default=None)
|
2017-03-15 15:52:27 +01:00
|
|
|
parser.add_argument("--cycles-resumable-start-chunk",
|
|
|
|
help="Start chunk to render",
|
|
|
|
default=None)
|
|
|
|
parser.add_argument("--cycles-resumable-end-chunk",
|
|
|
|
help="End chunk to render",
|
|
|
|
default=None)
|
2018-07-27 15:46:13 +02:00
|
|
|
parser.add_argument("--cycles-print-stats",
|
|
|
|
help="Print rendering statistics to stderr",
|
|
|
|
action='store_true')
|
2017-03-15 15:36:40 +01:00
|
|
|
return parser
|
|
|
|
|
|
|
|
|
2016-03-30 15:55:12 +02:00
|
|
|
def _parse_command_line():
|
|
|
|
import sys
|
|
|
|
|
|
|
|
argv = sys.argv
|
|
|
|
if "--" not in argv:
|
|
|
|
return
|
|
|
|
|
2017-03-15 15:36:40 +01:00
|
|
|
parser = _configure_argument_parser()
|
2018-11-26 09:26:38 +11:00
|
|
|
args, _ = parser.parse_known_args(argv[argv.index("--") + 1:])
|
2016-03-30 15:55:12 +02:00
|
|
|
|
2017-03-15 15:52:27 +01:00
|
|
|
if args.cycles_resumable_num_chunks is not None:
|
|
|
|
if args.cycles_resumable_current_chunk is not None:
|
|
|
|
import _cycles
|
|
|
|
_cycles.set_resumable_chunk(
|
2018-07-12 11:03:13 +02:00
|
|
|
int(args.cycles_resumable_num_chunks),
|
|
|
|
int(args.cycles_resumable_current_chunk),
|
|
|
|
)
|
2017-03-15 15:52:27 +01:00
|
|
|
elif args.cycles_resumable_start_chunk is not None and \
|
2018-07-12 11:03:13 +02:00
|
|
|
args.cycles_resumable_end_chunk:
|
2017-03-15 15:52:27 +01:00
|
|
|
import _cycles
|
|
|
|
_cycles.set_resumable_chunk_range(
|
2018-07-12 11:03:13 +02:00
|
|
|
int(args.cycles_resumable_num_chunks),
|
|
|
|
int(args.cycles_resumable_start_chunk),
|
|
|
|
int(args.cycles_resumable_end_chunk),
|
|
|
|
)
|
2018-07-27 15:46:13 +02:00
|
|
|
if args.cycles_print_stats:
|
|
|
|
import _cycles
|
|
|
|
_cycles.enable_print_stats()
|
2016-03-30 15:55:12 +02:00
|
|
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def init():
|
2012-12-13 08:45:55 +00:00
|
|
|
import bpy
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
2011-08-28 13:55:59 +00:00
|
|
|
import os.path
|
2011-09-09 12:04:39 +00:00
|
|
|
|
2015-09-14 02:21:15 +10:00
|
|
|
# Workaround possibly buggy legacy drivers which crashes on the OpenCL
|
2015-07-20 11:08:50 +02:00
|
|
|
# device enumeration.
|
|
|
|
#
|
|
|
|
# This checks are not really correct because they might still fail
|
|
|
|
# in the case of multiple GPUs. However, currently buggy drivers
|
|
|
|
# are really old and likely to be used in single GPU systems only
|
|
|
|
# anyway.
|
|
|
|
#
|
|
|
|
# Can't do it in the background mode, so we hope OpenCL is no enabled
|
|
|
|
# in the user preferences.
|
|
|
|
if not bpy.app.background:
|
|
|
|
_workaround_buggy_drivers()
|
|
|
|
|
2011-09-09 12:04:39 +00:00
|
|
|
path = os.path.dirname(__file__)
|
|
|
|
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
|
|
|
|
|
2015-02-18 21:16:52 +05:00
|
|
|
_cycles.init(path, user_path, bpy.app.background)
|
2016-03-30 15:55:12 +02:00
|
|
|
_parse_command_line()
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2016-08-01 11:54:02 +10:00
|
|
|
|
2016-02-07 03:40:41 +05:00
|
|
|
def exit():
|
|
|
|
import _cycles
|
|
|
|
_cycles.exit()
|
|
|
|
|
2016-08-01 11:54:02 +10:00
|
|
|
|
2018-05-23 12:13:21 +02:00
|
|
|
def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
2018-05-23 12:13:21 +02:00
|
|
|
import bpy
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
data = data.as_pointer()
|
2018-12-21 12:47:44 +11:00
|
|
|
prefs = bpy.context.preferences.as_pointer()
|
2019-09-12 10:25:39 +02:00
|
|
|
screen = 0
|
2011-08-28 13:55:59 +00:00
|
|
|
if region:
|
2019-09-11 08:22:53 +02:00
|
|
|
screen = region.id_data.as_pointer()
|
2011-08-28 13:55:59 +00:00
|
|
|
region = region.as_pointer()
|
|
|
|
if v3d:
|
2019-09-11 08:22:53 +02:00
|
|
|
screen = screen or v3d.id_data.as_pointer()
|
2011-08-28 13:55:59 +00:00
|
|
|
v3d = v3d.as_pointer()
|
|
|
|
if rv3d:
|
2019-09-11 08:22:53 +02:00
|
|
|
screen = screen or rv3d.id_data.as_pointer()
|
2011-08-28 13:55:59 +00:00
|
|
|
rv3d = rv3d.as_pointer()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2017-04-25 16:18:24 +02:00
|
|
|
engine.session = _cycles.create(
|
2019-09-11 08:22:53 +02:00
|
|
|
engine.as_pointer(), prefs, data, screen, region, v3d, rv3d, preview_osl)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def free(engine):
|
2011-11-15 02:58:01 +00:00
|
|
|
if hasattr(engine, "session"):
|
2011-08-28 13:55:59 +00:00
|
|
|
if engine.session:
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
|
|
|
_cycles.free(engine.session)
|
2011-08-28 13:55:59 +00:00
|
|
|
del engine.session
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2017-04-25 16:18:24 +02:00
|
|
|
def render(engine, depsgraph):
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
2011-11-27 03:49:09 +00:00
|
|
|
if hasattr(engine, "session"):
|
2018-02-26 16:46:48 +01:00
|
|
|
_cycles.render(engine.session, depsgraph.as_pointer())
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2018-02-26 16:46:48 +01:00
|
|
|
def bake(engine, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
|
2014-01-02 19:05:07 -02:00
|
|
|
import _cycles
|
|
|
|
session = getattr(engine, "session", None)
|
|
|
|
if session is not None:
|
2018-02-26 16:46:48 +01:00
|
|
|
_cycles.bake(engine.session, depsgraph.as_pointer(), obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
|
2014-01-02 19:05:07 -02:00
|
|
|
|
2014-07-22 12:03:15 +10:00
|
|
|
|
2018-05-23 12:13:21 +02:00
|
|
|
def reset(engine, data, depsgraph):
|
2012-11-09 08:46:53 +00:00
|
|
|
import _cycles
|
2018-05-23 12:13:21 +02:00
|
|
|
import bpy
|
|
|
|
|
|
|
|
if bpy.app.debug_value == 256:
|
2018-07-25 19:15:20 +02:00
|
|
|
_cycles.debug_flags_update(depsgraph.scene.as_pointer())
|
2018-05-23 12:13:21 +02:00
|
|
|
else:
|
|
|
|
_cycles.debug_flags_reset()
|
|
|
|
|
2012-11-09 08:46:53 +00:00
|
|
|
data = data.as_pointer()
|
2018-05-23 12:13:21 +02:00
|
|
|
depsgraph = depsgraph.as_pointer()
|
|
|
|
_cycles.reset(engine.session, data, depsgraph)
|
2012-11-09 08:46:53 +00:00
|
|
|
|
|
|
|
|
2018-05-23 12:13:21 +02:00
|
|
|
def sync(engine, depsgraph, data):
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
2018-02-26 16:46:48 +01:00
|
|
|
_cycles.sync(engine.session, depsgraph.as_pointer())
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2017-04-25 16:18:24 +02:00
|
|
|
def draw(engine, depsgraph, region, v3d, rv3d):
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
2017-04-25 16:18:24 +02:00
|
|
|
depsgraph = depsgraph.as_pointer()
|
2011-08-28 13:55:59 +00:00
|
|
|
v3d = v3d.as_pointer()
|
|
|
|
rv3d = rv3d.as_pointer()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-08-28 13:55:59 +00:00
|
|
|
# draw render image
|
2017-04-25 16:18:24 +02:00
|
|
|
_cycles.draw(engine.session, depsgraph, v3d, rv3d)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def available_devices():
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
|
|
|
return _cycles.available_devices()
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-11-15 02:58:01 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
def with_osl():
|
2011-12-24 02:47:13 +00:00
|
|
|
import _cycles
|
|
|
|
return _cycles.with_osl
|
2014-02-13 08:51:33 +11:00
|
|
|
|
|
|
|
|
2013-12-07 02:29:53 +01:00
|
|
|
def with_network():
|
|
|
|
import _cycles
|
|
|
|
return _cycles.with_network
|
2015-01-06 14:13:21 +05:00
|
|
|
|
2015-01-29 15:35:06 +11:00
|
|
|
|
2015-01-06 14:13:21 +05:00
|
|
|
def system_info():
|
|
|
|
import _cycles
|
|
|
|
return _cycles.system_info()
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
|
2019-12-04 19:57:28 +01:00
|
|
|
def list_render_passes(srl):
|
|
|
|
# Builtin Blender passes.
|
|
|
|
yield ("Combined", "RGBA", 'COLOR')
|
|
|
|
|
|
|
|
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
|
|
|
|
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
|
|
|
|
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR')
|
|
|
|
if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR')
|
|
|
|
if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR')
|
|
|
|
if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE')
|
|
|
|
if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE')
|
|
|
|
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_glossy_direct: yield ("GlossDir", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_glossy_indirect: yield ("GlossInd", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_glossy_color: yield ("GlossCol", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
|
|
|
|
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
|
|
|
|
|
|
|
|
# Cycles specific passes.
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
crl = srl.cycles
|
2019-12-04 19:57:28 +01:00
|
|
|
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
|
|
|
|
if crl.pass_debug_bvh_traversed_nodes: yield ("Debug BVH Traversed Nodes", "X", 'VALUE')
|
|
|
|
if crl.pass_debug_bvh_traversed_instances: yield ("Debug BVH Traversed Instances", "X", 'VALUE')
|
|
|
|
if crl.pass_debug_bvh_intersections: yield ("Debug BVH Intersections", "X", 'VALUE')
|
|
|
|
if crl.pass_debug_ray_bounces: yield ("Debug Ray Bounces", "X", 'VALUE')
|
2020-03-05 12:05:42 +01:00
|
|
|
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
|
2019-12-04 19:57:28 +01:00
|
|
|
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
|
|
|
|
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
|
|
|
|
|
|
|
|
# Cryptomatte passes.
|
2020-04-03 01:47:23 +02:00
|
|
|
crypto_depth = (crl.pass_crypto_depth + 1) // 2
|
2018-10-28 05:37:41 -04:00
|
|
|
if crl.use_pass_crypto_object:
|
2020-04-03 01:47:23 +02:00
|
|
|
for i in range(0, crypto_depth):
|
|
|
|
yield ("CryptoObject" + '{:02d}'.format(i), "RGBA", 'COLOR')
|
2018-10-28 05:37:41 -04:00
|
|
|
if crl.use_pass_crypto_material:
|
2020-04-03 01:47:23 +02:00
|
|
|
for i in range(0, crypto_depth):
|
|
|
|
yield ("CryptoMaterial" + '{:02d}'.format(i), "RGBA", 'COLOR')
|
2018-10-28 05:37:41 -04:00
|
|
|
if srl.cycles.use_pass_crypto_asset:
|
2020-04-03 01:47:23 +02:00
|
|
|
for i in range(0, crypto_depth):
|
|
|
|
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
|
2018-10-28 05:37:41 -04:00
|
|
|
|
2019-12-04 19:57:28 +01:00
|
|
|
# Denoising passes.
|
2018-10-29 15:45:58 +01:00
|
|
|
if crl.use_denoising or crl.denoising_store_passes:
|
2019-12-04 19:57:28 +01:00
|
|
|
yield ("Noisy Image", "RGBA", 'COLOR')
|
2018-08-30 23:28:10 +02:00
|
|
|
if crl.denoising_store_passes:
|
2019-12-04 19:57:28 +01:00
|
|
|
yield ("Denoising Normal", "XYZ", 'VECTOR')
|
|
|
|
yield ("Denoising Albedo", "RGB", 'COLOR')
|
|
|
|
yield ("Denoising Depth", "Z", 'VALUE')
|
|
|
|
yield ("Denoising Shadowing", "X", 'VALUE')
|
|
|
|
yield ("Denoising Variance", "RGB", 'COLOR')
|
|
|
|
yield ("Denoising Intensity", "X", 'VALUE')
|
2018-08-30 23:28:10 +02:00
|
|
|
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
|
|
|
|
"denoising_glossy_direct", "denoising_glossy_indirect",
|
2020-02-14 12:20:12 +01:00
|
|
|
"denoising_transmission_direct", "denoising_transmission_indirect")
|
2018-08-30 23:28:10 +02:00
|
|
|
if any(getattr(crl, option) for option in clean_options):
|
2019-12-04 19:57:28 +01:00
|
|
|
yield ("Denoising Clean", "RGB", 'COLOR')
|
|
|
|
|
|
|
|
# Custom AOV passes.
|
|
|
|
for aov in crl.aovs:
|
|
|
|
if aov.type == 'VALUE':
|
|
|
|
yield (aov.name, "X", 'VALUE')
|
|
|
|
else:
|
|
|
|
yield (aov.name, "RGBA", 'COLOR')
|
|
|
|
|
|
|
|
def register_passes(engine, scene, view_layer):
|
|
|
|
# Detect duplicate render pass names, first one wins.
|
|
|
|
listed = set()
|
|
|
|
for name, channelids, channeltype in list_render_passes(view_layer):
|
|
|
|
if name not in listed:
|
|
|
|
engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype)
|
|
|
|
listed.add(name)
|
|
|
|
|
|
|
|
def detect_conflicting_passes(view_layer):
|
|
|
|
# Detect conflicting render pass names for UI.
|
|
|
|
counter = {}
|
|
|
|
for name, _, _ in list_render_passes(view_layer):
|
|
|
|
counter[name] = counter.get(name, 0) + 1
|
|
|
|
|
|
|
|
for aov in view_layer.cycles.aovs:
|
|
|
|
if counter[aov.name] > 1:
|
|
|
|
aov.conflict = "Conflicts with another render pass with the same name"
|
|
|
|
else:
|
|
|
|
aov.conflict = ""
|