Hi Ivan, after playing some more with the function you posted I noticed that If I extract ZYX rotation from a standard Nuke card, and the cards scaling is not uniform on x,y,z, the extracted z-rotation is a bit off. This might be totally expected due to some matrix math that I don't really understand, but any chance you have an idea why this happens?
Cheers, Simon 2012/11/4 Simon Björk <bjork.si...@gmail.com> > Just to follow up Ivan, it worked perfectly. Thanks a lot, I've been > looking for a solution for this for quite some time :)! > > Best regards, > Simon > > > > 2012/11/4 Simon Björk <bjork.si...@gmail.com> > >> Hi Ivan, >> >> thanks a lot for that information, I really appreciate it. I will take a >> look at your example code and try to get it working :)! >> >> Cheers, >> Simon >> >> >> >> 2012/11/4 Ivan Busquets <ivanbusqu...@gmail.com> >> >>> Hi Simon, >>> >>> In Nuke 7, the Matrix4 class has python methods to extract euler >>> rotations in any order. >>> (check Matrix4.rotationsZYX(), Matrix4.rotationsXYZ(), etc...) >>> >>> If you need to do it in an earlier version, here's a function that might >>> help: >>> >>> http://pastebin.com/jf9uAAEU >>> >>> (Disclaimer, I just extracted this from a larger matrix-related module >>> I wrote. It should run fine independently, but I have not tested it) >>> >>> >>> Using the getEulerRotations() function from the link above, you'd want >>> to do something like: >>> >>> cam = nuke.toNode('YOUR_CAMERA_NAME') >>> mtx = cam['transform'].value() >>> >>> # And then, to get the rotations (in degrees) for a ZYX order... >>> print getEulerRotations(mtx, 'ZYX') >>> >>> Hope that helps. >>> >>> Cheers, >>> Ivan >>> >>> On Sat, Nov 3, 2012 at 2:01 PM, Simon Björk <bjork.si...@gmail.com> >>> wrote: >>> > >>> > Hi all, >>> > >>> > this is probably way over my head, but I'm looking for a way to >>> convert rotation values from a standard Nuke camera (rotation order ZXY) to >>> rotation order ZYX using Python. Anyone know where I can find any example >>> code of this, or could point me in the right direction? >>> > >>> > Thank you. >>> > >>> > _______________________________________________ >>> > Nuke-python mailing list >>> > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >>> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>> > >>> _______________________________________________ >>> Nuke-python mailing list >>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>> >> >> >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python