[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19373] branches/bmesh/blender/source/ blender: removed all those nasty enums from the operator api.
Joseph Eagar
joeedh at gmail.com
Mon Mar 23 00:16:43 CET 2009
Revision: 19373
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19373
Author: joeedh
Date: 2009-03-23 00:16:43 +0100 (Mon, 23 Mar 2009)
Log Message:
-----------
removed all those nasty enums from the operator api. yay! I'm
so happy. so now operators and their slots are referred to by
string names. so much easier to remember!
Modified Paths:
--------------
branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h
branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
branches/bmesh/blender/source/blender/bmesh/bmesh_queries.h
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_iterators.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/bmesh/intern/bmesh_mods.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_queries.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_to_editmesh.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers.c
branches/bmesh/blender/source/blender/bmesh/intern/editmesh_to_bmesh.c
branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
branches/bmesh/blender/source/blender/bmesh/operators/connectops.c
branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c
branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
branches/bmesh/blender/source/blender/bmesh/operators/triangulateop.c
branches/bmesh/blender/source/blender/editors/mesh/editmesh_add.c
branches/bmesh/blender/source/blender/editors/mesh/editmesh_lib.c
branches/bmesh/blender/source/blender/editors/mesh/editmesh_loop.c
branches/bmesh/blender/source/blender/editors/mesh/editmesh_mods.c
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h 2009-03-22 23:01:21 UTC (rev 19372)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_iterators.h 2009-03-22 23:16:43 UTC (rev 19373)
@@ -16,23 +16,23 @@
/*Defines for passing to BMIter_New.
"OF" can be substituted for "around"
- so BM_VERTS_OF_FACE means "vertices
+ so BM_VERTS_OF_MESH_OF_FACE means "vertices
around a face."
*/
/*these iterator over all elements of a specific
type in the mesh.*/
-#define BM_VERTS 1
-#define BM_EDGES 2
-#define BM_FACES 3
+#define BM_VERTS_OF_MESH 1
+#define BM_EDGES_OF_MESH 2
+#define BM_FACES_OF_MESH 3
/*these are topological iterators.*/
-#define BM_EDGES_OF_VERT 4
-#define BM_FACES_OF_VERT 5
-#define BM_FACES_OF_EDGE 6
-#define BM_VERTS_OF_FACE 7
+#define BM_EDGES_OF_MESH_OF_VERT 4
+#define BM_FACES_OF_MESH_OF_VERT 5
+#define BM_FACES_OF_MESH_OF_EDGE 6
+#define BM_VERTS_OF_MESH_OF_FACE 7
#define BM_FACEVERTS_OF_FACE 8
-#define BM_EDGES_OF_FACE 9
+#define BM_EDGES_OF_MESH_OF_FACE 9
#define BM_LOOPS_OF_FACE 10
#define BM_LOOPS_OF_VERT 11
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h 2009-03-22 23:01:21 UTC (rev 19372)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h 2009-03-22 23:16:43 UTC (rev 19373)
@@ -42,19 +42,22 @@
struct GHashIterator;
-#define BMOP_OPSLOT_INT 0
-#define BMOP_OPSLOT_FLT 1
-#define BMOP_OPSLOT_PNT 2
-#define BMOP_OPSLOT_VEC 6
+/*slot type arrays are terminated by the last member
+ having a slot type of 0.*/
+#define BMOP_OPSLOT_SENTINEL 0
+#define BMOP_OPSLOT_INT 1
+#define BMOP_OPSLOT_FLT 2
+#define BMOP_OPSLOT_PNT 3
+#define BMOP_OPSLOT_VEC 7
/*after BMOP_OPSLOT_VEC, everything is
dynamically allocated arrays. we
leave a space in the identifiers
for future growth.*/
-#define BMOP_OPSLOT_ELEMENT_BUF 7
-#define BMOP_OPSLOT_MAPPING 8
-#define BMOP_OPSLOT_TYPES 9
+#define BMOP_OPSLOT_ELEMENT_BUF 8
+#define BMOP_OPSLOT_MAPPING 9
+#define BMOP_OPSLOT_TYPES 10
/*please ignore all these structures, don't touch them in tool code, except
for when your defining an operator with BMOpDefine.*/
@@ -96,7 +99,6 @@
char *name;
slottype slottypes[BMOP_MAX_SLOTS];
void (*exec)(BMesh *bm, BMOperator *op);
- int totslot;
int flag; /*doesn't do anything right now*/
} BMOpDefine;
@@ -106,7 +108,7 @@
have it set directly. and never use BMO_Set_Pnt to
pass in a list of edges or any arrays, really.*/
-void BMO_Init_Op(struct BMOperator *op, int opcode);
+void BMO_Init_Op(struct BMOperator *op, char *opname);
/*executes an operator, pushing and popping a new tool flag
layer as appropriate.*/
@@ -160,7 +162,9 @@
/*executes an operator*/
int BMO_CallOpf(BMesh *bm, char *fmt, ...);
-/*initializes, but doesn't execute an operator*/
+/*initializes, but doesn't execute an operator. this is so you can
+ gain access to the outputs of the operator. note that you have
+ to execute/finitsh (BMO_Exec_Op and BMO_Finish_Op) yourself.*/
int BMO_InitOpf(BMesh *bm, BMOperator *op, char *fmt, ...);
/*va_list version, used to implement the above two functions,
@@ -168,72 +172,77 @@
int BMO_VInitOpf(BMesh *bm, BMOperator *op, char *fmt, va_list vlist);
/*get a point to a slot. this may be removed layer on from the public API.*/
-BMOpSlot *BMO_GetSlot(struct BMOperator *op, int slotcode);
+BMOpSlot *BMO_GetSlot(struct BMOperator *op, char *slotname);
/*copies the data of a slot from one operator to another. src and dst are the
source/destination slot codes, respectively.*/
-void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op, int src, int dst);
+void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op,
+ char *src, char *dst);
-void BMO_Set_Float(struct BMOperator *op, int slotcode, float f);
-void BMO_Set_Int(struct BMOperator *op, int slotcode, int i);
+void BMO_Set_Float(struct BMOperator *op, char *slotname, float f);
+float BMO_Get_Float(BMOperator *op, char *slotname);
+void BMO_Set_Int(struct BMOperator *op, char *slotname, int i);
+int BMO_Get_Int(BMOperator *op, char *slotname);
/*don't pass in arrays that are supposed to map to elements this way.
so, e.g. passing in list of floats per element in another slot is bad.
passing in, e.g. pointer to an editmesh for the conversion operator is fine
though.*/
-void BMO_Set_Pnt(struct BMOperator *op, int slotcode, void *p);
-void BMO_Set_Vec(struct BMOperator *op, int slotcode, float *vec);
+void BMO_Set_Pnt(struct BMOperator *op, char *slotname, void *p);
+void *BMO_Get_Pnt(BMOperator *op, char *slotname);
+void BMO_Set_Vec(struct BMOperator *op, char *slotname, float *vec);
+void BMO_Get_Vec(BMOperator *op, char *slotname, float *vec_out);
/*puts every element of type type (which is a bitmask) with tool flag flag,
into a slot.*/
-void BMO_Flag_To_Slot(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag, int type);
+void BMO_Flag_To_Slot(struct BMesh *bm, struct BMOperator *op, char *slotname, int flag, int type);
/*tool-flags all elements inside an element slot array with flag flag.*/
-void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag);
+void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, char *slotname, int flag);
/*clears tool-flag flag from all elements inside a slot array.*/
-void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag);
+void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, char *slotname, int flag);
/*puts every element of type type (which is a bitmask) with header flag
flag, into a slot.*/
-void BMO_HeaderFlag_To_Slot(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag, int type);
+void BMO_HeaderFlag_To_Slot(struct BMesh *bm, struct BMOperator *op, char *slotname, int flag, int type);
/*counts number of elements inside a slot array.*/
-int BMO_CountSlotBuf(struct BMesh *bm, struct BMOperator *op, int slotcode);
+int BMO_CountSlotBuf(struct BMesh *bm, struct BMOperator *op, char *slotname);
/*inserts a key/value mapping into a mapping slot. note that it copies the
value, it doesn't store a reference to it.*/
-void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, int slotcode,
+void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, char *slotname,
void *element, void *data, int len);
/*inserts a key/float mapping pair into a mapping slot.*/
-void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, int slotcode,
+void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, char *slotname,
void *element, float val);
//returns 1 if the specified pointer is in the map.
-int BMO_InMap(BMesh *bm, BMOperator *op, int slotcode, void *element);
+int BMO_InMap(BMesh *bm, BMOperator *op, char *slotname, void *element);
/*returns a point to the value of a specific key.*/
-void *BMO_Get_MapData(BMesh *bm, BMOperator *op, int slotcode, void *element);
+void *BMO_Get_MapData(BMesh *bm, BMOperator *op, char *slotname, void *element);
/*returns the float part of a key/float pair.*/
-float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, int slotcode, void *element);
+float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, char *slotname, void *element);
/*flags all elements in a mapping. note that the mapping must only have
bmesh elements in it.*/
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
- int slotcode, int flag);
+ char *slotname, int flag);
/*pointer versoins of BMO_Get_MapFloat and BMO_Insert_MapFloat.
do NOT use these for non-operator-api-allocated memory! instead
use BMO_Get_MapData and BMO_Insert_Mapping, which copies the data.*/
-void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, int slotcode,
+void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, char *slotname,
void *element, void *val);
-void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, int slotcode,
+void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, char *slotname,
void *element);
@@ -279,7 +288,7 @@
} BMOIter;
void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
- int slotcode);
+ char *slotname);
void *BMO_IterStep(BMOIter *iter);
/*returns a pointer to the key value when iterating over mappings.
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h 2009-03-22 23:01:21 UTC (rev 19372)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h 2009-03-22 23:16:43 UTC (rev 19373)
@@ -1,182 +1,19 @@
#ifndef BM_OPERATORS_H
#define BM_OPERATORS_H
-/*slot names and operator names appear in comments next to/above tbeir
- enumeration/define value*/
+/*--------defines/enumerations for specific operators-------*/
-/*------------begin operator defines (see bmesh_opdefines.c too)------------*/
-
-/*split*/
-#define BMOP_SPLIT 0
-
-/*the split operator. splits geometry from the mesh.*/
+/*del operator "context" slot values*/
enum {
- BMOP_SPLIT_MULTIN, /*geom*/
- BMOP_SPLIT_MULTOUT, /*geomout*/
-
- //bounding edges of split faces
- BMOP_SPLIT_BOUNDS_EDGEMAP, /*boundarymap*/
- BMOP_SPLIT_ISOLATED_VERTS_MAP, /*isovertmap*/
- BMOP_SPLIT_TOTSLOT,
+ DEL_VERTS = 1,
+ DEL_EDGES,
+ DEL_ONLYFACES,
+ DEL_EDGESFACES,
+ DEL_FACES,
+ DEL_ALL ,
+ DEL_ONLYTAGGED,
};
-/*dupe*/
-#define BMOP_DUPE 1
-
-/*duplicates input geometry, and creates a bounds mapping between old/new
- edges along the boundary.*/
-enum {
- BMOP_DUPE_MULTIN, /*geom*/
- BMOP_DUPE_ORIG, /*origout*/
- BMOP_DUPE_NEW, /*newout*/
- /*we need a map for verts duplicated not connected
- to any faces, too.*/
- BMOP_DUPE_BOUNDS_EDGEMAP, /*boundarymap*/
- BMOP_DUPE_ISOLATED_VERTS_MAP, /*isovertmap*/
- BMOP_DUPE_TOTSLOT
-};
-
-/*del*/
-#define BMOP_DEL 2
-
-/*deletes input geometry, using on of several deletion methods
- specified by context.*/
-enum {
- BMOP_DEL_MULTIN, /*geom*/
- BMOP_DEL_CONTEXT, /*context*/
- BMOP_DEL_TOTSLOT,
-};
-
-/*context slot values*/
-#define DEL_VERTS 1
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list