fix numbering (inverted)

0.3.1

- fix: renumbering in the right order (since top layers are at bottom of file output)
- fix: renumering error for the last index
main
Pullusb 2021-09-21 19:14:15 +02:00
parent 556612664d
commit 3965a15922
3 changed files with 19 additions and 2 deletions

View File

@ -12,6 +12,11 @@ Activate / deactivate layer opaticty according to prefix
Activate / deactivate all masks using MA layers Activate / deactivate all masks using MA layers
--> -->
0.3.1
- fix: renumbering in the right order (since top layers are at bottom of file output)
- fix: renumering error for the last index
0.3.0 0.3.0
- fix: viewlayer exclude attribution error - fix: viewlayer exclude attribution error

View File

@ -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, 3, 0), "version": (0, 3, 1),
"blender": (2, 93, 0), "blender": (2, 93, 0),
"location": "View3D", "location": "View3D",
"warning": "", "warning": "",

14
fn.py
View File

@ -480,7 +480,12 @@ def delete_numbering(fo): # padding=3
new = '/'.join(elems) new = '/'.join(elems)
fs.path = new fs.path = new
def renumber_keep_existing(fo, offset=10): def reverse_fileout_inputs(fo):
count = len(fo.inputs)
for i in range(count):
fo.inputs.move(count-1, i)
def renumber_keep_existing(fo, offset=10, invert=True):
'''Renumber by keeping existing numbers and inserting new one whenever possible '''Renumber by keeping existing numbers and inserting new one whenever possible
Big and ugly function that do the trick nonetheless... Big and ugly function that do the trick nonetheless...
''' '''
@ -488,6 +493,9 @@ def renumber_keep_existing(fo, offset=10):
if fo.type != 'OUTPUT_FILE': return if fo.type != 'OUTPUT_FILE': return
ct = 10 ct = 10
if invert:
reverse_fileout_inputs(fo)
fsl = fo.file_slots fsl = fo.file_slots
last_idx = len(fsl) - 1 last_idx = len(fsl) - 1
@ -497,6 +505,8 @@ def renumber_keep_existing(fo, offset=10):
# print('-->', idx, fs.path) # print('-->', idx, fs.path)
if idx == last_idx: # handle last if idx == last_idx: # handle last
if get_num(fs) is not None:
break
if idx > 0: if idx > 0:
prev = fsl[idx-1] prev = fsl[idx-1]
num = get_num(prev) num = get_num(prev)
@ -565,6 +575,8 @@ def renumber_keep_existing(fo, offset=10):
prev = fs prev = fs
ct += offset ct += offset
if invert:
reverse_fileout_inputs(fo)
def has_channel_color(layer): def has_channel_color(layer):
'''Return True if gp_layer.channel_color is different than the default (0.2, 0.2, 0.2) ''' '''Return True if gp_layer.channel_color is different than the default (0.2, 0.2, 0.2) '''