import bpy from bpy.types import Panel from . import fn class RT_PT_render_toolbox_ui(Panel): bl_space_type = "NODE_EDITOR" bl_region_type = "UI" bl_category = "Render" # Wrangler bl_label = "Render Toolbox" def draw(self, context): layout = self.layout layout.operator("rt.create_output_layers", icon="NODE") layout.operator("rt.outputs_search_and_replace", text='Search and replace outputs', icon="BORDERMOVE") # layout.separator() # Base panel for drawing class RT_PT_visibility_check_ui_base(bpy.types.Panel): bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "View" bl_label = "Visibility Checks" bl_options = {'DEFAULT_CLOSED'} def draw_header_preset(self, context): layout = self.layout layout.operator('rt.scene_checker', text="", icon='CHECKMARK') #, depress=True def draw(self, context): layout = self.layout # layout.label(text="Visibily Checks:") layout.operator("rt.list_object_visibility_conflicts", icon="OBJECT_DATAMODE") layout.operator("rt.list_viewport_render_visibility", text="List Viewport Vs Render Visibility", icon="OBJECT_DATAMODE") layout.operator("rt.list_modifier_visibility", text="List Modifiers Visibility Conflicts", icon="MODIFIER") layout.operator("rt.list_collection_visibility_conflicts", text="List Collections Visibility Conflicts", icon="OUTLINER_COLLECTION") layout.separator() layout.operator("rt.list_object_affected_by_simplify", text="List Object Affected By Simplify", icon="MOD_SIMPLIFY") class RT_PT_visibility_check_ui_viewport(RT_PT_visibility_check_ui_base): bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "View" class RT_PT_visibility_check_ui_node(RT_PT_visibility_check_ui_base): bl_space_type = 'NODE_EDITOR' # bl_parent_id = "RT_PT_render_toolbox_ui" bl_region_type = 'UI' bl_category = "Render" # Wrangler ? class RT_PT_conformation_ui(bpy.types.Panel): bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "View" bl_label = "Conformation" bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout ## Show properties for outliner conformation layout.use_property_split = True layout.use_property_decorate = False # props = context.scene.render_toolbox_conform props = context.view_layer.render_toolbox_conform col = layout.column(align=True) col.prop(props, "hierarchy_type", text="Work On") # , expand=True # col.separator() col.prop(props, "target_name", text="Search") # (Optional) ## Show current target box = layout.box() tgt_row = box.row() if props.hierarchy_type == 'COLLECTION': ref_collection = fn.get_target_collection(props.target_name, context) if not ref_collection or ref_collection == context.scene.collection: layout.label(text="Select a collection or search by name", icon='INFO') if ref_collection == context.scene.collection: layout.label(text="Cannot use the scene collection", icon='ERROR') layout.label(text="An excluded collection collection cannot be active (use search)") return if not ref_collection: layout.label(text=f"Error: Collection '{ref_collection.name}' not found", icon='ERROR') return ref_vlc = fn.get_view_layer_collection(ref_collection) if not ref_vlc: layout.label(text=f"Error: Viewlayer Collection '{ref_collection.name}' not found", icon='ERROR') return # tgt_row = layout.row(align=True) # tgt_row.label(text="", icon='TRIA_RIGHT') tgt_row.label(text=ref_collection.name, icon='OUTLINER_COLLECTION') col.operator("rt.store_visibility_states", text='Store target State', icon="DISK_DRIVE") ## Show current collection state (behave badly when changed, should be tweaked before) # col = layout.column(align=True) row = tgt_row.row(align=True) row.prop(ref_vlc, "exclude", text="", emboss=False) row.prop(ref_collection, "hide_select", text="", emboss=False) row.prop(ref_vlc, "hide_viewport", text="", emboss=False) row.prop(ref_collection, "hide_viewport", text="", emboss=False) row.prop(ref_collection, "hide_render", text="", emboss=False) row.prop(ref_vlc, "holdout", text="", emboss=False) row.prop(ref_vlc, "indirect_only", text="", emboss=False) layout.prop(props, "affect_target", text="Target Items") layout.separator() col = layout.column(align=True) row = col.row(align=True) row.label(text="Parameter To Conform:") ## Same order, greyout unused options collec_row = row.row(align=True) collec_row.prop(props, "conform_exclude", text="", icon='CHECKBOX_DEHLT' if ref_vlc.exclude else 'CHECKBOX_HLT') # Exclude from View Layer collec_row.active = props.affect_target != 'OBJECT' ## Object and collections row.prop(props, "conform_selectability", text="", icon='RESTRICT_SELECT_ON' if ref_collection.hide_select else 'RESTRICT_SELECT_OFF') # Hide Select row.prop(props, "conform_viewlayer", text="", icon='HIDE_ON' if ref_vlc.hide_viewport else 'HIDE_OFF') # Hide in current viewlayer (eye) row.prop(props, "conform_viewport", text="", icon='RESTRICT_VIEW_ON' if ref_collection.hide_viewport else 'RESTRICT_VIEW_OFF') # Disable in Viewports row.prop(props, "conform_render", text="", icon='RESTRICT_RENDER_ON' if ref_collection.hide_render else 'RESTRICT_RENDER_OFF') # Disable in Renders ## Specific to collections collec_row = row.row(align=True) collec_row.prop(props, "conform_holdout", text="", icon='HOLDOUT_OFF') # Holdout collec_row.prop(props, "conform_use_indirect", text="", icon='INDIRECT_ONLY_OFF') # Indirect Only collec_row.active = props.affect_target != 'OBJECT' else: ref_obj = fn.get_target_object(props.target_name, context) if not ref_obj: layout.label(text="Make object active or search by name", icon='INFO') return # tgt_row = layout.row(align=True) # tgt_row.label(text="", icon='TRIA_RIGHT') tgt_row.label(text=ref_obj.name, icon='OBJECT_DATA') if not ref_obj.children_recursive: tgt_row.label(text="Object has no children", icon='ERROR') return layout.separator() ## Show current collection state (can behave badly when changed, should be tweaked before) # col = layout.column(align=True) row = tgt_row.row(align=True) # row.label(text="Reference Object State:") row.prop(ref_obj, "hide_select", text="", emboss=False) # row.prop(props, "active_object_viewlayer_hide", text="", icon='HIDE_ON' if ref_obj.hide_get() else 'HIDE_OFF', emboss=False) # hack row.label(text="", icon='HIDE_ON' if ref_obj.hide_get() else 'HIDE_OFF') # hack row.prop(ref_obj, "hide_viewport", text="", emboss=False) row.prop(ref_obj, "hide_render", text="", emboss=False) layout.separator() col = layout.column(align=True) row = col.row(align=True) row.label(text="Parameter To Conform:") row.prop(props, "conform_selectability", text="", icon='RESTRICT_SELECT_ON' if ref_obj.hide_select else 'RESTRICT_SELECT_OFF') # Hide Select row.prop(props, "conform_viewlayer", text="", icon='HIDE_ON' if ref_obj.hide_get() else 'HIDE_OFF') # Hide in current viewlayer (eye) row.prop(props, "conform_viewport", text="", icon='RESTRICT_VIEW_ON' if ref_obj.hide_viewport else 'RESTRICT_VIEW_OFF') # Disable in Viewports row.prop(props, "conform_render", text="", icon='RESTRICT_RENDER_ON' if ref_obj.hide_render else 'RESTRICT_RENDER_OFF') # Disable in Renders layout.operator("rt.conform_collection_hierarchy",text="Conform Hierarchy", icon="CHECKMARK") class RT_PT_outliner_state_ui(bpy.types.Panel): bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "View" bl_label = "Outliner State" bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "RT_PT_conformation_ui" def draw(self, context): layout = self.layout ## Outliner state ## Scene col = layout.column() col.operator("rt.store_visibility_states", text='Store Whole Viewlayer State', icon="DISK_DRIVE").collection_name = "ALL-SCENE-COLLECTION" stored_keys = context.scene.get('outliner_state', {}).keys() if stored_keys and 'ALL' in stored_keys: row = col.row(align=True) row.operator("rt.apply_visibility_states", text=f"Restore Viewlayer State", icon="OUTLINER").collection_name = "ALL-SCENE-COLLECTION" row.operator("rt.delete_visibility_states", text="", icon="TRASH").collection_name = 'ALL' col = layout.column() ## Specific collection if stored_keys: col.label(text="Collections State:") for key in stored_keys: if key == 'ALL': continue row = col.row(align=True) row.operator("rt.apply_visibility_states", text=f"Restore: {key}", icon="OUTLINER").collection_name = key row.operator("rt.delete_visibility_states", text="", icon="TRASH").collection_name = key ## Unused, only exposed in Create output panel # class RT_PT_output_template(Panel): # bl_space_type = "3D_VIEW" # bl_region_type = "UI" # bl_category = "Render" # Wrangler # bl_label = "File Output Templates" # bl_parent_id = "RT_PT_render_toolbox_ui" # # bl_options = {'DEFAULT_CLOSED'} # def draw(self, context): # layout = self.layout # settings = context.scene.render_toolbox # col = layout.column(align=True) # col.label(text='Single file:') # col.prop(settings, "default_base_path", text="Base Path") # col.prop(settings, "default_file_slot", text="File Slot") # col.separator() # col = layout.column(align=True) # col.label(text='Multilayers:') # col.prop(settings, "default_multilayer_base_path", text="Base Path") # col.prop(settings, "default_multilayer_name", text="Layer Name") # ## Handle separate tech passes names ? classes = ( RT_PT_render_toolbox_ui, RT_PT_visibility_check_ui_viewport, RT_PT_visibility_check_ui_node, RT_PT_conformation_ui, RT_PT_outliner_state_ui, # RT_PT_output_template, ) def register(): for cls in classes: bpy.utils.register_class(cls) def unregister(): for cls in reversed(classes): bpy.utils.unregister_class(cls)