Readblend and ListBase
Posted: Sun Sep 27, 2009 3:38 am
Hi, I can't seem to load a ListBase struct from a .blend, I am importing an armature which has worked, going by the makesDNA headers and this blender page, but I don't really know what I'm doing
Here is the problem code:
This is the part where I'm trying to get some data from the bones. When I step through the second blend_object_structure_getfield() I can see "ListBase" as the type, so it looked as though I was close.
That code doesn't "abort" but bFirstBonePtr is set to 0 here:
So I can't get the data that way, it seems! Any thoughts?
Thanks.
Here is the problem code:
Code: Select all
void
blend_acquire_armature_from_obj(BlendFile *bf, BlendObject *meobj, bArmature *arm)
{
{
BlendObject obj, bListBaseObj, bFirstBoneObj;
BlendBlockPointer vblock, fblock, cblock, ttblock,mtblock,dblock, matlink, bFirstBonePtr;
int i;
int32_t ldata = 123456;
float fdata1, fdata2, fdata3;
blend_init_armature(arm);
if (!(blend_object_structure_getfield(bf, &obj, *meobj,
"flag") &&
blend_object_getdata(bf, &ldata, obj)))
{
printf("invalid armature 0x1\n");
meobj->type = BOBJ_TYPE_INVALID_ARMATURE;
return;
}
arm->flag = ldata;
if (!(blend_object_structure_getfield(bf, &obj, *meobj,
"drawtype") &&
blend_object_getdata(bf, &ldata, obj)))
{
printf("invalid armature 0x2\n");
meobj->type = BOBJ_TYPE_INVALID_ARMATURE;
return;
}
arm->drawtype = ldata;
if (!(blend_object_structure_getfield(bf, &obj, *meobj,
"bonebase") &&
blend_object_structure_getfield(bf, &bListBaseObj, obj,
"first") &&
//blend_object_structure_getfield(bf, &bFirstBoneObj, bListBaseObj,
//"weight") &&
blend_object_getdata(bf, &bFirstBonePtr, bListBaseObj))) {
abort();
}Code: Select all
if (!(blend_object_structure_getfield(bf, &obj, *meobj,
"bonebase") &&
blend_object_structure_getfield(bf, &bListBaseObj, obj,
"first") &&
//blend_object_structure_getfield(bf, &bFirstBoneObj, bListBaseObj,
//"weight") &&
blend_object_getdata(bf, &bFirstBonePtr, bListBaseObj))) {
abort();
}Code: Select all
*(BlendBlockPointer*)dest =
blend_block_from_blendpointer(blend_file,
BGETLEUINT32(data));Thanks.