2021-09-07 23:11:42 +02:00
|
|
|
import bpy
|
|
|
|
from bpy.types import Panel
|
2023-01-17 16:50:42 +01:00
|
|
|
from pathlib import Path
|
2021-09-24 18:36:58 +02:00
|
|
|
from .prefs import get_addon_prefs
|
2024-04-16 18:01:10 +02:00
|
|
|
from .constant import RD_SCENE_NAME
|
2021-09-07 23:11:42 +02:00
|
|
|
# from .preferences import get_addon_prefs
|
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
# Node view panel
|
2021-09-07 23:11:42 +02:00
|
|
|
class GPEXP_PT_gp_node_ui(Panel):
|
2021-09-16 12:14:14 +02:00
|
|
|
bl_space_type = "NODE_EDITOR"
|
2021-09-07 23:11:42 +02:00
|
|
|
bl_region_type = "UI"
|
2021-09-16 12:14:14 +02:00
|
|
|
# bl_category = "View"
|
|
|
|
bl_category = "GP render"
|
2021-09-07 23:11:42 +02:00
|
|
|
bl_label = "Gpencil Render Manager"
|
|
|
|
|
|
|
|
def draw(self, context):
|
2021-09-24 18:36:58 +02:00
|
|
|
prefs = get_addon_prefs()
|
|
|
|
advanced = prefs.advanced
|
2021-09-14 18:54:30 +02:00
|
|
|
layout = self.layout
|
2024-04-16 18:01:10 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator('gp.render_scene_switch', icon='SCENE_DATA', text='Switch Scene')
|
|
|
|
|
|
|
|
## Check if there is another scene reference current scene in it's comp renderlayers
|
|
|
|
## If so, expose a button to go in (expensive check ?)
|
|
|
|
node_scn = next((s for s in bpy.data.scenes
|
|
|
|
if s != context.scene and s.use_nodes
|
|
|
|
and next((n for n in s.node_tree.nodes if n.type == 'R_LAYERS' and n.scene == context.scene), None)
|
|
|
|
),None)
|
|
|
|
if node_scn:
|
|
|
|
row.operator('gp.render_scene_switch', icon='NODETREE', text='Node Scene').scene = node_scn.name
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-22 15:01:49 +02:00
|
|
|
scn = context.scene
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-22 15:01:49 +02:00
|
|
|
## Camera swapping
|
|
|
|
row = layout.row()
|
|
|
|
cam = scn.camera
|
|
|
|
if cam:
|
2023-01-18 14:28:27 +01:00
|
|
|
text = f'{cam.name} : {scn.render.resolution_x}x{scn.render.resolution_y}' # Cam:
|
2021-09-22 15:01:49 +02:00
|
|
|
else:
|
2023-01-18 14:28:27 +01:00
|
|
|
text = f'None' # Cam:
|
2021-09-22 15:01:49 +02:00
|
|
|
|
|
|
|
# if cam and cam_name == 'draw_cam':
|
|
|
|
# cam_name = f'{cam.parent.name} > {cam_name}'
|
|
|
|
row.operator("gp.swap_render_cams", text=text, icon='OUTLINER_OB_CAMERA')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
# Live checks
|
|
|
|
if scn.render.resolution_percentage != 100:
|
|
|
|
layout.label(text='Res Percentage not 100%', icon='ERROR')
|
|
|
|
layout.prop(scn.render, 'resolution_percentage')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
exclude_count = len([vl for vl in scn.view_layers if not vl.use and vl.name not in {'View Layer', 'exclude'}])
|
|
|
|
if exclude_count:
|
|
|
|
# layout.label(text=f'{exclude_count} Excluded View Layers !')
|
|
|
|
layout.operator('gp.enable_all_viewlayers', text=f'Reactivate {exclude_count} Excluded View Layers')
|
|
|
|
|
2021-09-24 18:36:58 +02:00
|
|
|
|
2021-09-22 18:35:52 +02:00
|
|
|
if not scn.use_nodes or not scn.node_tree:
|
|
|
|
return
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-24 18:36:58 +02:00
|
|
|
disabled_output = [n for n in scn.node_tree.nodes if n.type == 'OUTPUT_FILE' and n.mute]
|
|
|
|
if disabled_output:
|
2021-10-08 18:21:27 +02:00
|
|
|
output_ct = len([n for n in scn.node_tree.nodes if n.type == 'OUTPUT_FILE'])
|
|
|
|
layout.label(text=f'{len(disabled_output)}/{output_ct} Output Muted', icon='INFO')
|
2021-09-10 18:32:50 +02:00
|
|
|
|
2021-09-22 18:35:52 +02:00
|
|
|
layout.separator()
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
layout.label(text='View layers:')
|
2021-09-08 18:29:10 +02:00
|
|
|
ct = len([n for n in context.scene.node_tree.nodes if n.type == 'R_LAYERS' and n.select])
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-10-08 17:01:33 +02:00
|
|
|
# col = layout.column(align=True)
|
|
|
|
# row=col.row(align=True)
|
|
|
|
row=layout.row(align=True)
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-10-08 17:01:33 +02:00
|
|
|
row1 = row.row(align=True)
|
|
|
|
row1.operator('gp.activate_only_selected_layers', text=f'Activate Only {ct} Layer Nodes')
|
|
|
|
row1.enabled = ct > 0
|
|
|
|
|
|
|
|
row2=row.row(align=True)
|
|
|
|
row2.operator("wm.call_panel", text="", icon='RENDERLAYERS').name = "GPEXP_PT_viewlayers_ui"
|
2021-11-12 15:42:32 +01:00
|
|
|
row2.operator("wm.call_panel", text="", icon='SCENE_DATA').name = "GPEXP_PT_viewlayers_multi_ui"
|
2021-10-08 17:01:33 +02:00
|
|
|
# row2.operator("gp.viewlayer_popup", text="", icon='RENDERLAYERS') # Ops invoke hack
|
|
|
|
# row2.operator("wm.call_menu", text="", icon='RENDERLAYERS').name = "GPEXP_MT_viewlayers_popup" # Bad menu
|
2021-09-23 19:14:48 +02:00
|
|
|
|
2021-09-24 18:36:58 +02:00
|
|
|
if advanced:
|
|
|
|
col = layout.column(align=True)
|
|
|
|
txt = f'Merge {ct} Layer Nodes'
|
|
|
|
col.operator('gp.merge_selected_viewlayer_nodes', icon='NODETREE', text=txt).disconnect = True
|
|
|
|
col.operator('gp.merge_selected_viewlayer_nodes', icon='NODETREE', text='Merge (keep connect)').disconnect = False
|
|
|
|
col.enabled = ct > 1
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
layout.separator()
|
|
|
|
col = layout.column()
|
|
|
|
subcol = col.column()
|
|
|
|
n = context.scene.node_tree.nodes.active
|
|
|
|
if n:
|
|
|
|
subcol.enabled = n and n.type == 'R_LAYERS' and not n.outputs[0].is_linked
|
|
|
|
else:
|
|
|
|
subcol.enabled = False
|
|
|
|
|
|
|
|
subcol.operator('gp.reconnect_render_layer', icon='ANIM', text=f'Reconnect {ct} Layer Node')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
col.operator('gp.delete_render_layer', icon='TRACKING_CLEAR_FORWARDS', text=f'Delete {ct} Layer Node')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
layout.separator()
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-10 18:32:50 +02:00
|
|
|
layout.label(text='All Outputs:')
|
2021-09-08 18:29:10 +02:00
|
|
|
row=layout.row()
|
|
|
|
row.operator('gp.mute_toggle_output_nodes', icon='NODE_INSERT_ON', text='Mute').mute = True
|
|
|
|
row.operator('gp.mute_toggle_output_nodes', icon='NODE_INSERT_OFF', text='Unmute').mute = False
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-10 18:32:50 +02:00
|
|
|
layout.separator()
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-10 18:32:50 +02:00
|
|
|
col=layout.column()
|
|
|
|
col.label(text='Clean and updates:')
|
2021-09-24 18:36:58 +02:00
|
|
|
|
2021-09-15 18:28:16 +02:00
|
|
|
|
2021-09-23 19:14:48 +02:00
|
|
|
col.separator()
|
2021-09-10 18:32:50 +02:00
|
|
|
|
|
|
|
col.operator('gp.clean_compo_tree', icon='BRUSHES_ALL', text='Clean Nodes') # NODE_CORNER
|
2021-10-25 16:02:11 +02:00
|
|
|
col.operator('gp.reset_render_settings', icon='SCENE', text='Reset All Scenes Render Settings')
|
2022-01-26 16:32:33 +01:00
|
|
|
col.operator('gp.check_render_scene', icon='PRESET', text='Check For Problems')
|
2021-09-10 18:32:50 +02:00
|
|
|
|
|
|
|
col.separator()
|
2021-09-14 18:54:30 +02:00
|
|
|
|
|
|
|
## (re)number exports
|
|
|
|
ct = len([n for n in context.scene.node_tree.nodes if n.type == 'OUTPUT_FILE' and n.select])
|
2021-09-22 12:06:40 +02:00
|
|
|
txt = f'Renumber {ct} Selected Outputs'
|
2021-09-14 18:54:30 +02:00
|
|
|
subcol = col.column()
|
|
|
|
subcol.enabled = bool(ct)
|
2023-04-04 11:09:00 +02:00
|
|
|
|
2023-06-27 11:50:31 +02:00
|
|
|
row = subcol.row(align=True)
|
|
|
|
row.operator('gp.number_outputs', icon='LINENUMBERS_ON', text=txt).mode = 'SELECTED'
|
|
|
|
op = row.operator('gp.number_outputs', icon='X', text='')
|
|
|
|
op.mode = 'SELECTED'
|
|
|
|
op.clear = True
|
|
|
|
|
|
|
|
## Set / remove preview
|
2023-04-04 11:09:00 +02:00
|
|
|
row=layout.row(align=True)
|
|
|
|
row.operator('gp.merge_preview_ouput', icon='NODETREE', text='Set Preview')
|
|
|
|
row.operator('gp.merge_preview_ouput', icon='X', text='').clear = True
|
2021-09-22 12:06:40 +02:00
|
|
|
# subcol.operator('gp.normalize_outnames', icon='SYNTAX_OFF', text=f'Normalize Paths {ct} Selected Ouptut') # not ready
|
2021-09-14 18:54:30 +02:00
|
|
|
# col.operator('gp.number_outputs', icon='LINENUMBERS_ON', text='Renumber all outputs').mode = 'ALL'
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-24 18:36:58 +02:00
|
|
|
if advanced:
|
|
|
|
subcol.operator('gp.set_output_node_format', icon='OUTPUT', text='Copy Active Output Format')
|
2021-12-16 19:10:00 +01:00
|
|
|
subcol.operator('gp.set_active_fileout_to_compout', icon='OUTPUT', text='Active Slot to Composite')
|
|
|
|
|
2024-01-16 16:55:07 +01:00
|
|
|
col.operator('gp.connect_selected_to_file_out', icon='OUTPUT', text='Connect Selection To Ouput')
|
2022-01-26 16:32:33 +01:00
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
col=layout.column()
|
2021-09-10 18:32:50 +02:00
|
|
|
col.label(text='Delete Options:')
|
2021-09-24 18:36:58 +02:00
|
|
|
if advanced:
|
|
|
|
col.operator('gp.clear_render_tree', icon='X', text='Clear Framed Nodes')
|
2021-09-16 00:19:57 +02:00
|
|
|
col.operator('gp.clear_render_tree', icon='X', text='Clear & Delete Render Scene').mode = "COMPLETE"
|
2021-09-10 18:32:50 +02:00
|
|
|
|
2021-09-30 18:51:49 +02:00
|
|
|
layout.separator()
|
2021-10-25 16:02:11 +02:00
|
|
|
layout.label(text='Scenes:')
|
2023-06-26 18:11:17 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator('gp.split_to_scene', icon='DUPLICATE', text='Split Selection To Scene').mode = 'ALL'
|
|
|
|
row.operator('gp.split_to_scene', text='Split Individually').mode = 'INDIVIDUAL'
|
2021-09-30 18:51:49 +02:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2021-10-13 19:00:15 +02:00
|
|
|
row.operator('gp.set_crop_from_selection', icon='CON_OBJECTSOLVER', text='Autoset Crop')
|
2021-09-30 18:51:49 +02:00
|
|
|
row.operator('gp.export_crop_coord_to_json', icon='FILE', text='Export json')
|
|
|
|
|
2021-10-25 16:02:11 +02:00
|
|
|
layout.label(text='Render:')
|
2021-10-21 19:55:41 +02:00
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator('gp.render_selected_scenes', icon='RENDER_ANIMATION', text='Render Selected Scene')
|
2021-10-25 16:02:11 +02:00
|
|
|
row.operator('gp.bg_render_script_selected_scenes', icon='TEXT', text='Gen Batch')
|
2021-10-21 19:55:41 +02:00
|
|
|
# row.operator('gp.render_all_scenes', icon='RENDER_ANIMATION', text='Render All')
|
2021-09-30 18:51:49 +02:00
|
|
|
|
2022-01-26 16:32:33 +01:00
|
|
|
if advanced:
|
|
|
|
layout.separator()
|
|
|
|
col = layout.column()
|
|
|
|
col.label(text='Post-Render:')
|
|
|
|
col.operator('gp.renumber_files_on_disk', icon='FILE', text='Renumber Files On Disk')
|
|
|
|
|
2024-04-16 18:01:10 +02:00
|
|
|
layout.prop(context.scene.gp_render_settings, 'use_aa', text='Use Native AA Settings')
|
2021-09-24 18:36:58 +02:00
|
|
|
layout.prop(prefs, 'advanced', text='Show Advanced Options')
|
2021-09-07 23:11:42 +02:00
|
|
|
# layout.operator('gp.add_object_to_render', icon='RENDERLAYERS', text='Layer To Render').mode = 'ALL'
|
|
|
|
# layout.operator('gp.add_object_to_render', icon='RENDERLAYERS', text='Layer To Render').mode = 'SELECTED'
|
2021-09-08 18:29:10 +02:00
|
|
|
|
2021-09-07 23:11:42 +02:00
|
|
|
# layout.operator('gp.merge_layers', icon='X', text='Merge selected nodes')
|
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
class GPEXP_PT_gp_dopesheet_ui(Panel):
|
|
|
|
bl_space_type = 'DOPESHEET_EDITOR'
|
|
|
|
bl_region_type = 'UI'
|
2021-09-16 00:19:57 +02:00
|
|
|
bl_category = "GP Render"
|
|
|
|
# bl_parent_id='DOPESHEET_PT_gpencil_mode'
|
2021-09-08 18:29:10 +02:00
|
|
|
bl_label = "Gpencil Render Manager"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return context.object and context.object.type == 'GPENCIL'
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2024-04-16 18:01:10 +02:00
|
|
|
settings = context.scene.gp_render_settings
|
|
|
|
|
|
|
|
icon = 'DISCLOSURE_TRI_DOWN' if settings.show_scene_setup else 'DISCLOSURE_TRI_RIGHT'
|
|
|
|
col = layout.column()
|
|
|
|
col.prop(settings, 'show_scene_setup', icon=icon, text='Scenes Setup', emboss=False )
|
|
|
|
if settings.show_scene_setup:
|
|
|
|
col.prop(settings, 'render_scene', icon='SCENE_DATA', placeholder=RD_SCENE_NAME)
|
|
|
|
|
|
|
|
nodetree_placeholder = settings.render_scene or RD_SCENE_NAME
|
|
|
|
col.prop(settings, 'node_scene', icon='NODETREE', placeholder=nodetree_placeholder)
|
|
|
|
|
|
|
|
op = layout.operator('gp_export.render_auto_build')
|
|
|
|
op.node_scene = settings.node_scene
|
2022-12-19 20:15:11 +01:00
|
|
|
|
2021-09-16 00:19:57 +02:00
|
|
|
if context.object:
|
2021-09-16 12:14:14 +02:00
|
|
|
layout.label(text=f'Object: {context.object.name}')
|
2021-09-16 00:19:57 +02:00
|
|
|
if context.object.data.users > 1:
|
|
|
|
row = layout.row()
|
|
|
|
row.label(text=f'Multiple users ({context.object.data.users})', icon='ERROR')
|
|
|
|
row.operator("wm.call_menu", text="", icon='QUESTION').name = "GPEXP_MT_multi_user_doc"
|
2021-10-27 18:53:39 +02:00
|
|
|
if context.object.data.layers.active:
|
|
|
|
layout.label(text=f'viewlayer: {context.object.data.layers.active.viewlayer_render}')
|
|
|
|
else:
|
|
|
|
layout.label(text=f'No active layer found')
|
|
|
|
layout.label(text=f'(Active dopesheet layer not in active obj)')
|
2021-09-16 00:19:57 +02:00
|
|
|
|
2021-09-14 18:54:30 +02:00
|
|
|
## On layers
|
2022-01-22 19:13:11 +01:00
|
|
|
col = layout.column()
|
2022-02-07 16:05:47 +01:00
|
|
|
col.operator('gp.select_layer_in_comp', icon='RESTRICT_SELECT_OFF', text='Select Nodes')
|
2021-09-14 18:54:30 +02:00
|
|
|
if context.object and context.object.type == 'GPENCIL':
|
|
|
|
txt = f'{len([l for l in context.object.data.layers if l.select])} Layer(s) To Render'
|
|
|
|
else:
|
|
|
|
txt = 'Layer To Render'
|
2024-04-16 18:01:10 +02:00
|
|
|
|
|
|
|
op = col.operator('gp.add_layer_to_render', icon='RENDERLAYERS', text=txt)
|
|
|
|
op.node_scene = settings.node_scene
|
2021-09-14 18:54:30 +02:00
|
|
|
|
2021-09-16 12:14:14 +02:00
|
|
|
|
2021-09-14 18:54:30 +02:00
|
|
|
# merge (only accessible if multiple layers selected)
|
2022-01-22 19:13:11 +01:00
|
|
|
row = col.row()
|
2021-09-08 18:29:10 +02:00
|
|
|
ct = len([l for l in context.object.data.layers if l.select])
|
|
|
|
txt = f'Merge {ct} layers'
|
|
|
|
# merge layers from dopesheet
|
2023-06-07 17:31:38 +02:00
|
|
|
row.operator('gp.merge_viewlayers_to_active', text=txt, icon='SELECT_EXTEND').multi_object_merge = True
|
|
|
|
ct = len([l for ob in context.selected_objects if ob.type == 'GPENCIL' for l in ob.data.layers if l.select])
|
|
|
|
txt = f'Multi: {ct} layers'
|
|
|
|
row.operator('gp.merge_viewlayers_to_active', text=txt, icon='SELECT_EXTEND').multi_object_merge = True
|
2021-09-14 18:54:30 +02:00
|
|
|
row.enabled= ct > 1
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2023-01-06 15:10:10 +01:00
|
|
|
col.operator('gpexp.auto_merge_adjacent_prefix', icon='SELECT_EXTEND')
|
2023-06-08 12:39:39 +02:00
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.remove_viewlayer_on_selected', text=f'Exclude {ct} layers', icon='X').remove_all_hidden = False
|
|
|
|
row.operator('gp.remove_viewlayer_on_selected', text='', icon='HIDE_ON').remove_all_hidden = True
|
2021-09-07 23:11:42 +02:00
|
|
|
|
2021-09-16 00:19:57 +02:00
|
|
|
## all and objects
|
2021-09-16 12:14:14 +02:00
|
|
|
layout.separator()
|
2021-09-17 16:31:26 +02:00
|
|
|
|
2022-01-22 19:13:11 +01:00
|
|
|
col = layout.column()
|
|
|
|
col.label(text='Whole Objects:')
|
2023-06-27 17:28:36 +02:00
|
|
|
txt = f'{len([o for o in context.selected_objects if o.type == "GPENCIL" and o.select_get()])} Selected Object(s) To Render'
|
2024-04-16 18:01:10 +02:00
|
|
|
|
|
|
|
op = col.operator('gp.add_object_to_render', icon='RENDERLAYERS', text=txt)
|
|
|
|
op.mode='SELECTED'
|
|
|
|
op.node_scene = settings.node_scene
|
|
|
|
|
|
|
|
op = col.operator('gp.add_object_to_render', icon='RENDERLAYERS', text='All Visible GP To Render')
|
|
|
|
op.mode='ALL'
|
|
|
|
op.node_scene = settings.node_scene
|
2021-09-16 00:19:57 +02:00
|
|
|
|
2021-09-17 16:31:26 +02:00
|
|
|
layout.separator()
|
2022-01-22 19:13:11 +01:00
|
|
|
col = layout.column()
|
|
|
|
col.label(text='Fixes:')
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.auto_number_object', icon='OBJECT_DATAMODE', text='Renumber Objects')
|
|
|
|
row.operator('gp.auto_number_object', icon='X', text='').delete = True
|
|
|
|
col.operator('gp.lower_layers_name', icon='SYNTAX_OFF', text='Rename Lowercase')
|
2022-01-26 16:32:33 +01:00
|
|
|
col.operator('gp.export_infos_for_compo', icon='FILE', text='Export Layers Infos') # Not really need, called in Check layers invoke
|
2024-09-06 17:55:04 +02:00
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator('gp.layers_state', icon='CHECKMARK', text='Check layers')
|
|
|
|
row.operator('gp.restore_layers_state', icon='DECORATE_OVERRIDE', text='')
|
|
|
|
|
2022-01-24 13:15:59 +01:00
|
|
|
col.operator('gp.check_masks', icon='MOD_MASK', text='Has Masks')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-17 16:31:26 +02:00
|
|
|
# row = layout.row()
|
|
|
|
layout.prop(bpy.context.preferences.edit, 'use_anim_channel_group_colors')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2021-09-24 18:36:58 +02:00
|
|
|
layout.separator()
|
2023-06-29 18:15:59 +02:00
|
|
|
|
|
|
|
# row.operator('gp.export_as_pdf', icon='RENDER_STILL', text='Render All to PDF Sequences')
|
|
|
|
layout.label(text='Render All To Vector:')
|
|
|
|
col= layout.column()
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.export_as_pdf', icon='RENDER_STILL', text='PDF Sequences').export_type = 'pdf_sequence'
|
|
|
|
row.operator('gp.export_as_pdf', icon='RENDER_STILL', text='PDF File').export_type = 'pdf'
|
|
|
|
col.operator('gp.export_as_pdf', icon='RENDER_STILL', text='SWF File').export_type = 'swf'
|
2021-09-24 18:36:58 +02:00
|
|
|
|
2023-01-18 14:28:27 +01:00
|
|
|
if bpy.app.version < (3,0,0):
|
2023-06-29 18:15:59 +02:00
|
|
|
col.label(text='Not Blender 3.0.0+ !')
|
2023-01-18 14:28:27 +01:00
|
|
|
|
2023-01-17 16:50:42 +01:00
|
|
|
## Append GP Render workspace (usefull for user with disabled 'load_UI')
|
|
|
|
if not bpy.data.workspaces.get('GP Render'):
|
|
|
|
layout.operator('gp.set_gp_render_workspace')
|
2021-09-17 16:31:26 +02:00
|
|
|
|
2021-09-16 00:19:57 +02:00
|
|
|
|
|
|
|
class GPEXP_MT_multi_user_doc(bpy.types.Menu):
|
|
|
|
bl_label = "Case of multiuser objects"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
# call another menu
|
|
|
|
#layout.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
|
|
|
|
#**Behavior from context mode**
|
|
|
|
col = layout.column()
|
|
|
|
col.label(text='Multi user data will be rendered all together on last generated viewlayers.', icon='INFO')
|
|
|
|
col.label(text='Make them single user if needed to render separately.')
|
|
|
|
# col.label(text='Select objects > call search pop-up (F3) > "Make single user" > tick "object data" > ok')
|
|
|
|
col.label(text='Procedure:')
|
|
|
|
|
|
|
|
col.label(text='- select concerned objects')
|
|
|
|
col.label(text='- call search pop-up (F3)')
|
|
|
|
col.label(text='- search "Make single user"')
|
|
|
|
col.label(text='- tick only "object data"')
|
|
|
|
|
2021-10-08 17:01:33 +02:00
|
|
|
|
2021-11-12 15:42:32 +01:00
|
|
|
def viewlayer_layout(layout, scn):
|
|
|
|
for vl in scn.view_layers:
|
2021-10-08 17:01:33 +02:00
|
|
|
row = layout.row()
|
|
|
|
row.prop(vl, 'use', text=vl.name, icon='RESTRICT_RENDER_OFF' if vl.use else 'RESTRICT_RENDER_ON', emboss=False, toggle=0)
|
|
|
|
# row.prop(vl, 'use', text=vl.name, icon='RESTRICT_RENDER_OFF', emboss=False)
|
|
|
|
|
|
|
|
## Can only toggle one with a menu
|
|
|
|
# class GPEXP_MT_viewlayers_popup(bpy.types.Menu):
|
|
|
|
# bl_label = "View Layers"
|
|
|
|
# def draw(self, context):
|
|
|
|
# layout = self.layout
|
2023-01-18 14:28:27 +01:00
|
|
|
# viewlayer_layout(layout, context)
|
2021-10-08 17:01:33 +02:00
|
|
|
|
|
|
|
class GPEXP_PT_viewlayers_ui(Panel):
|
|
|
|
bl_space_type = "NODE_EDITOR"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_label = "View Layers"
|
2021-11-12 15:42:32 +01:00
|
|
|
|
2021-10-08 17:01:33 +02:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2021-10-08 17:46:50 +02:00
|
|
|
layout.label(text=f'{context.scene.name} :: View layers')
|
2021-11-12 15:42:32 +01:00
|
|
|
col = layout.column(align=True)
|
|
|
|
viewlayer_layout(col, context.scene)
|
|
|
|
|
|
|
|
class GPEXP_PT_viewlayers_multi_ui(Panel):
|
|
|
|
bl_space_type = "NODE_EDITOR"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_label = "Multi View Layers"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.label(text=f'{len(bpy.data.scenes)} scenes :: View layers')
|
|
|
|
for s in bpy.data.scenes:
|
|
|
|
col = layout.column()
|
|
|
|
col.label(text=f'{s.name}::')
|
|
|
|
viewlayer_layout(col, s)
|
|
|
|
layout.separator()
|
2021-10-08 17:01:33 +02:00
|
|
|
|
|
|
|
class GPEXP_OT_viewlayer_popup_invoke(bpy.types.Operator):
|
|
|
|
bl_idname = "gp.viewlayer_popup"
|
|
|
|
bl_label = "Viewlayer Popup"
|
|
|
|
bl_description = "Pop up menu for toggling viewlayers"
|
|
|
|
bl_options = {"REGISTER",}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return context.window_manager.invoke_props_dialog(self)
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
viewlayer_layout(layout, context)
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
return {"FINISHED"}
|
|
|
|
|
|
|
|
|
2021-09-16 00:19:57 +02:00
|
|
|
## not registered for now (better to place render menu in GP dopesheet)
|
2021-09-07 23:11:42 +02:00
|
|
|
def manager_ui(self, context):
|
|
|
|
'''appended to DATA_PT_gpencil_layers'''
|
|
|
|
|
|
|
|
layout = self.layout
|
2021-09-08 18:29:10 +02:00
|
|
|
|
|
|
|
## On layers
|
2021-09-07 23:11:42 +02:00
|
|
|
if context.object and context.object.type == 'GPENCIL':
|
|
|
|
txt = f'{len([l for l in context.object.data.layers if l.select])} Layer(s) To Render'
|
|
|
|
else:
|
|
|
|
txt = 'Layer To Render'
|
|
|
|
layout.operator('gp.add_layer_to_render', icon='RENDERLAYERS', text=txt)
|
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
## On objects
|
|
|
|
# txt = 'Selected Object To Render'
|
2024-04-16 18:01:10 +02:00
|
|
|
# if context.scene.name != RD_SCENE_NAME:
|
|
|
|
txt = f'{len([o for o in context.selected_objects if o.type == "GPENCIL" and o.select_get()])} Selected Object(s) To Render'
|
|
|
|
layout.operator('gp.add_object_to_render', icon='RENDERLAYERS', text=txt).mode='SELECTED'
|
|
|
|
|
2021-09-07 23:11:42 +02:00
|
|
|
layout.operator('gp.add_object_to_render', icon='RENDERLAYERS', text='All GP at once').mode='ALL'
|
|
|
|
|
2021-09-08 18:29:10 +02:00
|
|
|
|
2021-09-07 23:11:42 +02:00
|
|
|
# ## function to append in a menu
|
|
|
|
# def palette_manager_menu(self, context):
|
|
|
|
# """Palette menu to append in existing menu"""
|
|
|
|
# # GPENCIL_MT_material_context_menu
|
|
|
|
# layout = self.layout
|
|
|
|
# # {'EDIT_GPENCIL', 'PAINT_GPENCIL','SCULPT_GPENCIL','WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
|
|
|
|
# layout.separator()
|
|
|
|
# prefs = get_addon_prefs()
|
|
|
|
|
|
|
|
# layout.operator("", text='do stuff from material submenu', icon='MATERIAL')
|
|
|
|
|
|
|
|
#-# REGISTER
|
|
|
|
|
|
|
|
classes=(
|
2021-10-08 17:01:33 +02:00
|
|
|
GPEXP_PT_viewlayers_ui,
|
2021-11-12 15:42:32 +01:00
|
|
|
GPEXP_PT_viewlayers_multi_ui,
|
2021-10-08 17:01:33 +02:00
|
|
|
GPEXP_OT_viewlayer_popup_invoke,
|
2021-09-16 00:19:57 +02:00
|
|
|
GPEXP_MT_multi_user_doc,
|
2021-09-07 23:11:42 +02:00
|
|
|
GPEXP_PT_gp_node_ui,
|
2021-09-08 18:29:10 +02:00
|
|
|
GPEXP_PT_gp_dopesheet_ui,
|
2021-09-07 23:11:42 +02:00
|
|
|
)
|
|
|
|
|
2023-01-18 14:28:27 +01:00
|
|
|
def register():
|
2021-09-07 23:11:42 +02:00
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.register_class(cls)
|
2021-09-16 00:19:57 +02:00
|
|
|
# bpy.types.DATA_PT_gpencil_layers.prepend(manager_ui)
|
2021-09-07 23:11:42 +02:00
|
|
|
|
|
|
|
def unregister():
|
2021-09-16 00:19:57 +02:00
|
|
|
# bpy.types.DATA_PT_gpencil_layers.remove(manager_ui)
|
2021-09-07 23:11:42 +02:00
|
|
|
for cls in reversed(classes):
|
|
|
|
bpy.utils.unregister_class(cls)
|