本帖最后由 mccoy39082 于 2018-12-9 02:47 编辑
saiyaku的基础上增加了fsp标签和VSFilterMod标签的支持。
脚本文件:
tcaxPy.py
(46.24 KB, 下载次数: 1374)
差分文件:
diff_tcaxPy_tcaxPy_Dec-09-2018 02-39.zip
(25.67 KB, 下载次数: 1372)
- def fsp(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\fsp{0}'.format(A)
- def fsvp(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\fsvp{0}'.format(A)
- def frs(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\frs{0}'.format(A)
- def z(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\z{0}'.format(A)
- def distort(u1, v1, u2, v2, u3, v3):
- if u1 == int(u1) and v1 == int(v1) and u2 == int(u2) and v2 == int(v2) and u3 == int(u3) and v3 == int(v3):
- U1 = str(int(u1))
- V1 = str(int(v1))
- U2 = str(int(u2))
- V2 = str(int(v2))
- U3 = str(int(u3))
- V3 = str(int(v3))
- else:
- U1 = str(format(u1, '.2f'))
- V1 = str(format(v1, '.2f'))
- U2 = str(format(u2, '.2f'))
- V2 = str(format(v2, '.2f'))
- U3 = str(format(u3, '.2f'))
- V3 = str(format(v3, '.2f'))
- return '\\distort({0},{1},{2},{3},{4},{5})'.format(U1, V1, U2, V2, U3, V3)
- def rnd(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\rnd{0}'.format(A)
- def rndx(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\rndx{0}'.format(A)
- def rndy(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\rndy{0}'.format(A)
- def rndz(a):
- if a == int(a):
- A = str(int(a))
- else:
- A = str(format(a, '.2f'))
- return '\\rndz{0}'.format(A)
- def img1(path, x, y):
- if x == int(x) and y == int(y):
- X = str(int(x))
- Y = str(int(y))
- else:
- X = str(format(x, '.2f'))
- Y = str(format(y, '.2f'))
- return '\\1img({0},{1},{2})'.format(abspath(path), X, Y)
- def vcolor1(ct1, ct2, cb1, cb2): # note that c is a RGB string
- return '\\1vc(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(ct1, ct2, cb1, cb2)
- def vcolor2(ct1, ct2, cb1, cb2):
- return '\\2vc(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(ct1, ct2, cb1, cb2)
- def vcolor3(ct1, ct2, cb1, cb2):
- return '\\3vc(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(ct1, ct2, cb1, cb2)
- def vcolor4(ct1, ct2, cb1, cb2):
- return '\\4vc(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(ct1, ct2, cb1, cb2)
- def valpha1(at1, at2, ab1, ab2):
- return '\\1va(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(FmtHex(at1), FmtHex(at2), FmtHex(ab1), FmtHex(ab2))
- def valpha2(at1, at2, ab1, ab2):
- return '\\2va(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(FmtHex(at1), FmtHex(at2), FmtHex(ab1), FmtHex(ab2))
- def valpha3(at1, at2, ab1, ab2):
- return '\\3va(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(FmtHex(at1), FmtHex(at2), FmtHex(ab1), FmtHex(ab2))
- def valpha4(at1, at2, ab1, ab2):
- return '\\4va(&H{0}&,&H{1}&,&H{2}&,&H{3}&)'.format(FmtHex(at1), FmtHex(at2), FmtHex(ab1), FmtHex(ab2))
- def mover(x1, y1, x2, y2, a1, a2, r1, r2, t1 = None, t2 = None):
- if x1 == int(x1) and y1 == int(y1) and x2 == int(x2) and y2 == int(y2) and a1 == int(a1) and a2 == int(a2):
- X1 = str(int(x1))
- Y1 = str(int(y1))
- X2 = str(int(x2))
- Y2 = str(int(y2))
- A1 = str(int(a1))
- A2 = str(int(a2))
- R1 = str(int(r1))
- R2 = str(int(r2))
- else:
- X1 = str(format(x1, '.2f'))
- Y1 = str(format(y1, '.2f'))
- X2 = str(format(x2, '.2f'))
- Y2 = str(format(y2, '.2f'))
- A1 = str(format(a1, '.2f'))
- A2 = str(format(a2, '.2f'))
- R1 = str(format(r1, '.2f'))
- R2 = str(format(r2, '.2f'))
- if t2 == None:
- return '\\mover({0},{1},{2},{3},{4},{5},{6},{7})'.format(X1, Y1, X2, Y2, A1, A2, R1, R2)
- else:
- return '\\mover({0},{1},{2},{3},{4},{5},{6},{7},{8},{9})'.format(X1, Y1, X2, Y2, A1, A2, R1, R2, int(t1), int(t2))
- def moves3(x1, y1, x2, y2, x3, y3, t1 = None, t2 = None):
- if x1 == int(x1) and y1 == int(y1) and x2 == int(x2) and y2 == int(y2) and x3 == int(x3) and y3 == int(y3):
- X1 = str(int(x1))
- Y1 = str(int(y1))
- X2 = str(int(x2))
- Y2 = str(int(y2))
- X3 = str(int(x3))
- Y3 = str(int(y3))
- else:
- X1 = str(format(x1, '.2f'))
- Y1 = str(format(y1, '.2f'))
- X2 = str(format(x2, '.2f'))
- Y2 = str(format(y2, '.2f'))
- X3 = str(format(x3, '.2f'))
- Y3 = str(format(y3, '.2f'))
- if t2 == None:
- return '\\moves3({0},{1},{2},{3},{4},{5})'.format(X1, Y1, X2, Y2, X3, Y3)
- else:
- return '\\moves3({0},{1},{2},{3},{4},{5},{6},{7})'.format(X1, Y1, X2, Y2, X3, Y3, int(t1), int(t2))
- def moves4(x1, y1, x2, y2, x3, y3, x4, y4, t1 = None, t2 = None):
- if x1 == int(x1) and y1 == int(y1) and x2 == int(x2) and y2 == int(y2) and x3 == int(x3) and y3 == int(y3) and x4 == int(x4) and y4 == int(y4):
- X1 = str(int(x1))
- Y1 = str(int(y1))
- X2 = str(int(x2))
- Y2 = str(int(y2))
- X3 = str(int(x3))
- Y3 = str(int(y3))
- X4 = str(int(x4))
- Y4 = str(int(y4))
- else:
- X1 = str(format(x1, '.2f'))
- Y1 = str(format(y1, '.2f'))
- X2 = str(format(x2, '.2f'))
- Y2 = str(format(y2, '.2f'))
- X3 = str(format(x3, '.2f'))
- Y3 = str(format(y3, '.2f'))
- X4 = str(format(x4, '.2f'))
- Y4 = str(format(y4, '.2f'))
- if t2 == None:
- return '\\moves4({0},{1},{2},{3},{4},{5},{6},{7})'.format(X1, Y1, X2, Y2, X3, Y3, X4, Y4)
- else:
- return '\\moves4({0},{1},{2},{3},{4},{5},{6},{7},{8},{9})'.format(X1, Y1, X2, Y2, X3, Y3, X4, Y4, int(t1), int(t2))
- def movevc(x1, y1, x2, y2, t1 = None, t2 = None):
- if x1 == int(x1) and y1 == int(y1) and x2 == int(x2) and y2 == int(y2):
- X1 = str(int(x1))
- Y1 = str(int(y1))
- X2 = str(int(x2))
- Y2 = str(int(y2))
- else:
- X1 = str(format(x1, '.2f'))
- Y1 = str(format(y1, '.2f'))
- X2 = str(format(x2, '.2f'))
- Y2 = str(format(y2, '.2f'))
- if t2 == None:
- return '\\moves3({0},{1},{2},{3},{4},{5})'.format(X1, Y1, X2, Y2)
- else:
- return '\\moves3({0},{1},{2},{3},{4},{5},{6},{7})'.format(X1, Y1, X2, Y2, int(t1), int(t2))
- def jitter(left, right, top, bottom, period, seed=None):
- if left == int(left) and right == int(right) and top == int(top) and bottom == int(bottom) and period == int(period):
- L = str(int(left))
- R = str(int(right))
- T = str(int(top))
- B = str(int(bottom))
- P = str(int(period))
- else:
- L = str(format(left, '.2f'))
- R = str(format(right, '.2f'))
- T = str(format(top, '.2f'))
- B = str(format(bottom, '.2f'))
- P = str(format(period, '.2f'))
- if seed == None:
- return '\\jitter({0},{1},{2},{3},{4})'.format(L, R, T, B, P)
- else:
- if seed == int(seed):
- S = str(int(seed))
- else:
- S = str(format(seed, '.2f'))
- return '\\jitter({0},{1},{2},{3},{4},{5})'.format(L, R, T, B, P, S)
复制代码 |