[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15994] trunk/blender/source/blender: added back copy buttons to "Texture Face" panel.

Campbell Barton ideasman42 at gmail.com
Thu Aug 7 03:02:40 CEST 2008


Revision: 15994
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15994
Author:   campbellbarton
Date:     2008-08-07 03:02:06 +0200 (Thu, 07 Aug 2008)

Log Message:
-----------
added back copy buttons to "Texture Face" panel.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editmesh.h
    trunk/blender/source/blender/include/butspace.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/editmesh_mods.c

Modified: trunk/blender/source/blender/include/BIF_editmesh.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editmesh.h	2008-08-06 20:52:15 UTC (rev 15993)
+++ trunk/blender/source/blender/include/BIF_editmesh.h	2008-08-07 01:02:06 UTC (rev 15994)
@@ -132,8 +132,8 @@
 extern void EM_free_backbuf(void);
 
 extern void EM_selectmode_menu(void);
+extern void EM_mesh_copy_face(short type);
 
-
 extern void vertexnoise(void);
 extern void vertexsmooth(void);
 extern void righthandfaces(int select);

Modified: trunk/blender/source/blender/include/butspace.h
===================================================================
--- trunk/blender/source/blender/include/butspace.h	2008-08-06 20:52:15 UTC (rev 15993)
+++ trunk/blender/source/blender/include/butspace.h	2008-08-07 01:02:06 UTC (rev 15994)
@@ -593,7 +593,7 @@
 
 #define B_VPCOLSLI		2801
 #define B_VPGAMMA		2802
-
+#define B_COPY_TF_TRANSP	2803
 #define B_COPY_TF_MODE		2804
 #define B_COPY_TF_UV		2805
 #define B_COPY_TF_COL		2806

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2008-08-06 20:52:15 UTC (rev 15993)
+++ trunk/blender/source/blender/src/buttons_editing.c	2008-08-07 01:02:06 UTC (rev 15994)
@@ -5671,13 +5671,9 @@
 
 void do_fpaintbuts(unsigned short event)
 {
-	Mesh *me;
 	Object *ob;
 	bDeformGroup *defGroup;
-	MTFace *activetf, *tf;
-	MFace *mf;
-	MCol *activemcol;
-	int a;
+	MTFace *activetf;
 	SculptData *sd= &G.scene->sculptdata;
 	ID *id, *idtest;
 	extern VPaint Gwp;         /* from vpaint */
@@ -5695,45 +5691,19 @@
 		vpaint_dogamma();
 		break;
 	case B_COPY_TF_MODE:
+		EM_mesh_copy_face(4); /* todo, get rid of magic numbers */
+		break;
+	case B_COPY_TF_TRANSP:
+		EM_mesh_copy_face(5);
+		break;
 	case B_COPY_TF_UV:
+		EM_mesh_copy_face(3);
+		break;
 	case B_COPY_TF_COL:
+		EM_mesh_copy_face(6);
+		break;
 	case B_COPY_TF_TEX:
-		me= get_mesh(OBACT);
-		activetf= get_active_mtface(NULL, &activemcol, 0);
-
-		if(me && activetf) {
-			for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
-				if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
-					if(event==B_COPY_TF_MODE) {
-						tf->mode= activetf->mode;
-						tf->transp= activetf->transp;
-					}
-					else if(event==B_COPY_TF_UV) {
-						memcpy(tf->uv, activetf->uv, sizeof(tf->uv));
-						tf->tpage= activetf->tpage;
-						tf->tile= activetf->tile;
-
-						if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
-						else tf->mode &= ~TF_TILES;
-
-					}
-					else if(event==B_COPY_TF_TEX) {
-						tf->tpage= activetf->tpage;
-						tf->tile= activetf->tile;
-
-						if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
-						else tf->mode &= ~TF_TILES;
-					}
-					else if(event==B_COPY_TF_COL && activemcol)
-						memcpy(&me->mcol[a*4], activemcol, sizeof(MCol)*4);
-				}
-			}
-
-			DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-			do_shared_vertexcol(me);
-			allqueue(REDRAWVIEW3D, 0);
-			allqueue(REDRAWIMAGE, 0);
-		}
+		EM_mesh_copy_face(2);
 		break;
 	case B_SET_VCOL:
 		if(FACESEL_PAINT_TEST) 
@@ -6170,8 +6140,20 @@
 	if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
 	
 	tf = get_active_mtface(NULL, NULL, 0);
+	
 	if(tf) {
+		uiDefBut(block, LABEL, B_NOP, "Active Face Mode",	600,185,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine ");
+		uiDefBut(block, BUT,B_COPY_TF_MODE, "Copy", 850,185,50,19, 0, 0, 0, 0, 0, "Copy active faces mode to other selected (View3D Ctrl+C)");
+		
+		/* Other copy buttons, layout isnt that nice */
 		uiBlockBeginAlign(block);
+		uiDefBut(block, BUT,B_COPY_TF_UV, "CopyUV", 600,15,100,19, 0, 0, 0, 0, 0, "Copy active faces UVs to other selected (View3D Ctrl+C)");
+		uiDefBut(block, BUT,B_COPY_TF_TEX, "CopyTex", 700,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Texture to other selected (View3D Ctrl+C)");		
+		uiDefBut(block, BUT,B_COPY_TF_COL, "CopyColor", 800,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Color to other selected (View3D Ctrl+C)");
+		uiBlockEndAlign(block);
+		
+		uiBlockBeginAlign(block);
+		
 		uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex",	600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");
 		uiDefButBitS(block, TOG, TF_TILES, B_REDR_3D_IMA, "Tiles",	660,160,60,19, &tf->mode, 0, 0, 0, 0, "Use tilemode for face");
 		uiDefButBitS(block, TOG, TF_LIGHT, REDRAWVIEW3D, "Light",	720,160,60,19, &tf->mode, 0, 0, 0, 0, "Use light for face");
@@ -6182,24 +6164,30 @@
 		uiDefButBitS(block, TOG, TF_SHAREDCOL, REDRAWVIEW3D, "Shared",	600,135,60,19, &tf->mode, 0, 0, 0, 0, "Blend vertex colors across face when vertices are shared");
 		uiDefButBitS(block, TOG, TF_TWOSIDE, REDRAWVIEW3D, "Twoside",660,135,60,19, &tf->mode, 0, 0, 0, 0, "Render face twosided");
 		uiDefButBitS(block, TOG, TF_OBCOL, REDRAWVIEW3D, "ObColor",720,135,60,19, &tf->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colors");
-
-		uiBlockBeginAlign(block);
+		uiBlockEndAlign(block);
 		
+		uiBlockBeginAlign(block);
 		uiDefButBitS(block, TOG, TF_BILLBOARD, B_TFACE_HALO, "Halo",	600,110,60,19, &tf->mode, 0, 0, 0, 0, "Screen aligned billboard");
 		uiDefButBitS(block, TOG, TF_BILLBOARD2, B_TFACE_BILLB, "Billboard",660,110,60,19, &tf->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
 		uiDefButBitS(block, TOG, TF_SHADOW, REDRAWVIEW3D, "Shadow", 720,110,60,19, &tf->mode, 0, 0, 0, 0, "Face is used for shadow");
 		uiDefButBitS(block, TOG, TF_BMFONT, REDRAWVIEW3D, "Text", 780,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable bitmap text on face");
 		uiDefButBitS(block, TOG, TF_ALPHASORT, REDRAWVIEW3D, "Sort", 840,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)");
-
+		uiBlockEndAlign(block);
+		
+		uiDefBut(block, LABEL, B_NOP, "Active Face Alpha Blending (Transp)",	600,75,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine");
+		uiDefBut(block, BUT,B_COPY_TF_TRANSP, "Copy", 850,75,50,19, 0, 0, 0, 0, 0, "Copy active faces transp to other selected (View3D Ctrl+C)");
+		
 		uiBlockBeginAlign(block);
 		uiBlockSetCol(block, TH_BUT_SETTING1);
-		uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque",	600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
-		uiDefButC(block, ROW, REDRAWVIEW3D, "Add",		660,80,60,19, &tf->transp, 2.0, (float)TF_ADD,	0, 0, "Render face transparent and add color of face");
-		uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",	720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
-		uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha",	780,80,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
-	}
-	else
+		uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque",		600,50,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
+		uiDefButC(block, ROW, REDRAWVIEW3D, "Add",			660,50,60,19, &tf->transp, 2.0, (float)TF_ADD,	0, 0, "Render face transparent and add color of face");
+		uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",		720,50,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
+		uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha",	780,50,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0,  "Use the images alpha values clipped with no blending (binary alpha)");
+		uiBlockEndAlign(block);
+		
+	} else {
 		uiDefBut(block,LABEL,B_NOP, "(No Active Face)", 10,200,150,19,0,0,0,0,0,"");
+	}
 
 }
 

Modified: trunk/blender/source/blender/src/editmesh_mods.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_mods.c	2008-08-06 20:52:15 UTC (rev 15993)
+++ trunk/blender/source/blender/src/editmesh_mods.c	2008-08-07 01:02:06 UTC (rev 15994)
@@ -1432,361 +1432,398 @@
 	return ret;
 }
 
-/* ctrl+c in mesh editmode */
-void mesh_copy_menu(void)
+void EM_mesh_copy_edge(short type) 
 {
 	EditMesh *em = G.editMesh;
 	EditSelection *ese;
-	short ret, change=0;
+	short change=0;
 	
+	EditEdge *eed, *eed_act;
+	float vec[3], vec_mid[3], eed_len, eed_len_act;
+	
 	if (!em) return;
 	
 	ese = em->selected.last;
+	if (!ese) return;
 	
-	/* Faces can have a NULL ese, so dont return on a NULL ese here */
+	eed_act = (EditEdge*)ese->data;
 	
-	if(ese && ese->type == EDITVERT) {
-		
-		if (!ese) return;
-		/*EditVert *ev, *ev_act = (EditVert*)ese->data;
-		ret= pupmenu("");*/
-	} else if(ese && ese->type == EDITEDGE) {
-		EditEdge *eed, *eed_act;
-		float vec[3], vec_mid[3], eed_len, eed_len_act;
-		
-		if (!ese) return;
-		
-		eed_act = (EditEdge*)ese->data;
-		
-		ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
-		if (ret<1) return;
-		
-		eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
-		
-		switch (ret) {
-		case 1: /* copy crease */
-			for(eed=em->edges.first; eed; eed=eed->next) {
-				if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
-					eed->crease = eed_act->crease;
-					change = 1;
-				}
+	switch (type) {
+	case 1: /* copy crease */
+		for(eed=em->edges.first; eed; eed=eed->next) {
+			if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
+				eed->crease = eed_act->crease;
+				change = 1;
 			}
-			break;
-		case 2: /* copy bevel weight */
-			for(eed=em->edges.first; eed; eed=eed->next) {
-				if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
-					eed->bweight = eed_act->bweight;
-					change = 1;
-				}
+		}
+		break;
+	case 2: /* copy bevel weight */
+		for(eed=em->edges.first; eed; eed=eed->next) {
+			if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
+				eed->bweight = eed_act->bweight;
+				change = 1;
 			}
-			break;
-			
-		case 3: /* copy length */
-			
-			for(eed=em->edges.first; eed; eed=eed->next) {
-				if (eed->f & SELECT && eed != eed_act) {
-					
-					eed_len = VecLenf(eed->v1->co, eed->v2->co);
-					
-					if (eed_len == eed_len_act) continue;
-					/* if this edge is zero length we cont do anything with it*/
-					if (eed_len == 0.0f) continue;
-					if (eed_len_act == 0.0f) {
-						VecAddf(vec_mid, eed->v1->co, eed->v2->co);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list