Hi Pete,

It's very possible, but probably easier to do it in Python than using
expression-links. Have a look at the nuke.math.Matrix4 class, and its
mapUnitSquareToQuad() method.

I have a function somewhere to feed the transformation of a CornerPin
node into the "matrix" knob of a roto/rotopaint node that would
probably fit the bill for this too. I can try to dig that up if you're
interested, but it would roughly consist of the following steps:

1 - Get the coordinates of the 4 "TO" corners from your cornerpin node.
2 - Build a "TO" matrix using mapUnitSquareToQuad(to0.x, to0.y, to1.x,
to1.y, ...)
3 - Get the coordinates of the 4 "FROM" corners from your cornerpin node.
4 - Build a "FROM" matrix using mapUnitSquareToQuad(from0.x, from0.y,
from1.x, from1.y, ...)
5 - The final transformation matrix should be =>  to_matrix *
from_matrix.inverse().

Then you can use that to fill in the matrix knob in a gridwarp, a roto
node, etc.

Not the best example, but if you want some more info on how to use
nuke.math.Matrix4.mapUnitSquareToQuad(), have a look here (towards the
end of the page).

http://www.nukepedia.com/written-tutorials/using-the-nukemath-python-module-to-do-vector-and-matrix-operations/page-4/

Hope that helps.

Cheers,
Ivan

On Sun, Aug 21, 2011 at 10:24 PM, Pete O'Connell
<[email protected]> wrote:
> Hi does anyone know if it is possible somehow to convert cornerpin values to
> a 4 by 4 matrix? Seem like it would be useful for the new Gridwarp and
> Splinewarp nodes.
> Thanks
> Pete
>
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to