Making new faces (fkey, scanfill etc) didnt create faces with the active material.

Keep the editmesh material and active material in sync
This commit is contained in:
Campbell Barton
2009-10-07 15:16:08 +00:00
parent cf4f00b2fa
commit 93b5375ca1
2 changed files with 11 additions and 0 deletions

View File

@@ -986,6 +986,8 @@ void load_editMesh(Scene *scene, Object *ob)
CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, mface, me->totface);
mesh_update_customdata_pointers(me);
em->mat_nr= ob->actcol-1;
/* the vertices, use ->tmp.l as counter */
eve= em->verts.first;
a= 0;

View File

@@ -99,6 +99,8 @@ EnumPropertyItem object_type_items[] = {
#include "BKE_particle.h"
#include "BKE_scene.h"
#include "BLI_editVert.h" /* for EditMesh->mat_nr */
#include "ED_object.h"
void rna_Object_update(bContext *C, PointerRNA *ptr)
@@ -404,6 +406,13 @@ static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
{
Object *ob= (Object*)ptr->id.data;
ob->actcol= value+1;
if(ob->mode==OB_MODE_EDIT && ob->type==OB_MESH) {
Mesh *me= ob->data;
if(me->edit_mesh)
me->edit_mesh->mat_nr= value;
}
}
static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)