[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27454] trunk/blender: - Hhighlight active nurb in edit mode

Sergey Sharybin g.ulairi at gmail.com
Fri Mar 12 17:43:05 CET 2010


Revision: 27454
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27454
Author:   nazgul
Date:     2010-03-12 17:43:04 +0100 (Fri, 12 Mar 2010)

Log Message:
-----------
- Hhighlight active nurb in edit mode
- Replaced hardcoded nurbcol array with theme colors
- Send notification in duplicate curve operator (this operator could
  reset/change active nurb)
- Edge seam color added to the user preferences dialog

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/include/UI_resources.h
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/space_graph/graph_draw.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2010-03-12 16:43:04 UTC (rev 27454)
@@ -658,6 +658,19 @@
             col.prop(v3d, "object_grouped")
             col.prop(v3d, "object_grouped_active")
             col.prop(v3d, "transform")
+            col.prop(v3d, "nurb_uline")
+            col.prop(v3d, "nurb_vline")
+            col.prop(v3d, "nurb_sel_uline")
+            col.prop(v3d, "nurb_sel_vline")
+            col.prop(v3d, "handle_free")
+            col.prop(v3d, "handle_auto")
+            col.prop(v3d, "handle_vect")
+            col.prop(v3d, "handle_align")
+            col.prop(v3d, "handle_sel_free")
+            col.prop(v3d, "handle_sel_auto")
+            col.prop(v3d, "handle_sel_vect")
+            col.prop(v3d, "handle_sel_align")
+            col.prop(v3d, "act_spline")
 
             col = split.column()
             col.prop(v3d, "vertex")
@@ -666,6 +679,7 @@
             col.prop(v3d, "vertex_normal")
             col.prop(v3d, "bone_solid")
             col.prop(v3d, "bone_pose")
+            col.prop(v3d, "edge_seam")
             #col.prop(v3d, "edge") Doesn't seem to work
 
         elif theme.theme_area == 'GRAPH_EDITOR':

Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/source/blender/editors/curve/editcurve.c	2010-03-12 16:43:04 UTC (rev 27454)
@@ -4255,6 +4255,7 @@
 	Object *obedit= CTX_data_edit_object(C);
 
 	adduplicateflagNurb(obedit, 1);
+	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
 	return OPERATOR_FINISHED;
 }

Modified: trunk/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_resources.h	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/source/blender/editors/include/UI_resources.h	2010-03-12 16:43:04 UTC (rev 27454)
@@ -164,7 +164,23 @@
 	TH_FACE_DOT,
 	TH_FACEDOT_SIZE,
 	TH_CFRAME,
+	TH_NURB_ULINE,
+	TH_NURB_VLINE,
+	TH_NURB_SEL_ULINE,
+	TH_NURB_SEL_VLINE,
 
+	/* this eight colors should be in one block */
+	TH_HANDLE_FREE,
+	TH_HANDLE_AUTO,
+	TH_HANDLE_VECT,
+	TH_HANDLE_ALIGN,
+	TH_HANDLE_SEL_FREE,
+	TH_HANDLE_SEL_AUTO,
+	TH_HANDLE_SEL_VECT,
+	TH_HANDLE_SEL_ALIGN,
+
+	TH_ACTIVE_SPLINE,
+
 	TH_SYNTAX_B,
 	TH_SYNTAX_V,
 	TH_SYNTAX_C,

Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/source/blender/editors/interface/resources.c	2010-03-12 16:43:04 UTC (rev 27454)
@@ -305,7 +305,33 @@
 				cp= ts->strip_select; break;
 			case TH_CFRAME:
 				cp= ts->cframe; break;
-				
+			case TH_NURB_ULINE:
+				cp= ts->nurb_uline; break;
+			case TH_NURB_VLINE:
+				cp= ts->nurb_vline; break;
+			case TH_NURB_SEL_ULINE:
+				cp= ts->nurb_sel_uline; break;
+			case TH_NURB_SEL_VLINE:
+				cp= ts->nurb_sel_vline; break;
+			case TH_ACTIVE_SPLINE:
+				cp= ts->act_spline; break;
+			case TH_HANDLE_FREE:
+				cp= ts->handle_free; break;
+			case TH_HANDLE_AUTO:
+				cp= ts->handle_auto; break;
+			case TH_HANDLE_VECT:
+				cp= ts->handle_vect; break;
+			case TH_HANDLE_ALIGN:
+				cp= ts->handle_align; break;
+			case TH_HANDLE_SEL_FREE:
+				cp= ts->handle_sel_free; break;
+			case TH_HANDLE_SEL_AUTO:
+				cp= ts->handle_sel_auto; break;
+			case TH_HANDLE_SEL_VECT:
+				cp= ts->handle_sel_vect; break;
+			case TH_HANDLE_SEL_ALIGN:
+				cp= ts->handle_sel_align; break;
+
 			case TH_SYNTAX_B:
 				cp= ts->syntaxb; break;
 			case TH_SYNTAX_V:
@@ -495,6 +521,22 @@
 	btheme->tv3d.facedot_size= 4;
 	SETCOL(btheme->tv3d.cframe, 0x60, 0xc0,	 0x40, 255);
 
+	SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
+	SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
+	SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
+	SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
+
+	SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
+	SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
+	SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
+	SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
+	SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
+	SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+	SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+	SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+
+	SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
+
 	SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
 	SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);               // alpha 80 is not meant editable, used for wire+action draw
 	

Modified: trunk/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-03-12 16:43:04 UTC (rev 27454)
@@ -357,7 +357,6 @@
  * note: draw_fcurve_handles_check must be checked before running this. */
 static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
 {
-	extern unsigned int nurbcol[];
 	int sel, b;
 	
 	/* a single call to GL_LINES here around these calls should be sufficient to still
@@ -371,8 +370,9 @@
 	 */
 	for (sel= 0; sel < 2; sel++) {
 		BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
-		unsigned int *col= (sel)? (nurbcol+4) : (nurbcol);
+		int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
 		float *fp;
+		char col[4];
 		
 		/* if only selected keyframes have handles shown, skip the first round */
 		if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY))
@@ -390,19 +390,24 @@
 			/* draw handle with appropriate set of colors if selection is ok */
 			if ((bezt->f2 & SELECT)==sel) {
 				fp= bezt->vec[0];
-				
+
 				/* only draw first handle if previous segment had handles */
 				if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) 
 				{
-					cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
+					UI_GetThemeColor3ubv(basecol + bezt->h1, col);
+					col[3]= drawFCurveFade(fcu) * 255;
+					glColor4ubv((GLubyte *)col);
 					
 					glVertex2fv(fp); glVertex2fv(fp+3); 
 				}
-				
+
 				/* only draw second handle if this segment is bezier */
 				if (bezt->ipo == BEZT_IPO_BEZ) 
 				{
-					cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
+					UI_GetThemeColor3ubv(basecol + bezt->h2, col);
+					col[3]= drawFCurveFade(fcu) * 255;
+					glColor4ubv((GLubyte *)col);
+
 					glVertex2fv(fp+3); glVertex2fv(fp+6); 
 				}
 			}
@@ -412,8 +417,10 @@
 					 ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) ) 
 				{
 					fp= bezt->vec[0];
-					cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
-					
+					UI_GetThemeColor3ubv(basecol + bezt->h1, col);
+					col[3]= drawFCurveFade(fcu) * 255;
+					glColor4ubv((GLubyte *)col);
+
 					glVertex2fv(fp); glVertex2fv(fp+3); 
 				}
 				
@@ -422,8 +429,10 @@
 					 (bezt->ipo == BEZT_IPO_BEZ) )
 				{
 					fp= bezt->vec[1];
-					cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
-					
+					UI_GetThemeColor3ubv(basecol + bezt->h2, col);
+					col[3]= drawFCurveFade(fcu) * 255;
+					glColor4ubv((GLubyte *)col);
+
 					glVertex2fv(fp); glVertex2fv(fp+3); 
 				}
 			}

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-03-12 16:32:18 UTC (rev 27453)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-03-12 16:43:04 UTC (rev 27454)
@@ -2854,8 +2854,7 @@
 		case DL_POLY:
 			if(ob->type==OB_SURF) {
 				int nr;
-				
-				UI_ThemeColor(TH_WIRE);
+
 				glDisable(GL_LIGHTING);
 				
 				/* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
@@ -4254,23 +4253,21 @@
 }
 
 /*place to add drawers */
-unsigned int nurbcol[8]= {
-	0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 };
 
 static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
 {
 	BezTriple *bezt;
 	float *fp;
-	unsigned int *col;
+	int basecol;
 	int a;
 	
 	if(nu->hide || hide_handles) return;
-	
+
 	glBegin(GL_LINES); 
 	
 	if(nu->type == CU_BEZIER) {
-		if(sel) col= nurbcol+4;
-		else col= nurbcol;
+		if(sel) basecol= TH_HANDLE_SEL_FREE;
+		else basecol= TH_HANDLE_FREE;
 
 		bezt= nu->bezt;
 		a= nu->pntsu;
@@ -4278,26 +4275,26 @@
 			if(bezt->hide==0) {
 				if( (bezt->f2 & SELECT)==sel) {
 					fp= bezt->vec[0];
-					
-					cpack(col[(int)bezt->h1]);
+
+					UI_ThemeColor(basecol + bezt->h1);
 					glVertex3fv(fp);
 					glVertex3fv(fp+3); 
 
-					cpack(col[(int)bezt->h2]);
+					UI_ThemeColor(basecol + bezt->h2);
 					glVertex3fv(fp+3); 
 					glVertex3fv(fp+6); 
 				}
 				else if( (bezt->f1 & SELECT)==sel) {
 					fp= bezt->vec[0];
-					
-					cpack(col[(int)bezt->h1]);
+
+					UI_ThemeColor(basecol + bezt->h1);
 					glVertex3fv(fp); 
 					glVertex3fv(fp+3); 
 				}
 				else if( (bezt->f3 & SELECT)==sel) {
 					fp= bezt->vec[1];
-					
-					cpack(col[(int)bezt->h2]);
+
+					UI_ThemeColor(basecol + bezt->h2);
 					glVertex3fv(fp); 
 					glVertex3fv(fp+3); 
 				}
@@ -4308,6 +4305,41 @@
 	glEnd();
 }
 
+static void tekenhandlesN_active(Nurb *nu)
+{
+	BezTriple *bezt;
+	float *fp;
+	int a;
+
+	if(nu->hide) return;
+
+	UI_ThemeColor(TH_ACTIVE_SPLINE);
+	glLineWidth(2);
+
+	glBegin(GL_LINES);
+
+	if(nu->type == CU_BEZIER) {
+		bezt= nu->bezt;
+		a= nu->pntsu;
+		while(a--) {
+			if(bezt->hide==0) {
+				fp= bezt->vec[0];
+
+				glVertex3fv(fp);
+				glVertex3fv(fp+3);
+
+				glVertex3fv(fp+3);
+				glVertex3fv(fp+6);
+			}
+			bezt++;
+		}
+	}
+	glEnd();
+
+	glColor3ub(0,0,0);
+	glLineWidth(1);
+}
+
 static void tekenvertsN(Nurb *nu, short sel, short hide_handles)
 {
 	BezTriple *bezt;
@@ -4357,18 +4389,94 @@
 	glPointSize(1.0);
 }
 
+static void editnurb_draw_active_poly(Nurb *nu)
+{
+	BPoint *bp;
+	int a, b;
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list