[Bf-committers] Curves and materials

Gergely Erdelyi gergely.erdelyi at gmail.com
Thu Feb 24 08:11:58 CET 2005


Hello,

Since this is my first post to the list let me take two sentences to introduce
myself. I'm a 26 year old Hungarian living in Finland. I spend most of my 
time with computer security-related research and occasional blending.
I have a few years of experience with extending/embedding Python so I think
my Blender-related coding will start with that.

Now to the question. I'm trying to figure out how to add materials to curves.
In the Python API this function does not seem to be implemented. I did a quick
test and came up with the following code sequence (partly adapted from
NMesh.c):

    matlist = EXPP_newMaterialList_fromPyList(pymats);
    EXPP_incr_mats_us( matlist, len );

    if( self->curve->mat )
        MEM_freeN( self->curve->mat );

    self->curve->mat = matlist;
    self->curve->totcol = len;

    test_object_materials( (ID *)self->curve );

With test_object_materials() added the materials get linked to the curve and
show in the 3D view properly. It crashes Blender during rendering though.

Could somebody please shed some light on how materials should be added
to curves? I have the feeling there is something I don't clearly understand
yet. It would be nice to get this implemented.


Thanks in advance,

Gergo


More information about the Bf-committers mailing list