Fuses: Matrix4()

User avatar
Posts: 706
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 64 times

Fuses: Matrix4()


Post by Midgardsormr » Fri Sep 14, 2018 5:58 pm

Anyone have any experience with or insight into the Matrix4() and related functions in a Fuse? I'm trying to improve the Redshift Camera Extractor to enable it to handle 3DS Max's right-handed Z-up coordinate system. While I could probably brute-force a solution by doing the matrix multiplication myself like I did the first time around, I'd really prefer to get my head around the built-in matrix handling functions.

Right now, I'm just trying to get data into and out of a matrix.

If I do this:

  1.         testMatrix = Matrix4()
  2.         testTable = testMatrix:GetTable()
  3.         dump(testTable)
  4.         newMatrix = Matrix4(testTable)

Lines 1 and 2 work as expected. A Matrix4 object is created, and it pulls the identity matrix values out to the table. But trying to put those values back into a new matrix fails with this error:

Code: Select all

[string "FFI Script"]:5446: bad argument #16 to 'ffi_Matrix4__newNums' (cannot convert 'nil' to 'double')
stack traceback:
	[C]: in function 'ffi_Matrix4__newNums'
	[string "FFI Script"]:5446: in function 'Matrix4'
	...xe\BlackMagic\fusion9\fuses\Fuses\RSCameraExtractor.fuse:80: in function <...xe\BlackMagic\fusion9\fuses\Fuses\RSCameraExtractor.fuse:50>

I thought perhaps it was a matter of table indices starting at 1 instead of 0, but shifting the indices didn't help, nor did adding an extra entry to the end of the table or putting another argument in directly.

I'm working from the (likely obsolete) hints described here: https://www.steakunderwater.com/VFXPedi ... es/Matrix4