Open enzyme69 opened 4 years ago
import bpy
import sys
from sys import maxsize
import re
# optional '-' to support negative numbers
_num_re = re.compile(r'-?\d+')
# number of chars in the largest possible int
_maxint_digits = len(str(maxsize))
# format for zero padding positive integers
_zero_pad_int_fmt = '{{0:0{0}d}}'.format(_maxint_digits)
# / is 0 - 1, so that negative numbers will come before positive
_zero_pad_neg_int_fmt = '/{{0:0{0}d}}'.format(_maxint_digits)
def _zero_pad(match):
n = int(match.group(0))
# if n is negative, we'll use the negative format and flip the number using
# maxint so that -2 comes before -1, ...
return _zero_pad_int_fmt.format(n) \
if n > -1 else _zero_pad_neg_int_fmt.format(n + maxint)
def zero_pad_numbers(s):
return _num_re.sub(_zero_pad, s)
# unordered = ['f0.svg', 'f1.svg', 'f5.svg','f12.svg', 'f10.svg']
ordered = sorted(unordered, key=zero_pad_numbers)
print(ordered)
# ordered
# ['file1.txt', 'file3.txt', 'file12.txt']
Animation Nodes help trigger drivers ON and OFF frame of COLLECTIONS to make an animation.
@enzyme69 I watched your youtube video about this. At 2:08 you mention a website, photop.com or something. I can't find it. Could you tell me what it is? Also, you don't explain how you import the SVG sequence into Blender. Did you import it one by one? Ever since I watched this presentation I wanted to the same in blender https://youtu.be/WvaZoOGHmzQ?t=590 In that case they used imported an .ai file sequence and converted it into an alembic file.
@foguetes it's Photopea
And I believe I keep the sequence in Layers and each layer become a single object.
Collections Flipbook Animation ON and OFF using Animation Nodes.
https://www.xormedia.com/natural-sort-order-with-zero-padding/
LOOOM_import_005.blend.zip