[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11411] branches/bmesh: -> Fixed transform code

Joe Eagar joeedh at gmail.com
Sun Jul 29 08:30:26 CEST 2007


Sorry I added the bmesh files in the wrong place :) I agree, its easier 
if they're in blenkernel.

Joe

Geoffrey Bantle wrote:
> Revision: 11411
>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11411
> Author:   briggs
> Date:     2007-07-29 07:25:22 +0200 (Sun, 29 Jul 2007)
>
> Log Message:
> -----------
> -> Fixed transform code
>
> Fixed transform code for bmesh so that scaling/rotation/translation
> of editmode elements works again. PET mode still not working.
>
> Also moved the bmesh kernel source files to blenkernel.
>
> Modified Paths:
> --------------
>     branches/bmesh/config/win32-vc-config.py
>     branches/bmesh/source/blender/src/editbmesh_interface.c
>     branches/bmesh/source/blender/src/transform_conversions.c
>
> Added Paths:
> -----------
>     branches/bmesh/source/blender/blenkernel/intern/BME_eulers.c
>     branches/bmesh/source/blender/blenkernel/intern/BME_mesh.c
>     branches/bmesh/source/blender/blenkernel/intern/BME_structure.c
>     branches/bmesh/source/blender/blenkernel/intern/BME_tools.c
>     branches/bmesh/source/blender/blenkernel/intern/bmesh_private.h
>
> Removed Paths:
> -------------
>     branches/bmesh/source/blender/bmesh/
>
> Modified: branches/bmesh/config/win32-vc-config.py
> ===================================================================
> --- branches/bmesh/config/win32-vc-config.py	2007-07-28 21:35:32 UTC (rev 11410)
> +++ branches/bmesh/config/win32-vc-config.py	2007-07-29 05:25:22 UTC (rev 11411)
> @@ -18,13 +18,13 @@
>  BF_PYTHON_LIB = 'python25'
>  BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
>  
> -WITH_BF_OPENAL = 'true'
> +WITH_BF_OPENAL = 'false'
>  BF_OPENAL = LIBDIR + '/openal'
>  BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
>  BF_OPENAL_LIB = 'openal_static'
>  BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
>  
> -WITH_BF_ICONV = 'true'
> +WITH_BF_ICONV = 'false'
>  BF_ICONV = LIBDIR + '/iconv'
>  BF_ICONV_INC = '${BF_ICONV}/include'
>  BF_ICONV_LIB = 'iconv'
> @@ -44,7 +44,7 @@
>  WITH_BF_FMOD = 'false'
>  BF_FMOD = LIBDIR + '/fmod'
>  
> -WITH_BF_OPENEXR = 'true'
> +WITH_BF_OPENEXR = 'false'
>  BF_OPENEXR = LIBDIR + '/openexr'
>  BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
>  BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
> @@ -71,26 +71,26 @@
>  BF_ZLIB_LIB = 'libz'
>  BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
>  
> -WITH_BF_INTERNATIONAL = 'true'
> +WITH_BF_INTERNATIONAL = 'false'
>  
>  BF_GETTEXT = LIBDIR + '/gettext'
>  BF_GETTEXT_INC = '${BF_GETTEXT}/include'
>  BF_GETTEXT_LIB = 'gnu_gettext'
>  BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
>  
> -WITH_BF_FTGL = 'true'
> +WITH_BF_FTGL = 'false'
>  BF_FTGL = LIBDIR + '/ftgl'
>  BF_FTGL_INC = '${BF_FTGL}/include'
>  BF_FTGL_LIB = 'extern_ftgl'
>  
>  WITH_BF_GAMEENGINE = 'false'
>  
> -WITH_BF_ODE = 'true'
> +WITH_BF_ODE = 'false'
>  BF_ODE = LIBDIR + '/ode'
>  BF_ODE_INC = BF_ODE + '/include'
>  BF_ODE_LIB = BF_ODE + '/lib/libode.a'
>  
> -WITH_BF_BULLET = 'true'
> +WITH_BF_BULLET = 'false'
>  BF_BULLET = '#extern/bullet2/src'
>  BF_BULLET_INC = '${BF_BULLET}'
>  BF_BULLET_LIB = 'extern_bullet'
> @@ -102,7 +102,7 @@
>  BF_WINTAB = LIBDIR + '/wintab'
>  BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
>  
> -WITH_BF_YAFRAY = 'true'
> +WITH_BF_YAFRAY = 'false'
>  
>  #WITH_BF_NSPR = 'true'
>  #BF_NSPR = $(LIBDIR)/nspr
> @@ -127,7 +127,7 @@
>  BF_FREETYPE_LIB = 'freetype2ST'
>  BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
>  
> -WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
> +WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
>  BF_QUICKTIME = LIBDIR + '/QTDevWin'
>  BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
>  BF_QUICKTIME_LIB = 'qtmlClient'
> @@ -144,12 +144,11 @@
>  CXX = 'cl.exe'
>  
>  CCFLAGS = ['/nologo', '/Og', '/Ot', '/Ob1', '/Op', '/G6','/EHsc', '/J', '/W3', '/Gd', '/MT']
> +BF_DEBUG_FLAGS = ['/Od', '/Zi', '/FR${TARGET}.sbr']
>  
> -BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET.base}.sbr']
> -
> -CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DUSE_OPENAL', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
> -REL_CFLAGS = ['-O2', '-DNDEBUG']
> -REL_CCFLAGS = ['-O2', '-DNDEBUG']
> +CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
> +REL_CFLAGS = ['-DNDEBUG']
> +REL_CCFLAGS = ['-DNDEBUG']
>  C_WARN = []
>  CC_WARN = []
>  
>
> Added: branches/bmesh/source/blender/blenkernel/intern/BME_eulers.c
> ===================================================================
> --- branches/bmesh/source/blender/blenkernel/intern/BME_eulers.c	                        (rev 0)
> +++ branches/bmesh/source/blender/blenkernel/intern/BME_eulers.c	2007-07-29 05:25:22 UTC (rev 11411)
> @@ -0,0 +1,1002 @@
> +/**
> + * BME_eulers.c    jan 2007
> + *
> + *	BMesh Euler construction API.
> + *
> + * $Id: BME_eulers.c,v 1.00 2007/01/17 17:42:01 Briggs Exp $
> + *
> + * ***** BEGIN GPL/BL DUAL 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. The Blender
> + * Foundation also sells licenses for use in proprietary software under
> + * the Blender License.  See http://www.blender.org/BL/ for information
> + * about this.	
> + *
> + * 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 Blender Foundation.
> + * All rights reserved.
> + *
> + * The Original Code is: all of this file.
> + *
> + * Contributor(s): Geoffrey Bantle.
> + *
> + * ***** END GPL/BL DUAL LICENSE BLOCK *****
> + */
> +
> +#include "MEM_guardedalloc.h"
> +
> +#include "DNA_listBase.h"
> +#include "DNA_meshdata_types.h"
> +#include "DNA_mesh_types.h"
> +
> +#include "BKE_utildefines.h"
> +#include "BKE_bmesh.h"
> +
> +#include "BLI_blenlib.h"
> +#include "bmesh_private.h"
> +#include "BLI_ghash.h"
> +
> +/*********************************************************
> + *                    "Euler API"                        *
> + *                                                       *
> + *                                                       *
> + *	 Primitive construction operators for mesh tools.    *
> + *                                                       *
> + **********************************************************/
> +
> +
> +/*
> +	The functions in this file represent the 'primitive' or 'atomic' operators that
> +	mesh tools use to manipulate the topology of the structure.* The purpose of these
> +	functions is to provide a trusted set of operators to manipulate the mesh topology
> +	and which can also be combined together like building blocks to create more 
> +	sophisticated tools. It needs to be stressed that NO manipulation of an existing 
> +	mesh structure should be done outside of these functions.
> +	
> +	In the BMesh system, each euler is named by an ancronym which describes what it actually does.
> +	Furthermore each Euler has a logical inverse. An important design criteria of all Eulers is that
> +	through a Euler's logical inverse you can 'undo' an operation. (Special note should
> +	be taken of BME_loop_reverse, which is its own inverse).
> +		
> +	BME_MF/KF: Make Face and Kill Face
> +	BME_ME/KE: Make Edge and Kill Edge
> +	BME_MV/KV: Make Vert and Kill Vert
> +	BME_SEMV/JEKV: Split Edge, Make Vert and Join Edge, Kill Vert
> +	BME_SFME/JFKE: Split Face, Make Edge and Join Face, Kill Edge
> +	BME_loop_reverse: Reverse a Polygon's loop cycle. (used for flip normals for one)
> +	
> +	Using a combination of these eleven eulers any non-manifold modelling operation can be achieved.
> +	Each Euler operator has a detailed explanation of what is does in the comments preceding its 
> +	code. 
> +
> +   *The term "Euler Operator" is actually a misnomer when referring to a non-manifold 
> +    data structure. Its use is in keeping with the convention established by others.
> +
> +	TODO:
> +	-Finish inserting 'strict' validation in all Eulers
> +*/
> +
> +#define RETCLEAR(bm) {bm->rval->v = bm->rval->e = bm->rval->f = bm->rva->l = NULL;}
> +/*MAKE Eulers*/
> +
> +/**
> + *			BME_MV
> + *
> + *	MAKE VERT EULER:
> + *	
> + *	Makes a single loose vertex.
> + *
> + *	Returns -
> + *	A BME_Vert pointer.
> + */
> +
> +BME_Vert *BME_MV(BME_Mesh *bm, float *vec){
> +	BME_Vert *v = BME_addvertlist(bm, NULL);	
> +	VECCOPY(v->co,vec);
> +	return v;
> +}
> +
> +/**
> + *			BME_ME
> + *
> + *	MAKE EDGE EULER:
> + *	
> + *	Makes a single wire edge between two vertices.
> + *	If the caller does not want there to be duplicate
> + *	edges between the vertices, it is up to them to check 
> + *	for this condition beforehand.
> + *
> + *	Returns -
> + *	A BME_Edge pointer.
> + */
> +
> +BME_Edge *BME_ME(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2){
> +	BME_Edge *e=NULL;
> +	BME_CycleNode *d1=NULL, *d2=NULL;
> +	int valance1=0, valance2=0, edok;
> +	
> +	/*edge must be between two distinct vertices...*/
> +	if(v1 == v2) return NULL;
> +	
> +	#ifndef BME_FASTEULER
> +	/*count valance of v1*/
> +	if(v1->edge){ 
> +		d1 = BME_disk_getpointer(v1->edge,v1);
> +		if(d1) valance1 = BME_cycle_length(d1);
> +		else BME_error();
> +	}
> +	if(v2->edge){
> +		d2 = BME_disk_getpointer(v2->edge,v2);
> +		if(d2) valance2 = BME_cycle_length(d2);
> +		else BME_error();
> +	}
> +	#endif
> +	
> +	/*go ahead and add*/
> +	e = BME_addedgelist(bm, v1, v2, NULL);
> +	BME_disk_append_edge(e, e->v1);
> +	BME_disk_append_edge(e, e->v2);
> +	
> +	#ifndef BME_FASTEULER
> +	/*verify disk cycle lengths*/
> +	d1 = BME_disk_getpointer(e, e->v1);
> +	edok = BME_cycle_validate(valance1+1, d1);
> +	if(!edok) BME_error();
> +	d2 = BME_disk_getpointer(e, e->v2);
> +	edok = BME_cycle_validate(valance2+1, d2);
> +	if(!edok) BME_error();
> +	
> +	/*verify that edge actually made it into the cycle*/
> +	edok = BME_disk_hasedge(v1, e);
> +	if(!edok) BME_error();
> +	edok = BME_disk_hasedge(v2, e);
> +	if(!edok) BME_error();
> +	#endif
> +	return e;
> +}
> +
> +
> +
> +/**
> + *			BME_MF
> + *
> + *	MAKE FACE EULER:
> + *	Takes a list of edge pointers which form a closed loop and makes a face 
> + *  from them. The first edge in elist is considered to be the start of the 
> + *	polygon, and v1 and v2 are its vertices and determine the winding of the face 
> + *  Other than the first edge, no other assumptions are made about the order of edges
> + *  in the elist array. To verify that it is a single closed loop and derive the correct 
> + *  order a simple series of verifications is done and all elements are visited.
> + *		
> + *  Returns -
> + *	A BME_Poly pointer
> + */
> +
> +#define MF_CANDIDATE	1
> +#define MF_VISITED		2
> +#define MF_TAKEN		4 
> +
> +BME_Poly *BME_MF(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Edge **elist, int len)
> +{
> +	BME_Poly *f = NULL;
> +	BME_Edge *curedge;
> +	BME_Vert *curvert, *tv, *nextv,**vlist;
> +	int i, j, done, cont, edok,vlen;
> +	
> +	if(len < 2) return NULL;
> +	
> +	/*make sure that v1 and v2 are in elist[0]*/
> +	if(BME_verts_in_edge(v1,v2,elist[0]) == 0) return NULL;
> +	
> +	/*clear euler flags*/
> +	for(i=0;i<len;i++) elist[i]->eflag1=elist[i]->eflag2 = 0;
> +	for(i=0;i<len;i++){
> +		elist[i]->eflag1 |= MF_CANDIDATE;
> +		
> +		/*if elist[i] has a loop, count its radial length*/
> +		if(elist[i]->loop) elist[i]->eflag2 = BME_cycle_length(&(elist[i]->loop->radial));
> +		else elist[i]->eflag2 = 0;
> +	}
> +	
> +	/*	For each vertex in each edge, it must have exactly two MF_CANDIDATE edges attached to it
> +		Note that this does not gauruntee that face is a single closed loop. At best it gauruntees
> +		that elist contains a finite number of seperate closed loops.
> +	*/
> +	for(i=0; i<len; i++){
> +		edok = BME_disk_count_edgeflag(elist[i]->v1, MF_CANDIDATE, 0);
> +		if(edok != 2) return NULL;
> +		edok = BME_disk_count_edgeflag(elist[i]->v2, MF_CANDIDATE, 0);
>
> @@ Diff output truncated at 10240 characters. @@
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
>   



More information about the Bf-committers mailing list