- Posts: 24
- Joined: Tue Apr 10, 2018 3:27 pm
- Real Name: Dirk de Jong
These values are contained in a table called DataWindow, a property of the Output or Input. The table contains four values:
1) Lower left X
2) Lower Left Y
3) Upper Right X
4) Upper Right Y
The tricky bit is that most Fusion tools use normalized coordinates instead of pixel coordinate values, so you'll need to perform a little math to get another node to use the DataWindow correctly.
Let's suppose you want to set a Transform's Center control to the lower-left corner of the DataWindow. Under most circumstances, you'd set a Simple Expression on the Center control and use the Point() function to control its location. While you can certainly do that in this situation, it will be a little easier to understand if we do the calculations one at a time in a Custom Tool.
CustomTool has eight sliders that don't do anything except hold values for use elsewhere. We'll use the first four to query the DataWindow and the second four to convert the pixel coordinates to normalized values. For Number In 1, the expression is:
Text1.Output.DataWindow[1].
That's the X coordinate of the lower-left corner. To normalize it, we divide it by the width of the frame. So the expression for Number In 5 is:
NumberIn1 / Text1.Output.OriginalWidth
We do the same for the other three values in DataWindow, except that 2 and 4 are the Y values and are therefore divided by OriginalHeight. Once that's done, we can set Point In 1 and Point In 2 using the values from NumberIn 5 - 8.
Those two points can be linked to whatever you like. You could use additional Custom Tools to do more math on the locations, giving them offsets from the corners or whatever. And you can obviously get the other two corners by composing them from the existing ones. Upper left, for instance, is DataWindow[1], DataWindow[4]
- Code: Select all
{
Tools = ordered() {
Background1 = Background {
Inputs = {
GlobalIn = Input { Value = 1, },
Width = Input { Value = 1920, },
Height = Input { Value = 1080, },
["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
},
ViewInfo = OperatorInfo { Pos = { 330, 181.5 } },
},
CustomTool1 = Custom {
CustomData = {
Settings = {
[1] = {
Tools = ordered() {
CustomTool1 = Custom {
Inputs = {
LUTIn3 = Input {
SourceOp = "CustomTool1LUTIn3",
Source = "Value"
},
LUTIn1 = Input {
SourceOp = "CustomTool1LUTIn1",
Source = "Value"
},
Image1 = Input {
SourceOp = "TimeSpeed1",
Source = "Output"
},
Image2 = Input {
SourceOp = "ChangeDepth1_1",
Source = "Output"
},
LUTIn4 = Input {
SourceOp = "CustomTool1LUTIn4",
Source = "Value"
},
LUTIn2 = Input {
SourceOp = "CustomTool1LUTIn2",
Source = "Value"
}
},
Name = "CustomTool1",
CtrlWZoom = false,
ViewInfo = OperatorInfo { Pos = { 550, 181.5 } },
CustomData = {
}
},
CustomTool1LUTIn1 = LUTBezier {
Name = "CustomTool1LUTIn1",
NameSet = true,
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Green = 0, Blue = 0, Red = 204 }
},
CustomTool1LUTIn2 = LUTBezier {
Name = "CustomTool1LUTIn2",
NameSet = true,
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Green = 204, Blue = 0, Red = 0 }
},
CustomTool1LUTIn3 = LUTBezier {
Name = "CustomTool1LUTIn3",
NameSet = true,
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Green = 0, Blue = 204, Red = 0 }
},
CustomTool1LUTIn4 = LUTBezier {
Name = "CustomTool1LUTIn4",
NameSet = true,
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Green = 204, Blue = 204, Red = 204 }
}
}
},
[2] = {
Tools = ordered() {
CustomTool1 = Custom {
Inputs = {
LUTIn3 = Input {
SourceOp = "CustomTool1LUTIn3",
Source = "Value"
},
LUTIn4 = Input {
SourceOp = "CustomTool1LUTIn4",
Source = "Value"
},
Image2 = Input {
SourceOp = "ChangeDepth1_1",
Source = "Output"
},
RedExpression = Input { Value = "c1-c2" },
GreenExpression = Input { Value = "c1-c2" },
LUTIn1 = Input {
SourceOp = "CustomTool1LUTIn1",
Source = "Value"
},
Image1 = Input {
SourceOp = "TimeSpeed1",
Source = "Output"
},
BlueExpression = Input { Value = "c1-c2" },
LUTIn2 = Input {
SourceOp = "CustomTool1LUTIn2",
Source = "Value"
}
},
CtrlWZoom = false,
ViewInfo = OperatorInfo { Pos = { 550, 181.5 } },
CustomData = {
}
},
CustomTool1LUTIn1 = LUTBezier {
SplineColor = { Green = 0, Blue = 0, Red = 204 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn2 = LUTBezier {
SplineColor = { Green = 204, Blue = 0, Red = 0 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn3 = LUTBezier {
SplineColor = { Green = 0, Blue = 204, Red = 0 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn4 = LUTBezier {
SplineColor = { Green = 204, Blue = 204, Red = 204 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
}
}
},
[3] = {
Tools = ordered() {
CustomTool1 = Custom {
Inputs = {
LUTIn3 = Input {
SourceOp = "CustomTool1LUTIn3",
Source = "Value"
},
LUTIn4 = Input {
SourceOp = "CustomTool1LUTIn4",
Source = "Value"
},
Image2 = Input {
SourceOp = "ChangeDepth1_1",
Source = "Output"
},
RedExpression = Input { Value = "c1+c2" },
GreenExpression = Input { Value = "c1+c2" },
LUTIn1 = Input {
SourceOp = "CustomTool1LUTIn1",
Source = "Value"
},
Image1 = Input {
SourceOp = "TimeSpeed1",
Source = "Output"
},
BlueExpression = Input { Value = "c1+c2" },
LUTIn2 = Input {
SourceOp = "CustomTool1LUTIn2",
Source = "Value"
}
},
CtrlWZoom = false,
ViewInfo = OperatorInfo { Pos = { 550, 181.5 } },
CustomData = {
}
},
CustomTool1LUTIn1 = LUTBezier {
SplineColor = { Green = 0, Blue = 0, Red = 204 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn2 = LUTBezier {
SplineColor = { Green = 204, Blue = 0, Red = 0 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn3 = LUTBezier {
SplineColor = { Green = 0, Blue = 204, Red = 0 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
},
CustomTool1LUTIn4 = LUTBezier {
SplineColor = { Green = 204, Blue = 204, Red = 204 },
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
NameSet = true
}
}
},
}
},
Inputs = {
PointIn1 = Input {
Value = { 0.330729166666667, 0.411111111111111 },
Expression = "Point(NumberIn5,NumberIn6)",
},
PointIn2 = Input {
Value = { 0.670833333333333, 0.588888888888889 },
Expression = "Point(NumberIn7, NumberIn8)",
},
NumberIn1 = Input {
Value = 635,
Expression = "Text1.Output.DataWindow[1]",
},
NumberIn2 = Input {
Value = 444,
Expression = "Text1.Output.DataWindow[2]",
},
NumberIn3 = Input {
Value = 1288,
Expression = "Text1.Output.DataWindow[3]",
},
NumberIn4 = Input {
Value = 636,
Expression = "Text1.Output.DataWindow[4]",
},
NumberIn5 = Input {
Value = 0.330729166666667,
Expression = "NumberIn1 / Text1.Output.OriginalWidth",
},
NumberIn6 = Input {
Value = 0.411111111111111,
Expression = "NumberIn2 / Text1.Output.OriginalHeight",
},
NumberIn7 = Input {
Value = 0.670833333333333,
Expression = "NumberIn3 / Text1.Output.OriginalWidth",
},
NumberIn8 = Input {
Value = 0.588888888888889,
Expression = "NumberIn4 / Text1.Output.OriginalHeight",
},
LUTIn1 = Input {
SourceOp = "CustomTool1LUTIn1",
Source = "Value",
},
LUTIn2 = Input {
SourceOp = "CustomTool1LUTIn2",
Source = "Value",
},
LUTIn3 = Input {
SourceOp = "CustomTool1LUTIn3",
Source = "Value",
},
LUTIn4 = Input {
SourceOp = "CustomTool1LUTIn4",
Source = "Value",
},
ShowPoint3 = Input { Value = 0, },
ShowPoint4 = Input { Value = 0, },
ShowLUT1 = Input { Value = 0, },
ShowLUT2 = Input { Value = 0, },
ShowLUT3 = Input { Value = 0, },
ShowLUT4 = Input { Value = 0, },
Image1 = Input {
SourceOp = "Text1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 605, 280.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,
},
Transform1 = Transform {
CtrlWZoom = false,
Inputs = {
Center = Input { Expression = "CustomTool1.PointIn1", },
Input = Input {
SourceOp = "Background1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 605, 181.5 } },
},
Text1 = TextPlus {
Inputs = {
GlobalIn = Input { Value = 1, },
Width = Input { Value = 1920, },
Height = Input { Value = 1080, },
["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
Font = Input { Value = "Open Sans", },
StyledText = Input { Value = "Some text.\nIt sets the DoD", },
Style = Input { Value = "Bold", },
ManualFontKerningPlacement = Input {
Value = StyledText {
Array = {
},
Value = ""
},
},
},
ViewInfo = OperatorInfo { Pos = { 385, 280.5 } },
}
}
}
Once you really understand what's happening, you could, of course, compose the entire thing in a single Simple Expression on the Transform's Center, but I find it really easy to make mistakes when writing a long expression like that. I think it's easier to decompose it like I've done here.