split bmesh_operators.h, added (some) docs in comments, and hopefully made it less messy. also added op names and slot names in comments next to their BM_XXXX_XXX definitions in bmesh_operators.h.
This commit is contained in:
@@ -216,7 +216,9 @@ struct EditMesh *bmesh_to_editmesh(BMesh *bm);
|
||||
#include "bmesh_filters.h"
|
||||
#include "bmesh_iterators.h"
|
||||
#include "bmesh_marking.h"
|
||||
#include "bmesh_operator_api.h"
|
||||
#include "bmesh_operators.h"
|
||||
#include "bmesh_error.h"
|
||||
#include "bmesh_queries.h"
|
||||
#include "bmesh_walkers.h"
|
||||
|
||||
|
||||
49
source/blender/bmesh/bmesh_error.h
Normal file
49
source/blender/bmesh/bmesh_error.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _BMESH_ERROR_H
|
||||
#define _BMESH_ERROR_H
|
||||
|
||||
/*----------- bmop error system ----------*/
|
||||
|
||||
/*pushes an error onto the bmesh error stack.
|
||||
if msg is null, then the default message for the errorcode is used.*/
|
||||
void BMO_RaiseError(BMesh *bm, BMOperator *owner, int errcode, char *msg);
|
||||
|
||||
/*gets the topmost error from the stack.
|
||||
returns error code or 0 if no error.*/
|
||||
int BMO_GetError(BMesh *bm, char **msg, BMOperator **op);
|
||||
int BMO_HasError(BMesh *bm);
|
||||
|
||||
/*same as geterror, only pops the error off the stack as well*/
|
||||
int BMO_PopError(BMesh *bm, char **msg, BMOperator **op);
|
||||
void BMO_ClearStack(BMesh *bm);
|
||||
|
||||
#if 0
|
||||
//this is meant for handling errors, like self-intersection test failures.
|
||||
//it's dangerous to handle errors in general though, so disabled for now.
|
||||
|
||||
/*catches an error raised by the op pointed to by catchop.
|
||||
errorcode is either the errorcode, or BMERR_ALL for any
|
||||
error.*/
|
||||
int BMO_CatchOpError(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
|
||||
#endif
|
||||
|
||||
/*------ error code defines -------*/
|
||||
|
||||
/*error messages*/
|
||||
#define BMERR_SELF_INTERSECTING 1
|
||||
#define BMERR_DISSOLVEDISK_FAILED 2
|
||||
#define BMERR_CONNECTVERT_FAILED 3
|
||||
#define BMERR_WALKER_FAILED 4
|
||||
#define BMERR_DISSOLVEFACES_FAILED 5
|
||||
#define BMERR_DISSOLVEVERTS_FAILED 6
|
||||
|
||||
static char *bmop_error_messages[] = {
|
||||
0,
|
||||
"Self intersection error",
|
||||
"Could not dissolve vert",
|
||||
"Could not connect verts",
|
||||
"Could not traverse mesh",
|
||||
"Could not dissolve faces",
|
||||
"Could not dissolve vertices",
|
||||
};
|
||||
|
||||
#endif /* _BMESH_ERROR_H */
|
||||
217
source/blender/bmesh/bmesh_operator_api.h
Normal file
217
source/blender/bmesh/bmesh_operator_api.h
Normal file
@@ -0,0 +1,217 @@
|
||||
#ifndef _BMESH_OPERATOR_H
|
||||
#define _BMESH_OPERATOR_H
|
||||
|
||||
#include "BLI_memarena.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
operators represent logical, executable mesh modules. all operations
|
||||
involving a bmesh has to go through them.
|
||||
|
||||
operators are nested, and certain data (e.g. tool flags) are also nested,
|
||||
and are private to an operator when it's executed.
|
||||
*/
|
||||
|
||||
struct GHashIterator;
|
||||
|
||||
#define BMOP_OPSLOT_INT 0
|
||||
#define BMOP_OPSLOT_FLT 1
|
||||
#define BMOP_OPSLOT_PNT 2
|
||||
#define BMOP_OPSLOT_VEC 6
|
||||
|
||||
/*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
|
||||
|
||||
/*don't access the contents of this directly*/
|
||||
typedef struct BMOpSlot{
|
||||
int slottype;
|
||||
int len;
|
||||
int flag;
|
||||
int index; /*index within slot array*/
|
||||
union {
|
||||
int i;
|
||||
float f;
|
||||
void *p;
|
||||
float vec[3];
|
||||
void *buf;
|
||||
GHash *ghash;
|
||||
} data;
|
||||
}BMOpSlot;
|
||||
|
||||
#define BMOP_MAX_SLOTS 16 /*way more than probably needed*/
|
||||
|
||||
typedef struct BMOperator {
|
||||
int type;
|
||||
int slottype;
|
||||
int needflag;
|
||||
struct BMOpSlot slots[BMOP_MAX_SLOTS];
|
||||
void (*exec)(struct BMesh *bm, struct BMOperator *op);
|
||||
MemArena *arena;
|
||||
} BMOperator;
|
||||
|
||||
#define MAX_SLOTNAME 32
|
||||
|
||||
typedef struct slottype {
|
||||
int type;
|
||||
char name[MAX_SLOTNAME];
|
||||
} slottype;
|
||||
|
||||
typedef struct BMOpDefine {
|
||||
char *name;
|
||||
slottype slottypes[BMOP_MAX_SLOTS];
|
||||
void (*exec)(BMesh *bm, BMOperator *op);
|
||||
int totslot;
|
||||
int flag; /*doesn't do anything right now*/
|
||||
} BMOpDefine;
|
||||
|
||||
/*------------- Operator API --------------*/
|
||||
|
||||
/*data types that use pointers (arrays, etc) should never
|
||||
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_Exec_Op(struct BMesh *bm, struct BMOperator *op);
|
||||
void BMO_Finish_Op(struct BMesh *bm, struct BMOperator *op);
|
||||
|
||||
/*tool flag API. never, ever ever should tool code put junk in
|
||||
header flags (element->head.flag), nor should they use
|
||||
element->head.eflag1/eflag2. instead, use this api to set
|
||||
flags.
|
||||
|
||||
if you need to store a value per element, use a
|
||||
ghash or a mapping slot to do it.*/
|
||||
/*flags 15 and 16 (1<<14 and 1<<15) are reserved for bmesh api use*/
|
||||
void BMO_SetFlag(struct BMesh *bm, void *element, int flag);
|
||||
void BMO_ClearFlag(struct BMesh *bm, void *element, int flag);
|
||||
int BMO_TestFlag(struct BMesh *bm, void *element, int flag);
|
||||
int BMO_CountFlag(struct BMesh *bm, int flag, int type);
|
||||
|
||||
/*---------formatted operator initialization/execution-----------*/
|
||||
/*
|
||||
this system is used to execute or initialize an operator,
|
||||
using a formatted-string system.
|
||||
|
||||
for example, BMO_CallOpf(bm, "del geom=%hf context=%d", BM_SELECT, DEL_FACES);
|
||||
. . .will execute the delete operator, feeding in selected faces, deleting them.
|
||||
|
||||
the basic format for the format string is:
|
||||
[operatorname] [slotname]=%[code] [slotname]=%[code]
|
||||
|
||||
as in printf, you pass in one additional argument to the function
|
||||
for every code.
|
||||
|
||||
the formatting codes are:
|
||||
%d - put int in slot
|
||||
%f - put float in float
|
||||
%h[f/e/v] - put elements with a header flag in slot.
|
||||
the letters after %h define which element types to use,
|
||||
so e.g. %hf will do faces, %hfe will do faces and edges,
|
||||
%hv will do verts, etc. must pass in at least one
|
||||
element type letter.
|
||||
%f[f/e/v] - same as %h.
|
||||
*/
|
||||
/*executes an operator*/
|
||||
int BMO_CallOpf(BMesh *bm, char *fmt, ...);
|
||||
|
||||
/*initializes, but doesn't execute an operator*/
|
||||
int BMO_InitOpf(BMesh *bm, BMOperator *op, char *fmt, ...);
|
||||
|
||||
/*va_list version, used to implement the above two functions,
|
||||
plus EDBM_CallOpf in bmeshutils.c.*/
|
||||
int BMO_VInitOpf(BMesh *bm, BMOperator *op, char *fmt, va_list vlist);
|
||||
|
||||
|
||||
BMOpSlot *BMO_GetSlot(struct BMOperator *op, int slotcode);
|
||||
void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op, int src, int dst);
|
||||
|
||||
void BMO_Set_Float(struct BMOperator *op, int slotcode, float f);
|
||||
void BMO_Set_Int(struct BMOperator *op, int slotcode, int i);
|
||||
/*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);
|
||||
|
||||
/*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_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag);
|
||||
void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, 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);
|
||||
int BMO_CountSlotBuf(struct BMesh *bm, struct BMOperator *op, int slotcode);
|
||||
|
||||
/*copies data, doesn't store a reference to it.*/
|
||||
void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element, void *data, int len);
|
||||
void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element, float val);
|
||||
//returns 1 if the specified element is in the map.
|
||||
int BMO_InMap(BMesh *bm, BMOperator *op, int slotcode, void *element);
|
||||
void *BMO_Get_MapData(BMesh *bm, BMOperator *op, int slotcode, void *element);
|
||||
float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, int slotcode, void *element);
|
||||
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
||||
int slotcode, int flag);
|
||||
|
||||
/*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 *element, void *val);
|
||||
void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element);
|
||||
|
||||
/*contents of this structure are private,
|
||||
don't directly access.*/
|
||||
typedef struct BMOIter {
|
||||
BMOpSlot *slot;
|
||||
int cur; //for arrays
|
||||
struct GHashIterator giter;
|
||||
void *val;
|
||||
} BMOIter;
|
||||
|
||||
/*this part of the API is used to iterate over element buffer or
|
||||
mapping slots.
|
||||
|
||||
for example, iterating over the faces in a slot is:
|
||||
|
||||
BMOIter oiter;
|
||||
BMFace *f;
|
||||
|
||||
f = BMO_IterNew(&oiter, bm, some_operator, SOME_SLOT_CODE);
|
||||
for (; f; f=BMO_IterStep) {
|
||||
/do something with the face
|
||||
}
|
||||
|
||||
another example, iterating over a mapping:
|
||||
BMOIter oiter;
|
||||
void *key;
|
||||
void *val;
|
||||
|
||||
key = BMO_IterNew(&oiter, bm, some_operator, SOME_SLOT_CODE);
|
||||
for (; key; key=BMO_IterStep) {
|
||||
val = BMO_IterMapVal(&oiter);
|
||||
//do something with the key/val pair
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
|
||||
int slotcode);
|
||||
void *BMO_IterStep(BMOIter *iter);
|
||||
|
||||
/*returns a pointer to the key value when iterating over mappings.
|
||||
remember for pointer maps this will be a pointer to a pointer.*/
|
||||
void *BMO_IterMapVal(BMOIter *iter);
|
||||
|
||||
#endif /* _BMESH_OPERATOR_H */
|
||||
@@ -1,222 +1,46 @@
|
||||
#ifndef BM_OPERATORS_H
|
||||
#define BM_OPERATORS_H
|
||||
|
||||
#include "BLI_memarena.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BMOP_OPSLOT_INT 0
|
||||
#define BMOP_OPSLOT_FLT 1
|
||||
#define BMOP_OPSLOT_PNT 2
|
||||
#define BMOP_OPSLOT_VEC 6
|
||||
|
||||
/*after BMOP_OPSLOT_VEC, everything is
|
||||
dynamically allocated arrays. we
|
||||
leave a space in the identifiers
|
||||
for future growth.*/
|
||||
#define BMOP_OPSLOT_PNT_BUF 7
|
||||
|
||||
#define BMOP_OPSLOT_MAPPING 8
|
||||
#define BMOP_OPSLOT_TYPES 9
|
||||
|
||||
typedef struct BMOpSlot{
|
||||
int slottype;
|
||||
int len;
|
||||
int flag;
|
||||
int index; /*index within slot array*/
|
||||
union {
|
||||
int i;
|
||||
float f;
|
||||
void *p;
|
||||
float vec[3]; /*vector*/
|
||||
void *buf; /*buffer*/
|
||||
GHash *ghash;
|
||||
} data;
|
||||
}BMOpSlot;
|
||||
|
||||
/*BMOpSlot->flag*/
|
||||
/*is a dynamically-allocated array. set at runtime.*/
|
||||
#define BMOS_DYNAMIC_ARRAY 1
|
||||
|
||||
/*operators represent logical, executable mesh modules.*/
|
||||
#define BMOP_MAX_SLOTS 16 /*way more than probably needed*/
|
||||
|
||||
typedef struct BMOperator{
|
||||
int type;
|
||||
int slottype;
|
||||
int needflag;
|
||||
struct BMOpSlot slots[BMOP_MAX_SLOTS];
|
||||
void (*exec)(struct BMesh *bm, struct BMOperator *op);
|
||||
MemArena *arena;
|
||||
}BMOperator;
|
||||
|
||||
#define MAX_SLOTNAME 32
|
||||
|
||||
typedef struct slottype {
|
||||
int type;
|
||||
char name[MAX_SLOTNAME];
|
||||
} slottype;
|
||||
|
||||
/*need to refactor code to use this*/
|
||||
typedef struct BMOpDefine {
|
||||
char *name;
|
||||
slottype slottypes[BMOP_MAX_SLOTS];
|
||||
void (*exec)(BMesh *bm, BMOperator *op);
|
||||
int totslot;
|
||||
int flag;
|
||||
} BMOpDefine;
|
||||
|
||||
/*BMOpDefine->flag*/
|
||||
//doesn't do anything at the moment.
|
||||
|
||||
/*API for operators*/
|
||||
|
||||
/*data types that use pointers (arrays, etc) should never
|
||||
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_Exec_Op(struct BMesh *bm, struct BMOperator *op);
|
||||
void BMO_Finish_Op(struct BMesh *bm, struct BMOperator *op);
|
||||
BMOpSlot *BMO_GetSlot(struct BMOperator *op, int slotcode);
|
||||
void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op, int src, int 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_Pnt(struct BMOperator *op, int slotcode, void *p);
|
||||
void BMO_Set_Vec(struct BMOperator *op, int slotcode, float *vec);
|
||||
void BMO_SetFlag(struct BMesh *bm, void *element, int flag);
|
||||
void BMO_ClearFlag(struct BMesh *bm, void *element, int flag);
|
||||
|
||||
/*flags 15 and 16 (1<<14 and 1<<15) are reserved for bmesh api use*/
|
||||
int BMO_TestFlag(struct BMesh *bm, void *element, int flag);
|
||||
int BMO_CountFlag(struct BMesh *bm, int flag, int type);
|
||||
void BMO_Flag_To_Slot(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag, int type);
|
||||
void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag);
|
||||
void BMO_Unflag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag);
|
||||
void BMO_HeaderFlag_To_Slot(struct BMesh *bm, struct BMOperator *op, int slotcode, int flag, int type);
|
||||
int BMO_CountSlotBuf(struct BMesh *bm, struct BMOperator *op, int slotcode);
|
||||
|
||||
/*copies data, doesn't store a reference to it.*/
|
||||
void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element, void *data, int len);
|
||||
void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element, float val);
|
||||
|
||||
//returns 1 if the specified element is in the map.
|
||||
int BMO_InMap(BMesh *bm, BMOperator *op, int slotcode, void *element);
|
||||
void *BMO_Get_MapData(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element);
|
||||
float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element);
|
||||
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
||||
int slotcode, int flag);
|
||||
|
||||
/*do NOT use these for non-operator-api-allocated memory! instead
|
||||
use BMO_Get_MapData, which copies the data.*/
|
||||
void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element, void *val);
|
||||
void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, int slotcode,
|
||||
void *element);
|
||||
|
||||
struct GHashIterator;
|
||||
typedef struct BMOIter {
|
||||
BMOpSlot *slot;
|
||||
int cur; //for arrays
|
||||
struct GHashIterator giter;
|
||||
void *val;
|
||||
} BMOIter;
|
||||
|
||||
void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
|
||||
int slotcode);
|
||||
void *BMO_IterStep(BMOIter *iter);
|
||||
|
||||
/*returns a pointer to the key value when iterating over mappings.
|
||||
remember for pointer maps this will be a pointer to a pointer.*/
|
||||
void *BMO_IterMapVal(BMOIter *iter);
|
||||
|
||||
/*formatted operator initialization/execution*/
|
||||
int BMO_CallOpf(BMesh *bm, char *fmt, ...);
|
||||
int BMO_InitOpf(BMesh *bm, BMOperator *op, char *fmt, ...);
|
||||
int BMO_VInitOpf(BMesh *bm, BMOperator *op, char *fmt, va_list vlist);
|
||||
|
||||
/*----------- bmop error system ----------*/
|
||||
|
||||
/*pushes an error onto the bmesh error stack.
|
||||
if msg is null, then the default message for the errorcode is used.*/
|
||||
void BMO_RaiseError(BMesh *bm, BMOperator *owner, int errcode, char *msg);
|
||||
|
||||
/*gets the topmost error from the stack.
|
||||
returns error code or 0 if no error.*/
|
||||
int BMO_GetError(BMesh *bm, char **msg, BMOperator **op);
|
||||
int BMO_HasError(BMesh *bm);
|
||||
|
||||
/*same as geterror, only pops the error off the stack as well*/
|
||||
int BMO_PopError(BMesh *bm, char **msg, BMOperator **op);
|
||||
void BMO_ClearStack(BMesh *bm);
|
||||
|
||||
#if 0
|
||||
//this is meant for handling errors, like self-intersection test failures.
|
||||
//it's dangerous to handle errors in general though, so disabled for now.
|
||||
|
||||
/*catches an error raised by the op pointed to by catchop.
|
||||
errorcode is either the errorcode, or BMERR_ALL for any
|
||||
error.*/
|
||||
int BMO_CatchOpError(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
|
||||
#endif
|
||||
|
||||
/*------ error code defines -------*/
|
||||
|
||||
/*error messages*/
|
||||
#define BMERR_SELF_INTERSECTING 1
|
||||
#define BMERR_DISSOLVEDISK_FAILED 2
|
||||
#define BMERR_CONNECTVERT_FAILED 3
|
||||
#define BMERR_WALKER_FAILED 4
|
||||
#define BMERR_DISSOLVEFACES_FAILED 5
|
||||
#define BMERR_DISSOLVEVERTS_FAILED 6
|
||||
|
||||
static char *bmop_error_messages[] = {
|
||||
0,
|
||||
"Self intersection error",
|
||||
"Could not dissolve vert",
|
||||
"Could not connect verts",
|
||||
"Could not traverse mesh",
|
||||
"Could not dissolve faces",
|
||||
"Could not dissolve vertices",
|
||||
};
|
||||
/*slot names and operator names appear in comments next to/above tbeir
|
||||
enumeration/define value*/
|
||||
|
||||
/*------------begin operator defines (see bmesh_opdefines.c too)------------*/
|
||||
/*split op*/
|
||||
|
||||
/*split*/
|
||||
#define BMOP_SPLIT 0
|
||||
|
||||
enum {
|
||||
BMOP_SPLIT_MULTIN,
|
||||
BMOP_SPLIT_MULTOUT,
|
||||
BMOP_SPLIT_BOUNDS_EDGEMAP, //bounding edges of split faces
|
||||
BMOP_SPLIT_MULTIN, /*geom*/
|
||||
BMOP_SPLIT_MULTOUT, /*geomout*/
|
||||
|
||||
//bounding edges of split faces
|
||||
BMOP_SPLIT_BOUNDS_EDGEMAP, /*boundarymap*/
|
||||
BMOP_SPLIT_TOTSLOT,
|
||||
};
|
||||
|
||||
/*dupe op*/
|
||||
/*dupe*/
|
||||
#define BMOP_DUPE 1
|
||||
|
||||
enum {
|
||||
BMOP_DUPE_MULTIN,
|
||||
BMOP_DUPE_ORIG,
|
||||
BMOP_DUPE_NEW,
|
||||
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,
|
||||
BMOP_DUPE_BOUNDS_EDGEMAP, /*boundarymap*/
|
||||
BMOP_DUPE_TOTSLOT
|
||||
};
|
||||
|
||||
/*delete op*/
|
||||
/*del*/
|
||||
#define BMOP_DEL 2
|
||||
|
||||
enum {
|
||||
BMOP_DEL_MULTIN,
|
||||
BMOP_DEL_CONTEXT,
|
||||
BMOP_DEL_MULTIN, /*geom*/
|
||||
BMOP_DEL_CONTEXT, /*context*/
|
||||
BMOP_DEL_TOTSLOT,
|
||||
};
|
||||
|
||||
/*context slot values*/
|
||||
#define DEL_VERTS 1
|
||||
#define DEL_EDGES 2
|
||||
#define DEL_ONLYFACES 3
|
||||
@@ -225,47 +49,46 @@ enum {
|
||||
#define DEL_ALL 6
|
||||
#define DEL_ONLYTAGGED 7
|
||||
|
||||
/*BMOP_DEL_CONTEXT*/
|
||||
enum {
|
||||
BMOP_DEL_VERTS = 1,
|
||||
BMOP_DEL_EDGESFACES,
|
||||
BMOP_DEL_ONLYFACES,
|
||||
BMOP_DEL_FACES,
|
||||
BMOP_DEL_ALL,
|
||||
};
|
||||
/*editmesh_to_bmesh*/
|
||||
#define BMOP_FROM_EDITMESH 3
|
||||
|
||||
/*editmesh->bmesh op*/
|
||||
#define BMOP_FROM_EDITMESH 3
|
||||
enum {
|
||||
BMOP_FROM_EDITMESH_EM,
|
||||
BMOP_FROM_EDITMESH_EM, /*em*/
|
||||
BMOP_FROM_EDITMESH_TOTSLOT,
|
||||
};
|
||||
|
||||
/*bmesh_to_editmesh*/
|
||||
#define BMOP_TO_EDITMESH 4
|
||||
|
||||
/*bmesh->editmesh op*/
|
||||
enum {
|
||||
BMOP_TO_EDITMESH_EMOUT,
|
||||
BMOP_TO_EDITMESH_EMOUT, /*emout*/
|
||||
BMOP_TO_EDITMESH_TOTSLOT,
|
||||
};
|
||||
|
||||
/*edge subdivide op*/
|
||||
/*esubd*/
|
||||
#define BMOP_ESUBDIVIDE 5
|
||||
enum {
|
||||
BMOP_ESUBDIVIDE_EDGES,
|
||||
BMOP_ESUBDIVIDE_NUMCUTS,
|
||||
BMOP_ESUBDIVIDE_FLAG, //beauty flag in esubdivide
|
||||
BMOP_ESUBDIVIDE_RADIUS,
|
||||
|
||||
BMOP_ESUBDIVIDE_CUSTOMFILL_FACEMAP,
|
||||
BMOP_ESUBDIVIDE_PERCENT_EDGEMAP,
|
||||
/*edge subdivide op*/
|
||||
enum {
|
||||
BMOP_ESUBDIVIDE_EDGES, /*edges*/
|
||||
BMOP_ESUBDIVIDE_NUMCUTS, /*numcuts*/
|
||||
|
||||
//beauty flag in esubdivide
|
||||
BMOP_ESUBDIVIDE_FLAG, /*flag*/
|
||||
BMOP_ESUBDIVIDE_RADIUS, /*radius*/
|
||||
|
||||
BMOP_ESUBDIVIDE_CUSTOMFILL_FACEMAP, /*custompatterns*/
|
||||
BMOP_ESUBDIVIDE_PERCENT_EDGEMAP, /*edgepercents*/
|
||||
|
||||
/*inner verts/new faces of completely filled faces, e.g.
|
||||
fully selected face.*/
|
||||
BMOP_ESUBDIVIDE_INNER_MULTOUT,
|
||||
BMOP_ESUBDIVIDE_INNER_MULTOUT, /*outinner*/
|
||||
|
||||
/*new edges and vertices from splitting original edges,
|
||||
doesn't include edges creating by connecting verts.*/
|
||||
BMOP_ESUBDIVIDE_SPLIT_MULTOUT,
|
||||
BMOP_ESUBDIVIDE_SPLIT_MULTOUT, /*outsplit*/
|
||||
BMOP_ESUBDIVIDE_TOTSLOT,
|
||||
};
|
||||
/*
|
||||
@@ -279,15 +102,18 @@ DOUBLEOPFILL
|
||||
/*triangulate*/
|
||||
#define BMOP_TRIANGULATE 6
|
||||
|
||||
/*triangle tesselator op*/
|
||||
enum {
|
||||
BMOP_TRIANG_FACEIN,
|
||||
BMOP_TRIANG_NEW_EDGES,
|
||||
BMOP_TRIANG_NEW_FACES,
|
||||
BMOP_TRIANG_FACEIN, /*faces*/
|
||||
BMOP_TRIANG_NEW_EDGES, /*edgeout*/
|
||||
BMOP_TRIANG_NEW_FACES, /*faceout*/
|
||||
BMOP_TRIANG_TOTSLOT,
|
||||
};
|
||||
|
||||
/*dissolve faces*/
|
||||
/*dissolvefaces*/
|
||||
#define BMOP_DISSOLVE_FACES 7
|
||||
|
||||
/*dissolve faces*/
|
||||
enum {
|
||||
BMOP_DISFACES_FACEIN,
|
||||
//list of faces that comprise regions of split faces
|
||||
@@ -295,35 +121,44 @@ enum {
|
||||
BMOP_DISFACES_TOTSLOT,
|
||||
};
|
||||
|
||||
/*dissolve verts*/
|
||||
/*dissolveverts*/
|
||||
#define BMOP_DISSOLVE_VERTS 8
|
||||
|
||||
/*dissolve verts*/
|
||||
enum {
|
||||
BMOP_DISVERTS_VERTIN,
|
||||
BMOP_DISVERTS_VERTIN, /*verts*/
|
||||
BMOP_DISVERTS_TOTSLOT,
|
||||
};
|
||||
|
||||
/*makefgon*/
|
||||
#define BMOP_MAKE_FGONS 9
|
||||
|
||||
#define BMOP_MAKE_FGONS_TOTSLOT 0
|
||||
|
||||
/*extrudefaceregion*/
|
||||
#define BMOP_EXTRUDE_EDGECONTEXT 10
|
||||
enum {
|
||||
BMOP_EXFACE_EDGEFACEIN,
|
||||
BMOP_EXFACE_EXCLUDEMAP, //exclude edges from skirt connecting
|
||||
BMOP_EXFACE_MULTOUT, //new geometry
|
||||
BMOP_EXFACE_EDGEFACEIN, /*edgefacein*/
|
||||
|
||||
//exclude edges from skirt connecting
|
||||
BMOP_EXFACE_EXCLUDEMAP, /*exclude*/
|
||||
|
||||
//new geometry
|
||||
BMOP_EXFACE_MULTOUT, /*geomout*/
|
||||
BMOP_EXFACE_TOTSLOT,
|
||||
};
|
||||
|
||||
/*connectverts*/
|
||||
#define BMOP_CONNECT_VERTS 11
|
||||
enum {
|
||||
BM_CONVERTS_VERTIN,
|
||||
BM_CONVERTS_EDGEOUT,
|
||||
BM_CONVERTS_VERTIN, /*verts*/
|
||||
BM_CONVERTS_EDGEOUT, /*edgeout*/
|
||||
BM_CONVERTS_TOTSLOT
|
||||
};
|
||||
|
||||
/*keep this updated!*/
|
||||
#define BMOP_TOTAL_OPS 12
|
||||
/*-------------------------------end operator defines-------------------------------*/
|
||||
/*-------------------------------end operator defines------------------------*/
|
||||
|
||||
extern BMOpDefine *opdefines[];
|
||||
extern int bmesh_total_ops;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
BMOpDefine def_connectverts = {
|
||||
"connectverts",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "verts"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "edgeout"}},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "edgeout"}},
|
||||
connectverts_exec,
|
||||
BM_CONVERTS_TOTSLOT,
|
||||
0
|
||||
@@ -14,9 +14,9 @@ BMOpDefine def_connectverts = {
|
||||
|
||||
BMOpDefine def_extrudefaceregion = {
|
||||
"extrudefaceregion",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "edgefacein"},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "edgefacein"},
|
||||
{BMOP_OPSLOT_MAPPING, "exclude"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "geomout"}},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "geomout"}},
|
||||
extrude_edge_context_exec,
|
||||
BMOP_EXFACE_TOTSLOT,
|
||||
0
|
||||
@@ -32,7 +32,7 @@ BMOpDefine def_makefgonsop = {
|
||||
|
||||
BMOpDefine def_dissolvevertsop = {
|
||||
"dissolveverts",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "verts"}},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "verts"}},
|
||||
dissolveverts_exec,
|
||||
BMOP_DISVERTS_TOTSLOT,
|
||||
0
|
||||
@@ -40,8 +40,8 @@ BMOpDefine def_dissolvevertsop = {
|
||||
|
||||
BMOpDefine def_dissolvefacesop = {
|
||||
"dissolvefaces",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "faces"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "regionnout"}},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "regionnout"}},
|
||||
dissolvefaces_exec,
|
||||
BMOP_DISFACES_TOTSLOT,
|
||||
0
|
||||
@@ -50,9 +50,9 @@ BMOpDefine def_dissolvefacesop = {
|
||||
|
||||
BMOpDefine def_triangop = {
|
||||
"triangulate",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "faces"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "edgeout"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "faceout"}},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "faceout"}},
|
||||
triangulate_exec,
|
||||
BMOP_TRIANG_TOTSLOT,
|
||||
0
|
||||
@@ -60,14 +60,14 @@ BMOpDefine def_triangop = {
|
||||
|
||||
BMOpDefine def_subdop = {
|
||||
"esubd",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "edges"},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
|
||||
{BMOP_OPSLOT_INT, "numcuts"},
|
||||
{BMOP_OPSLOT_INT, "flag"},
|
||||
{BMOP_OPSLOT_FLT, "radius"},
|
||||
{BMOP_OPSLOT_MAPPING, "custompatterns"},
|
||||
{BMOP_OPSLOT_MAPPING, "edgepercents"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "outinner"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "outsplit"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "outinner"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "outsplit"},
|
||||
},
|
||||
esubdivide_exec,
|
||||
BMOP_ESUBDIVIDE_TOTSLOT,
|
||||
@@ -92,7 +92,7 @@ BMOpDefine def_bmesh2edit = {
|
||||
|
||||
BMOpDefine def_delop = {
|
||||
"del",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "geom"}, {BMOP_OPSLOT_INT, "context"}},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "geom"}, {BMOP_OPSLOT_INT, "context"}},
|
||||
delop_exec,
|
||||
BMOP_DEL_TOTSLOT,
|
||||
0
|
||||
@@ -100,9 +100,9 @@ BMOpDefine def_delop = {
|
||||
|
||||
BMOpDefine def_dupeop = {
|
||||
"dupe",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "geom"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "origout"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "newout"},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "origout"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "newout"},
|
||||
{BMOP_OPSLOT_MAPPING, "boundarymap"}},
|
||||
dupeop_exec,
|
||||
BMOP_DUPE_TOTSLOT,
|
||||
@@ -111,8 +111,8 @@ BMOpDefine def_dupeop = {
|
||||
|
||||
BMOpDefine def_splitop = {
|
||||
"split",
|
||||
{{BMOP_OPSLOT_PNT_BUF, "geom"},
|
||||
{BMOP_OPSLOT_PNT_BUF, "geomout"},
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
|
||||
{BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
|
||||
{BMOP_OPSLOT_MAPPING, "boundarymap"}},
|
||||
splitop_exec,
|
||||
BMOP_SPLIT_TOTSLOT,
|
||||
|
||||
@@ -758,7 +758,7 @@ void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
|
||||
|
||||
void *BMO_IterStep(BMOIter *iter)
|
||||
{
|
||||
if (iter->slot->slottype == BMOP_OPSLOT_PNT_BUF) {
|
||||
if (iter->slot->slottype == BMOP_OPSLOT_ELEMENT_BUF) {
|
||||
if (iter->cur >= iter->slot->len) return NULL;
|
||||
|
||||
return ((void**)iter->slot->data.buf)[iter->cur++];
|
||||
|
||||
Reference in New Issue
Block a user