Jump to: Board index » General » Fusion

Txt+ to show framecount in specific order with expressions

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Txt+ to show framecount in specific order with expressions

PostSun Apr 10, 2016 1:20 am

Hi, I want the Text node to give out frames in this order: 0001 0002 etc and when it hits 10, it should must show 0010 and when it hits 100 - 0100 so it must always stay in the 4 digit pattern
So I'm typing an expression in the Styled Text as this:

Text( iff( time<10,"000"..time,"00"..time) )

but it doesn't work.. neither this one: iff(time<10, Text("000"..time, Text("00"..time))

How would be the right way?
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline

Sander de Regt

  • Posts: 4131
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Txt+ to show framecount in specific order with expressio

PostSun Apr 10, 2016 8:36 am

The right way would in this case be: use the timecode modifier like this

Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            Font = Input { Value = "Arial", },
            StyledText = Input {
               SourceOp = "TimeCode1",
               Source = "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, },
                  },
               },
            },
            RenderToDPTFile = Input { Disabled = true, },
            DPTType = Input { Disabled = true, },
            DPTResolution = Input { Disabled = true, },
         },
         ViewInfo = OperatorInfo { Pos = { 55, 16.5, }, },
      },
      TimeCode1 = TimeCode {
         CtrlWZoom = false,
         Inputs = {
            Hrs = Input { Value = 0, },
            Mins = Input { Value = 0, },
            Secs = Input { Value = 0, },
            PadDigits = Input { Value = 4, },
         },
      },
   },
   ActiveTool = "Text1",
}
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Txt+ to show framecount in specific order with expressio

PostSun Apr 10, 2016 5:53 pm

Cool! Thanks:)
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Txt+ to show framecount in specific order with expressio

PostSun Apr 10, 2016 6:00 pm

Still... Interesting enough how to make the output text react to conditions, with iff or it's not working for text like that?
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline

Sander de Regt

  • Posts: 4131
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Txt+ to show framecount in specific order with expressio

PostSun Apr 10, 2016 6:46 pm

Honestly I have no idea. I almost never use expressions or scripting in Fusion. There are lots of things possible though.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline
User avatar

Eric Westphal

  • Posts: 215
  • Joined: Thu Nov 20, 2014 1:59 pm

Re: Txt+ to show framecount in specific order with expressio

PostThu Apr 14, 2016 6:50 am

The Expressions are pretty much based on Lua scripting.
So in the Text+ something like
Code: Select all
Text(string.format("%04d", time))

works just fine.

Cheers.

Eric.
my hovercraft is full of eels.
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Txt+ to show framecount in specific order with expressio

PostThu Apr 14, 2016 12:07 pm

Great! Thank you!
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Txt+ to show framecount in specific order with expressio

PostMon May 02, 2016 6:37 am

Guys, I've found what was wrong with this string of code:
Text( iff( time<10,"000"..time,"00"..time) )

I'm wondering why Fusion veterans haven't pointed this mistake right away...
Last edited by Eugene Afanasiev on Mon May 02, 2016 6:45 am, edited 2 times in total.
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline
User avatar

Eugene Afanasiev

  • Posts: 607
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Txt+ to show framecount in specific order with expressio

PostMon May 02, 2016 6:40 am

well it's the documentation that confused me. there is "iff" mentioned in there not "iif" cause the right way is "iif"

so if you paste this code to styled text expression it'll work:

Code: Select all
Text( iif( time<10,"000"..time,"00"..time) )
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--

Return to Fusion

Who is online

Users browsing this forum: David Chabashvili, KrunoSmithy and 23 guests