Hey David -
I am using the fusion tab and in a custom tool taking something like Number in 1 field, right clicking and choosing expression, then in that box I am typing in values like p1x or w and these don't work.
Values that did work for me were things like pi, PointIn1.X, time.
Yes, it's a bit confusing, but in essence, these (w, h, ax etc) are only available to parts of the custom tool: channels, inter and setup tab. These all deal with the actual processing of the image and take input from the variables defined on the controls tab. Now on the controls tab itself, you use "normal" expressions and you can link those to other nodes. Here you can find the height of the image1 input1 with:
- Code: Select all
Image1.Width
and Height:
- Code: Select all
Image1.Height
So you could use those for instance for Number in 1 or 2.
Were you putting the formulae in an expression box or somewhere else? I am on Davinci Resolve version 15.0.1.003. I noticed that you were not converting from radians to degrees, I wonder if this is a version difference thing or that I am using an expression field (i.e. an issue with the expression field) and you are using something different.
This is something you find in Fusion a fair bit: inconsistencies in expressions syntax, units etc. depending on where you use it. Seems that in the "normal" expressions tan/atan etc deal with radians, whereas on the channels, intermediate and setup tab it deals with degrees.
You can test this with an example. Pipe a standard background into a custom tool and then display the custom tool in the viewer. Then in the controls tab for Number in 1 type the expression:
- Code: Select all
atan(1)
This yields 0.785, which is indeed in radians. Converting this, as you had correctly stated yields the degrees:
- Code: Select all
deg(atan(1))
This yields 45.
However, if you move over to the channels tab and for the red channel type in:
- Code: Select all
atan(1)/100
If you then hover over the image in the viewer (now showing a dark red) you see 0.447. I think this is a type of rounding error, but would round up to 0.45 (i.e. 45 degrees divided by 100). Now, here's the thing, since the Fusion update last December (2017), you now have maths functions that deal with radians, for example (again, use it for example in the red channel)
- Code: Select all
atanr(1)
This yields 0.785
I just checked it in Resolve on the Fusion tab, and it works the same there.