[Bf-committers] "Assign New" button for material indeces
Desoto
bf-committers@blender.org
Sun, 26 Oct 2003 01:07:47 -0500
This is a multi-part message in MIME format.
--------------090204040409010505000104
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi all,
I was thinking about the material index system and decided that it
needed a button which creates a new material index and assigns it to the
selected faces all at once in edit mode instead of having to hit "New"
and then "Assign". The code in my patch has rearranged the buttons
slightly to accommodate the new button. I think you guys will like it,
and from the users I've talked to in #blenderchat, they think its a good
idea as well. Not major feature suggestion, but its one of those neat
little things that could help productivity slightly. Let me know what
you think about it. Thanks!
--------------090204040409010505000104
Content-Type: text/plain;
name="desoto_assign_new.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="desoto_assign_new.txt"
Index: source/blender/src/buttons_editing.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v
retrieving revision 1.10
diff -u -r1.10 buttons_editing.c
--- source/blender/src/buttons_editing.c 25 Oct 2003 19:17:24 -0000 1.10
+++ source/blender/src/buttons_editing.c 26 Oct 2003 06:08:03 -0000
@@ -1779,21 +1779,24 @@
ma= give_current_material(ob, ob->actcol);
if(ma) {
- uiDefButF(block, COL, 0, "", 291,123,24,30, &(ma->r), 0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, ma->id.name+2, 318,146, 103, 30, 0, 0, 0, 0, 0, "");
+ uiDefButF(block, COL, 0, "", 292,133,24,30, &(ma->r), 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, ma->id.name+2, 319,156, 100, 30, 0, 0, 0, 0, 0, "");
}
- uiDefButC(block, NUM, B_REDR, str, 318,123,103,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
- uiDefBut(block, BUT,B_MATWICH, "?", 423,123,31,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
+ uiDefButC(block, NUM, B_REDR, str, 318,133,100,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
+ uiDefBut(block, BUT,B_MATWICH, "?", 422,133,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
- uiDefBut(block, BUT,B_MATNEW, "New", 292,101,80,21, 0, 0, 0, 0, 0, "Adds a new Material index");
- uiDefBut(block, BUT,B_MATDEL, "Delete", 374,101,80,21, 0, 0, 0, 0, 0, "Deletes this Material index");
- uiDefBut(block, BUT,B_MATASS, "Assign", 291,47,162,26, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
-
- uiDefBut(block, BUT,B_MATSEL, "Select", 292,76,79,22, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
- uiDefBut(block, BUT,B_MATDESEL, "Deselect", 373,76,79,21, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
+ uiDefBut(block, BUT,B_MATNEW, "New", 292,110,79,21, 0, 0, 0, 0, 0, "Adds a new Material index");
+ uiDefBut(block, BUT,B_MATDEL, "Delete", 373,110,79,21, 0, 0, 0, 0, 0, "Deletes this Material index");
+
+ uiDefBut(block, BUT,B_MATSEL, "Select", 292,89,79,21, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
+ uiDefBut(block, BUT,B_MATDESEL, "Deselect", 373,89,79,21, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
+
+ uiDefBut(block, BUT,B_MATASS, "Assign", 292,67,160,21, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
+ uiDefBut(block, BUT,B_MATASSNEW, "Assign New", 292,45,160,21, 0, 0, 0, 0, 0, "In EditMode, assigns a new Material index to selected faces");
- uiDefBut(block, BUT,B_SETSMOOTH, "Set Smooth", 291,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
- uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 373,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
+
+ uiDefBut(block, BUT,B_SETSMOOTH, "Set Smooth", 292,15,79,21, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
+ uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 373,15,79,21, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
}
@@ -1896,14 +1899,28 @@
static void editing_panel_mesh_paint(void)
{
extern VPaint Gvp; /* from vpaint */
+ float *colpoin = NULL, min;
uiBlock *block;
block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
- uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
- uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
- uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+ colpoin = &(Gvp.r);
+
+ if(Gvp.colmode==MA_RGB) {
+ uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, colpoin, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
+ uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, colpoin+1, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
+ uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, colpoin+2, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+ }
+ else {
+ uiBlockSetCol(block, TH_BUT_SETTING1);
+ uiDefButF(block, HSVSLI, 0, "H ", 979,160,194,19, colpoin, 0.0, 0.9999, B_VPCOLSLI, 0, "The hue of the color used for painting");
+ uiDefButF(block, HSVSLI, 0, "S ", 979,140,194,19, colpoin, 0.0001, 1.0, B_VPCOLSLI, 0, "The saturation of the color used for painting");
+ uiDefButF(block, HSVSLI, 0, "V ", 979,120,194,19, colpoin, 0.0001, 1.0, B_VPCOLSLI, 0, "The value of the color used for painting");
+ uiBlockSetCol(block, TH_AUTO);
+ }
+
+
uiDefButF(block, NUMSLI, 0, "Opacity ", 979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefButF(block, NUMSLI, 0, "Size ", 979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
@@ -1915,15 +1932,18 @@
uiDefButS(block, ROW, B_DIFF, "Mul", 1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
uiDefButS(block, ROW, B_DIFF, "Filter", 1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
- uiDefButS(block, TOG|BIT|1, 0, "Area", 980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
- uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
- uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
-
- uiDefBut(block, BUT, B_VPGAMMA, "Set", 980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
- uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
- uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
+ uiDefButS(block, ROW, REDRAWBUTSEDIT, "RGB", 980,55,70,20, &Gvp.colmode, 2.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+ uiDefButS(block, ROW, REDRAWBUTSEDIT, "HSV", 1050,55,70,20, &Gvp.colmode, 2.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");
+
+ uiDefButS(block, TOG|BIT|1, 0, "Area", 980,30,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
+ uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,30,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
+ uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,30,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
+
+ uiDefBut(block, BUT, B_VPGAMMA, "Set", 980,10,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
+ uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,10,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
+ uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,10,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
- uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 980,5,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
+ uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 980,-10,103,19, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
}
Index: source/blender/src/buttons_object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_object.c,v
retrieving revision 1.12
diff -u -r1.12 buttons_object.c
--- source/blender/src/buttons_object.c 25 Oct 2003 22:29:24 -0000 1.12
+++ source/blender/src/buttons_object.c 26 Oct 2003 06:08:03 -0000
@@ -916,6 +916,31 @@
}
}
break;
+ case B_MATASSNEW:
+ if(G.obedit) {
+ new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
+ scrarea_queue_winredraw(curarea);
+ }
+ if(G.obedit->type == OB_MESH) {
+ undo_push_mesh("Assign material index");
+ evl= G.edvl.first;
+ while(evl) {
+ if( vlakselectedAND(evl, 1) )
+ evl->mat_nr= G.obedit->actcol-1;
+ evl= evl->next;
+ }
+ allqueue(REDRAWVIEW3D_Z, 0);
+ makeDispList(G.obedit);
+ }
+ else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ nu= editNurb.first;
+ while(nu) {
+ if( isNurbsel(nu) )
+ nu->mat_nr= G.obedit->actcol-1;
+ nu= nu->next;
+ }
+ }
+ break;
case B_MATSEL:
case B_MATDESEL:
if(G.obedit) {
Index: source/blender/include/butspace.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/butspace.h,v
retrieving revision 1.12
diff -u -r1.12 butspace.h
--- source/blender/include/butspace.h 23 Oct 2003 16:52:53 -0000 1.12
+++ source/blender/include/butspace.h 26 Oct 2003 06:08:03 -0000
@@ -277,17 +277,18 @@
#define B_MATNEW 2004
#define B_MATDEL 2005
#define B_MATASS 2006
-#define B_MATSEL 2007
-#define B_MATDESEL 2008
-#define B_HIDE 2009
-#define B_REVEAL 2010
-#define B_SELSWAP 2011
-#define B_SETSMOOTH 2012
-#define B_SETSOLID 2013
-#define B_AUTOTEX 2014
-#define B_DOCENTRE 2015
-#define B_DOCENTRENEW 2016
-#define B_DOCENTRECURSOR 2017
+#define B_MATASSNEW 2007
+#define B_MATSEL 2008
+#define B_MATDESEL 2009
+#define B_HIDE 2010
+#define B_REVEAL 2012
+#define B_SELSWAP 2013
+#define B_SETSMOOTH 2014
+#define B_SETSOLID 2015
+#define B_AUTOTEX 2016
+#define B_DOCENTRE 2017
+#define B_DOCENTRENEW 2019
+#define B_DOCENTRECURSOR 2020
/* 32 values! */
#define B_OBLAY 2018
--------------090204040409010505000104--