Page Menu
Home
Search
Configure Global Search
Log In
Files
F4669
addmat4.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
addmat4.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.357
diff -u -p -u -r1.357 buttons_editing.c
--- source/blender/src/buttons_editing.c 2 Feb 2007 06:26:10 -0000 1.357
+++ source/blender/src/buttons_editing.c 3 Feb 2007 16:21:27 -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,20 @@ 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 material and assign verts to group in case there is a selection */
+ for(efa= em->faces.first; efa; efa=efa->next){
+ if(faceselectedOR(efa, SELECT)) {
+ new_material_to_objectdata(ob);
+ assign_verts_to_material_group(em);
+ break;
+ }
+ }
+
scrarea_queue_winredraw(curarea);
BIF_undo_push("New material");
allqueue(REDRAWBUTSSHADING, 0);
@@ -443,30 +484,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;
@@ -3826,6 +3846,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;
@@ -4403,7 +4425,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
60/69/e030083ab6e9cb489fcff7c4d266
Event Timeline
Log In to Comment