for x in range(0,3):
matD.setRow (x, VBase4D(matF.getRow(x).getCell(0), matF.getRow(x).getCell(1), matF.getRow(x).getCell(2), matF.getRow(x).getCell(3)))
Yeah, I was wondering why the constructors for MatF/MatD didn’t just accept their opposite-precision cousin.
I didn’t realize that this problem extended to all the other dual-precision data representations, too, or how they are templated representations.
Everybody else: Thanks for the cute suggestions, especially the inline loop one. Glad to see people are keeping the spirit of my original code, but honestly I was more hoping someone would just say, “Oh yeah, here’s a direct conversion method that’s kind of obscure and not documented.”
At least I learned that Mats can be treated as a nestled list. Didn’t occur to me to check for that, since I was just looking for a method that dumped the Mat as a raw string of digits, a Python equiv of get_data.
The only reason I encountered it was finding out that EggData nodes store their transforms in double-precision matrices.
I was wanting to make my loaded Egg data conform to what would eventually be the net transform of its scene graph parent node.
matF = parentNodePath.getMat()
matD = Mat4D()
# less stupid, but still stupid
for i in range(4):
for j in range(4):
matD[i][j] = matF[i][j]
eggNode.transform (matD)
Luckily this isn’t a per-frame operation so speed isn’t of the essence.