[Bf-python] getWorldMatrix() Implimented

Campbell Barton cbarton at metavr.com
Thu Jun 24 16:56:26 CEST 2004


Hi, I got sick of an objects matrix not takingh into account the parents 
location or parent verts.

I added the function to Object.c that works a treat, I have tested it 
for exporters and it works as expected.

See the function in bold below. Just add it below getMatrix as well as 
the obvious places in the code.

This is simple but realy needed for exporters-
Cam



static PyObject *Object_getMatrix (BPy_Object *self)
{
    PyObject * matrix;
    matrix = newMatrixObject(NULL, 4, 4);
    object_to_mat4(self->object, *((MatrixObject*)matrix)->matrix);
    return matrix;
}


*static PyObject *Object_getWorldMatrix (BPy_Object *self)
{
    PyObject * matrix;
   
    matrix = newMatrixObject(NULL, 4, 4);
   
    /* Worldspace matrix */
    where_is_object(self->object);
    Mat4CpyMat4(*((MatrixObject*)matrix)->matrix, 
self->object->obmat);       
   
    return matrix;
}

*



More information about the Bf-python mailing list