[Bf-python] Bug with Object.getMatrix?
alex mole
nal at blueyonder.co.uk
Tue Apr 26 23:18:01 CEST 2005
Sorry- I should have included repro steps:
1. Create a new scene
2. Add a mesh at the origin (MeshA)
3. Move mesh (eg. to (2,2,0))
4. Snap cursor to selection (ie. to (2,2,0))
5. Add a new mesh (MeshB)
6. Parent MeshB to MeshA
MeshB should now have no localspace transform. However, it seems to have
the original object's translation. This persists across load/save, so
I don't think it can be anything needing updating.
Cheers-
Alex
Willian Padovani Germano wrote:
> Hi Alex,
>
> alex mole wrote:
>
>> Hi
>>
>> I've been using Object.getMatrix('localspace') to get an object's
>> matrix in it's parent's space (world space if it has no parent).
>> However, this sometimes gives results that disagree with what I think
>> they should be. In addition, they give different results to the
>> following:
>>
>> invpmatrix = parent.getMatrix('worldspace')
>> invpmatrix.invert()
>> cmatrix = child.getMatrix('worldspace')
>> local_cmatrix = cmatrix * invpmatrix
>>
>> This, incidentally, gives me the answers I was looking for.
>>
>> Is this a bug, or just a badly documented routine?
>
>
> Just a guess (the first thing that occurred to me after reading your
> post), but past problems related to this method were mostly caused by
> early or late updates of the matrix. The old method required a redraw
> to get it updated (when the script changed loc, rot or size values and
> did not call a redraw before calling ob.getMatrix), then Joseph fixed a
> bug report changing that. Now all options are available: local, global
> and old_global (old behavior, not updated).
>
> Since you say the problem occurs "sometimes", would it be when there is
> no parent (in this case we gotta see which global is being returned,
> updated for the current frame or not)? If so, a test is adding a redraw
> before getting the matrix, to make sure it is updated.
>
> It'd be great to have an example that always, if possible, shows the
> problem.
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 25/04/2005
More information about the Bf-python
mailing list