[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39015] trunk/blender/source/blender: UserPref/Node editor feature: Change the level of noodle curving.

Jeroen Bakker j.bakker at atmind.nl
Thu Aug 4 12:05:15 CEST 2011


Revision: 39015
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39015
Author:   jbakker
Date:     2011-08-04 10:05:14 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
UserPref/Node editor feature: Change the level of noodle curving.

Some people like curved lines, other hate them. This commit will let the user change the level of curving.

In UserPreferences=>Themes=>Node editor=>Noodle curving the level can be modified. Allowed range is 0-10 with the default on 5

The patch will default everything to the way blender works ATM.
File subversion has been increased otherwise older 258 files got straight lines.

The data is stored in the ThemeSpace.noodle_curving
the bezierdrawing is done in the drawnode. Also tested the Line cut tool

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/UI_resources.h
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_resources.h	2011-08-04 09:47:40 UTC (rev 39014)
+++ trunk/blender/source/blender/editors/include/UI_resources.h	2011-08-04 10:05:14 UTC (rev 39015)
@@ -242,7 +242,9 @@
 
 	TH_DRAWEXTRA_EDGELEN,
 	TH_DRAWEXTRA_FACEAREA,
-	TH_DRAWEXTRA_FACEANG
+	TH_DRAWEXTRA_FACEANG,
+
+	TH_NODE_CURVING
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 

Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c	2011-08-04 09:47:40 UTC (rev 39014)
+++ trunk/blender/source/blender/editors/interface/resources.c	2011-08-04 10:05:14 UTC (rev 39015)
@@ -360,7 +360,9 @@
 				cp= ts->syntaxv; break;
 			case TH_NODE_GROUP:
 				cp= ts->syntaxc; break;
-				
+			case TH_NODE_CURVING:
+				cp= &ts->noodle_curving; break;
+
 			case TH_SEQ_MOVIE:
 				cp= ts->movie; break;
 			case TH_SEQ_IMAGE:
@@ -787,6 +789,7 @@
 	SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255);	/* operator */
 	SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255);	/* generator */
 	SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255);	/* group */
+	btheme->tnode.noodle_curving = 5;
 
 	/* space logic */
 	btheme->tlogic= btheme->tv3d;
@@ -1553,7 +1556,14 @@
 		/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
 		U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
 	}
-	
+
+	if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
+		bTheme *btheme;
+		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+			btheme->tnode.noodle_curving = 5;
+		}
+	}
+
 	/* GL Texture Garbage Collection (variable abused above!) */
 	if (U.textimeout == 0) {
 		U.texcollectrate = 60;

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2011-08-04 09:47:40 UTC (rev 39014)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2011-08-04 10:05:14 UTC (rev 39015)
@@ -1768,9 +1768,9 @@
 		vec[3][0]= snode->mx;
 		vec[3][1]= snode->my;
 	}
+
+	dist= UI_GetThemeValue(TH_NODE_CURVING)*0.10f*ABS(vec[0][0] - vec[3][0]);
 	
-	dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
-	
 	/* check direction later, for top sockets */
 	vec[1][0]= vec[0][0]+dist;
 	vec[1][1]= vec[0][1];

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2011-08-04 09:47:40 UTC (rev 39014)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2011-08-04 10:05:14 UTC (rev 39015)
@@ -220,7 +220,7 @@
 	char console_cursor[4];
 	
 	char vertex_size, outline_width, facedot_size;
-	char bpad;
+	char noodle_curving;
 
 	char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes
 	char syntaxv[4], syntaxc[4];

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2011-08-04 09:47:40 UTC (rev 39014)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2011-08-04 10:05:14 UTC (rev 39015)
@@ -1351,6 +1351,13 @@
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Group Node", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop= RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
+	RNA_def_property_int_default(prop, 5);
+	RNA_def_property_range(prop, 0, 10);
+	RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
 static void rna_def_userdef_theme_space_logic(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list