It provides some easy to use information through the parameters, and the function will be executed many times, which is decided by the number of syllables or texts.
Description of parameters:
# _i the current line being handled whose index is _i
# _j the current text being handled whose index is _j in the current line
# _n number of texts in the current line
# _start start time of the current line
# _end end time of the current line
# _elapk elapsed time from the first text of the line to the current text
# _k the karaoke time of the current text
# _x the horizontal position of the current text (an5)
# _y the vertical position of the current text (an5)
# _a the advance of the current text
# _txt the content of the current text
Note:
1. the existing time of the current text is from _start + _elapk to _start + _elapk + _k
2. you can replace the parameter names with whatever you preferred.
It will be executed only once and if this function is used, tcaxPy_Main function will be ignored. The difference between tcaxPy_User function and tcaxPy_Main function is that tcaxPy_User function leaves all the work to be done by the user, while tcaxPy_Main function leaves the I/O task to TCAX. The structure of tcaxPy_Main function is somewhat dull, not as flexible as tcaxPy_User function. However, you can make your own script template by implementing the tcaxPy_User interface.
Implementation example:
def tcaxPy_User():
ASS = CreateAssFile(GetVal(val_OutFile) + '.ass', GetVal(val_AssHeader))
for i in range(lineNum):
initPosX = (resX - textLength[i]) / 2 + marginX # if marginX = 0, then it's just on the middle
initPosY = marginY
for j in range(textNum[i]):
ASS_BUF = [] # you can put the BUF anywhere according to your usage
if text[i][j] == '' or text[i][j] == ' ' or text[i][j] == ' ':
Usually, it does some finalization, and it will be executed only once after any other predefined functions of the tcaxPy script.
Implementation example:
def tcaxPy_Fin():
FinFont(font)
FinFont(fontBord)
Pause()
复制代码
TCC Options to Enable/Disable the Interfaces
You can change the options about whether to use these functions through the TCC file:
< tcaxpy init = true >
true - will use tcaxPy_Init function, and you should implement the tcaxPy_Init interface in your tcaxPy scripts.
< tcaxpy user = false >
false - will use tcaxPy_Main function instead, and you should implement the tcaxPy_Main interface in your tcaxPy scripts.
< tcaxpy fin = false >
false - will not use tcaxPy_Fin function, so you do not have to implement it.
you can change the settings according to your usage.
Miscellaneous
Python is a powerful scripting language, you can break the limitations of TCAX, and enhance it by using external modules and co-operate with your own tcaxPy script template, which can be achieved by using your own implementation of the predefined tcaxPy_User interface. Though such task is never easy, and requires your better understanding of Python programming and the concepts of TCAX.