Bugfix #25120 and #25119 and numerous future bugs!

Two isses:
- Material assigning to MetaBalls used wrong pointer
  (copy paste error, casting badly).
- Checking for node-material used wrong RNA pointer
  (confusing void stuff going on here!)

The error leads to corruption in data and/or random
crashes. Better update svn now!
This commit is contained in:
2010-12-09 15:49:05 +00:00
parent 9f4b5d49fc
commit ad35b37f2d
2 changed files with 7 additions and 3 deletions

View File

@@ -445,7 +445,7 @@ Material ***give_matarar_id(ID *id)
return &(((Curve *)id)->mat);
break;
case ID_MB:
return &(((Curve *)id)->mat);
return &(((MetaBall *)id)->mat);
break;
}
return NULL;
@@ -461,7 +461,7 @@ short *give_totcolp_id(ID *id)
return &(((Curve *)id)->totcol);
break;
case ID_MB:
return &(((Curve *)id)->totcol);
return &(((MetaBall *)id)->totcol);
break;
}
return NULL;
@@ -530,6 +530,10 @@ Material *give_current_material(Object *ob, int act)
totcolp= give_totcolp(ob);
if(totcolp==NULL || ob->totcol==0) return NULL;
if(act<0) {
printf("no!\n");
}
if(act>ob->totcol) act= ob->totcol;
else if(act<=0) act= 1;

View File

@@ -2008,7 +2008,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* provision to draw active node name */
Material *ma, *manode;
Object *ob= (Object*)ptr->id.data;
int index= (Material**)ptr->data - ob->mat;
int index= (Material**)itemptr->data - ob->mat;
/* default item with material base name */
uiItemL(sub, name, icon);