Jump to: Board index » General » Fusion

Expression to make mask the same width as a text layer

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

Trevor Asquerthian

  • Posts: 582
  • Joined: Sun May 11, 2014 10:03 am

Expression to make mask the same width as a text layer

PostMon Sep 24, 2018 4:57 am

Is there an expression that can get the width of a text layer so that a shape can be a matching width?

Thanks
Offline
User avatar

Bryan Ray

  • Posts: 2491
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Expression to make mask the same width as a text layer

PostMon Sep 24, 2018 5:32 am

Yes, but how it's done depends on exactly what you mean. If you just want to make a Mask tool have the same image dimensions as a Text+ tool, you can set expressions on the Width and Height like so:

Text1.Output.OriginalWidth
Text1.Output.OriginalHeight

Those expressions would go in the Width and Height fields in the Format tab. Set Output Size to Custom to expose them.

Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         Inputs = {
            Width = Input { Value = 800, },
            Height = Input { Value = 600, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "This is TEXT", },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 354, 85 } },
      },
      Polygon1 = PolylineMask {
         DrawMode = "ClickAppend",
         DrawMode2 = "InsertAndModify",
         CtrlWZoom = false,
         Inputs = {
            OutputSize = Input { Value = FuID { "Custom" }, },
            MaskWidth = Input {
               Value = 1920,
               Expression = "Text1.Output.OriginalWidth",
            },
            MaskHeight = Input {
               Value = 1080,
               Expression = "Text1.Output.OriginalHeight",
            },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Polyline = Input {
               SourceOp = "Polygon1Polyline",
               Source = "Value",
            },
            Polyline2 = Input {
               Value = Polyline {
               },
               Disabled = true,
            },
         },
         ViewInfo = OperatorInfo { Pos = { 352, 132 } },
      },
      Polygon1Polyline = BezierSpline {
         SplineColor = { Red = 173, Green = 255, Blue = 47 },
         NameSet = true,
         KeyFrames = {
            [0] = { 0, Flags = { Linear = true, LockedY = true }, Value = Polyline {
               } }
         }
      }
   }
}


If you want to get the bounding box of the text inside the Text+, that's a little more involved. This thread has what you need:
viewtopic.php?f=22&t=72710&p=405140
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

Trevor Asquerthian

  • Posts: 582
  • Joined: Sun May 11, 2014 10:03 am

Re: Expression to make mask the same width as a text layer

PostMon Sep 24, 2018 4:17 pm

Bryan Ray wrote:
If you want to get the bounding box of the text inside the Text+, that's a little more involved. This thread has what you need:
viewtopic.php?f=22&t=72710&p=405140


Thanks Bryan, that thread (& the comp you shared there) was a big help.

Sadly just got it all sorted when Resolve crashed.

C'est la vie - guess it will stick when I do it a second time!

Return to Fusion

Who is online

Users browsing this forum: No registered users and 35 guests