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
-->
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
- fix: viewlayer exclude attribution error

View File

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

14
fn.py
View File

@ -480,13 +480,21 @@ def delete_numbering(fo): # padding=3
new = '/'.join(elems)
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
Big and ugly function that do the trick nonetheless...
'''
if fo.type != 'OUTPUT_FILE': return
ct = 10
if invert:
reverse_fileout_inputs(fo)
fsl = fo.file_slots
@ -497,6 +505,8 @@ def renumber_keep_existing(fo, offset=10):
# print('-->', idx, fs.path)
if idx == last_idx: # handle last
if get_num(fs) is not None:
break
if idx > 0:
prev = fsl[idx-1]
num = get_num(prev)
@ -565,6 +575,8 @@ def renumber_keep_existing(fo, offset=10):
prev = fs
ct += offset
if invert:
reverse_fileout_inputs(fo)
def has_channel_color(layer):
'''Return True if gp_layer.channel_color is different than the default (0.2, 0.2, 0.2) '''