[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37308] branches/soc-2011-onion/source/ blender: GSOC 2011 - onion

Ryakiotakis Antonis kalast at gmail.com
Wed Jun 8 01:12:59 CEST 2011


Revision: 37308
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37308
Author:   psy-fi
Date:     2011-06-07 23:12:58 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
GSOC 2011 - onion

subsurf-aware unwrapper GUI commit #2

Add subsurf aware flags to toolsettings so that we can use this in live unwrap too.

Pending for GUI: add integer parameter to select subdivision level.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2011-06-07 21:20:25 UTC (rev 37307)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2011-06-07 23:12:58 UTC (rev 37308)
@@ -522,6 +522,7 @@
 	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
 	short abf = scene->toolsettings->unwrapper == 0;
 	short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
+	short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
 
 	if(!ED_uvedit_test(obedit)) {
 		BKE_mesh_end_editmesh(obedit->data, em);
@@ -837,6 +838,7 @@
 
 	const short fill_holes= scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
 	const short correct_aspect= !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
+	const short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
 
 	ParamHandle *handle= construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
 
@@ -860,6 +862,7 @@
 	int method = RNA_enum_get(op->ptr, "method");
 	int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
 	int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
+	int use_subsurf = RNA_boolean_get(op->ptr, "use_subsurf_data");
 	
 	/* add uvs if they don't exist yet */
 	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
@@ -875,6 +878,9 @@
 	if(correct_aspect)	scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
 	else				scene->toolsettings->uvcalc_flag |=  UVCALC_NO_ASPECT_CORRECT;
 
+	if(use_subsurf)		scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
+	else				scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
+
 	/* execute unwrap */
 	ED_unwrap_lscm(scene, obedit, TRUE);
 

Modified: branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h	2011-06-07 21:20:25 UTC (rev 37307)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h	2011-06-07 23:12:58 UTC (rev 37308)
@@ -1190,6 +1190,7 @@
 #define UVCALC_FILLHOLES			1
 #define UVCALC_NO_ASPECT_CORRECT	2	/* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
 #define UVCALC_TRANSFORM_CORRECT	4	/* adjust UV's while transforming to avoid distortion */
+#define UVCALC_USESUBSURF			8	/* Use mesh data after subsurf to compute UVs*/
 
 /* toolsettings->uv_flag */
 #define UV_SYNC_SELECTION	1




More information about the Bf-blender-cvs mailing list