TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua
标题:
TypeError: 'NoneType' object is not subscriptable
[打印本页]
作者:
Alex
时间:
2022-1-9 00:17:29
标题:
TypeError: 'NoneType' object is not subscriptable
本帖最后由 Alex 于 2022-2-7 22:48 编辑
Hi, I trying to use Bezier function which is in util.tcCurve but I got an error
from tcaxPy import *
from util.tcCurve import *
def tcaxPy_Init():
global _Fs
global _FD
global _Spacing
global Font
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Spacing = GetVal(val_Spacing)
Font = InitFont(_FontFileName, _FaceID, _Fs, _Spacing, GetVal(val_SpaceScale), MakeRGB(255, 255, 255), 0, False)
def tcaxPy_Fin():
FinFont(Font)
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = []
TCAS_BUF = []
dx = _x - int((_a + _Spacing) / 2 + 0.5)
dy = _y - int(_Fs / 2 + 0.5)
EFT = move(_x, _y,_x, _y) + fad(90, 0) + shad(0) + bord(0)
ass_main(ASS_BUF, SubL(_start, _end, 3), EFT, _txt)
PIX = TextPix(Font,_txt)
points = PixPoints(PIX)
pt_num = len(points)
dx = _x - int((_a + _Spacing) / 2 + 0.5) + PIX[0][0]
dy = _y - int(_Fs / 2 + 0.5) + PIX[0][1] + 1
inix = dx - randint(15, 30)
tab_posx = (inix + randint(-40, 40), inix + randint(-130, 130), inix + randint(-130, 130), inix + randint(-40, 40))
tab_posy = (dy + _Fs + randint(-15, 20), _y + randint(-100, 100), _y + randint(-110, 110), dy + randint(-15, 20))
Points = [(tab_posx[0] + randint(-15, 15), tab_posy[0]), (tab_posx[3] + randint(-15, 15), tab_posy[3]), (tab_posx[1] + randint(-20, 20), tab_posy[1]), (tab_posx[2] + randint(-20, 20), tab_posy[2])]
posb = []
for i in range(pt_num ):
indice_text = randint(0, pt_num - 1)
indice_pos = randint(0, pt_num - 1)
x = dx + points[i][0]
y = dy + points[i][1]
PP= posb.append(Bezier(Points,pt_num))
x_fin = PP[i][0]
y_fin = PP[i][1]
rand_ini = randint(50, 400)
ts = _start + _elapk + _j * 2.5
te = ts + _k + 70 + _j * 2.5
rand_end = 10 * (te - ts)
EFT = move(x, y, x_fin, y_fin, rand_ini, rand_end) + fad(0, randint(90,150)) + color1(col) + shad(0) + bord(0) + alpha(255 - points[indice_text][2])
ass_main(ASS_BUF, SubL(ts, te, 0, Pix_Style), EFT, PixPt())
return (ASS_BUF, TCAS_BUF)
复制代码
图片附件:
Capture.PNG
(2022-1-9 00:19:05, 20.1 KB) / 下载次数 1710
http://tcax.org/forum.php?mod=attachment&aid=MjgzOXxiYzE2ZTU1NnwxNzMyMjA1MDU4fDB8MA%3D%3D
作者:
Alex
时间:
2022-1-9 00:26:47
?????
作者:
Alex
时间:
2022-2-7 23:34:07
本帖最后由 Alex 于 2022-2-7 23:59 编辑
I just fixed the error but the pixels not moving in curve?
There's an issue with position!! move(165,39,
-135665737821,-21123381180
,348,930)
PP.zip
(171.21 KB, 下载次数: 2289)
2022-2-7 23:58:56 上传
下载次数: 2289
from tcaxPy import *
from util.tcCurve import *
def tcaxPy_Init():
global _Fs
global _FD
global _Spacing
global Font
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Spacing = GetVal(val_Spacing)
Font = InitFont(_FontFileName, _FaceID, _Fs, _Spacing, GetVal(val_SpaceScale), MakeRGB(255, 255, 255), 0, False)
def tcaxPy_Fin():
FinFont(Font)
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = []
TCAS_BUF = []
dx = _x - int((_a + _Spacing) / 2 + 0.5)
dy = _y - int(_Fs / 2 + 0.5)
EFT = move(_x, _y,_x, _y) + fad(90, 0) + shad(0) + bord(0)
ass_main(ASS_BUF, SubL(_start, _start+ _elapk, 3), EFT, _txt)
PIX = TextPix(Font,_txt)
points = PixPoints(PIX)
pt_num = len(points)
dx = _x - int((_a + _Spacing) / 2 + 0.5) + PIX[0][0]
dy = _y - int(_Fs / 2 + 0.5) + PIX[0][1] + 1
inix = dx - randint(15, 30)
tab_posx = (inix + randint(-40, 40), inix + randint(-130, 130), inix + randint(-130, 130), inix + randint(-40, 40))
tab_posy = (dy + _Fs + randint(-15, 20), _y + randint(-100, 100), _y + randint(-110, 110), dy + randint(-15, 20))
Points = [(tab_posx[0] + randint(-15, 15), tab_posy[0]), (tab_posx[3] + randint(-15, 15), tab_posy[3]), (tab_posx[1] + randint(-20, 20), tab_posy[1]), (tab_posx[2] + randint(-20, 20), tab_posy[2])]
posb = []
for i in range(pt_num ):
indice_text = randint(0, pt_num - 1)
indice_pos = randint(0, pt_num - 1)
x = dx + points[i][0]
y = dy + points[i][1]
posb.append(Bezier(Points,pt_num))
x_fin = posb[i ][0]
y_fin = posb[i][1]
rand_ini = randint(50, 400)
ts = _start + _elapk + _j * 2.5
te = ts + _k + 70 + _j * 2.5
rand_end = 10 * (te - ts)
EFT = move(x, y, x_fin, y_fin, rand_ini, rand_end) + shad(0) + bord(0) + alpha(255 - points[indice_text][2])
ass_main(ASS_BUF, SubL(ts, te, 0, Pix_Style), EFT, PixPt())
return (ASS_BUF, TCAS_BUF)
复制代码
附件:
PP.zip
(2022-2-7 23:58:56, 171.21 KB) / 下载次数 2289
http://tcax.org/forum.php?mod=attachment&aid=Mjg5MnxlZTBjMzFiNnwxNzMyMjA1MDU4fDB8MA%3D%3D
作者:
milkyjing
时间:
2022-2-10 22:11:04
for ref.
http://www.tcax.org/forum.php?mod=viewthread&tid=382
and
http://www.tcax.org/forum.php?mod=viewthread&tid=178
作者:
Alex
时间:
2022-2-11 01:02:44
本帖最后由 Alex 于 2022-2-11 01:07 编辑
Thanks for responding Milky
I have looked at the links that you have mentioned it as ref , still there's an issue with the pixels movement in the bezi
test1.zip
(73.02 KB, 下载次数: 2285)
2022-2-11 01:05:49 上传
下载次数: 2285
from tcaxPy import *
from util.tcCurve import *
from util.gdiFont import *
def tcaxPy_Init():
global _Fs
global _FD
global _Spacing
global Font
global GdiFont
_Fs = GetVal(val_FontSize)
_FD = 1000 / GetVal(val_FXFPS)
_FontFileName = GetVal(val_FontFileName)
_FaceID = GetVal(val_FaceID)
_Spacing = GetVal(val_Spacing)
GdiFont = gfInitFont(GetVal(val_FontFaceName), _Fs, _Spacing, GetVal(val_SpaceScale), 0, False)
def tcaxPy_Fin():
gfFinFont(GdiFont)
def tcaxPy_Main(_i, _j, _n, _start, _end, _elapk, _k, _x, _y, _a, _txt):
ASS_BUF = []
TCAS_BUF = []
dx = _x - int((_a + _Spacing) / 2 + 0.5)
dy = _y - int(_Fs / 2 + 0.5)
EFT = move(_x, _y,_x, _y) + fad(90, 0) + shad(0) + bord(0)
ass_main(ASS_BUF, SubL(_start, _start+ _elapk, 3), EFT, _txt)
points = gfGetPoints(GdiFont, _txt)
pt_num = len(points)
dx = _x - int((_a + _Spacing) / 2 + 0.5)
dy = _y - int(_Fs / 2 + 0.5)
inix = dx - randint(15, 30)
tab_posx = (inix + randint(-40, 40), inix + randint(-130, 130), inix + randint(-130, 130), inix + randint(-40, 40))
tab_posy = (dy + _Fs + randint(-15, 20), _y + randint(-100, 100), _y + randint(-110, 110), dy + randint(-15, 20))
maxi = int(tab_posy[0] - tab_posy[3]) + 90
Points = [(tab_posx[0] + randint(-15, 15), tab_posy[0]), (tab_posx[3] + randint(-15, 15), tab_posy[3]), (tab_posx[1] + randint(-20, 20), tab_posy[1]), (tab_posx[2] + randint(-20, 20), tab_posy[2])]
bucle = max(pt_num, maxi)
posb = []
for i in range(pt_num):
indice_text = randint(0, pt_num - 1)
indice_pos = randint(0, maxi - 1)
x = dx + points[indice_text][0]
y = dy + points[indice_text][1]
posb.append(Bezier(Points,pt_num))
x_fin = posb[i][0]
y_fin = posb[i][1]
rand_ini = randint(50, 400)
ts = _start + _elapk + _j * 2.5
te = ts + _k + 70 + _j * 2.5
rand_end = 10 * (te - ts)
EFT = move(x, y, x_fin, y_fin, rand_ini, rand_end) + shad(0) + bord(0) + alpha(255 - points[indice_text][2])
ass_main(ASS_BUF, SubL(ts, te, 0, Pix_Style), EFT, PixPt())
return (ASS_BUF, TCAS_BUF)
复制代码
When I tired to do
x_fin = posb[indice_pos ][0]
y_fin = posb[indice_pos ][1]
It says list index out of range!
附件:
test1.zip
(2022-2-11 01:05:49, 73.02 KB) / 下载次数 2285
http://tcax.org/forum.php?mod=attachment&aid=Mjg5M3w5ZGNlZjRjZHwxNzMyMjA1MDU4fDB8MA%3D%3D
欢迎光临 TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua (http://tcax.org/)
Powered by Discuz! X2