viewlayer panel popup
0.5.4 - feat: button to popup a floating panel with viewlayer list for easy check/togglemain
parent
014df3c996
commit
ab1698730d
|
@ -14,6 +14,10 @@ Activate / deactivate layer opaticty according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
0.5.4
|
||||||
|
|
||||||
|
- feat: button to popup a floating panel with viewlayer list for easy check/toggle
|
||||||
|
|
||||||
0.5.3
|
0.5.3
|
||||||
|
|
||||||
- fix: manage output : activate only some viewlayer take context.scene instead of render.scene
|
- fix: manage output : activate only some viewlayer take context.scene instead of render.scene
|
||||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
||||||
"name": "GP Render",
|
"name": "GP Render",
|
||||||
"description": "Organise export of gp layers through compositor output",
|
"description": "Organise export of gp layers through compositor output",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (0, 5, 3),
|
"version": (0, 5, 4),
|
||||||
"blender": (2, 93, 0),
|
"blender": (2, 93, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
57
ui.py
57
ui.py
|
@ -53,10 +53,19 @@ class GPEXP_PT_gp_node_ui(Panel):
|
||||||
|
|
||||||
layout.label(text='View layers:')
|
layout.label(text='View layers:')
|
||||||
ct = len([n for n in context.scene.node_tree.nodes if n.type == 'R_LAYERS' and n.select])
|
ct = len([n for n in context.scene.node_tree.nodes if n.type == 'R_LAYERS' and n.select])
|
||||||
col = layout.column(align=True)
|
|
||||||
|
|
||||||
col.operator('gp.activate_only_selected_layers', text=f'Activate Only {ct} Layer Nodes')
|
# col = layout.column(align=True)
|
||||||
col.enabled = ct > 0
|
# row=col.row(align=True)
|
||||||
|
row=layout.row(align=True)
|
||||||
|
|
||||||
|
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"
|
||||||
|
# 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
|
||||||
|
|
||||||
if advanced:
|
if advanced:
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
|
@ -199,7 +208,6 @@ class GPEXP_PT_gp_dopesheet_ui(Panel):
|
||||||
|
|
||||||
|
|
||||||
class GPEXP_MT_multi_user_doc(bpy.types.Menu):
|
class GPEXP_MT_multi_user_doc(bpy.types.Menu):
|
||||||
# bl_idname = "OBJECT_MT_custom_menu"
|
|
||||||
bl_label = "Case of multiuser objects"
|
bl_label = "Case of multiuser objects"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
@ -218,6 +226,45 @@ class GPEXP_MT_multi_user_doc(bpy.types.Menu):
|
||||||
col.label(text='- search "Make single user"')
|
col.label(text='- search "Make single user"')
|
||||||
col.label(text='- tick only "object data"')
|
col.label(text='- tick only "object data"')
|
||||||
|
|
||||||
|
|
||||||
|
def viewlayer_layout(layout, context):
|
||||||
|
for vl in context.scene.view_layers:
|
||||||
|
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
|
||||||
|
# viewlayer_layout(layout, context)
|
||||||
|
|
||||||
|
class GPEXP_PT_viewlayers_ui(Panel):
|
||||||
|
bl_space_type = "NODE_EDITOR"
|
||||||
|
bl_region_type = "UI"
|
||||||
|
bl_label = "View Layers"
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
viewlayer_layout(layout, context)
|
||||||
|
|
||||||
|
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"}
|
||||||
|
|
||||||
|
|
||||||
## not registered for now (better to place render menu in GP dopesheet)
|
## not registered for now (better to place render menu in GP dopesheet)
|
||||||
def manager_ui(self, context):
|
def manager_ui(self, context):
|
||||||
'''appended to DATA_PT_gpencil_layers'''
|
'''appended to DATA_PT_gpencil_layers'''
|
||||||
|
@ -253,6 +300,8 @@ def manager_ui(self, context):
|
||||||
#-# REGISTER
|
#-# REGISTER
|
||||||
|
|
||||||
classes=(
|
classes=(
|
||||||
|
GPEXP_PT_viewlayers_ui,
|
||||||
|
GPEXP_OT_viewlayer_popup_invoke,
|
||||||
GPEXP_MT_multi_user_doc,
|
GPEXP_MT_multi_user_doc,
|
||||||
GPEXP_PT_gp_node_ui,
|
GPEXP_PT_gp_node_ui,
|
||||||
GPEXP_PT_gp_dopesheet_ui,
|
GPEXP_PT_gp_dopesheet_ui,
|
||||||
|
|
Loading…
Reference in New Issue