[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38710] branches/soc-2011-onion/source/ blender: -smart stitch: Theme Colors for preview

Antony Riakiotakis kalast at gmail.com
Tue Jul 26 02:31:18 CEST 2011


Revision: 38710
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38710
Author:   psy-fi
Date:     2011-07-26 00:31:17 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
-smart stitch: Theme Colors for preview
-weight export: bugfix: clear off-screen buffer before rendering another weight layer. This used to work because of depth testing and 0 weights in vertices not in the same group but this way we avoid potential depth-fighting artifacts.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/blenkernel/BKE_blender.h
    branches/soc-2011-onion/source/blender/editors/include/UI_resources.h
    branches/soc-2011-onion/source/blender/editors/interface/resources.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_userdef.c

Modified: branches/soc-2011-onion/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/BKE_blender.h	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/blenkernel/BKE_blender.h	2011-07-26 00:31:17 UTC (rev 38710)
@@ -44,7 +44,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION			258
-#define BLENDER_SUBVERSION		3 // temporary bump for testing purposes in Onion branch
+#define BLENDER_SUBVERSION		4 // temporary bump for testing purposes in Onion branch
 
 #define BLENDER_MINVERSION		250
 #define BLENDER_MINSUBVERSION	0

Modified: branches/soc-2011-onion/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/UI_resources.h	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/include/UI_resources.h	2011-07-26 00:31:17 UTC (rev 38710)
@@ -242,7 +242,12 @@
 
 	TH_DRAWEXTRA_EDGELEN,
 	TH_DRAWEXTRA_FACEAREA,
-	TH_DRAWEXTRA_FACEANG
+	TH_DRAWEXTRA_FACEANG,
+	TH_STITCH_PREVIEW_FACE,
+	TH_STITCH_PREVIEW_EDGE,
+	TH_STITCH_PREVIEW_VERT,
+	TH_STITCH_PREVIEW_STITCHABLE,
+	TH_STITCH_PREVIEW_UNSTITCHABLE
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 

Modified: branches/soc-2011-onion/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/interface/resources.c	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/interface/resources.c	2011-07-26 00:31:17 UTC (rev 38710)
@@ -408,6 +408,26 @@
 			case TH_PREVIEW_BACK:
 				cp= ts->preview_back;
 				break;	
+
+			case TH_STITCH_PREVIEW_FACE:
+				cp = ts->preview_stitch_face;
+				break;
+
+			case TH_STITCH_PREVIEW_EDGE:
+				cp = ts->preview_stitch_edge;
+				break;
+
+			case TH_STITCH_PREVIEW_VERT:
+				cp = ts->preview_stitch_vert;
+				break;
+
+			case TH_STITCH_PREVIEW_STITCHABLE:
+				cp = ts->preview_stitch_stitchable;
+				break;
+
+			case TH_STITCH_PREVIEW_UNSTITCHABLE:
+				cp = ts->preview_stitch_unstitchable;
+				break;
 			}
 		}
 	}
@@ -720,6 +740,11 @@
 	SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
 	SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
 	SETCOLF(btheme->tima.preview_back, 	0.45, 0.45, 0.45, 1.0);
+	SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
+	SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
+	SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
+	SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+	SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
 
 	/* space imageselect */
 	btheme->timasel= btheme->tv3d;
@@ -1553,11 +1578,24 @@
 	}
 	
 	/* GSoC 2011 Onion */
-	if (bmain->versionfile < 257 || (bmain->versionfile == 257 && bmain->subversionfile < 3))
-		U.hirestex = 0;
+	if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 4)){
+		if(bmain->subversionfile < 4){
+			bTheme *btheme;
+			for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+				SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
+				SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
+				SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
+				SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+				SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
+			}
+		}
+		if(bmain->subversionfile < 3){
+			U.hirestex = 0;
+		}
+	}
 
 	/* GSoC 2011 Onion */
-	if (bmain->versionfile < 257 || (bmain->versionfile == 257 && bmain->subversionfile < 3)) {
+	if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 3)) {
 		U.sculpt_paint_mask_col[0]= 1.00f;
 		U.sculpt_paint_mask_col[1]= 0.39f;
 		U.sculpt_paint_mask_col[2]= 0.39f;

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c	2011-07-26 00:31:17 UTC (rev 38710)
@@ -5601,7 +5601,7 @@
  * We really don't need all checks + we need to draw only the selected object */
 static int weight_layers_images_from_view_exec(bContext *C, wmOperator *op)
 {
-//	char filename[FILE_MAX];
+	char filename[FILE_MAX];
 	Scene *scene= CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar =  CTX_wm_region(C);
@@ -5615,7 +5615,7 @@
 		return OPERATOR_FINISHED;
 	else return OPERATOR_CANCELLED;
 
-//	RNA_string_get(op->ptr, "filepath", filename);
+	RNA_string_get(op->ptr, "filepath", filename);
 
 
 }
@@ -5635,7 +5635,7 @@
 	ot->flag= OPTYPE_REGISTER;
 
 	/* Copied from above, may come in handy */
-//	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
+	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
 }
 
 
@@ -5643,7 +5643,7 @@
  * We really don't need all checks + we need to draw only the selected object */
 static int weight_layers_to_uv_images_exec(bContext *C, wmOperator *op)
 {
-//	char filename[FILE_MAX];
+	char filename[FILE_MAX];
 	Scene *scene= CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar =  CTX_wm_region(C);
@@ -5657,7 +5657,7 @@
 		return OPERATOR_FINISHED;
 	else return OPERATOR_CANCELLED;
 
-//	RNA_string_get(op->ptr, "filepath", filename);
+	RNA_string_get(op->ptr, "filepath", filename);
 
 
 }
@@ -5677,5 +5677,5 @@
 	ot->flag= OPTYPE_REGISTER;
 
 	/* Copied from above, may come in handy */
-//	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
+	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
 }

Modified: branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c	2011-07-26 00:31:17 UTC (rev 38710)
@@ -2771,8 +2771,6 @@
 
 	glClearColor(0.0, 0.0, 0.0, 0.0);
 
-	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-
 	/* setup view matrices */
 	if(winmatexists)
 		view3d_main_area_setup_view(scene, v3d, ar, NULL, winmat);
@@ -2845,6 +2843,8 @@
 					weightColors[4*i + 3] = FTOCHAR(defvert_find_weight(dw+i, defnum));
 		}
 
+		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
 		glDrawElements(GL_TRIANGLES, 3*(numOfFaces - numOfQuads), GL_UNSIGNED_INT, triIndices);
 		glDrawElements(GL_QUADS, 4*numOfQuads, GL_UNSIGNED_INT, quadIndices);
 

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c	2011-07-26 00:31:17 UTC (rev 38710)
@@ -872,24 +872,24 @@
 
 			glVertexPointer(2, GL_FLOAT, 0, stitch_preview->previewTris);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-			glColor4f(0.5, 0.5, 0.0, 0.2);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
 			glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-			glColor4f(1.0, 0.0, 1.0, 0.2);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
 			glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-			glColor4f(0.0, 0.0, 1.0, 0.5);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
 			glDrawArrays(GL_TRIANGLES, 0, stitch_preview->numOfTris*3);
 
 			glVertexPointer(2, GL_FLOAT, 0, stitch_preview->previewQuads);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-			glColor4f(0.5, 0.5, 0.0, 0.2);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
 			glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-			glColor4f(1.0, 0.0, 1.0, 0.2);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
 			glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-			glColor4f(0.0, 0.0, 1.0, 0.2);
+			UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
 			glDrawArrays(GL_QUADS, 0, stitch_preview->numOfQuads*4);
 
 			glDisable(GL_BLEND);

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-25 22:43:06 UTC (rev 38709)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-07-26 00:31:17 UTC (rev 38710)
@@ -70,6 +70,7 @@
 #include "WM_types.h"
 
 #include "UI_view2d.h"
+#include "UI_resources.h"
 
 #include "uvedit_intern.h"
 
@@ -1819,7 +1820,7 @@
 					preview->previewOrig[bufferIterator*2] = mt->uv[element->tfindex][0];
 					preview->previewOrig[bufferIterator*2 + 1] = mt->uv[element->tfindex][1];
 					/* stitchable uv's will be green, non-stitchable red */
-					preview->previewOrigColors[bufferIterator] = 0x0000FF00;
+					UI_GetThemeColor4ubv(TH_STITCH_PREVIEW_STITCHABLE, &preview->previewOrigColors[bufferIterator]);
 					bufferIterator++;
 
 					if(efa->v4){
@@ -1836,7 +1837,7 @@
 
 					preview->previewOrig[bufferIterator*2] = mt->uv[element->tfindex][0];
 					preview->previewOrig[bufferIterator*2 + 1] = mt->uv[element->tfindex][1];
-					preview->previewOrigColors[bufferIterator] = 0x000000FF;
+					UI_GetThemeColor4ubv(TH_STITCH_PREVIEW_UNSTITCHABLE, &preview->previewOrigColors[bufferIterator]);
 					bufferIterator++;
 				}
 			}else{
@@ -1878,12 +1879,12 @@
 					preview->previewOrig[bufferIterator*4 + 3] = mt->uv[(element->tfindex + 1)%nverts][1];
 
 					if(element->flag & STITCH_EDGE_STITCHABLE){
-						preview->previewOrigColors[bufferIterator*2] = 0x0000FF00;
-						preview->previewOrigColors[bufferIterator*2 + 1] = 0x0000FF00;
+						UI_GetThemeColor4ubv(TH_STITCH_PREVIEW_STITCHABLE, &preview->previewOrigColors[bufferIterator*2]);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list