NyuFX User Funktionen: Unterschied zwischen den Versionen

Aus WiFX - The Karaoke Wiki for ASSCalc, NyuFX, Lua, AFX, Tenfex & Templater
Wechseln zu: Navigation, Suche
(Utils)
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 21: Zeile 21:
 
=Utils=
 
=Utils=
  
== utils.colorchange(LINES , getColorObjectFromASSFile(absolute_filePath),optional: OFFSET ) (written by McWhite)==
+
== utils.colorchange(LINES , getColorObjectFromASSFile(absolute_filePath){,optional: OFFSET }) (written by McWhite)==
  
If you want to use automatic colorchanges it would be a mess in NyuFX, because there is no automatic color Change function like in ASSCalc. So MCWhite had to write it as a plugin ;)
+
=== Introducing ===
  
How does it work`? If you know ASSCalc Colorchange, you know that every color information had to be in {} before the \k Information. So in this case we have some guidelines for the creation of colorchanges too (referes to getColorObjectFromASSFile):
+
DOWNLOAD ALL MCWHITE USER FUNCTIONS: http://pastebin.com/mQjbfAds
  
--  * THERE MUSTN BE ANY COMMENTARS IN THE TEXT LIKE {My beautiful text, because I can do this :D \o}, I WILL NOT GUARANTEE FOR ANYTHING IF YOU DO THIS!
+
If you want to use automatic colorchanges it would be a mess in NyuFX, because there is no automatic colorchange function like in ASSCalc. So MCWhite had to write it as a plugin ;) So if you want to use it, you have to download McWhite.lua from McWhite and put it in the '''include''' Folder in the NyuFX directory!<br>
--  * Each colorchange is in its own bracket as this type: {\t(441,474,\c&H924625&\3c&HEEEDED&)}
+
--  * Each and every color-tag has to be in the format of c&H924625& <- DO NOT FORGET THE LAST &
+
--  * You can set the first Colorchange of the line as: {\c&HEEB2DE&\3c&HF9FADC&} without a transformation tag
+
--  * Commented lines won't be recognized
+
--  * You have to put the output of this function into the colorChange function.
+
--  * Get sure that there are not any commented lines above or in between
+
--  ! Also note that the filePath must be absolute! You cannot just say "mykaraokescript.ass", it must be something like "C:\\someFolder\\myFX\\mykaraokescript.ass". Don't forget the double backslash!
+
  
So in the best way it Looks like:
+
How does it work`? If you know ASSCalc Colorchange, you know that every color information had to be in {} before the \k Information. So in this case we have some guidelines for the creation of colorchanges too (referes to getColorObjectFromASSFile):<br>
  
-- Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te
+
  -- * THERE MUSTN BE ANY COMMENTARS IN THE TEXT LIKE {My beautiful text, because I can do this :D \o}, I WILL NOT GUARANTEE FOR ANYTHING IF YOU DO THIS!<br>
-- Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge
+
  --  * Each colorchange is in its own bracket as this type: {\t(441,474,\c&H924625&\3c&HEEEDED&)}<br>
 +
  -- * Each and every color-tag has to be in the format of c&H924625& <- DO NOT FORGET THE LAST &<br>
 +
  -- * You can set the first Colorchange of the line as: {\c&HEEB2DE&\3c&HF9FADC&} without a transformation tag<br>
 +
  --  * Commented lines won't be recognized<br>
 +
  -- * You have to put the output of this function into the colorChange function.<br>
 +
  -- * Get sure that there are not any commented lines above or in between<br>
 +
  --  ! Also note that the filePath must be absolute! You cannot just say "mykaraokescript.ass", it must be something like "C:\\someFolder\\myFX\\mykaraokescript.ass". Don't forget the double backslash!<br>
  
=== First STEP ===
+
So in the best way it Looks like:<br>
  
Use getColorObjectFromASSFile(filePath) with an absolute filepath refered to any *.ass file. This function allows you to load any ASS File in NyuFX to extract colorinformations from the Basic Script. This function is the first step for the utils.color_change() function and should be saved in a var.
+
'''-- Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te<br>'''
 +
'''-- Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge<br>'''
  
 +
=== First STEP ===
 +
 +
Use '''getColorObjectFromASSFile(filePath)''' with an '''absolute filepath''' referes to any *.ass file. This function allows you to load any ASS File in NyuFX to extract colorinformations from the basic script. This function is the first step for the '''utils.color_change()''' function and should be saved in a var.
  
 
=== Second STEP ===
 
=== Second STEP ===
  
If you use the standard declaration of vars like in the tutorials and save the color values to var '''colors''' then you can use '''utils.color_change(l, colors)''' in every Point, like:
+
If you use the standard declaration of vars like in the tutorials and save the color values to var '''colors''' then you can use '''utils.color_change(l, colors)''' in every Point, like:<br>
  
l.text = string.format("{%s}%s",utils.color_change(l, colors),syl.text)
+
'''l.text = string.format("{%s}%s",utils.color_change(l, colors),syl.text)'''<br>
  
 
'''Please set the l.start_time and the l.end_time before the l.text function every time, because instead you didn't get the right Timings and it would be out of sync!'''
 
'''Please set the l.start_time and the l.end_time before the l.text function every time, because instead you didn't get the right Timings and it would be out of sync!'''
 
  
 
=== Special Thoughts ===
 
=== Special Thoughts ===
  
In the example above we have Start -> End , 100ms free space, Start->End. So if the fade in for the second line starts at l.start_time = line.start_time-100, it would be before the basic color sets at the second line (\c&HFFFFFF&\3c&H000000&). So what would the function do? It gets the last color from the last line. So if there is an colortransform between lines, you have to program a color transformation in the first line. In our example could it be like this:
+
In the example above we have '''Start -> End , 100ms free space, Start->End'''. So if the fade in for the second line starts at '''l.start_time = line.start_time-100''', it would be before the basic color sets at the second line '''(\c&HFFFFFF&\3c&H000000&)'''. So what would the function do? It gets the last color from the last line. '''So if there is an colortransform between lines, you have to program a color transformation in the first line.''' In our example could it be like this:<br>
  
Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\t(4730,4740,\c&HFFFFFF&\3c&H000000&)}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te
+
'''-- Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\t(4730,4740,\c&HFFFFFF&\3c&H000000&)}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te<br>'''
Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge
+
'''-- Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge<br>'''
  
You couldn't see the transform in the Aegisub preview, when you code them, but you didn't need it, because the time in the Video Player referes to the marked line. So know the color transform are inside the fade in, because the function generates an absolute time list and check the current l.start_time with the list to find out the active color.
+
You couldn't see the transform in the Aegisub preview, when you code them, but you didn't need it, because the time in the Video Player referes to the marked line. So know the color transform are inside the fade in, because the function generates an absolute time list and check the current '''l.start_time''' with the list to find out the active color.

Aktuelle Version vom 18. Dezember 2014, 03:18 Uhr

Basic

Conversion

Input/Output

Math

Shapes

Strings

Tables

Utils

utils.colorchange(LINES , getColorObjectFromASSFile(absolute_filePath){,optional: OFFSET }) (written by McWhite)

Introducing

DOWNLOAD ALL MCWHITE USER FUNCTIONS: http://pastebin.com/mQjbfAds

If you want to use automatic colorchanges it would be a mess in NyuFX, because there is no automatic colorchange function like in ASSCalc. So MCWhite had to write it as a plugin ;) So if you want to use it, you have to download McWhite.lua from McWhite and put it in the include Folder in the NyuFX directory!

How does it work`? If you know ASSCalc Colorchange, you know that every color information had to be in {} before the \k Information. So in this case we have some guidelines for the creation of colorchanges too (referes to getColorObjectFromASSFile):

 --  * THERE MUSTN BE ANY COMMENTARS IN THE TEXT LIKE {My beautiful text, because I can do this :D \o}, I WILL NOT GUARANTEE FOR ANYTHING IF YOU DO THIS!
-- * Each colorchange is in its own bracket as this type: {\t(441,474,\c&H924625&\3c&HEEEDED&)}
-- * Each and every color-tag has to be in the format of c&H924625& <- DO NOT FORGET THE LAST &
-- * You can set the first Colorchange of the line as: {\c&HEEB2DE&\3c&HF9FADC&} without a transformation tag
-- * Commented lines won't be recognized
-- * You have to put the output of this function into the colorChange function.
-- * Get sure that there are not any commented lines above or in between
--  ! Also note that the filePath must be absolute! You cannot just say "mykaraokescript.ass", it must be something like "C:\\someFolder\\myFX\\mykaraokescript.ass". Don't forget the double backslash!

So in the best way it Looks like:

-- Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te
-- Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge

First STEP

Use getColorObjectFromASSFile(filePath) with an absolute filepath referes to any *.ass file. This function allows you to load any ASS File in NyuFX to extract colorinformations from the basic script. This function is the first step for the utils.color_change() function and should be saved in a var.

Second STEP

If you use the standard declaration of vars like in the tutorials and save the color values to var colors then you can use utils.color_change(l, colors) in every Point, like:

l.text = string.format("{%s}%s",utils.color_change(l, colors),syl.text)

Please set the l.start_time and the l.end_time before the l.text function every time, because instead you didn't get the right Timings and it would be out of sync!

Special Thoughts

In the example above we have Start -> End , 100ms free space, Start->End. So if the fade in for the second line starts at l.start_time = line.start_time-100, it would be before the basic color sets at the second line (\c&HFFFFFF&\3c&H000000&). So what would the function do? It gets the last color from the last line. So if there is an colortransform between lines, you have to program a color transformation in the first line. In our example could it be like this:

-- Dialogue: 0,0:00:00.48,0:00:05.21,japro,fx2,0,0,0,,{\c&H000000&\3c&HFFFFFF&}{\t(4730,4740,\c&HFFFFFF&\3c&H000000&)}{\k24}I{\k25}ma {\k22}su{\k21}gu{\k24}ni {\k47\-sp}mo{\k16\-sp}tto {\k53\-sp}HANDS {\k45\-sp}UP! {\k46}Sou {\k22}yu{\k23}me {\k8}wo {\k17}u{\k21}ta{\k24}t{\k35}te
-- Dialogue: 0,0:00:05.31,0:00:08.94,japro,fx2,0,0,0,,{\c&HFFFFFF&\3c&H000000&}{\t(0,3630,\c&H000000&\3c&H383636&)}{\k50\-sp}Zu{\k22\-sp}tto {\k43\-sp}STAND {\k25\-sp}UP!{\k23} {\k23}O{\k24}re{\k23}na{\k22}i {\k21}ha{\k23}ta {\k25}ka{\k24}ka{\k15}ge

You couldn't see the transform in the Aegisub preview, when you code them, but you didn't need it, because the time in the Video Player referes to the marked line. So know the color transform are inside the fade in, because the function generates an absolute time list and check the current l.start_time with the list to find out the active color.