When referenced (Library-linked) Mesh was used by a local Object, and the
amount of Materials became less in library, Blender crashed!
This commit is contained in:
Ton Roosendaal
2006-11-25 18:15:55 +00:00
parent 8292e4ac1a
commit f554aa8a35
3 changed files with 17 additions and 0 deletions

View File

@@ -404,6 +404,13 @@ Material *give_current_material(Object *ob, int act)
ma= ob->mat[act-1];
}
else { /* in data */
short *totcolp= give_totcolp(ob);
/* check for inconsistancy */
if(*totcolp < ob->totcol)
ob->totcol= *totcolp;
if(act>ob->totcol) act= ob->totcol;
matarar= give_matarar(ob);
if(matarar && *matarar) ma= (*matarar)[act-1];

View File

@@ -4002,6 +4002,9 @@ static void editing_panel_links(Object *ob)
if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL);
else return;
id= ob->data;
uiSetButLock(id->lib!=NULL, "Cannot edit Library data");
if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
else poin= &( ((Curve *)ob->data)->texflag );

View File

@@ -3282,11 +3282,17 @@ static void material_panel_links(Object *ob, Material *ma)
/* indicate which one is linking a material */
if(id) {
if(id->lib)
uiSetButLock(1, "Can't edit library data");
else
uiClearButLock();
strncpy(str, id->name, 2);
str[2]= ':'; str[3]= 0;
but= uiDefBut(block, TEX, B_IDNAME, str, 10,135,115,20, id->name+2, 0.0, 18.0, 0, 0, "Shows the block the material is linked to");
uiButSetFunc(but, test_idbutton_cb, id->name, NULL);
}
uiBlockSetCol(block, TH_BUT_ACTION);
uiDefButBitS(block, TOG, 1<<(ob->actcol-1), B_MATFROM, "OB", 125,135,32,20, &ob->colbits, 0, 0, 0, 0, "Links material to object");
idn= ob->data;
@@ -3302,6 +3308,7 @@ static void material_panel_links(Object *ob, Material *ma)
uiBlockEndAlign(block);
if(ma==NULL) return;
uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
/* Active material node */
if(ma->use_nodes) {