Page Menu
Home
Search
Configure Global Search
Log In
Files
F4668
addmat3.txt
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Juho Vepsalainen (bebraw)
Nov 13 2013, 1:17 PM
Size
3 KB
Subscribers
None
addmat3.txt
View Options
Index: source/blender/src/buttons_editing.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v
retrieving revision 1.336
diff -u -p -u -r1.336 buttons_editing.c
--- source/blender/src/buttons_editing.c 6 Jan 2007 20:47:34 -0000 1.336
+++ source/blender/src/buttons_editing.c 9 Jan 2007 12:31:14 -0000
@@ -376,6 +376,35 @@ VFont *exist_vfont(char *str);
/* *************** */
+static void assign_verts_to_material_group(EditMesh *em) {
+ EditFace *efa;
+ Nurb *nu;
+
+ if(G.obedit->type == OB_MESH) {
+ efa= em->faces.first;
+ while(efa) {
+ if(efa->f & SELECT)
+ efa->mat_nr= G.obedit->actcol-1;
+ efa= efa->next;
+ }
+ }
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ nu= editNurb.first;
+ while(nu) {
+ if( isNurbsel(nu) )
+ nu->mat_nr= nu->charidx= G.obedit->actcol-1;
+ nu= nu->next;
+ }
+ }
+ else if (G.obedit->type == OB_FONT) {
+ if (mat_to_sel()) {
+ allqueue(REDRAWVIEW3D, 0);
+ }
+ }
+
+ DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
+}
+
void do_common_editbuts(unsigned short event) // old name, is a mix of object and editing events....
{
EditMesh *em = G.editMesh;
@@ -425,8 +454,16 @@ void do_common_editbuts(unsigned short e
}
}
break;
- case B_MATNEW:
- new_material_to_objectdata(ob);
+ case B_MATNEW:
+ /* if the object doesn't have a material yet, add one */
+ if(give_current_material(ob, ob->actcol) == 0)
+ new_material_to_objectdata(ob);
+ /* add another material group in case there is a selection */
+ if(G.obedit && G.obedit->actcol>0 && em->faces.first) {
+ new_material_to_objectdata(ob);
+ assign_verts_to_material_group(em);
+ }
+
scrarea_queue_winredraw(curarea);
BIF_undo_push("New material");
allqueue(REDRAWBUTSSHADING, 0);
@@ -443,30 +480,9 @@ void do_common_editbuts(unsigned short e
break;
case B_MATASS:
if(G.obedit && G.obedit->actcol>0) {
- if(G.obedit->type == OB_MESH) {
- efa= em->faces.first;
- while(efa) {
- if(efa->f & SELECT)
- efa->mat_nr= G.obedit->actcol-1;
- efa= efa->next;
- }
- }
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
- nu= editNurb.first;
- while(nu) {
- if( isNurbsel(nu) )
- nu->mat_nr= nu->charidx= G.obedit->actcol-1;
- nu= nu->next;
- }
- }
- else if (G.obedit->type == OB_FONT) {
- if (mat_to_sel()) {
- allqueue(REDRAWVIEW3D, 0);
- }
- }
+ assign_verts_to_material_group(em);
allqueue(REDRAWVIEW3D_Z, 0);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
- shade_buttons_change_3d();
+ shade_buttons_change_3d();
BIF_undo_push("Assign material index");
}
break;
@@ -3691,6 +3707,8 @@ void do_vgroupbuts(unsigned short event)
switch(event) {
case B_NEWVGROUP:
add_defgroup (ob);
+ /* assign currently selected verts to the group as well */
+ assign_verts_defgroup ();
scrarea_queue_winredraw(curarea);
allqueue(REDRAWOOPS, 0);
break;
@@ -4259,7 +4277,9 @@ static void editing_panel_links(Object *
uiDefBut(block, BUT,B_MATWICH, "?", 424,123,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_MATNEW, "New", 292,98,80,20, 0, 0, 0, 0, 0, "Adds a new Material index");
+
+ uiDefBut(block, BUT, B_MATALONE, "Make Single User", 292,98,40,20, 0, 0, 0, 0, 0, "Makes the current material single user.");
+ uiDefBut(block, BUT,B_MATNEW, "New", 332,98,40,20, 0, 0, 0, 0, 0, "Adds a new Material index");
uiDefBut(block, BUT,B_MATDEL, "Delete", 374,98,80,20, 0, 0, 0, 0, 0, "Deletes this Material index");
uiDefBut(block, BUT,B_MATSEL, "Select", 292,76,80,20, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
uiDefBut(block, BUT,B_MATDESEL, "Deselect", 374,76,80,20, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fb/f5/e366d1b575b5722ebc2d3754717e
Event Timeline
Log In to Comment