[Bf-python] Mesh Module
Martin Poirier
theeth at yahoo.com
Thu Oct 6 22:35:17 CEST 2005
--- Willian Padovani Germano <wgermano at superig.com.br>
wrote:
> It occurred to me this morning that it might be a
> good idea to make
> pyverts follow exactly the MVert struct, with the py
> object header being
> the only difference:
>
> typedef struct MVert {
> float co[3];
> short no[3];
> char flag, mat_nr;
> } MVert;
>
> ->
>
> typedef struct PyVert {
> PyObject_VAR_HEAD
> float co[3];
> short no[3];
> char flag, mat_nr;
> } PyVert;
>
> With this we can copy data from one to the other
> type with a single
> memcopy, instead of copying per var: pyvert->flag =
> mvert->flag, etc.
PyObject_VAR_HEAD adds some stuff to the struct
(IIRC), so the memcpy wouldn't work directly, we would
need to add an offset and that's just a big can of
worms, if you ask me.
Of course, using the same names for struct members is
an excellent guideline nonetheless.
Martin
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the Bf-python
mailing list