renumber and exclude layer use current scene

1.4.1

- added: expose button for output file de-numbering
- changed: denumbering and exclude layer based on current scene instead of render scene only
main
pullusb 2023-06-27 11:50:31 +02:00
parent f6be9c056d
commit 7abb626a05
5 changed files with 30 additions and 15 deletions

View File

@ -14,6 +14,11 @@ Activate / deactivate layer opacity according to prefix
Activate / deactivate all masks using MA layers
-->
1.4.1
- added: expose button for output file de-numbering
- changed: denumbering and exclude layer based on current scene instead of render scene only
1.4.0
- added: split selection to scenes individually

View File

@ -35,20 +35,23 @@ class GPEXP_OT_number_outputs(bpy.types.Operator):
return True
mode : bpy.props.StringProperty(default='SELECTED', options={'SKIP_SAVE'})
# ctrl : bpy.props.StringProperty(default=False, options={'SKIP_SAVE'}) # no need
clear : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
def invoke(self, context, event):
self.ctrl = event.ctrl
# use clear with Ctrl + Click
if event.ctrl:
self.clear = True
return self.execute(context)
def execute(self, context):
render = bpy.data.scenes.get('Render')
if not render:
print('SKIP, no Render scene')
return {"CANCELLED"}
scn = context.scene
# scn = bpy.data.scenes.get('Render')
# if not scn:
# print('SKIP, no Render scene')
# return {"CANCELLED"}
ct = 0
nodes = render.node_tree.nodes
nodes = scn.node_tree.nodes
for fo in nodes:
if fo.type != 'OUTPUT_FILE':
continue
@ -56,13 +59,13 @@ class GPEXP_OT_number_outputs(bpy.types.Operator):
continue
# print(f'numbering {fo.name}')
ct += 1
if self.ctrl:
if self.clear:
fn.delete_numbering(fo)
else:
fn.renumber_keep_existing(fo)
# fn.renumber(fo)
txt = 'de-numbered' if self.ctrl else 're-numbered'
txt = 'de-numbered' if self.clear else 're-numbered'
if ct:
self.report({'INFO'}, f'{ct} output nodes {txt}')
else:

View File

@ -308,10 +308,11 @@ class GPEXP_OT_remove_viewlayer_on_selected(bpy.types.Operator):
ob = context.object
## Force use of render scene (?)
rd_scn = bpy.data.scenes.get('Render')
if not rd_scn:
self.report({'ERROR'}, 'No render scene found')
return {'CANCELLED'}
rd_scn = context.scene
# rd_scn = bpy.data.scenes.get('Render')
# if not rd_scn:
# self.report({'ERROR'}, 'No render scene found')
# return {'CANCELLED'}
if self.remove_all_hidden:
if self.multi_object:

View File

@ -2,7 +2,7 @@ bl_info = {
"name": "GP Render",
"description": "Organise export of gp layers through compositor output",
"author": "Samuel Bernou",
"version": (1, 4, 0),
"version": (1, 4, 1),
"blender": (3, 0, 0),
"location": "View3D",
"warning": "",

8
ui.py
View File

@ -116,8 +116,14 @@ class GPEXP_PT_gp_node_ui(Panel):
txt = f'Renumber {ct} Selected Outputs'
subcol = col.column()
subcol.enabled = bool(ct)
subcol.operator('gp.number_outputs', icon='LINENUMBERS_ON', text=txt).mode = 'SELECTED'
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
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