Page 1 of 1

Burn-in frame count instead of Timecode.

PostPosted: Thu Jan 11, 2018 3:08 pm
by Ignacio de La Cierva
I can't see any option to do this with the Timer or Timecode tools.

I'll probably need an expression with the variable time. I I've tried but it does not work. time is a numeric variable and the text tool expects a string. There must be a function to do that, something like string(time) or so.

Btw... where is the expression/scripting syntax and functions explained? I've seen the Fusion Scripting_Guide, but that seems to be specific to Fusion tools. Do I need a Lua or Python manual to learn those functions and syntax?

Re: Burn-in frame count instead of Timecode.

PostPosted: Thu Jan 11, 2018 3:16 pm
by Ignacio de La Cierva
found it in a Lua manual

tostring (v)
Receives a value of any type and converts it to a string in a human-readable format. (For complete control of how numbers are converted, use string.format.)

tostring(time) works.

Moderator can delete the thread or leave as reference for future thugs.

Re: Burn-in frame count instead of Timecode.

PostPosted: Thu Jan 11, 2018 4:40 pm
by Bryan Ray
When you put an expression on the Styled Text field, the default code is Text(""). You can simply put time in there, removing the quotation marks, and you'll get the current frame number. tostring() works as well, as you've found, but it's not as obvious as using the built-in hint.

Here's an example:

Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Size = Input { Value = 0.0319148936170213, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input {
               Value = "Current frame: 0",
               Expression = "Text(\"Current frame: \" .. time)",
            },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
            ShadingGradient1 = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 427, 60 } },
      }
   },
   ActiveTool = "Text1"
}


The information on the old VFXPedia is pretty useful:
https://www.steakunderwater.com/VFXPedi ... xpressions

There are also some bits and pieces scattered throughout the official manuals. I have found the entry on the Custom Tool in the Fusion Tool Reference document to be very helpful.

And, of course, the Lua documentation can help you to figure out quite a bit if you need more advanced behavior.

Re: Burn-in frame count instead of Timecode.

PostPosted: Sat Jan 13, 2018 4:49 am
by Joe Laffey
Right-click in the Txt+ text box and add a Time Code modifier. Then on the timecode tab turn off everything except the frames checkbox. Now you get a frame count. You can even pad it with zeros.

I actually save this as the default for Txt+ as I burn frame numbers into every test render.

Re: Burn-in frame count instead of Timecode.

PostPosted: Sun Jan 14, 2018 9:38 pm
by Ignacio de La Cierva
Bryan,

I saw that post in the VFXpedia, and saved the link, but I'm needing even more basic reference.

Righ now I'm wondering if theres a script function to know the distance between two points, or I have to implement the old formula. In that case I'll need reference for the SQRoot and ^2 operations...

I assume that basic syntax for scripting is Lua. Isnt it?

I'm right now investigating this. Any cue?

EDIT: Found it. The offset distance modifier is my friend ( :


Joe,

I did not try the timecode frame count expecting it to cycle between 00 and 24/25/30, as the frame count of a timecode does. But just tried and... It does not!!

Thanks guys, and sorry for my delay.

Re: Burn-in frame count instead of Timecode.

PostPosted: Mon Jan 15, 2018 12:03 am
by Bryan Ray
Ignacio de La Cierva wrote:Righ now I'm wondering if theres a script function to know the distance between two points, or I have to implement the old formula. In that case I'll need reference for the SQRoot and ^2 operations...

EDIT: Found it. The offset distance modifier is my friend ( :


If you do at some point need a sqrt function, it's math.sqrt(). The Lua math library is available to expressions. And squaring a value works exactly like you wrote it above: x^2 = x * x.

Code: Select all
{
   Tools = ordered() {
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 321, 107 } },
      },
      MeasuringTape = Custom {
         NameSet = true,
         Inputs = {
            PointIn1 = Input { Value = { 0.25, 0.25 }, },
            PointIn2 = Input { Value = { 0.75, 0.75 }, },
            NumberIn1 = Input {
               Value = 0.707106781186548,
               Expression = "math.sqrt((PointIn2.X - PointIn1.X)^2 + (PointIn2.Y-PointIn1.Y)^2)",
            },
            LUTIn1 = Input {
               SourceOp = "CustomTool1LUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CustomTool1LUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CustomTool1LUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CustomTool1LUTIn4",
               Source = "Value",
            },
            NameforNumber1 = Input { Value = "Distance", },
            ShowNumber2 = Input { Value = 0, },
            ShowNumber3 = Input { Value = 0, },
            ShowNumber4 = Input { Value = 0, },
            ShowNumber5 = Input { Value = 0, },
            ShowNumber6 = Input { Value = 0, },
            ShowNumber7 = Input { Value = 0, },
            ShowNumber8 = Input { Value = 0, },
            PointControls = Input { Value = 1, },
            ShowPoint3 = Input { Value = 0, },
            ShowPoint4 = Input { Value = 0, },
            LUTControls = Input { Value = 1, },
            ShowLUT1 = Input { Value = 0, },
            ShowLUT2 = Input { Value = 0, },
            ShowLUT3 = Input { Value = 0, },
            ShowLUT4 = Input { Value = 0, },
            Image1 = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 458, 111.5 } },
      },
      CustomTool1LUTIn1 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 0, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn2 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 204, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn3 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 0, Blue = 204 },
         NameSet = true,
      },
      CustomTool1LUTIn4 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 204, Blue = 204 },
         NameSet = true,
      },
      Merge1 = Merge {
         Inputs = {
            Blend = Input { Value = 0.274566473988439, },
            Background = Input {
               SourceOp = "MeasuringTape",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Text1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 458, 144.5 } },
      },
      Text1 = TextPlus {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Center = Input { Value = { 0.434895833333333, 0.352777777777778 }, },
            Size = Input { Value = 0.0242774566473988, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input {
               Value = "Distance = 0.70710678118655",
               Expression = "Text(\"Distance = \"..MeasuringTape.NumberIn1)",
            },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
            ShadingGradient1 = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1 },
                     [1] = { 1, 1, 1, 1 }
                  }
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 323, 145.5 } },
      }
   }
}

Re: Burn-in frame count instead of Timecode.

PostPosted: Mon Jan 15, 2018 12:08 am
by Joe Laffey
Ignacio de La Cierva wrote:Joe,

I did not try the timecode frame count expecting it to cycle between 00 and 24/2/39, as the frame count of a timecode does. But just tried and... It does not!!

Thanks guys, and sorry for my delay.


Yeah, I had assumed the same thing for the first year I used Fusion. At one point, on the Fusion-L mailing list, one of the devs pointed this out. Works great!

Re: Burn-in frame count instead of Timecode.

PostPosted: Mon Jan 15, 2018 2:46 am
by Ignacio de La Cierva
Hey Bryan,

I found the basic operations for expressions and calculations are explained in the tool Manual! Why didn't I start by RTFM? :oops:

And there's this expression described on page 755

dist3d(x1,y1,z1,x2,y2,z2)


Very convenient. Finally, my autofocus camera ; )