diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 8 | ||||
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 31 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 23 | ||||
-rw-r--r-- | intern/cycles/blender/addon/version_update.py | 12 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 10 |
5 files changed, 22 insertions, 62 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 807dcaf7f43..69ad1321c1a 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -270,14 +270,14 @@ def list_render_passes(scene, srl): if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR') # Cryptomatte passes. - crypto_depth = (crl.pass_crypto_depth + 1) // 2 - if crl.use_pass_crypto_object: + crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2 + if srl.use_pass_cryptomatte_object: for i in range(0, crypto_depth): yield ("CryptoObject" + '{:02d}'.format(i), "RGBA", 'COLOR') - if crl.use_pass_crypto_material: + if srl.use_pass_cryptomatte_material: for i in range(0, crypto_depth): yield ("CryptoMaterial" + '{:02d}'.format(i), "RGBA", 'COLOR') - if srl.cycles.use_pass_crypto_asset: + if srl.use_pass_cryptomatte_asset: for i in range(0, crypto_depth): yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR') diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 054fd900419..0d861fde6fc 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1470,37 +1470,6 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup): default='RGB_ALBEDO_NORMAL', ) - use_pass_crypto_object: BoolProperty( - name="Cryptomatte Object", - description="Render cryptomatte object pass, for isolating objects in compositing", - default=False, - update=update_render_passes, - ) - use_pass_crypto_material: BoolProperty( - name="Cryptomatte Material", - description="Render cryptomatte material pass, for isolating materials in compositing", - default=False, - update=update_render_passes, - ) - use_pass_crypto_asset: BoolProperty( - name="Cryptomatte Asset", - description="Render cryptomatte asset pass, for isolating groups of objects with the same parent", - default=False, - update=update_render_passes, - ) - pass_crypto_depth: IntProperty( - name="Cryptomatte Levels", - description="Sets how many unique objects can be distinguished per pixel", - default=6, min=2, max=16, step=2, - update=update_render_passes, - ) - pass_crypto_accurate: BoolProperty( - name="Cryptomatte Accurate", - description="Generate a more accurate Cryptomatte pass. CPU only, may render slower and use more memory", - default=True, - update=update_render_passes, - ) - aovs: CollectionProperty( type=CyclesAOVPass, description="Custom render passes that can be output by shader nodes", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 6b88be3e7aa..aecdb3e7572 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -23,6 +23,7 @@ from bl_ui.utils import PresetPanel from bpy.types import Panel from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel +from bl_ui.properties_view_layer import VIEWLAYER_PT_layer_passes_cryptomatte class CYCLES_PT_sampling_presets(PresetPanel, Panel): @@ -885,31 +886,11 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel): col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion") -class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, Panel): +class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, VIEWLAYER_PT_layer_passes_cryptomatte): bl_label = "Cryptomatte" bl_context = "view_layer" bl_parent_id = "CYCLES_RENDER_PT_passes" - def draw(self, context): - import _cycles - - layout = self.layout - layout.use_property_split = True - layout.use_property_decorate = False - - cycles_view_layer = context.view_layer.cycles - - col = layout.column(heading="Include", align=True) - col.prop(cycles_view_layer, "use_pass_crypto_object", text="Object") - col.prop(cycles_view_layer, "use_pass_crypto_material", text="Material") - col.prop(cycles_view_layer, "use_pass_crypto_asset", text="Asset") - - layout.prop(cycles_view_layer, "pass_crypto_depth", text="Levels") - - row = layout.row(align=True) - row.active = use_cpu(context) - row.prop(cycles_view_layer, "pass_crypto_accurate", text="Accurate Mode") - class CYCLES_RENDER_PT_passes_debug(CyclesButtonsPanel, Panel): bl_label = "Debug" diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py index f7e3e693858..474d782ddfb 100644 --- a/intern/cycles/blender/addon/version_update.py +++ b/intern/cycles/blender/addon/version_update.py @@ -108,7 +108,7 @@ def do_versions(self): library_versions.setdefault(library.version, []).append(library) # Do versioning per library, since they might have different versions. - max_need_versioning = (2, 80, 41) + max_need_versioning = (2, 90, 0) for version, libraries in library_versions.items(): if version > max_need_versioning: continue @@ -194,6 +194,16 @@ def do_versions(self): if not cscene.is_property_set("sample_clamp_indirect"): cscene.sample_clamp_indirect = 0.0 + if version <= (2, 91, 0): + if scene.render.engine == 'CYCLES': + for view_layer in scene.view_layers: + cview_layer = view_layer.cycles + view_layer.use_pass_cryptomatte_object = cview_layer.get("use_pass_crypto_object") + view_layer.use_pass_cryptomatte_material = cview_layer.get("use_pass_crypto_material") + view_layer.use_pass_cryptomatte_asset = cview_layer.get("use_pass_crypto_asset") + view_layer.pass_cryptomatte_depth = cview_layer.get("pass_crypto_depth") + view_layer.use_pass_cryptomatte_accurate = cview_layer.get("pass_crypto_accurate") + # Lamps for light in bpy.data.lights: if light.library not in libraries: diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 94ff0ff1473..b830db7485b 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -667,10 +667,10 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, /* Cryptomatte stores two ID/weight pairs per RGBA layer. * User facing parameter is the number of pairs. */ - int crypto_depth = divide_up(min(16, get_int(crl, "pass_crypto_depth")), 2); + int crypto_depth = divide_up(min(16, b_view_layer.pass_cryptomatte_depth()), 2); scene->film->set_cryptomatte_depth(crypto_depth); CryptomatteType cryptomatte_passes = CRYPT_NONE; - if (get_boolean(crl, "use_pass_crypto_object")) { + if (b_view_layer.use_pass_cryptomatte_object()) { for (int i = 0; i < crypto_depth; i++) { string passname = cryptomatte_prefix + string_printf("Object%02d", i); b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str()); @@ -678,7 +678,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, } cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_OBJECT); } - if (get_boolean(crl, "use_pass_crypto_material")) { + if (b_view_layer.use_pass_cryptomatte_material()) { for (int i = 0; i < crypto_depth; i++) { string passname = cryptomatte_prefix + string_printf("Material%02d", i); b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str()); @@ -686,7 +686,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, } cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_MATERIAL); } - if (get_boolean(crl, "use_pass_crypto_asset")) { + if (b_view_layer.use_pass_cryptomatte_asset()) { for (int i = 0; i < crypto_depth; i++) { string passname = cryptomatte_prefix + string_printf("Asset%02d", i); b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str()); @@ -694,7 +694,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, } cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ASSET); } - if (get_boolean(crl, "pass_crypto_accurate") && cryptomatte_passes != CRYPT_NONE) { + if (b_view_layer.use_pass_cryptomatte_accurate() && cryptomatte_passes != CRYPT_NONE) { cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ACCURATE); } scene->film->set_cryptomatte_passes(cryptomatte_passes); |