[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23103] branches/bmesh/blender/source/ blender: commit of transform pinning patch by Fabian Fricke (frigi).

Joseph Eagar joeedh at gmail.com
Thu Sep 10 05:59:17 CEST 2009


Revision: 23103
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23103
Author:   joeedh
Date:     2009-09-10 05:59:12 +0200 (Thu, 10 Sep 2009)

Log Message:
-----------
commit of transform pinning patch by Fabian Fricke (frigi).  wip hotkey is enter/alt-enter to pin/unpin verts.  pinned verts aren't affected by transform, e.g. grab, rotate, etc.  this could probably work nicer for proportional editing, but that can be done later.  also the UI for this probably needs reviewing and feedback.  still, very nice patch by Fabian, something I for one will probably find very useful :) 

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
    branches/bmesh/blender/source/blender/editors/include/UI_resources.h
    branches/bmesh/blender/source/blender/editors/interface/resources.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h
    branches/bmesh/blender/source/blender/editors/mesh/mesh_ops.c
    branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c
    branches/bmesh/blender/source/blender/editors/transform/transform_conversions.c
    branches/bmesh/blender/source/blender/makesdna/DNA_mesh_types.h
    branches/bmesh/blender/source/blender/makesdna/DNA_meshdata_types.h
    branches/bmesh/blender/source/blender/makesdna/DNA_userdef_types.h
    branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h	2009-09-10 03:59:12 UTC (rev 23103)
@@ -109,6 +109,7 @@
 #define BM_SMOOTH	(1<<5)
 #define BM_ACTIVE	(1<<6)
 #define BM_NONORMCALC	(1<<7)
+#define BM_PINNED	(1<<8)
 
 typedef struct BMHeader {
 	struct BMHeader *next, *prev;

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h	2009-09-10 03:59:12 UTC (rev 23103)
@@ -8,6 +8,12 @@
 	void *data;
 } BMEditSelection;
 
+/* pinning code */
+void BM_Pin(BMesh *bm, void *element, int pin);
+void BM_Pin_Vert(BMesh *bm, BMVert *v, int pin);
+void BM_Pin_Edge(BMesh *bm, BMEdge *e, int pin);
+void BM_Pin_Face(BMesh *bm, BMFace *f, int pin);
+
 /*geometry hiding code*/
 void BM_Hide(BMesh *bm, void *element, int hide);
 void BM_Hide_Vert(BMesh *bm, BMVert *v, int hide);

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2009-09-10 03:59:12 UTC (rev 23103)
@@ -542,6 +542,7 @@
 	BMHeader *h = element;
 	int f = 0;
 
+	if (h->flag & BM_PINNED) f |= ME_PIN;
 	if (h->flag & BM_HIDDEN) f |= ME_HIDE;
 
 	if (h->type == BM_FACE) {
@@ -571,6 +572,7 @@
 */
 int MEFlags_To_BMFlags(int flag, int type) {
 	int f = 0;
+	if (flag & ME_PIN) f |= BM_PINNED;
 
 	if (type == BM_FACE) {
 		if (flag & ME_FACE_SEL) f |= BM_SELECT;

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2009-09-10 03:59:12 UTC (rev 23103)
@@ -532,6 +532,51 @@
 	}
 }
 
+/***************** Pinning **************/
+
+#define SETPIN(ele) pin ? BM_SetHFlag(ele, BM_PINNED) : BM_ClearHFlag(ele, BM_PINNED);
+
+
+void BM_Pin_Vert(BMesh *bm, BMVert *v, int pin)
+{
+	SETPIN(v);
+}
+
+void BM_Pin_Edge(BMesh *bm, BMEdge *e, int pin)
+{
+	SETPIN(e->v1);
+	SETPIN(e->v2);
+}
+
+void BM_Pin_Face(BMesh *bm, BMFace *f, int pin)
+{
+	BMIter vfiter;
+	BMVert *vf;
+
+	BM_ITER(vf, &vfiter, bm, BM_VERTS_OF_FACE, f) {
+		SETPIN(vf);
+	}
+}
+
+void BM_Pin(BMesh *bm, void *element, int pin)
+{
+	BMHeader *h = element;
+
+	switch (h->type) {
+		case BM_VERT:
+			BM_Pin_Vert(bm, element, pin);
+			break;
+		case BM_EDGE:
+			BM_Pin_Edge(bm, element, pin);
+			break;
+		case BM_FACE:
+			BM_Pin_Face(bm, element, pin);
+			break;
+	}
+}
+
+
+
 /***************** Mesh Hiding stuff *************/
 
 #define SETHIDE(ele) hide ? BM_SetHFlag(ele, BM_HIDDEN) : BM_ClearHFlag(ele, BM_HIDDEN);

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2009-09-10 03:59:12 UTC (rev 23103)
@@ -194,8 +194,6 @@
 	unsigned int maxlength = 0;
 	float (*projectverts)[3];
 	
-	//return;
-
 	/*first, find out the largest face in mesh*/
 	for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f = BMIter_Step(&faces)){
 		if (BM_TestHFlag(f, BM_HIDDEN))

Modified: branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/bmesh/blender/source/blender/editors/include/ED_mesh.h	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/editors/include/ED_mesh.h	2009-09-10 03:59:12 UTC (rev 23103)
@@ -111,6 +111,9 @@
 void EDBM_editselection_normal(float *normal, struct BMEditSelection *ese);
 int EDBM_vertColorCheck(struct BMEditMesh *em);
 
+void EDBM_pin_mesh(struct BMEditMesh *em, int swap);
+void EDBM_unpin_mesh(struct BMEditMesh *em, int swap);
+
 void EDBM_hide_mesh(struct BMEditMesh *em, int swap);
 void EDBM_reveal_mesh(struct BMEditMesh *em);
 

Modified: branches/bmesh/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/bmesh/blender/source/blender/editors/include/UI_resources.h	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/editors/include/UI_resources.h	2009-09-10 03:59:12 UTC (rev 23103)
@@ -202,6 +202,9 @@
 	
 	TH_DOPESHEET_CHANNELOB,
 	TH_DOPESHEET_CHANNELSUBOB,
+
+	TH_PIN,
+	TH_PIN_OPAC,
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 

Modified: branches/bmesh/blender/source/blender/editors/interface/resources.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/interface/resources.c	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/editors/interface/resources.c	2009-09-10 03:59:12 UTC (rev 23103)
@@ -355,6 +355,10 @@
 			case TH_DOPESHEET_CHANNELSUBOB:
 				cp= ts->ds_subchannel;
 				break;	
+			case TH_PIN:
+				cp= ts->pin; break;
+			case TH_PIN_OPAC:
+				cp= &ts->pin_opac; break;
 				
 			}
 		}
@@ -475,6 +479,9 @@
 
 	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
+
+	SETCOL(btheme->tv3d.pin, 115, 171, 209, 255);
+	btheme->tv3d.pin_opac = 40;
 	
 	
 	/* space buttons */

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2009-09-10 03:00:50 UTC (rev 23102)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2009-09-10 03:59:12 UTC (rev 23103)
@@ -1,2681 +1,2802 @@
- /* $Id: bmesh_tools.c
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2004 by Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>
-
-#include "MEM_guardedalloc.h"
-#include "PIL_time.h"
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-#include "DNA_mesh_types.h"
-#include "DNA_material_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_key_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "RNA_types.h"
-#include "RNA_define.h"
-#include "RNA_access.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-#include "BLI_ghash.h"
-#include "BLI_linklist.h"
-#include "BLI_heap.h"
-
-#include "BKE_context.h"
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_bmesh.h"
-#include "BKE_report.h"
-#include "BKE_tessmesh.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_mesh.h"
-#include "ED_view3d.h"
-#include "ED_util.h"
-#include "ED_screen.h"
-#include "ED_transform.h"
-
-#include "UI_interface.h"
-
-#include "mesh_intern.h"
-#include "bmesh.h"
-
-static void add_normal_aligned(float *nor, float *add)
-{
-	if( INPR(nor, add) < -0.9999f)
-		VecSubf(nor, nor, add);
-	else
-		VecAddf(nor, nor, add);
-}
-
-
-static int subdivide_exec(bContext *C, wmOperator *op)
-{
-	Scene *scene = CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
-	int cuts= RNA_int_get(op->ptr,"number_cuts");
-	float smooth= 0.292f*RNA_float_get(op->ptr, "smoothness");
-	float fractal= RNA_float_get(op->ptr, "fractal")/100;
-	int flag= 0;
-
-	if(smooth != 0.0f)
-		flag |= B_SMOOTH;
-	if(fractal != 0.0f)
-		flag |= B_FRACTAL;
-
-	BM_esubdivideflag(obedit, em->bm, BM_SELECT, 
-	                  smooth, fractal, 
-	                  scene->toolsettings->editbutflag|flag, 
-	                  cuts, 0, RNA_enum_get(op->ptr, "quadcorner"), 
-	                  RNA_boolean_get(op->ptr, "tess_single_edge"),
-	                  RNA_boolean_get(op->ptr, "gridfill"));
-
-	DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
-	return OPERATOR_FINISHED;
-}
-
-/* Note, these values must match delete_mesh() event values */
-static EnumPropertyItem prop_mesh_cornervert_types[] = {
-	{SUBD_INNERVERT,     "INNERVERT", 0,      "Inner Vert", ""},
-	{SUBD_PATH,          "PATH", 0,           "Path", ""},
-	{SUBD_STRAIGHT_CUT,  "STRAIGHT_CUT", 0,   "Straight Cut", ""},
-	{SUBD_FAN,           "FAN", 0,            "Fan", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
-void MESH_OT_subdivide(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Subdivide";
-	ot->description= "Subdivide selected edges.";
-	ot->idname= "MESH_OT_subdivide";
-
-	/* api callbacks */
-	ot->exec= subdivide_exec;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list