Matrix inconsistencies

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
z0r
Posts: 0
Joined: Wed Oct 18, 2006 8:29 am
Location: Japan

Matrix inconsistencies

Post by z0r » Wed Oct 18, 2006 6:03 pm

Hi! I'm having trouble with a script I'm writing. I think I've found a bug in Blender, but I thought I'd ask here first.

The script multiplies two transformation matrices together and applies them to an object. In the 3D view this works fine, but when the scene is rendered the object has a different transform. It retains the new (different) transform in the 3D view after rendering.

The object has a parent. I've found that calling object.getMatrix('localspace') is safe, but as soon as object.getMatrix('worldspace') is called, it obtains a new transform.

An example .blend is available at http://phatcore.com/projects/files/EyeDemo.blend. Instructions are available at http://phatcore.com/projects/Track_And_Transform.php. Try rendering the scene after setting up the tracker. Sorry, my site seems to be down at the moment but will hopefully be back online soon! - Edit: Back online now.

So, is this a bug, or am I missing something?

Cheers,
Alex
Last edited by z0r on Thu Oct 19, 2006 5:21 am, edited 1 time in total.

z0r
Posts: 0
Joined: Wed Oct 18, 2006 8:29 am
Location: Japan

Script excerpt

Post by z0r » Wed Oct 18, 2006 6:14 pm

Here's an excerpt from my script (GPL'd) for reference until my site is back online:

Code: Select all

	# Transform the mesh to match the LOCAL rotation of the tracker.
	tmx = tracker.getMatrix('localspace').rotationPart().resize4x4()
	# Transform again, this time to match the FinalSpace object
	# (which will generally be used for scaling).
	fmx = finalSpace.getMatrix('worldspace')
	
	object.setMatrix(tmx *  fmx)
	# object.getMatrix('worldspace')
If the final line is un-commented, the incorrect transform is applied even in the 3D view. Otherwise, it works as I expect it to.

z0r
Posts: 0
Joined: Wed Oct 18, 2006 8:29 am
Location: Japan

Closed

Post by z0r » Wed Oct 10, 2007 3:51 am

This issue won't be fixed - it turns out this type of matrix transformation is not supported by Blender. See this bug report.

Post Reply