From a353352f1d1a589094ac07bac11e48dab49d6700 Mon Sep 17 00:00:00 2001 From: eze Date: Wed, 24 Nov 2021 08:07:19 -0500 Subject: [PATCH] Lightgroup components and extra outputs --- startup/gui/outputs.py | 135 ++++++++++++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 35 deletions(-) diff --git a/startup/gui/outputs.py b/startup/gui/outputs.py index 10e6210..e54053f 100644 --- a/startup/gui/outputs.py +++ b/startup/gui/outputs.py @@ -13,63 +13,128 @@ # If Arnold isn't available for any reason, this will fail # and we won't add any unnecessary output definitions. import GafferArnold - - for lightgroup in [ - 'lightgroup_a', - 'lightgroup_a_denoise', - 'lightgroup_b', - 'lightgroup_b_denoise', - 'lightgroup_c', - 'lightgroup_c_denoise', - 'lightgroup_d', - 'lightgroup_d_denoise', - 'lightgroup_e', - 'lightgroup_e_denoise', - 'lightgroup_f', - 'lightgroup_f_denoise', - 'lightgroup_g', - 'lightgroup_g_denoise', - 'lightgroup_h', - 'lightgroup_h_denoise', - 'lightgroup_i', - 'lightgroup_i_denoise' - ]: - label = lightgroup.replace( "_", " " ).title().replace( " ", "_" ) - - lightgroup_letter = lightgroup.replace("_denoise","").split("_")[1] - data="C.*[V]" %(lightgroup_letter) - - interactive_plugs = { + interactive_plugs = { "driverType" : "ClientDisplayDriver", "displayHost" : "localhost", "displayPort" : "${image:catalogue:port}", "remoteDisplayType" : "GafferImage::GafferDisplayDriver", "filter" : "box" } - batch_plugs = { - } + batch_plugs = { + } + + lightgroup_list = [ + 'lightgroup_a', + 'lightgroup_b', + 'lightgroup_c', + 'lightgroup_d', + 'lightgroup_e', + 'lightgroup_f', + 'lightgroup_g', + 'lightgroup_h', + 'lightgroup_i', + 'lightgroup_j', + 'lightgroup_k'] + #'lightgroup_l', + #'lightgroup_m', + #'lightgroup_n', + #'lightgroup_o', + #'lightgroup_p', + #'lightgroup_q', + #'lightgroup_r' + #'lightgroup_s', + #'lightgroup_t', + #'lightgroup_v', + #'lightgroup_w', + #'lightgroup_x', + #'lightgroup_y', + #'lightgroup_z']""" + + lightgroup_components = { + "specular_direct":"lpe C", + "specular_indirect":"lpe C[DSVOB].*", + "diffuse_direct":"lpe C", + "diffuse_indirect":"lpe C[DSVOB].*", + "sss":"lpe C.*", + "volume":"lpe CV.*" + } - if "denoise" in lightgroup: - interactive_plugs['filter'] = 'denoise_optix' - batch_plugs['filter'] = 'denoise_optix' + for lightgroup in lightgroup_list: + label = lightgroup.replace( "_", " " ).title().replace( " ", "_" ) + + lightgroup_letter = lightgroup.split("_")[1] + # Main Lightgroups OUTPUT GafferScene.Outputs.registerOutput( "Interactive/Arnold/" + label, IECoreScene.Output( lightgroup, "ieDisplay", - "lpe " + data, + "lpe " + "C.*[V]" %(lightgroup_letter), interactive_plugs ) ) - GafferScene.Outputs.registerOutput( "Batch/Arnold/" + label, IECoreScene.Output( "${project:rootDirectory}/renders/${script:name}/%s/%s.####.exr" % ( lightgroup, lightgroup ), "exr", - "lpe " + data, + "lpe " + "C.*[V]" %(lightgroup_letter), batch_plugs ) ) + # Lightgroups Components Outputs + for component in lightgroup_components.keys(): + component_label = label + "_" + component + component_name = lightgroup + "_" + component + data = lightgroup_components[component].replace("lightgroup", lightgroup_letter) + GafferScene.Outputs.registerOutput( + "Interactive/Arnold/" + component_label, + IECoreScene.Output( + component_name, + "ieDisplay", + data, + interactive_plugs + ) + ) + GafferScene.Outputs.registerOutput( + "Batch/Arnold/" + component_label, + IECoreScene.Output( + "${project:rootDirectory}/renders/${script:name}/%s/%s.####.exr" % ( component_name, component_name ), + "exr", + data, + batch_plugs + ) + ) + + # Other custom outputs + custom_outputs = { + "denoise_albedo":"denoise_albedo", + "emission_indirect":"lpe C.O", + "Pref":"Pref vector", + "raycount":"raycount float", + "nlights":"color nlights", + "cputime":"cputime float" + } + + for output in custom_outputs.keys(): + label = output.replace( "_", " " ).title().replace( " ", "_" ) + GafferScene.Outputs.registerOutput( + "Interactive/Arnold/" + label, + IECoreScene.Output( + output, + "ieDisplay", + custom_outputs[output], + interactive_plugs + ) + ) + GafferScene.Outputs.registerOutput( + "Batch/Arnold/" + label, + IECoreScene.Output( + "${project:rootDirectory}/renders/${script:name}/%s/%s.####.exr" % ( output, output ), + "exr", + custom_outputs[output], + batch_plugs + ) + )