Style Cleanup: whitespace and some formatting.
This commit is contained in:
@@ -49,8 +49,8 @@ def main():
|
|||||||
|
|
||||||
check_commands = []
|
check_commands = []
|
||||||
for c, inc_dirs, defs in source_info:
|
for c, inc_dirs, defs in source_info:
|
||||||
if not 'bevel' in c: continue
|
# if not 'bevel' in c: continue
|
||||||
if 'MOD' in c: continue
|
# if 'MOD' in c: continue
|
||||||
cmd = ([CHECKER_BIN] +
|
cmd = ([CHECKER_BIN] +
|
||||||
CHECKER_ARGS +
|
CHECKER_ARGS +
|
||||||
[c] +
|
[c] +
|
||||||
|
|||||||
@@ -39,20 +39,20 @@ extern "C" {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* short introduction:
|
* short introduction:
|
||||||
*
|
*
|
||||||
* the bmesh structure is a boundary representation, supporting non-manifold
|
* the bmesh structure is a boundary representation, supporting non-manifold
|
||||||
* locally modifiable topology. the API is designed to allow clean, maintainable
|
* locally modifiable topology. the API is designed to allow clean, maintainable
|
||||||
* code, that never (or almost never) directly inspects the underlying structure.
|
* code, that never (or almost never) directly inspects the underlying structure.
|
||||||
*
|
*
|
||||||
* The API includes iterators, including many useful topological iterators;
|
* The API includes iterators, including many useful topological iterators;
|
||||||
* walkers, which walk over a mesh, without the risk of hitting the recursion
|
* walkers, which walk over a mesh, without the risk of hitting the recursion
|
||||||
* limit; operators, which are logical, reusable mesh modules; topological
|
* limit; operators, which are logical, reusable mesh modules; topological
|
||||||
* modification functions (like split face, join faces, etc), which are used for
|
* modification functions (like split face, join faces, etc), which are used for
|
||||||
* topological manipulations; and some (not yet finished) geometric utility
|
* topological manipulations; and some (not yet finished) geometric utility
|
||||||
* functions.
|
* functions.
|
||||||
*
|
*
|
||||||
* some definitions:
|
* some definitions:
|
||||||
*
|
*
|
||||||
* tool flags: private flags for tools. each operator has it's own private
|
* tool flags: private flags for tools. each operator has it's own private
|
||||||
* tool flag "layer", which it can use to flag elements.
|
* tool flag "layer", which it can use to flag elements.
|
||||||
* tool flags are also used by various other parts of the api.
|
* tool flags are also used by various other parts of the api.
|
||||||
@@ -265,7 +265,7 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source);
|
|||||||
|
|
||||||
/* projects a single loop, target, onto source for customdata interpolation. multires is handled.
|
/* projects a single loop, target, onto source for customdata interpolation. multires is handled.
|
||||||
* if do_vertex is true, target's vert data will also get interpolated.*/
|
* if do_vertex is true, target's vert data will also get interpolated.*/
|
||||||
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
|
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
|
||||||
int do_vertex, int do_multires);
|
int do_vertex, int do_multires);
|
||||||
|
|
||||||
/* smoothes boundaries between multires grids, including some borders in adjacent faces */
|
/* smoothes boundaries between multires grids, including some borders in adjacent faces */
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH ITERATORS
|
* BMESH ITERATORS
|
||||||
*
|
*
|
||||||
* The functions and structures in this file
|
* The functions and structures in this file
|
||||||
* provide a unified method for iterating over
|
* provide a unified method for iterating over
|
||||||
* the elements of a mesh and answering simple
|
* the elements of a mesh and answering simple
|
||||||
* adjacency queries. Tool authors should use
|
* adjacency queries. Tool authors should use
|
||||||
* the iterators provided in this file instead
|
* the iterators provided in this file instead
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
#define BM_VERTS_OF_FACE 8
|
#define BM_VERTS_OF_FACE 8
|
||||||
#define BM_EDGES_OF_FACE 9
|
#define BM_EDGES_OF_FACE 9
|
||||||
#define BM_LOOPS_OF_FACE 10
|
#define BM_LOOPS_OF_FACE 10
|
||||||
/* returns elements from all boundaries, and returns
|
/* returns elements from all boundaries, and returns
|
||||||
* the first element at the end to flag that we're entering
|
* the first element at the end to flag that we're entering
|
||||||
* a different face hole boundary*/
|
* a different face hole boundary*/
|
||||||
#define BM_ALL_LOOPS_OF_FACE 11
|
#define BM_ALL_LOOPS_OF_FACE 11
|
||||||
|
|
||||||
|
|||||||
@@ -36,36 +36,36 @@ extern "C" {
|
|||||||
#include <string.h> /* for memcpy */
|
#include <string.h> /* for memcpy */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* operators represent logical, executable mesh modules. all topological
|
* operators represent logical, executable mesh modules. all topological
|
||||||
* operations involving a bmesh has to go through them.
|
* operations involving a bmesh has to go through them.
|
||||||
*
|
*
|
||||||
* operators are nested, as are tool flags, which are private to an operator
|
* operators are nested, as are tool flags, which are private to an operator
|
||||||
* when it's executed. tool flags are allocated in layers, one per operator
|
* when it's executed. tool flags are allocated in layers, one per operator
|
||||||
* execution, and are used for all internal flagging a tool needs to do.
|
* execution, and are used for all internal flagging a tool needs to do.
|
||||||
*
|
*
|
||||||
* each operator has a series of "slots," which can be of the following types:
|
* each operator has a series of "slots," which can be of the following types:
|
||||||
* - simple numerical types
|
* - simple numerical types
|
||||||
* - arrays of elements (e.g. arrays of faces).
|
* - arrays of elements (e.g. arrays of faces).
|
||||||
* - hash mappings.
|
* - hash mappings.
|
||||||
*
|
*
|
||||||
* each slot is identified by a slot code, as are each operator.
|
* each slot is identified by a slot code, as are each operator.
|
||||||
* operators, and their slots, are defined in bmesh_opdefines.c (with their
|
* operators, and their slots, are defined in bmesh_opdefines.c (with their
|
||||||
* execution functions prototyped in bmesh_operators_private.h), with all their
|
* execution functions prototyped in bmesh_operators_private.h), with all their
|
||||||
* operator code and slot codes defined in bmesh_operators.h. see
|
* operator code and slot codes defined in bmesh_operators.h. see
|
||||||
* bmesh_opdefines.c and the BMOpDefine struct for how to define new operators.
|
* bmesh_opdefines.c and the BMOpDefine struct for how to define new operators.
|
||||||
*
|
*
|
||||||
* in general, operators are fed arrays of elements, created using either
|
* in general, operators are fed arrays of elements, created using either
|
||||||
* BM_HeaderFlag_To_Slot or BM_Flag_To_Slot (or through one of the format
|
* BM_HeaderFlag_To_Slot or BM_Flag_To_Slot (or through one of the format
|
||||||
* specifyers in BMO_CallOpf or BMO_InitOpf). Note that multiple element
|
* specifyers in BMO_CallOpf or BMO_InitOpf). Note that multiple element
|
||||||
* types (e.g. faces and edges) can be fed to the same slot array. Operators
|
* types (e.g. faces and edges) can be fed to the same slot array. Operators
|
||||||
* act on this data, and possibly spit out data into output slots.
|
* act on this data, and possibly spit out data into output slots.
|
||||||
*
|
*
|
||||||
* some notes:
|
* some notes:
|
||||||
* - operators should never read from header flags (e.g. element->head.flag). for
|
* - operators should never read from header flags (e.g. element->head.flag). for
|
||||||
* example, if you want an operator to only operate on selected faces, you
|
* example, if you want an operator to only operate on selected faces, you
|
||||||
* should use BM_HeaderFlag_To_Slot to put the selected elements into a slot.
|
* should use BM_HeaderFlag_To_Slot to put the selected elements into a slot.
|
||||||
* - when you read from an element slot array or mapping, you can either tool-flag
|
* - when you read from an element slot array or mapping, you can either tool-flag
|
||||||
* all the elements in it, or read them using an iterator APi (which is
|
* all the elements in it, or read them using an iterator APi (which is
|
||||||
* semantically similar to the iterator api in bmesh_iterators.h).
|
* semantically similar to the iterator api in bmesh_iterators.h).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -73,14 +73,14 @@ struct GHashIterator;
|
|||||||
|
|
||||||
/* slot type arrays are terminated by the last member
|
/* slot type arrays are terminated by the last member
|
||||||
* having a slot type of 0.*/
|
* having a slot type of 0.*/
|
||||||
#define BMOP_OPSLOT_SENTINEL 0
|
#define BMOP_OPSLOT_SENTINEL 0
|
||||||
#define BMOP_OPSLOT_INT 1
|
#define BMOP_OPSLOT_INT 1
|
||||||
#define BMOP_OPSLOT_FLT 2
|
#define BMOP_OPSLOT_FLT 2
|
||||||
#define BMOP_OPSLOT_PNT 3
|
#define BMOP_OPSLOT_PNT 3
|
||||||
#define BMOP_OPSLOT_MAT 4
|
#define BMOP_OPSLOT_MAT 4
|
||||||
#define BMOP_OPSLOT_VEC 7
|
#define BMOP_OPSLOT_VEC 7
|
||||||
|
|
||||||
/* after BMOP_OPSLOT_VEC, everything is
|
/* after BMOP_OPSLOT_VEC, everything is
|
||||||
|
|
||||||
* dynamically allocated arrays. we
|
* dynamically allocated arrays. we
|
||||||
* leave a space in the identifiers
|
* leave a space in the identifiers
|
||||||
@@ -88,8 +88,8 @@ struct GHashIterator;
|
|||||||
*/
|
*/
|
||||||
//it's very important this remain a power of two
|
//it's very important this remain a power of two
|
||||||
#define BMOP_OPSLOT_ELEMENT_BUF 8
|
#define BMOP_OPSLOT_ELEMENT_BUF 8
|
||||||
#define BMOP_OPSLOT_MAPPING 9
|
#define BMOP_OPSLOT_MAPPING 9
|
||||||
#define BMOP_OPSLOT_TYPES 10
|
#define BMOP_OPSLOT_TYPES 10
|
||||||
|
|
||||||
/* please ignore all these structures, don't touch them in tool code, except
|
/* please ignore all these structures, don't touch them in tool code, except
|
||||||
* for when your defining an operator with BMOpDefine.*/
|
* for when your defining an operator with BMOpDefine.*/
|
||||||
@@ -109,7 +109,7 @@ typedef struct BMOpSlot{
|
|||||||
} data;
|
} data;
|
||||||
} BMOpSlot;
|
} BMOpSlot;
|
||||||
|
|
||||||
#define BMOP_MAX_SLOTS 16 /* way more than probably needed */
|
#define BMOP_MAX_SLOTS 16 /* way more than probably needed */
|
||||||
|
|
||||||
#ifdef slots
|
#ifdef slots
|
||||||
#undef slots
|
#undef slots
|
||||||
@@ -136,7 +136,7 @@ typedef struct BMOpDefine {
|
|||||||
const char *name;
|
const char *name;
|
||||||
BMOSlotType slottypes[BMOP_MAX_SLOTS];
|
BMOSlotType slottypes[BMOP_MAX_SLOTS];
|
||||||
void (*exec)(BMesh *bm, BMOperator *op);
|
void (*exec)(BMesh *bm, BMOperator *op);
|
||||||
int flag;
|
int flag;
|
||||||
} BMOpDefine;
|
} BMOpDefine;
|
||||||
|
|
||||||
/*BMOpDefine->flag*/
|
/*BMOpDefine->flag*/
|
||||||
@@ -157,23 +157,23 @@ typedef struct BMOpDefine {
|
|||||||
|
|
||||||
void BMO_Init_Op(struct BMesh *bm, struct BMOperator *op, const char *opname);
|
void BMO_Init_Op(struct BMesh *bm, struct BMOperator *op, const char *opname);
|
||||||
|
|
||||||
/* executes an operator, pushing and popping a new tool flag
|
/* executes an operator, pushing and popping a new tool flag
|
||||||
* layer as appropriate.*/
|
* layer as appropriate.*/
|
||||||
void BMO_Exec_Op(struct BMesh *bm, struct BMOperator *op);
|
void BMO_Exec_Op(struct BMesh *bm, struct BMOperator *op);
|
||||||
|
|
||||||
/* finishes an operator (though note the operator's tool flag is removed
|
/* finishes an operator (though note the operator's tool flag is removed
|
||||||
* after it finishes executing in BMO_Exec_Op).*/
|
* after it finishes executing in BMO_Exec_Op).*/
|
||||||
void BMO_Finish_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
|
/* tool flag API. never, ever ever should tool code put junk in
|
||||||
* header flags (element->head.flag), nor should they use
|
* header flags (element->head.flag), nor should they use
|
||||||
* element->head.eflag1/eflag2. instead, use this api to set
|
* element->head.eflag1/eflag2. instead, use this api to set
|
||||||
* flags.
|
* flags.
|
||||||
*
|
*
|
||||||
* if you need to store a value per element, use a
|
* if you need to store a value per element, use a
|
||||||
* ghash or a mapping slot to do it. */
|
* ghash or a mapping slot to do it. */
|
||||||
|
|
||||||
/* flags 15 and 16 (1<<14 and 1<<15) are reserved for bmesh api use */
|
/* flags 15 and 16 (1<<14 and 1<<15) are reserved for bmesh api use */
|
||||||
#define BMO_TestFlag(bm, element, flag) (((BMHeader*)(element))->flags[bm->stackdepth-1].f & (flag))
|
#define BMO_TestFlag(bm, element, flag) (((BMHeader*)(element))->flags[bm->stackdepth-1].f & (flag))
|
||||||
#define BMO_SetFlag(bm, element, flag) (((BMHeader*)(element))->flags[bm->stackdepth-1].f |= (flag))
|
#define BMO_SetFlag(bm, element, flag) (((BMHeader*)(element))->flags[bm->stackdepth-1].f |= (flag))
|
||||||
@@ -199,7 +199,7 @@ int BMO_CountFlag(struct BMesh *bm, int flag, const char htype);
|
|||||||
*
|
*
|
||||||
* the basic format for the format string is:
|
* the basic format for the format string is:
|
||||||
* [operatorname] [slotname]=%[code] [slotname]=%[code]
|
* [operatorname] [slotname]=%[code] [slotname]=%[code]
|
||||||
*
|
*
|
||||||
* as in printf, you pass in one additional argument to the function
|
* as in printf, you pass in one additional argument to the function
|
||||||
* for every code.
|
* for every code.
|
||||||
*
|
*
|
||||||
@@ -248,7 +248,7 @@ BMOpSlot *BMO_GetSlot(struct BMOperator *op, const char *slotname);
|
|||||||
|
|
||||||
/* copies the data of a slot from one operator to another. src and dst are the
|
/* copies the data of a slot from one operator to another. src and dst are the
|
||||||
* source/destination slot codes, respectively. */
|
* source/destination slot codes, respectively. */
|
||||||
void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op,
|
void BMO_CopySlot(struct BMOperator *source_op, struct BMOperator *dest_op,
|
||||||
const char *src, const char *dst);
|
const char *src, const char *dst);
|
||||||
|
|
||||||
/*remove tool flagged elements*/
|
/*remove tool flagged elements*/
|
||||||
@@ -320,11 +320,11 @@ int BMO_Vert_CountEdgeFlags(BMesh *bm, BMVert *v, int toolflag);
|
|||||||
/* inserts a key/value mapping into a mapping slot. note that it copies the
|
/* inserts a key/value mapping into a mapping slot. note that it copies the
|
||||||
* value, it doesn't store a reference to it. */
|
* value, it doesn't store a reference to it. */
|
||||||
|
|
||||||
//BM_INLINE void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, const char *slotname,
|
//BM_INLINE void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
//void *element, void *data, int len);
|
//void *element, void *data, int len);
|
||||||
|
|
||||||
/* inserts a key/float mapping pair into a mapping slot. */
|
/* inserts a key/float mapping pair into a mapping slot. */
|
||||||
//BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
//BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
//void *element, float val);
|
//void *element, float val);
|
||||||
|
|
||||||
//returns 1 if the specified pointer is in the map.
|
//returns 1 if the specified pointer is in the map.
|
||||||
@@ -338,15 +338,15 @@ int BMO_Vert_CountEdgeFlags(BMesh *bm, BMVert *v, int toolflag);
|
|||||||
|
|
||||||
/* flags all elements in a mapping. note that the mapping must only have
|
/* flags all elements in a mapping. note that the mapping must only have
|
||||||
* bmesh elements in it.*/
|
* bmesh elements in it.*/
|
||||||
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
||||||
const char *slotname, int flag);
|
const char *slotname, int flag);
|
||||||
|
|
||||||
/* pointer versoins of BMO_Get_MapFloat and BMO_Insert_MapFloat.
|
/* pointer versoins of BMO_Get_MapFloat and BMO_Insert_MapFloat.
|
||||||
*
|
*
|
||||||
* do NOT use these for non-operator-api-allocated memory! instead
|
* do NOT use these for non-operator-api-allocated memory! instead
|
||||||
* use BMO_Get_MapData and BMO_Insert_Mapping, which copies the data. */
|
* use BMO_Get_MapData and BMO_Insert_Mapping, which copies the data. */
|
||||||
|
|
||||||
//BM_INLINE void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
//BM_INLINE void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
//void *key, void *val);
|
//void *key, void *val);
|
||||||
//BM_INLINE void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
//BM_INLINE void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
//void *key);
|
//void *key);
|
||||||
@@ -397,7 +397,7 @@ void *BMO_FirstElem(BMOperator *op, const char *slotname);
|
|||||||
/* restrictmask restricts the iteration to certain element types
|
/* restrictmask restricts the iteration to certain element types
|
||||||
* (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
|
* (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
|
||||||
* over an element buffer (not a mapping).*/
|
* over an element buffer (not a mapping).*/
|
||||||
void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
|
void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op,
|
||||||
const char *slotname, const char restrictmask);
|
const char *slotname, const char restrictmask);
|
||||||
void *BMO_IterStep(BMOIter *iter);
|
void *BMO_IterStep(BMOIter *iter);
|
||||||
|
|
||||||
@@ -427,14 +427,14 @@ typedef struct BMOElemMapping {
|
|||||||
|
|
||||||
extern const int BMOP_OPSLOT_TYPEINFO[];
|
extern const int BMOP_OPSLOT_TYPEINFO[];
|
||||||
|
|
||||||
BM_INLINE void BMO_Insert_Mapping(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
|
BM_INLINE void BMO_Insert_Mapping(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
|
||||||
void *element, void *data, int len) {
|
void *element, void *data, int len) {
|
||||||
BMOElemMapping *mapping;
|
BMOElemMapping *mapping;
|
||||||
BMOpSlot *slot = BMO_GetSlot(op, slotname);
|
BMOpSlot *slot = BMO_GetSlot(op, slotname);
|
||||||
|
|
||||||
/*sanity check*/
|
/*sanity check*/
|
||||||
if (slot->slottype != BMOP_OPSLOT_MAPPING) return;
|
if (slot->slottype != BMOP_OPSLOT_MAPPING) return;
|
||||||
|
|
||||||
mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
|
mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
|
||||||
|
|
||||||
mapping->element = (BMHeader*) element;
|
mapping->element = (BMHeader*) element;
|
||||||
@@ -445,23 +445,23 @@ BM_INLINE void BMO_Insert_Mapping(BMesh *UNUSED(bm), BMOperator *op, const char
|
|||||||
slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash,
|
slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash,
|
||||||
BLI_ghashutil_ptrcmp, "bmesh op");
|
BLI_ghashutil_ptrcmp, "bmesh op");
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_ghash_insert(slot->data.ghash, element, mapping);
|
BLI_ghash_insert(slot->data.ghash, element, mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_INLINE void BMO_Insert_MapInt(BMesh *bm, BMOperator *op, const char *slotname,
|
BM_INLINE void BMO_Insert_MapInt(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
void *element, int val)
|
void *element, int val)
|
||||||
{
|
{
|
||||||
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(int));
|
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
void *element, float val)
|
void *element, float val)
|
||||||
{
|
{
|
||||||
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(float));
|
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_INLINE void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
BM_INLINE void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
void *element, void *val)
|
void *element, void *val)
|
||||||
{
|
{
|
||||||
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(void*));
|
BMO_Insert_Mapping(bm, op, slotname, element, &val, sizeof(void*));
|
||||||
@@ -489,7 +489,7 @@ BM_INLINE void *BMO_Get_MapData(BMesh *UNUSED(bm), BMOperator *op, const char *s
|
|||||||
if (!slot->data.ghash) return NULL;
|
if (!slot->data.ghash) return NULL;
|
||||||
|
|
||||||
mapping = (BMOElemMapping *) BLI_ghash_lookup(slot->data.ghash, element);
|
mapping = (BMOElemMapping *) BLI_ghash_lookup(slot->data.ghash, element);
|
||||||
|
|
||||||
if (!mapping) return NULL;
|
if (!mapping) return NULL;
|
||||||
|
|
||||||
return mapping + 1;
|
return mapping + 1;
|
||||||
|
|||||||
@@ -103,9 +103,9 @@ struct Object;
|
|||||||
struct EditMesh;
|
struct EditMesh;
|
||||||
|
|
||||||
void BMOP_DupeFromFlag(struct BMesh *bm, int etypeflag, const char hflag);
|
void BMOP_DupeFromFlag(struct BMesh *bm, int etypeflag, const char hflag);
|
||||||
void BM_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth,
|
void BM_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth,
|
||||||
float fractal, int beauty, int numcuts, int seltype,
|
float fractal, int beauty, int numcuts, int seltype,
|
||||||
int cornertype, int singleedge, int gridfill, int seed);
|
int cornertype, int singleedge, int gridfill, int seed);
|
||||||
void BM_extrudefaceflag(BMesh *bm, int flag);
|
void BM_extrudefaceflag(BMesh *bm, int flag);
|
||||||
|
|
||||||
/* this next one return 1 if they did anything, or zero otherwise.
|
/* this next one return 1 if they did anything, or zero otherwise.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
* about this.
|
* about this.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
|
|
||||||
#include "BLI_array.h"
|
#include "BLI_array.h"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_meshdata_types.h"
|
#include "DNA_meshdata_types.h"
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "BKE_utildefines.h"
|
#include "BKE_utildefines.h"
|
||||||
#include "BKE_multires.h"
|
#include "BKE_multires.h"
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ static void UNUSED_FUNCTION(BM_Data_Vert_Average)(BMesh *UNUSED(bm), BMFace *UNU
|
|||||||
*
|
*
|
||||||
* Walks around the faces of an edge and interpolates the per-face-edge
|
* Walks around the faces of an edge and interpolates the per-face-edge
|
||||||
* data between two sources to a target.
|
* data between two sources to a target.
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
* Nothing
|
* Nothing
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +136,7 @@ void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVe
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
src[0] = v1loop->head.data;
|
src[0] = v1loop->head.data;
|
||||||
src[1] = v2loop->head.data;
|
src[1] = v2loop->head.data;
|
||||||
|
|
||||||
CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, vloop->head.data);
|
CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, vloop->head.data);
|
||||||
l = l->radial_next;
|
l = l->radial_next;
|
||||||
@@ -144,7 +144,7 @@ void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVe
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
|
void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
|
||||||
BMFace *f, int numTex, int numCol)
|
BMFace *f, int numTex, int numCol)
|
||||||
{
|
{
|
||||||
BMLoop *l;
|
BMLoop *l;
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
@@ -197,7 +197,7 @@ void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
|
|||||||
*
|
*
|
||||||
* projects target onto source, and pulls interpolated customdata from
|
* projects target onto source, and pulls interpolated customdata from
|
||||||
* source.
|
* source.
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
* Nothing
|
* Nothing
|
||||||
*/
|
*/
|
||||||
@@ -636,11 +636,11 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* mdisps is a grid of displacements, ordered thus:
|
* mdisps is a grid of displacements, ordered thus:
|
||||||
*
|
*
|
||||||
* v4/next
|
* v4/next
|
||||||
* |
|
* |
|
||||||
* | v1/cent-----mid2 ---> x
|
* | v1/cent-----mid2 ---> x
|
||||||
* | | |
|
* | | |
|
||||||
* | | |
|
* | | |
|
||||||
* v2/prev---mid1-----v3/cur
|
* v2/prev---mid1-----v3/cur
|
||||||
* |
|
* |
|
||||||
@@ -667,11 +667,11 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* mdisps is a grid of displacements, ordered thus:
|
* mdisps is a grid of displacements, ordered thus:
|
||||||
*
|
*
|
||||||
* v4/next
|
* v4/next
|
||||||
* |
|
* |
|
||||||
* | v1/cent-----mid2 ---> x
|
* | v1/cent-----mid2 ---> x
|
||||||
* | | |
|
* | | |
|
||||||
* | | |
|
* | | |
|
||||||
* v2/prev---mid1-----v3/cur
|
* v2/prev---mid1-----v3/cur
|
||||||
* |
|
* |
|
||||||
@@ -725,7 +725,7 @@ void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source)
|
|||||||
bmesh_loop_interp_mdisps(bm, target, source);
|
bmesh_loop_interp_mdisps(bm, target, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
|
void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
|
||||||
int do_vertex, int do_multires)
|
int do_vertex, int do_multires)
|
||||||
{
|
{
|
||||||
BMLoop *l_iter;
|
BMLoop *l_iter;
|
||||||
|
|||||||
@@ -46,9 +46,9 @@
|
|||||||
/*
|
/*
|
||||||
* BMESH SELECTMODE FLUSH
|
* BMESH SELECTMODE FLUSH
|
||||||
*
|
*
|
||||||
* Makes sure to flush selections
|
* Makes sure to flush selections
|
||||||
* 'upwards' (ie: all verts of an edge
|
* 'upwards' (ie: all verts of an edge
|
||||||
* selects the edge and so on). This
|
* selects the edge and so on). This
|
||||||
* should only be called by system and not
|
* should only be called by system and not
|
||||||
* tool authors.
|
* tool authors.
|
||||||
*
|
*
|
||||||
@@ -142,7 +142,7 @@ void BM_SelectMode_Flush(BMesh *bm)
|
|||||||
/*
|
/*
|
||||||
* BMESH SELECT VERT
|
* BMESH SELECT VERT
|
||||||
*
|
*
|
||||||
* Changes selection state of a single vertex
|
* Changes selection state of a single vertex
|
||||||
* in a mesh
|
* in a mesh
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ BMesh *BM_Make_Mesh(struct Object *ob, int allocsize[4])
|
|||||||
return bm;
|
return bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH FREE MESH
|
* BMESH FREE MESH
|
||||||
*
|
*
|
||||||
* Frees a BMesh structure.
|
* Frees a BMesh structure.
|
||||||
@@ -198,7 +198,7 @@ void BM_Clear_Mesh(BMesh *bm)
|
|||||||
bm->totflags = 1;
|
bm->totflags = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH FREE MESH
|
* BMESH FREE MESH
|
||||||
*
|
*
|
||||||
* Frees a BMesh structure.
|
* Frees a BMesh structure.
|
||||||
@@ -214,7 +214,7 @@ void BM_Free_Mesh(BMesh *bm)
|
|||||||
* BMESH COMPUTE NORMALS
|
* BMESH COMPUTE NORMALS
|
||||||
*
|
*
|
||||||
* Updates the normals of a mesh.
|
* Updates the normals of a mesh.
|
||||||
* Note that this can only be called
|
* Note that this can only be called
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -426,11 +426,11 @@ static void bmesh_set_mdisps_space(BMesh *bm, int from, int to)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH BEGIN/END EDIT
|
* BMESH BEGIN/END EDIT
|
||||||
*
|
*
|
||||||
* Functions for setting up a mesh for editing and cleaning up after
|
* Functions for setting up a mesh for editing and cleaning up after
|
||||||
* the editing operations are done. These are called by the tools/operator
|
* the editing operations are done. These are called by the tools/operator
|
||||||
* API for each time a tool is executed.
|
* API for each time a tool is executed.
|
||||||
*/
|
*/
|
||||||
void bmesh_begin_edit(BMesh *bm, int flag)
|
void bmesh_begin_edit(BMesh *bm, int flag)
|
||||||
|
|||||||
@@ -49,19 +49,19 @@
|
|||||||
/**
|
/**
|
||||||
* bmesh_dissolve_disk
|
* bmesh_dissolve_disk
|
||||||
*
|
*
|
||||||
* Turns the face region surrounding a manifold vertex into
|
* Turns the face region surrounding a manifold vertex into
|
||||||
* A single polygon.
|
* A single polygon.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* |=========| |=========|
|
* |=========| |=========|
|
||||||
* | \ / | | |
|
* | \ / | | |
|
||||||
* Before: | V | After: | |
|
* Before: | V | After: | |
|
||||||
* | / \ | | |
|
* | / \ | | |
|
||||||
* |=========| |=========|
|
* |=========| |=========|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if 1
|
#if 1
|
||||||
int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
|
int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
|
||||||
@@ -80,7 +80,7 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
if (v->e)
|
if (v->e)
|
||||||
BM_Kill_Edge(bm, v->e);
|
BM_Kill_Edge(bm, v->e);
|
||||||
BM_Kill_Vert(bm, v);
|
BM_Kill_Vert(bm, v);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -244,7 +244,7 @@ void BM_Dissolve_Disk(BMesh *bm, BMVert *v)
|
|||||||
* BM_Join_TwoFaces
|
* BM_Join_TwoFaces
|
||||||
*
|
*
|
||||||
* Joins two adjacenct faces togather.
|
* Joins two adjacenct faces togather.
|
||||||
*
|
*
|
||||||
* Because this method calls to BM_Join_Faces to do its work, ff a pair
|
* Because this method calls to BM_Join_Faces to do its work, ff a pair
|
||||||
* of faces share multiple edges, the pair of faces will be joined at
|
* of faces share multiple edges, the pair of faces will be joined at
|
||||||
* every edge (not just edge e). This part of the functionality might need
|
* every edge (not just edge e). This part of the functionality might need
|
||||||
@@ -338,7 +338,7 @@ BMEdge *BM_Connect_Verts(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **nf)
|
|||||||
* v1 & v2 - vertices which define the split edge, must be different
|
* v1 & v2 - vertices which define the split edge, must be different
|
||||||
* nl - pointer which will receive the BMLoop for the split edge in the new face
|
* nl - pointer which will receive the BMLoop for the split edge in the new face
|
||||||
*
|
*
|
||||||
* Notes: the
|
* Notes: the
|
||||||
|
|
||||||
* Returns -
|
* Returns -
|
||||||
* Pointer to the newly created face representing one side of the split
|
* Pointer to the newly created face representing one side of the split
|
||||||
@@ -532,7 +532,7 @@ BMEdge *BM_Collapse_Vert_Edges(BMesh *bm, BMEdge *ke, BMVert *kv)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BM_split_edge
|
* BM_split_edge
|
||||||
*
|
*
|
||||||
* Splits an edge. v should be one of the vertices in e and
|
* Splits an edge. v should be one of the vertices in e and
|
||||||
* defines the direction of the splitting operation for interpolation
|
* defines the direction of the splitting operation for interpolation
|
||||||
* purposes.
|
* purposes.
|
||||||
@@ -550,7 +550,7 @@ BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percen
|
|||||||
SmallHash hash;
|
SmallHash hash;
|
||||||
|
|
||||||
/* we need this for handling multire */
|
/* we need this for handling multire */
|
||||||
if (!ne)
|
if (!ne)
|
||||||
ne = &dummy;
|
ne = &dummy;
|
||||||
|
|
||||||
/* do we have a multires layer */
|
/* do we have a multires layer */
|
||||||
@@ -570,7 +570,7 @@ BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percen
|
|||||||
for (i = 0; i < BLI_array_count(oldfaces); i++) {
|
for (i = 0; i < BLI_array_count(oldfaces); i++) {
|
||||||
oldfaces[i] = BM_Copy_Face(bm, oldfaces[i], 1, 1);
|
oldfaces[i] = BM_Copy_Face(bm, oldfaces[i], 1, 1);
|
||||||
BLI_smallhash_insert(&hash, (intptr_t)oldfaces[i], NULL);
|
BLI_smallhash_insert(&hash, (intptr_t)oldfaces[i], NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v2 = bmesh_edge_getothervert(e, v);
|
v2 = bmesh_edge_getothervert(e, v);
|
||||||
@@ -588,7 +588,7 @@ BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percen
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* v->nv->v2 */
|
/* v->nv->v2 */
|
||||||
BM_Data_Facevert_Edgeinterp(bm, v2, v, nv, e, percent);
|
BM_Data_Facevert_Edgeinterp(bm, v2, v, nv, e, percent);
|
||||||
BM_Data_Interp_From_Verts(bm, v, v2, nv, percent);
|
BM_Data_Interp_From_Verts(bm, v, v2, nv, percent);
|
||||||
|
|
||||||
if (CustomData_has_layer(&bm->ldata, CD_MDISPS) && e->l && nv) {
|
if (CustomData_has_layer(&bm->ldata, CD_MDISPS) && e->l && nv) {
|
||||||
@@ -638,7 +638,7 @@ BMVert *BM_Split_Edge(BMesh *bm, BMVert *v, BMEdge *e, BMEdge **ne, float percen
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
BM_multires_smooth_bounds(bm, l->f);
|
BM_multires_smooth_bounds(bm, l->f);
|
||||||
l = l->radial_next;
|
l = l->radial_next;
|
||||||
} while (l != e1->l);
|
} while (l != e1->l);
|
||||||
}
|
}
|
||||||
@@ -664,7 +664,7 @@ BMVert *BM_Split_Edge_Multi(BMesh *bm, BMEdge *e, int numcuts)
|
|||||||
return nv;
|
return nv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err)
|
int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err)
|
||||||
{
|
{
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
BLI_array_declare(verts);
|
BLI_array_declare(verts);
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ static BMLoop *BM_Add_FaceBoundary(BMesh *bm, BMFace *f, BMVert *startv, BMEdge
|
|||||||
|
|
||||||
l->f = f;
|
l->f = f;
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
|
BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
|
||||||
@@ -580,7 +580,7 @@ void BM_Kill_Edge(BMesh *bm, BMEdge *e)
|
|||||||
lnext = l->radial_next;
|
lnext = l->radial_next;
|
||||||
if (lnext->f == l->f) {
|
if (lnext->f == l->f) {
|
||||||
BM_Kill_Face(bm, l->f);
|
BM_Kill_Face(bm, l->f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_Kill_Face(bm, l->f);
|
BM_Kill_Face(bm, l->f);
|
||||||
@@ -913,7 +913,7 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
|
|||||||
/* create region fac */
|
/* create region fac */
|
||||||
newf = BM_Make_Ngon(bm, v1, v2, edges, tote, 0);
|
newf = BM_Make_Ngon(bm, v1, v2, edges, tote, 0);
|
||||||
if (!newf || BMO_HasError(bm)) {
|
if (!newf || BMO_HasError(bm)) {
|
||||||
if (!BMO_HasError(bm))
|
if (!BMO_HasError(bm))
|
||||||
err = "Invalid boundary region to join faces";
|
err = "Invalid boundary region to join faces";
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@@ -964,7 +964,7 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
|
|||||||
BM_loop_interp_multires(bm, l_iter, faces[i]);
|
BM_loop_interp_multires(bm, l_iter, faces[i]);
|
||||||
}
|
}
|
||||||
} while ((l_iter = l_iter->next) != l_first);
|
} while ((l_iter = l_iter->next) != l_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete old geometr */
|
/* delete old geometr */
|
||||||
for (i = 0; i < BLI_array_count(deledges); i++) {
|
for (i = 0; i < BLI_array_count(deledges); i++) {
|
||||||
@@ -1334,14 +1334,14 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
|
|||||||
* JOIN EDGE KILL VERT:
|
* JOIN EDGE KILL VERT:
|
||||||
* Takes a an edge and pointer to one of its vertices and collapses
|
* Takes a an edge and pointer to one of its vertices and collapses
|
||||||
* the edge on that vertex.
|
* the edge on that vertex.
|
||||||
*
|
*
|
||||||
* Before: OE KE
|
* Before: OE KE
|
||||||
* ------- -------
|
* ------- -------
|
||||||
* | || |
|
* | || |
|
||||||
* OV KV TV
|
* OV KV TV
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* After: OE
|
* After: OE
|
||||||
* ---------------
|
* ---------------
|
||||||
* | |
|
* | |
|
||||||
* OV TV
|
* OV TV
|
||||||
@@ -1375,7 +1375,7 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
|
|||||||
if (len == 2) {
|
if (len == 2) {
|
||||||
oe = bmesh_disk_nextedge(ke, kv);
|
oe = bmesh_disk_nextedge(ke, kv);
|
||||||
tv = bmesh_edge_getothervert(ke, kv);
|
tv = bmesh_edge_getothervert(ke, kv);
|
||||||
ov = bmesh_edge_getothervert(oe, kv);
|
ov = bmesh_edge_getothervert(oe, kv);
|
||||||
halt = bmesh_verts_in_edge(kv, tv, oe); /* check for double edge */
|
halt = bmesh_verts_in_edge(kv, tv, oe); /* check for double edge */
|
||||||
|
|
||||||
if (halt) {
|
if (halt) {
|
||||||
@@ -1481,21 +1481,21 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
|
|||||||
* bmesh_JFKE
|
* bmesh_JFKE
|
||||||
*
|
*
|
||||||
* JOIN FACE KILL EDGE:
|
* JOIN FACE KILL EDGE:
|
||||||
*
|
*
|
||||||
* Takes two faces joined by a single 2-manifold edge and fuses them togather.
|
* Takes two faces joined by a single 2-manifold edge and fuses them togather.
|
||||||
* The edge shared by the faces must not be connected to any other edges which have
|
* The edge shared by the faces must not be connected to any other edges which have
|
||||||
* Both faces in its radial cycle
|
* Both faces in its radial cycle
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
*
|
*
|
||||||
* A B
|
* A B
|
||||||
* ---------- ----------
|
* ---------- ----------
|
||||||
* | | | |
|
* | | | |
|
||||||
* | f1 | | f1 |
|
* | f1 | | f1 |
|
||||||
* v1========v2 = Ok! v1==V2==v3 == Wrong!
|
* v1========v2 = Ok! v1==V2==v3 == Wrong!
|
||||||
* | f2 | | f2 |
|
* | f2 | | f2 |
|
||||||
* | | | |
|
* | | | |
|
||||||
* ---------- ----------
|
* ---------- ----------
|
||||||
*
|
*
|
||||||
* In the example A, faces f1 and f2 are joined by a single edge, and the euler can safely be used.
|
* In the example A, faces f1 and f2 are joined by a single edge, and the euler can safely be used.
|
||||||
* In example B however, f1 and f2 are joined by multiple edges and will produce an error. The caller
|
* In example B however, f1 and f2 are joined by multiple edges and will produce an error. The caller
|
||||||
|
|||||||
@@ -61,34 +61,34 @@
|
|||||||
|
|
||||||
/* ok, I'm going to write a little docgen script. so all
|
/* ok, I'm going to write a little docgen script. so all
|
||||||
* bmop comments must conform to the following template/rules:
|
* bmop comments must conform to the following template/rules:
|
||||||
*
|
*
|
||||||
* template (py quotes used because nested comments don't work
|
* template (py quotes used because nested comments don't work
|
||||||
* on all C compilers):
|
* on all C compilers):
|
||||||
*
|
*
|
||||||
* """
|
* """
|
||||||
* Region Extend.
|
* Region Extend.
|
||||||
*
|
*
|
||||||
* paragraph1, Extends bleh bleh bleh.
|
* paragraph1, Extends bleh bleh bleh.
|
||||||
* Bleh Bleh bleh.
|
* Bleh Bleh bleh.
|
||||||
*
|
*
|
||||||
* Another paragraph.
|
* Another paragraph.
|
||||||
*
|
*
|
||||||
* Another paragraph.
|
* Another paragraph.
|
||||||
* """
|
* """
|
||||||
*
|
*
|
||||||
* so the first line is the "title" of the bmop.
|
* so the first line is the "title" of the bmop.
|
||||||
* subsequent line blocks seperated by blank lines
|
* subsequent line blocks seperated by blank lines
|
||||||
* are paragraphs. individual descriptions of slots
|
* are paragraphs. individual descriptions of slots
|
||||||
* would be extracted from comments
|
* would be extracted from comments
|
||||||
* next to them, e.g.
|
* next to them, e.g.
|
||||||
*
|
*
|
||||||
* {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, //output slot, boundary region
|
* {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, //output slot, boundary region
|
||||||
*
|
*
|
||||||
* the doc generator would automatically detect the presence of "output slot"
|
* the doc generator would automatically detect the presence of "output slot"
|
||||||
* and flag the slot as an output. the same happens for "input slot". also
|
* and flag the slot as an output. the same happens for "input slot". also
|
||||||
* note that "edges", "faces", "verts", "loops", and "geometry" are valid
|
* note that "edges", "faces", "verts", "loops", and "geometry" are valid
|
||||||
* substitutions for "slot".
|
* substitutions for "slot".
|
||||||
*
|
*
|
||||||
* note that slots default to being input slots.
|
* note that slots default to being input slots.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -128,12 +128,12 @@ static BMOpDefine def_righthandfaces = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Region Extend
|
* Region Extend
|
||||||
*
|
*
|
||||||
* used to implement the select more/less tools.
|
* used to implement the select more/less tools.
|
||||||
* this puts some geometry surrounding regions of
|
* this puts some geometry surrounding regions of
|
||||||
* geometry in geom into geomout.
|
* geometry in geom into geomout.
|
||||||
*
|
*
|
||||||
* if usefaces is 0 then geomout spits out verts and edges,
|
* if usefaces is 0 then geomout spits out verts and edges,
|
||||||
* otherwise it spits out faces.
|
* otherwise it spits out faces.
|
||||||
*/
|
*/
|
||||||
static BMOpDefine def_regionextend = {
|
static BMOpDefine def_regionextend = {
|
||||||
@@ -182,7 +182,7 @@ static BMOpDefine def_reversefaces = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Edge Bisect
|
* Edge Bisect
|
||||||
*
|
*
|
||||||
* Splits input edges (but doesn't do anything else).
|
* Splits input edges (but doesn't do anything else).
|
||||||
* This creates a 2-valence vert.
|
* This creates a 2-valence vert.
|
||||||
*/
|
*/
|
||||||
@@ -253,7 +253,7 @@ static BMOpDefine def_removedoubles = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Auto Merge
|
* Auto Merge
|
||||||
*
|
*
|
||||||
* Finds groups of vertices closer then dist and merges them together,
|
* Finds groups of vertices closer then dist and merges them together,
|
||||||
* using the weld verts bmop. The merges must go from a vert not in
|
* using the weld verts bmop. The merges must go from a vert not in
|
||||||
* verts to one in verts.
|
* verts to one in verts.
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void BMO_Clear_OpFlag(BMesh *UNUSED(bm), BMOperator *op, int flag)
|
|||||||
/*
|
/*
|
||||||
* BMESH OPSTACK PUSH
|
* BMESH OPSTACK PUSH
|
||||||
*
|
*
|
||||||
* Pushes the opstack down one level
|
* Pushes the opstack down one level
|
||||||
* and allocates a new flag layer if
|
* and allocates a new flag layer if
|
||||||
* appropriate.
|
* appropriate.
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +112,7 @@ void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
|
|||||||
/*
|
/*
|
||||||
* BMESH OPSTACK POP
|
* BMESH OPSTACK POP
|
||||||
*
|
*
|
||||||
* Pops the opstack one level
|
* Pops the opstack one level
|
||||||
* and frees a flag layer if appropriate
|
* and frees a flag layer if appropriate
|
||||||
* BMESH_TODO: investigate NOT freeing flag
|
* BMESH_TODO: investigate NOT freeing flag
|
||||||
* layers.
|
* layers.
|
||||||
@@ -128,7 +128,7 @@ void BMO_pop(BMesh *bm)
|
|||||||
/*
|
/*
|
||||||
* BMESH OPSTACK INIT OP
|
* BMESH OPSTACK INIT OP
|
||||||
*
|
*
|
||||||
* Initializes an operator structure
|
* Initializes an operator structure
|
||||||
* to a certain type
|
* to a certain type
|
||||||
*/
|
*/
|
||||||
void BMO_Init_Op(BMesh *bm, BMOperator *op, const char *opname)
|
void BMO_Init_Op(BMesh *bm, BMOperator *op, const char *opname)
|
||||||
@@ -184,7 +184,7 @@ void BMO_Exec_Op(BMesh *bm, BMOperator *op)
|
|||||||
if (bm->stackdepth == 2)
|
if (bm->stackdepth == 2)
|
||||||
bmesh_end_edit(bm, op->flag);
|
bmesh_end_edit(bm, op->flag);
|
||||||
|
|
||||||
BMO_pop(bm);
|
BMO_pop(bm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -201,7 +201,7 @@ void BMO_Finish_Op(BMesh *bm, BMOperator *op)
|
|||||||
for (i = 0; opdefines[op->type]->slottypes[i].type; i++) {
|
for (i = 0; opdefines[op->type]->slottypes[i].type; i++) {
|
||||||
slot = &op->slots[i];
|
slot = &op->slots[i];
|
||||||
if (slot->slottype == BMOP_OPSLOT_MAPPING) {
|
if (slot->slottype == BMOP_OPSLOT_MAPPING) {
|
||||||
if (slot->data.ghash)
|
if (slot->data.ghash)
|
||||||
BLI_ghash_free(slot->data.ghash, NULL, NULL);
|
BLI_ghash_free(slot->data.ghash, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ int BMO_HasSlot(BMOperator *op, const char *slotname)
|
|||||||
/*
|
/*
|
||||||
* BMESH OPSTACK GET SLOT
|
* BMESH OPSTACK GET SLOT
|
||||||
*
|
*
|
||||||
* Returns a pointer to the slot of
|
* Returns a pointer to the slot of
|
||||||
* type 'slotcode'
|
* type 'slotcode'
|
||||||
*/
|
*/
|
||||||
BMOpSlot *BMO_GetSlot(BMOperator *op, const char *slotname)
|
BMOpSlot *BMO_GetSlot(BMOperator *op, const char *slotname)
|
||||||
@@ -279,24 +279,21 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
|
|||||||
if (!source_slot->data.ghash) return;
|
if (!source_slot->data.ghash) return;
|
||||||
|
|
||||||
if (!dest_slot->data.ghash) {
|
if (!dest_slot->data.ghash) {
|
||||||
dest_slot->data.ghash =
|
dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash,
|
||||||
BLI_ghash_new(BLI_ghashutil_ptrhash,
|
BLI_ghashutil_ptrcmp, "bmesh operator 2");
|
||||||
BLI_ghashutil_ptrcmp, "bmesh operator 2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_ghashIterator_init(&it, source_slot->data.ghash);
|
BLI_ghashIterator_init(&it, source_slot->data.ghash);
|
||||||
for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
|
for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
|
||||||
BLI_ghashIterator_step(&it))
|
BLI_ghashIterator_step(&it))
|
||||||
{
|
{
|
||||||
dstmap = BLI_memarena_alloc(dest_op->arena,
|
dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
|
||||||
sizeof(*dstmap) + srcmap->len);
|
|
||||||
|
|
||||||
dstmap->element = srcmap->element;
|
dstmap->element = srcmap->element;
|
||||||
dstmap->len = srcmap->len;
|
dstmap->len = srcmap->len;
|
||||||
memcpy(dstmap + 1, srcmap + 1, srcmap->len);
|
memcpy(dstmap + 1, srcmap + 1, srcmap->len);
|
||||||
|
|
||||||
BLI_ghash_insert(dest_slot->data.ghash,
|
BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
|
||||||
dstmap->element, dstmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,7 +458,7 @@ int BMO_CountFlag(BMesh *bm, int flag, const char htype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMO_Clear_Flag_All(BMesh *bm, BMOperator *UNUSED(op), const char htype, int flag)
|
void BMO_Clear_Flag_All(BMesh *bm, BMOperator *UNUSED(op), const char htype, int flag)
|
||||||
@@ -538,7 +535,7 @@ void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
||||||
const char *slotname, int flag)
|
const char *slotname, int flag)
|
||||||
{
|
{
|
||||||
GHashIterator it;
|
GHashIterator it;
|
||||||
@@ -616,7 +613,7 @@ static void BMO_All_To_Slot(BMesh *bm, BMOperator *op, const char *slotname, con
|
|||||||
/*
|
/*
|
||||||
* BMO_HEADERFLAG_TO_SLOT
|
* BMO_HEADERFLAG_TO_SLOT
|
||||||
*
|
*
|
||||||
* Copies elements of a certain type, which have a certain header flag set
|
* Copies elements of a certain type, which have a certain header flag set
|
||||||
* into a slot for an operator.
|
* into a slot for an operator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -669,7 +666,7 @@ void BMO_HeaderFlag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
|
|||||||
*
|
*
|
||||||
* BMO_FLAG_TO_SLOT
|
* BMO_FLAG_TO_SLOT
|
||||||
*
|
*
|
||||||
* Copies elements of a certain type, which have a certain flag set
|
* Copies elements of a certain type, which have a certain flag set
|
||||||
* into an output slot for an operator.
|
* into an output slot for an operator.
|
||||||
*/
|
*/
|
||||||
void BMO_Flag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
|
void BMO_Flag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
|
||||||
@@ -831,7 +828,7 @@ void BMO_Unflag_Buffer(BMesh *bm, BMOperator *op, const char *slotname,
|
|||||||
*
|
*
|
||||||
* ALLOC/FREE FLAG LAYER
|
* ALLOC/FREE FLAG LAYER
|
||||||
*
|
*
|
||||||
* Used by operator stack to free/allocate
|
* Used by operator stack to free/allocate
|
||||||
* private flag data. This is allocated
|
* private flag data. This is allocated
|
||||||
* using a mempool so the allocation/frees
|
* using a mempool so the allocation/frees
|
||||||
* should be quite fast.
|
* should be quite fast.
|
||||||
@@ -1101,7 +1098,7 @@ typedef struct BMOFlag {
|
|||||||
int flag;
|
int flag;
|
||||||
} BMOFlag;
|
} BMOFlag;
|
||||||
|
|
||||||
#define PAIR(f) {#f, f},
|
#define PAIR(f) {#f, f},fv
|
||||||
static const char *bmesh_flags = {
|
static const char *bmesh_flags = {
|
||||||
PAIR(BM_SELECT);
|
PAIR(BM_SELECT);
|
||||||
PAIR(BM_SEAM);
|
PAIR(BM_SEAM);
|
||||||
@@ -1309,26 +1306,30 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
stop = 0;
|
stop = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (NEXT_CHAR(fmt)) {
|
switch (NEXT_CHAR(fmt)) {
|
||||||
case 'f': ret |= BM_FACE; break;
|
case 'f': ret |= BM_FACE; break;
|
||||||
case 'e': ret |= BM_EDGE; break;
|
case 'e': ret |= BM_EDGE; break;
|
||||||
case 'v': ret |= BM_VERT; break;
|
case 'v': ret |= BM_VERT; break;
|
||||||
default:
|
default:
|
||||||
stop = 1;
|
stop = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (stop) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt++;
|
||||||
}
|
}
|
||||||
if (stop) break;
|
|
||||||
fmt++;
|
if (type == 'h') {
|
||||||
|
BMO_HeaderFlag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
|
||||||
}
|
}
|
||||||
|
else if (type == 'a') {
|
||||||
if (type == 'h')
|
|
||||||
BMO_HeaderFlag_To_Slot(bm, op,
|
|
||||||
slotname, va_arg(vlist, int), ret);
|
|
||||||
else if (type == 'a')
|
|
||||||
BMO_All_To_Slot(bm, op, slotname, ret);
|
BMO_All_To_Slot(bm, op, slotname, ret);
|
||||||
else
|
}
|
||||||
BMO_Flag_To_Slot(bm, op, slotname,
|
else {
|
||||||
va_arg(vlist, int), ret);
|
BMO_Flag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state = 1;
|
state = 1;
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ static int point_in_triangle(const double v1[2], const double v2[2], const doubl
|
|||||||
/*
|
/*
|
||||||
* COMPUTE POLY NORMAL
|
* COMPUTE POLY NORMAL
|
||||||
*
|
*
|
||||||
* Computes the normal of a planar
|
* Computes the normal of a planar
|
||||||
* polygon See Graphics Gems for
|
* polygon See Graphics Gems for
|
||||||
* computing newell normal.
|
* computing newell normal.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -209,7 +209,7 @@ static int compute_poly_center(float center[3], float *r_area, float (*verts)[3]
|
|||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
while (j < nverts) {
|
while (j < nverts) {
|
||||||
ai = verts[i][0] * verts[j][1] - verts[j][0] * verts[i][1];
|
ai = verts[i][0] * verts[j][1] - verts[j][0] * verts[i][1];
|
||||||
atmp += ai;
|
atmp += ai;
|
||||||
xtmp += (verts[j][0] + verts[i][0]) * ai;
|
xtmp += (verts[j][0] + verts[i][0]) * ai;
|
||||||
ytmp += (verts[j][1] + verts[i][1]) * ai;
|
ytmp += (verts[j][1] + verts[i][1]) * ai;
|
||||||
@@ -290,7 +290,7 @@ void BM_Compute_Face_CenterMean(BMesh *bm, BMFace *f, float r_cent[3])
|
|||||||
/*
|
/*
|
||||||
* COMPUTE POLY PLANE
|
* COMPUTE POLY PLANE
|
||||||
*
|
*
|
||||||
* Projects a set polygon's vertices to
|
* Projects a set polygon's vertices to
|
||||||
* a plane defined by the average
|
* a plane defined by the average
|
||||||
* of its edges cross products
|
* of its edges cross products
|
||||||
*
|
*
|
||||||
@@ -337,7 +337,7 @@ void compute_poly_plane(float (*verts)[3], int nverts)
|
|||||||
v1 = verts[i];
|
v1 = verts[i];
|
||||||
mag = dot_v3v3(v1, avgn);
|
mag = dot_v3v3(v1, avgn);
|
||||||
madd_v3_v3fl(v1, avgn, -mag);
|
madd_v3_v3fl(v1, avgn, -mag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -607,13 +607,13 @@ void bmesh_update_face_normal_vertex_cos(BMesh *bm, BMFace *f, float no[3],
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH FLIP NORMAL
|
* BMESH FLIP NORMAL
|
||||||
*
|
*
|
||||||
* Reverses the winding of a face.
|
* Reverses the winding of a face.
|
||||||
* Note that this updates the calculated
|
* Note that this updates the calculated
|
||||||
* normal.
|
* normal.
|
||||||
*/
|
*/
|
||||||
void BM_flip_normal(BMesh *bm, BMFace *f)
|
void BM_flip_normal(BMesh *bm, BMFace *f)
|
||||||
{
|
{
|
||||||
bmesh_loop_reverse(bm, f);
|
bmesh_loop_reverse(bm, f);
|
||||||
negate_v3(f->no);
|
negate_v3(f->no);
|
||||||
}
|
}
|
||||||
@@ -837,10 +837,10 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i
|
|||||||
/*
|
/*
|
||||||
* BMESH TRIANGULATE FACE
|
* BMESH TRIANGULATE FACE
|
||||||
*
|
*
|
||||||
* Triangulates a face using a
|
* Triangulates a face using a
|
||||||
* simple 'ear clipping' algorithm
|
* simple 'ear clipping' algorithm
|
||||||
* that tries to favor non-skinny
|
* that tries to favor non-skinny
|
||||||
* triangles (angles less than
|
* triangles (angles less than
|
||||||
* 90 degrees). If the triangulator
|
* 90 degrees). If the triangulator
|
||||||
* has bits left over (or cannot
|
* has bits left over (or cannot
|
||||||
* triangulate at all) it uses a
|
* triangulate at all) it uses a
|
||||||
@@ -850,7 +850,7 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i
|
|||||||
* with a length equal to f->len. it will be filled with the new
|
* with a length equal to f->len. it will be filled with the new
|
||||||
* triangles, and will be NULL-terminated.
|
* triangles, and will be NULL-terminated.
|
||||||
*/
|
*/
|
||||||
void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
|
void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
|
||||||
int newedgeflag, int newfaceflag, BMFace **newfaces)
|
int newedgeflag, int newfaceflag, BMFace **newfaces)
|
||||||
{
|
{
|
||||||
int i, done, nvert, nf_i = 0;
|
int i, done, nvert, nf_i = 0;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ int bmesh_get_filter_argtype(int type);
|
|||||||
|
|
||||||
/* Polygon Utilities ? FIXME... where do these each go? */
|
/* Polygon Utilities ? FIXME... where do these each go? */
|
||||||
/* newedgeflag sets a flag layer flag, obviously not the header flag. */
|
/* newedgeflag sets a flag layer flag, obviously not the header flag. */
|
||||||
void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
|
void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
|
||||||
int newedgeflag, int newfaceflag, BMFace **newfaces);
|
int newedgeflag, int newfaceflag, BMFace **newfaces);
|
||||||
void bmesh_update_face_normal(struct BMesh *bm, struct BMFace *f, float no[3],
|
void bmesh_update_face_normal(struct BMesh *bm, struct BMFace *f, float no[3],
|
||||||
float (*projectverts)[3]);
|
float (*projectverts)[3]);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ int BM_Edge_In_Face(BMFace *f, BMEdge *e)
|
|||||||
/*
|
/*
|
||||||
* BMESH VERTS IN EDGE
|
* BMESH VERTS IN EDGE
|
||||||
*
|
*
|
||||||
* Returns whether or not two vertices are in
|
* Returns whether or not two vertices are in
|
||||||
* a given edge
|
* a given edge
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -233,7 +233,7 @@ int BM_Edge_FaceCount(BMEdge *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BMESH VERT FACECOUNT
|
* BMESH VERT FACECOUNT
|
||||||
@@ -318,7 +318,7 @@ int BM_Wire_Edge(BMesh *UNUSED(bm), BMEdge *e)
|
|||||||
* 2: Joins two distinct regions - (two pyramids joined at the tip)
|
* 2: Joins two distinct regions - (two pyramids joined at the tip)
|
||||||
* 3: Is part of a non-manifold edge (edge with more than 2 faces)
|
* 3: Is part of a non-manifold edge (edge with more than 2 faces)
|
||||||
* 4: Is part of a wire edge
|
* 4: Is part of a wire edge
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
* 1 for true, 0 for false.
|
* 1 for true, 0 for false.
|
||||||
*/
|
*/
|
||||||
@@ -429,7 +429,7 @@ int BM_Boundary_Edge(BMEdge *e)
|
|||||||
*
|
*
|
||||||
* BMESH_TODO:
|
* BMESH_TODO:
|
||||||
* Move this to structure, and wrap.
|
* Move this to structure, and wrap.
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
* Integer
|
* Integer
|
||||||
*/
|
*/
|
||||||
@@ -526,7 +526,7 @@ void BM_Edge_OrderedVerts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
|
|||||||
*
|
*
|
||||||
* Calculates the angle between two faces. Assumes
|
* Calculates the angle between two faces. Assumes
|
||||||
* That face normals are correct.
|
* That face normals are correct.
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
* Float.
|
* Float.
|
||||||
*/
|
*/
|
||||||
@@ -552,7 +552,7 @@ float BM_Face_Angle(BMesh *UNUSED(bm), BMEdge *e)
|
|||||||
* Returns:
|
* Returns:
|
||||||
* 0 for no overlap
|
* 0 for no overlap
|
||||||
* 1 for overlap
|
* 1 for overlap
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
* about this.
|
* about this.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -98,29 +98,29 @@ int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
|
|||||||
* circular linked list, each one is considered to have a 'base' or 'head',
|
* circular linked list, each one is considered to have a 'base' or 'head',
|
||||||
* and care must be taken by Euler code when modifying the contents of a cycle.
|
* and care must be taken by Euler code when modifying the contents of a cycle.
|
||||||
*
|
*
|
||||||
* The contents of this file are split into two parts. First there are the
|
* The contents of this file are split into two parts. First there are the
|
||||||
* bmesh_cycle family of functions which are generic circular double linked list
|
* bmesh_cycle family of functions which are generic circular double linked list
|
||||||
* procedures. The second part contains higher level procedures for supporting
|
* procedures. The second part contains higher level procedures for supporting
|
||||||
* modification of specific cycle types.
|
* modification of specific cycle types.
|
||||||
*
|
*
|
||||||
* The three cycles explicitly stored in the BM data structure are as follows:
|
* The three cycles explicitly stored in the BM data structure are as follows:
|
||||||
*
|
*
|
||||||
* 1: The Disk Cycle - A circle of edges around a vertex
|
* 1: The Disk Cycle - A circle of edges around a vertex
|
||||||
* Base: vertex->edge pointer.
|
* Base: vertex->edge pointer.
|
||||||
*
|
*
|
||||||
* This cycle is the most complicated in terms of its structure. Each bmesh_Edge contains
|
* This cycle is the most complicated in terms of its structure. Each bmesh_Edge contains
|
||||||
* two bmesh_CycleNode structures to keep track of that edge's membership in the disk cycle
|
* two bmesh_CycleNode structures to keep track of that edge's membership in the disk cycle
|
||||||
* of each of its vertices. However for any given vertex it may be the first in some edges
|
* of each of its vertices. However for any given vertex it may be the first in some edges
|
||||||
* in its disk cycle and the second for others. The bmesh_disk_XXX family of functions contain
|
* in its disk cycle and the second for others. The bmesh_disk_XXX family of functions contain
|
||||||
* some nice utilities for navigating disk cycles in a way that hides this detail from the
|
* some nice utilities for navigating disk cycles in a way that hides this detail from the
|
||||||
* tool writer.
|
* tool writer.
|
||||||
*
|
*
|
||||||
* Note that the disk cycle is completley independant from face data. One advantage of this
|
* Note that the disk cycle is completley independant from face data. One advantage of this
|
||||||
* is that wire edges are fully integrated into the topology database. Another is that the
|
* is that wire edges are fully integrated into the topology database. Another is that the
|
||||||
* the disk cycle has no problems dealing with non-manifold conditions involving faces.
|
* the disk cycle has no problems dealing with non-manifold conditions involving faces.
|
||||||
*
|
*
|
||||||
* Functions relating to this cycle:
|
* Functions relating to this cycle:
|
||||||
*
|
*
|
||||||
* bmesh_disk_append_edge
|
* bmesh_disk_append_edge
|
||||||
* bmesh_disk_remove_edge
|
* bmesh_disk_remove_edge
|
||||||
* bmesh_disk_nextedge
|
* bmesh_disk_nextedge
|
||||||
@@ -130,33 +130,33 @@ int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
|
|||||||
* Base: edge->l->radial structure.
|
* Base: edge->l->radial structure.
|
||||||
*
|
*
|
||||||
* The radial cycle is similar to the radial cycle in the radial edge data structure.*
|
* The radial cycle is similar to the radial cycle in the radial edge data structure.*
|
||||||
* Unlike the radial edge however, the radial cycle does not require a large amount of memory
|
* Unlike the radial edge however, the radial cycle does not require a large amount of memory
|
||||||
* to store non-manifold conditions since BM does not keep track of region/shell
|
* to store non-manifold conditions since BM does not keep track of region/shell
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
* Functions relating to this cycle:
|
* Functions relating to this cycle:
|
||||||
*
|
*
|
||||||
* bmesh_radial_append
|
* bmesh_radial_append
|
||||||
* bmesh_radial_remove_loop
|
* bmesh_radial_remove_loop
|
||||||
* bmesh_radial_nextloop
|
* bmesh_radial_nextloop
|
||||||
* bmesh_radial_find_face
|
* bmesh_radial_find_face
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 3: The Loop Cycle - A circle of face edges around a polygon.
|
* 3: The Loop Cycle - A circle of face edges around a polygon.
|
||||||
* Base: polygon->lbase.
|
* Base: polygon->lbase.
|
||||||
*
|
*
|
||||||
* The loop cycle keeps track of a faces vertices and edges. It should be noted that the
|
* The loop cycle keeps track of a faces vertices and edges. It should be noted that the
|
||||||
* direction of a loop cycle is either CW or CCW depending on the face normal, and is
|
* direction of a loop cycle is either CW or CCW depending on the face normal, and is
|
||||||
* not oriented to the faces editedges.
|
* not oriented to the faces editedges.
|
||||||
*
|
*
|
||||||
* Functions relating to this cycle:
|
* Functions relating to this cycle:
|
||||||
*
|
*
|
||||||
* bmesh_cycle_XXX family of functions.
|
* bmesh_cycle_XXX family of functions.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Note that the order of elements in all cycles except the loop cycle is undefined. This
|
* Note that the order of elements in all cycles except the loop cycle is undefined. This
|
||||||
* leads to slightly increased seek time for deriving some adjacency relations, however the
|
* leads to slightly increased seek time for deriving some adjacency relations, however the
|
||||||
* advantage is that no intrinsic properties of the data structures are dependant upon the
|
* advantage is that no intrinsic properties of the data structures are dependant upon the
|
||||||
* cycle order and all non-manifold conditions are represented trivially.
|
* cycle order and all non-manifold conditions are represented trivially.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -716,7 +716,7 @@ int bmesh_cycle_validate(int len, void *h)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BMEdge *bmesh_disk_nextedge(BMEdge *e, BMVert *v)
|
BMEdge *bmesh_disk_nextedge(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
if (bmesh_vert_in_edge(e, v)) {
|
if (bmesh_vert_in_edge(e, v)) {
|
||||||
if (e->v1 == v) {
|
if (e->v1 == v) {
|
||||||
return e->d1.next->data;
|
return e->d1.next->data;
|
||||||
@@ -758,7 +758,7 @@ BMNode *bmesh_disk_getpointer(BMEdge *e, BMVert *v)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int bmesh_disk_append_edge(BMEdge *e, BMVert *v)
|
int bmesh_disk_append_edge(BMEdge *e, BMVert *v)
|
||||||
{
|
{
|
||||||
|
|
||||||
BMNode *base, *tail;
|
BMNode *base, *tail;
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ void bmesh_disk_remove_edge(BMEdge *e, BMVert *v)
|
|||||||
/**
|
/**
|
||||||
* bmesh_disk_next_edgeflag
|
* bmesh_disk_next_edgeflag
|
||||||
*
|
*
|
||||||
* Searches the disk cycle of v, starting with e, for the
|
* Searches the disk cycle of v, starting with e, for the
|
||||||
* next edge that has either eflag or tflag.
|
* next edge that has either eflag or tflag.
|
||||||
*
|
*
|
||||||
* bmesh_Edge pointer.
|
* bmesh_Edge pointer.
|
||||||
@@ -854,7 +854,7 @@ BMEdge *bmesh_disk_next_edgeflag(BMEdge *e, BMVert *v, int eflag, int tflag)
|
|||||||
/**
|
/**
|
||||||
* bmesh_disk_count_edgeflag
|
* bmesh_disk_count_edgeflag
|
||||||
*
|
*
|
||||||
* Counts number of edges in this verts disk cycle which have
|
* Counts number of edges in this verts disk cycle which have
|
||||||
* either eflag or tflag (but not both!)
|
* either eflag or tflag (but not both!)
|
||||||
*
|
*
|
||||||
* Returns -
|
* Returns -
|
||||||
|
|||||||
@@ -47,20 +47,20 @@
|
|||||||
|
|
||||||
/* - joeedh -
|
/* - joeedh -
|
||||||
* design notes:
|
* design notes:
|
||||||
*
|
*
|
||||||
* original desing: walkers directly emulation recursive functions.
|
* original desing: walkers directly emulation recursive functions.
|
||||||
* functions save their state onto a worklist, and also add new states
|
* functions save their state onto a worklist, and also add new states
|
||||||
* to implement recursive or looping behaviour. generally only one
|
* to implement recursive or looping behaviour. generally only one
|
||||||
* state push per call with a specific state is desired.
|
* state push per call with a specific state is desired.
|
||||||
*
|
*
|
||||||
* basic design pattern: the walker step function goes through it's
|
* basic design pattern: the walker step function goes through it's
|
||||||
* list of possible choices for recursion, and recurses (by pushing a new state)
|
* list of possible choices for recursion, and recurses (by pushing a new state)
|
||||||
* using the first non-visited one. this choise is the flagged as visited using
|
* using the first non-visited one. this choise is the flagged as visited using
|
||||||
* the ghash. each step may push multiple new states onto the worklist at once.
|
* the ghash. each step may push multiple new states onto the worklist at once.
|
||||||
*
|
*
|
||||||
* - walkers use tool flags, not header flags
|
* - walkers use tool flags, not header flags
|
||||||
* - walkers now use ghash for storing visited elements,
|
* - walkers now use ghash for storing visited elements,
|
||||||
* rather then stealing flags. ghash can be rewritten
|
* rather then stealing flags. ghash can be rewritten
|
||||||
* to be faster if necassary, in the far future :) .
|
* to be faster if necassary, in the far future :) .
|
||||||
* - tools should ALWAYS have necassary error handling
|
* - tools should ALWAYS have necassary error handling
|
||||||
* for if walkers fail.
|
* for if walkers fail.
|
||||||
@@ -75,8 +75,8 @@ void *BMW_Begin(BMWalker *walker, void *start)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* BMW_CREATE
|
* BMW_CREATE
|
||||||
*
|
*
|
||||||
* Allocates and returns a new mesh walker of
|
* Allocates and returns a new mesh walker of
|
||||||
* a given type. The elements visited are filtered
|
* a given type. The elements visited are filtered
|
||||||
* by the bitmask 'searchmask'.
|
* by the bitmask 'searchmask'.
|
||||||
*/
|
*/
|
||||||
@@ -253,7 +253,7 @@ void *BMW_addstate(BMWalker *walker)
|
|||||||
default:
|
default:
|
||||||
BLI_assert(0);
|
BLI_assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return newstate;
|
return newstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,13 +45,13 @@
|
|||||||
|
|
||||||
/* Shell Walker:
|
/* Shell Walker:
|
||||||
*
|
*
|
||||||
* Starts at a vertex on the mesh and walks over the 'shell' it belongs
|
* Starts at a vertex on the mesh and walks over the 'shell' it belongs
|
||||||
* to via visiting connected edges.
|
* to via visiting connected edges.
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
* Add restriction flag/callback for wire edges.
|
* Add restriction flag/callback for wire edges.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e)
|
static void shellWalker_visitEdge(BMWalker *walker, BMEdge *e)
|
||||||
@@ -150,7 +150,7 @@ static void *shellWalker_step(BMWalker *walker)
|
|||||||
/* find the next edge whose other vertex has not been visite */
|
/* find the next edge whose other vertex has not been visite */
|
||||||
curedge = shellWalk.curedge;
|
curedge = shellWalk.curedge;
|
||||||
do {
|
do {
|
||||||
if (!BLI_ghash_haskey(walker->visithash, curedge)) {
|
if (!BLI_ghash_haskey(walker->visithash, curedge)) {
|
||||||
if (!walker->restrictflag || (walker->restrictflag &&
|
if (!walker->restrictflag || (walker->restrictflag &&
|
||||||
BMO_TestFlag(walker->bm, curedge, walker->restrictflag)))
|
BMO_TestFlag(walker->bm, curedge, walker->restrictflag)))
|
||||||
{
|
{
|
||||||
@@ -178,7 +178,7 @@ static void *shellWalker_step(BMWalker *walker)
|
|||||||
/* Connected Vertex Walker:
|
/* Connected Vertex Walker:
|
||||||
*
|
*
|
||||||
* Similar to shell walker, but visits vertices instead of edges.
|
* Similar to shell walker, but visits vertices instead of edges.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void connectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v)
|
static void connectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v)
|
||||||
@@ -240,7 +240,7 @@ static void *connectedVertexWalker_step(BMWalker *walker)
|
|||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
* Add restriction flag/callback for wire edges.
|
* Add restriction flag/callback for wire edges.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void islandboundWalker_begin(BMWalker *walker, void *data)
|
static void islandboundWalker_begin(BMWalker *walker, void *data)
|
||||||
@@ -323,7 +323,7 @@ static void *islandboundWalker_step(BMWalker *walker)
|
|||||||
//if (!BMO_TestFlag(walker->bm, l->f, walker->restrictflag))
|
//if (!BMO_TestFlag(walker->bm, l->f, walker->restrictflag))
|
||||||
// iwalk->curloop = l->radial_next;
|
// iwalk->curloop = l->radial_next;
|
||||||
iwalk->curloop = l; //else iwalk->curloop = l;
|
iwalk->curloop = l; //else iwalk->curloop = l;
|
||||||
iwalk->lastv = v;
|
iwalk->lastv = v;
|
||||||
|
|
||||||
return owalk.curloop;
|
return owalk.curloop;
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ static void *islandboundWalker_step(BMWalker *walker)
|
|||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
* Add restriction flag/callback for wire edges.
|
* Add restriction flag/callback for wire edges.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void islandWalker_begin(BMWalker *walker, void *data)
|
static void islandWalker_begin(BMWalker *walker, void *data)
|
||||||
@@ -532,7 +532,7 @@ static void *loopWalker_step(BMWalker *walker)
|
|||||||
* Starts at a tool-flagged face and walks over the face loop
|
* Starts at a tool-flagged face and walks over the face loop
|
||||||
* Conditions for starting and stepping the face loop have been
|
* Conditions for starting and stepping the face loop have been
|
||||||
* tuned in an attempt to match the face loops built by EditMesh
|
* tuned in an attempt to match the face loops built by EditMesh
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Check whether the face loop should includes the face specified
|
/* Check whether the face loop should includes the face specified
|
||||||
@@ -664,7 +664,7 @@ static void *faceloopWalker_step(BMWalker *walker)
|
|||||||
* Starts at a tool-flagged edge and walks over the edge ring
|
* Starts at a tool-flagged edge and walks over the edge ring
|
||||||
* Conditions for starting and stepping the edge ring have been
|
* Conditions for starting and stepping the edge ring have been
|
||||||
* tuned in an attempt to match the edge rings built by EditMesh
|
* tuned in an attempt to match the edge rings built by EditMesh
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void edgeringWalker_begin(BMWalker *walker, void *data)
|
static void edgeringWalker_begin(BMWalker *walker, void *data)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static void calc_corner_co(BMesh *bm, BMLoop *l, const float fac, float r_co[3],
|
|||||||
|
|
||||||
cross_v3_v3v3(no, l_vec_prev, l_vec_next);
|
cross_v3_v3v3(no, l_vec_prev, l_vec_next);
|
||||||
if (dot_v3v3(no, no) == 0.0f) {
|
if (dot_v3v3(no, no) == 0.0f) {
|
||||||
no[0] = no[1] = 0.0f; no[2] = -1.0f;
|
no[0] = no[1] = 0.0f; no[2] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_concave = dot_v3v3(no, up) < 0.0f;
|
is_concave = dot_v3v3(no, up) < 0.0f;
|
||||||
@@ -299,7 +299,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
|||||||
if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
|
if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
|
||||||
BLI_array_growone(etags);
|
BLI_array_growone(etags);
|
||||||
BM_SetIndex(l2->e, BLI_array_count(etags) - 1); /* set_dirty! */
|
BM_SetIndex(l2->e, BLI_array_count(etags) - 1); /* set_dirty! */
|
||||||
BLI_smallhash_insert(&hash, (intptr_t)l2->e, NULL);
|
BLI_smallhash_insert(&hash, (intptr_t)l2->e, NULL);
|
||||||
BMO_SetFlag(bm, l2->e, EDGE_OLD);
|
BMO_SetFlag(bm, l2->e, EDGE_OLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
else if (BMO_TestFlag(bm, l->v, BEVEL_FLAG)) {
|
else if (BMO_TestFlag(bm, l->v, BEVEL_FLAG)) {
|
||||||
tag = tags + BM_GetIndex(l);
|
tag = tags + BM_GetIndex(l);
|
||||||
tag->newv = ETAG_GET(l->e, l->v);
|
tag->newv = ETAG_GET(l->e, l->v);
|
||||||
|
|
||||||
if (!tag->newv) {
|
if (!tag->newv) {
|
||||||
sub_v3_v3v3(co, l->next->v->co, l->v->co);
|
sub_v3_v3v3(co, l->next->v->co, l->v->co);
|
||||||
@@ -400,7 +400,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
|||||||
tag->newv = BM_Make_Vert(bm, co, l->v);
|
tag->newv = BM_Make_Vert(bm, co, l->v);
|
||||||
|
|
||||||
ETAG_SET(l->e, l->v, tag->newv);
|
ETAG_SET(l->e, l->v, tag->newv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tag = tags + BM_GetIndex(l);
|
tag = tags + BM_GetIndex(l);
|
||||||
@@ -453,8 +453,9 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
e = BM_Make_Edge(bm, firstv, lastv, BM_FACE_FIRST_LOOP(faces[i])->e, 1);
|
e = BM_Make_Edge(bm, firstv, lastv, BM_FACE_FIRST_LOOP(faces[i])->e, 1);
|
||||||
if (BM_FACE_FIRST_LOOP(faces[i])->prev->e != e)
|
if (BM_FACE_FIRST_LOOP(faces[i])->prev->e != e) {
|
||||||
BM_Copy_Attributes(bm, bm, BM_FACE_FIRST_LOOP(faces[i])->prev->e, e);
|
BM_Copy_Attributes(bm, bm, BM_FACE_FIRST_LOOP(faces[i])->prev->e, e);
|
||||||
|
}
|
||||||
BLI_array_append(edges, e);
|
BLI_array_append(edges, e);
|
||||||
|
|
||||||
f = BM_Make_Ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), 0);
|
f = BM_Make_Ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), 0);
|
||||||
@@ -588,7 +589,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
|||||||
else {
|
else {
|
||||||
f = NULL;
|
f = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill in holes at vertices */
|
/* fill in holes at vertices */
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *tar
|
|||||||
target_vertex = BM_Make_Vert(target_mesh, source_vertex->co, NULL);
|
target_vertex = BM_Make_Vert(target_mesh, source_vertex->co, NULL);
|
||||||
|
|
||||||
/* Insert new vertex into the vert has */
|
/* Insert new vertex into the vert has */
|
||||||
BLI_ghash_insert(vhash, source_vertex, target_vertex);
|
BLI_ghash_insert(vhash, source_vertex, target_vertex);
|
||||||
|
|
||||||
/* Copy attribute */
|
/* Copy attribute */
|
||||||
BM_Copy_Attributes(source_mesh, target_mesh, source_vertex, target_vertex);
|
BM_Copy_Attributes(source_mesh, target_mesh, source_vertex, target_vertex);
|
||||||
@@ -106,7 +106,7 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Insert new edge into the edge hash */
|
/* Insert new edge into the edge hash */
|
||||||
BLI_ghash_insert(ehash, source_edge, target_edge);
|
BLI_ghash_insert(ehash, source_edge, target_edge);
|
||||||
|
|
||||||
/* Copy attributes */
|
/* Copy attributes */
|
||||||
BM_Copy_Attributes(source_mesh, target_mesh, source_edge, target_edge);
|
BM_Copy_Attributes(source_mesh, target_mesh, source_edge, target_edge);
|
||||||
@@ -124,7 +124,7 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
|
static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
|
||||||
BMFace *source_face, BMesh *target_mesh,
|
BMFace *source_face, BMesh *target_mesh,
|
||||||
BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash)
|
BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash)
|
||||||
{
|
{
|
||||||
/* BMVert *target_vert1, *target_vert2; */ /* UNUSED */
|
/* BMVert *target_vert1, *target_vert2; */ /* UNUSED */
|
||||||
@@ -226,9 +226,10 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iso)
|
if (iso) {
|
||||||
BMO_Insert_MapPointer(source, op, "isovertmap", v, v2);
|
BMO_Insert_MapPointer(source, op, "isovertmap", v, v2);
|
||||||
|
}
|
||||||
|
|
||||||
BMO_SetFlag(source, (BMHeader *)v, DUPE_DONE);
|
BMO_SetFlag(source, (BMHeader *)v, DUPE_DONE);
|
||||||
}
|
}
|
||||||
@@ -247,7 +248,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
|
|||||||
BMO_SetFlag(source, (BMHeader *)e->v2, DUPE_DONE);
|
BMO_SetFlag(source, (BMHeader *)e->v2, DUPE_DONE);
|
||||||
}
|
}
|
||||||
/* now copy the actual edg */
|
/* now copy the actual edg */
|
||||||
copy_edge(op, source, e, target, vhash, ehash);
|
copy_edge(op, source, e, target, vhash, ehash);
|
||||||
BMO_SetFlag(source, (BMHeader *)e, DUPE_DONE);
|
BMO_SetFlag(source, (BMHeader *)e, DUPE_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,7 +286,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
|
|||||||
|
|
||||||
/* free pointer hashe */
|
/* free pointer hashe */
|
||||||
BLI_ghash_free(vhash, NULL, NULL);
|
BLI_ghash_free(vhash, NULL, NULL);
|
||||||
BLI_ghash_free(ehash, NULL, NULL);
|
BLI_ghash_free(ehash, NULL, NULL);
|
||||||
|
|
||||||
BLI_array_free(vtar); /* free vert pointer array */
|
BLI_array_free(vtar); /* free vert pointer array */
|
||||||
BLI_array_free(edar); /* free edge pointer array */
|
BLI_array_free(edar); /* free edge pointer array */
|
||||||
@@ -303,7 +304,7 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
|
|||||||
* BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be duplicated
|
* BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be duplicated
|
||||||
*
|
*
|
||||||
* OUTPUT SLOTS:
|
* OUTPUT SLOTS:
|
||||||
*
|
*
|
||||||
* BMOP_DUPE_VORIGINAL: Buffer containing pointers to the original mesh vertices
|
* BMOP_DUPE_VORIGINAL: Buffer containing pointers to the original mesh vertices
|
||||||
* BMOP_DUPE_EORIGINAL: Buffer containing pointers to the original mesh edges
|
* BMOP_DUPE_EORIGINAL: Buffer containing pointers to the original mesh edges
|
||||||
* BMOP_DUPE_FORIGINAL: Buffer containing pointers to the original mesh faces
|
* BMOP_DUPE_FORIGINAL: Buffer containing pointers to the original mesh faces
|
||||||
@@ -362,7 +363,7 @@ void BMOP_DupeFromFlag(BMesh *bm, int etypeflag, const char hflag)
|
|||||||
* BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be split
|
* BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be split
|
||||||
*
|
*
|
||||||
* OUTPUT SLOTS:
|
* OUTPUT SLOTS:
|
||||||
*
|
*
|
||||||
* BMOP_DUPE_VOUTPUT: Buffer containing pointers to the split mesh vertices
|
* BMOP_DUPE_VOUTPUT: Buffer containing pointers to the split mesh vertices
|
||||||
* BMOP_DUPE_EOUTPUT: Buffer containing pointers to the split mesh edges
|
* BMOP_DUPE_EOUTPUT: Buffer containing pointers to the split mesh edges
|
||||||
* BMOP_DUPE_FOUTPUT: Buffer containing pointers to the split mesh faces
|
* BMOP_DUPE_FOUTPUT: Buffer containing pointers to the split mesh faces
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void connectverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
BLI_array_free(verts);
|
BLI_array_free(verts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BMVert *get_outer_vert(BMesh *bm, BMEdge *e)
|
static BMVert *get_outer_vert(BMesh *bm, BMEdge *e)
|
||||||
{
|
{
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
BMEdge *e2;
|
BMEdge *e2;
|
||||||
@@ -241,7 +241,7 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
|||||||
e2 = e3;
|
e2 = e3;
|
||||||
} while (e3 && e2 != e);
|
} while (e3 && e2 != e);
|
||||||
|
|
||||||
if (v && !e3) {
|
if (v && !e3) {
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
if (BLI_array_count(vv1) && v == vv1[BLI_array_count(vv1) - 1]) {
|
if (BLI_array_count(vv1) && v == vv1[BLI_array_count(vv1) - 1]) {
|
||||||
printf("%s: internal state waning *TODO DESCRIPTION!*\n", __func__);
|
printf("%s: internal state waning *TODO DESCRIPTION!*\n", __func__);
|
||||||
@@ -399,12 +399,12 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
|||||||
SWAP(int, i2, i2next);
|
SWAP(int, i2, i2next);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = BM_Make_Face_QuadTri(bm,
|
f = BM_Make_Face_QuadTri(bm,
|
||||||
vv1[i1],
|
vv1[i1],
|
||||||
vv2[i2],
|
vv2[i2],
|
||||||
vv2[i2next],
|
vv2[i2next],
|
||||||
vv1[i1next],
|
vv1[i1next],
|
||||||
NULL, 1);
|
NULL, 1);
|
||||||
if (!f || f->len != 4) {
|
if (!f || f->len != 4) {
|
||||||
fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
|
fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ static void UNUSED_FUNCTION(rotsys_remove_edge)(struct BMEdge *e, struct BMVert
|
|||||||
e1->next = e1->prev = NULL;
|
e1->next = e1->prev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v,
|
static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v,
|
||||||
EdgeData *edata, VertData *UNUSED(vdata))
|
EdgeData *edata, VertData *UNUSED(vdata))
|
||||||
{
|
{
|
||||||
if (v == e->v1)
|
if (v == e->v1)
|
||||||
return edata[BM_GetIndex(e)].dlink1.next;
|
return edata[BM_GetIndex(e)].dlink1.next;
|
||||||
@@ -159,8 +159,8 @@ static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BMEdge *rotsys_prevedge(BMEdge *e, BMVert *v,
|
static BMEdge *rotsys_prevedge(BMEdge *e, BMVert *v,
|
||||||
EdgeData *edata, VertData *UNUSED(vdata))
|
EdgeData *edata, VertData *UNUSED(vdata))
|
||||||
{
|
{
|
||||||
if (v == e->v1)
|
if (v == e->v1)
|
||||||
return edata[BM_GetIndex(e)].dlink1.prev;
|
return edata[BM_GetIndex(e)].dlink1.prev;
|
||||||
@@ -545,7 +545,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
|||||||
SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge])
|
SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge])
|
||||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge])
|
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,8 +726,8 @@ static void edge_free_path(PathBase *pathbase, EPath *path)
|
|||||||
BLI_mempool_free(pathbase->pathpool, path);
|
BLI_mempool_free(pathbase->pathpool, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, EdgeData *edata,
|
static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, EdgeData *edata,
|
||||||
VertData *vdata, PathBase *pathbase, int group)
|
VertData *vdata, PathBase *pathbase, int group)
|
||||||
{
|
{
|
||||||
BMEdge *e;
|
BMEdge *e;
|
||||||
GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path");
|
GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path");
|
||||||
@@ -781,7 +781,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
v2 = NULL;
|
v2 = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!last->cure) {
|
if (!last->cure) {
|
||||||
last->cure = e = vdata[BM_GetIndex(last->v)].e;
|
last->cure = e = vdata[BM_GetIndex(last->v)].e;
|
||||||
}
|
}
|
||||||
@@ -931,7 +931,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
|||||||
if (use_restrict) {
|
if (use_restrict) {
|
||||||
int i = 0, j = 0, gi = 0;
|
int i = 0, j = 0, gi = 0;
|
||||||
|
|
||||||
group = BMO_Get_MapInt(bm, op, "restrict", e);
|
group = BMO_Get_MapInt(bm, op, "restrict", e);
|
||||||
|
|
||||||
for (i = 0; i < 30; i++) {
|
for (i = 0; i < 30; i++) {
|
||||||
if (group & (1 << i)) {
|
if (group & (1 << i)) {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op)
|
|||||||
f2 = BMW_Begin(®walker, f);
|
f2 = BMW_Begin(®walker, f);
|
||||||
for ( ; f2; f2 = BMW_Step(®walker)) {
|
for ( ; f2; f2 = BMW_Step(®walker)) {
|
||||||
BLI_array_append(faces, f2);
|
BLI_array_append(faces, f2);
|
||||||
}
|
}
|
||||||
BMW_End(®walker);
|
BMW_End(®walker);
|
||||||
|
|
||||||
for (i = 0; i < BLI_array_count(faces); i++) {
|
for (i = 0; i < BLI_array_count(faces); i++) {
|
||||||
@@ -124,7 +124,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
faces = regions[i];
|
faces = regions[i];
|
||||||
if (!faces[0]) {
|
if (!faces[0]) {
|
||||||
BMO_RaiseError(bm, op, BMERR_DISSOLVEFACES_FAILED,
|
BMO_RaiseError(bm, op, BMERR_DISSOLVEFACES_FAILED,
|
||||||
"Could not find boundary of dissolve region");
|
"Could not find boundary of dissolve region");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
f = BM_Join_Faces(bm, faces, tot);
|
f = BM_Join_Faces(bm, faces, tot);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
BMO_RaiseError(bm, op, BMERR_DISSOLVEFACES_FAILED,
|
BMO_RaiseError(bm, op, BMERR_DISSOLVEFACES_FAILED,
|
||||||
"Could not create merged face");
|
"Could not create merged face");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
//check for duplicate edges
|
//check for duplicate edges
|
||||||
l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
|
l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
|
||||||
for ( ; l; l = BMIter_Step(&liter)) {
|
for ( ; l; l = BMIter_Step(&liter)) {
|
||||||
ed[i] = l->e;
|
ed[i] = l->e;
|
||||||
lp[i] = l;
|
lp[i] = l;
|
||||||
vt[i++] = l->v;
|
vt[i++] = l->v;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ static void tag_out_edges(BMesh *bm, EdgeTag *etags, BMOperator *UNUSED(op))
|
|||||||
int i, ok;
|
int i, ok;
|
||||||
|
|
||||||
ok = 0;
|
ok = 0;
|
||||||
while (ok++ < 100000) {
|
while (ok++ < 100000) {
|
||||||
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
|
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
|
||||||
if (!BMO_TestFlag(bm, e, EDGE_SEAM))
|
if (!BMO_TestFlag(bm, e, EDGE_SEAM))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delorig) {
|
if (delorig) {
|
||||||
BMO_InitOpf(bm, &delop, "del geom=%fvef context=%d",
|
BMO_InitOpf(bm, &delop, "del geom=%fvef context=%d",
|
||||||
EXT_DEL, DEL_ONLYTAGGED);
|
EXT_DEL, DEL_ONLYTAGGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ static void calc_solidify_normals(BMesh *bm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
copy_v3_v3(v->no, f->no);
|
copy_v3_v3(v->no, f->no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
#include "DNA_customdata_types.h"
|
#include "DNA_customdata_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
/*
|
/*
|
||||||
* JOIN_TRIANGLES.C
|
* JOIN_TRIANGLES.C
|
||||||
*
|
*
|
||||||
* utility bmesh operators, e.g. transform,
|
* utility bmesh operators, e.g. transform,
|
||||||
* translate, rotate, scale, etc.
|
* translate, rotate, scale, etc.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -252,7 +252,7 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
/* flag all edges of all input face */
|
/* flag all edges of all input face */
|
||||||
BMO_ITER(f1, &siter, bm, op, "faces", BM_FACE) {
|
BMO_ITER(f1, &siter, bm, op, "faces", BM_FACE) {
|
||||||
BMO_SetFlag(bm, f1, FACE_INPUT);
|
BMO_SetFlag(bm, f1, FACE_INPUT);
|
||||||
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f1) {
|
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f1) {
|
||||||
BMO_SetFlag(bm, l->e, EDGE_MARK);
|
BMO_SetFlag(bm, l->e, EDGE_MARK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "BKE_mesh.h"
|
#include "BKE_mesh.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
#include "BKE_DerivedMesh.h"
|
#include "BKE_DerivedMesh.h"
|
||||||
@@ -139,8 +139,8 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
|
|||||||
keyco = actkey->data;
|
keyco = actkey->data;
|
||||||
bm->shapenr = ob->shapenr;
|
bm->shapenr = ob->shapenr;
|
||||||
for (i = 0, block = me->key->block.first; block; block = block->next, i++) {
|
for (i = 0, block = me->key->block.first; block; block = block->next, i++) {
|
||||||
CustomData_add_layer_named(&bm->vdata, CD_SHAPEKEY,
|
CustomData_add_layer_named(&bm->vdata, CD_SHAPEKEY,
|
||||||
CD_ASSIGN, NULL, 0, block->name);
|
CD_ASSIGN, NULL, 0, block->name);
|
||||||
|
|
||||||
j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
|
j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
|
||||||
bm->vdata.layers[j].uid = block->uid;
|
bm->vdata.layers[j].uid = block->uid;
|
||||||
@@ -182,8 +182,8 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (block = me->key->block.first, j = 0; block; block = block->next, j++) {
|
for (block = me->key->block.first, j = 0; block; block = block->next, j++) {
|
||||||
float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data,
|
float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, j);
|
||||||
CD_SHAPEKEY, j);
|
|
||||||
if (co) {
|
if (co) {
|
||||||
copy_v3_v3(co, ((float *)block->data) + 3 * i);
|
copy_v3_v3(co, ((float *)block->data) + 3 * i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "BKE_mesh.h"
|
#include "BKE_mesh.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
#include "BKE_DerivedMesh.h"
|
#include "BKE_DerivedMesh.h"
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
|
|||||||
#define FACE_MARK 2
|
#define FACE_MARK 2
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
|
int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
|
||||||
int len, BMFace *exclude,
|
int len, BMFace *exclude,
|
||||||
BMFace **overlapface)
|
BMFace **overlapface)
|
||||||
{
|
{
|
||||||
BMIter vertfaces;
|
BMIter vertfaces;
|
||||||
BMFace *f;
|
BMFace *f;
|
||||||
@@ -144,10 +144,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
|
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
|
||||||
BM_SetIndex(f, 0); /* set_dirty! */
|
BM_SetIndex(f, 0); /* set_dirty! */
|
||||||
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
||||||
if (BMO_TestFlag(bm, l->v, ELE_DEL))
|
if (BMO_TestFlag(bm, l->v, ELE_DEL)) {
|
||||||
BMO_SetFlag(bm, f, FACE_MARK|ELE_DEL);
|
BMO_SetFlag(bm, f, FACE_MARK|ELE_DEL);
|
||||||
if (BMO_TestFlag(bm, l->e, EDGE_COL))
|
}
|
||||||
|
if (BMO_TestFlag(bm, l->e, EDGE_COL)) {
|
||||||
BM_SetIndex(f, BM_GetIndex(f) + 1); /* set_dirty! */
|
BM_SetIndex(f, BM_GetIndex(f) + 1); /* set_dirty! */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bm->elem_index_dirty |= BM_FACE;
|
bm->elem_index_dirty |= BM_FACE;
|
||||||
@@ -167,10 +169,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
|
||||||
v = l->v;
|
v = l->v;
|
||||||
v2 = ((BMLoop *)l->next)->v;
|
v2 = ((BMLoop *)l->next)->v;
|
||||||
if (BMO_TestFlag(bm, v, ELE_DEL))
|
if (BMO_TestFlag(bm, v, ELE_DEL)) {
|
||||||
v = BMO_Get_MapPointer(bm, op, "targetmap", v);
|
v = BMO_Get_MapPointer(bm, op, "targetmap", v);
|
||||||
if (BMO_TestFlag(bm, v2, ELE_DEL))
|
}
|
||||||
|
if (BMO_TestFlag(bm, v2, ELE_DEL)) {
|
||||||
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
|
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
|
||||||
|
}
|
||||||
|
|
||||||
e2 = v != v2 ? BM_Edge_Exist(v, v2) : NULL;
|
e2 = v != v2 ? BM_Edge_Exist(v, v2) : NULL;
|
||||||
if (e2) {
|
if (e2) {
|
||||||
@@ -198,10 +202,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
|
|||||||
v = loops[0]->v;
|
v = loops[0]->v;
|
||||||
v2 = loops[1]->v;
|
v2 = loops[1]->v;
|
||||||
|
|
||||||
if (BMO_TestFlag(bm, v, ELE_DEL))
|
if (BMO_TestFlag(bm, v, ELE_DEL)) {
|
||||||
v = BMO_Get_MapPointer(bm, op, "targetmap", v);
|
v = BMO_Get_MapPointer(bm, op, "targetmap", v);
|
||||||
if (BMO_TestFlag(bm, v2, ELE_DEL))
|
}
|
||||||
|
if (BMO_TestFlag(bm, v2, ELE_DEL)) {
|
||||||
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
|
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
|
||||||
|
}
|
||||||
|
|
||||||
f2 = BM_Make_Ngon(bm, v, v2, edges, a, 1);
|
f2 = BM_Make_Ngon(bm, v, v2, edges, a, 1);
|
||||||
if (f2 && (f2 != f)) {
|
if (f2 && (f2 != f)) {
|
||||||
@@ -252,7 +258,7 @@ void bmesh_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
|
|||||||
float fac;
|
float fac;
|
||||||
int i, tot;
|
int i, tot;
|
||||||
|
|
||||||
snapv = BMO_IterNew(&siter, bm, op, "snapv", BM_VERT);
|
snapv = BMO_IterNew(&siter, bm, op, "snapv", BM_VERT);
|
||||||
tot = BM_Vert_FaceCount(snapv);
|
tot = BM_Vert_FaceCount(snapv);
|
||||||
|
|
||||||
if (!tot)
|
if (!tot)
|
||||||
@@ -269,7 +275,7 @@ void bmesh_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
|
|||||||
int type = bm->ldata.layers[i].type;
|
int type = bm->ldata.layers[i].type;
|
||||||
void *e1, *e2;
|
void *e1, *e2;
|
||||||
|
|
||||||
e1 = CustomData_bmesh_get_layer_n(&bm->ldata, firstl->head.data, i);
|
e1 = CustomData_bmesh_get_layer_n(&bm->ldata, firstl->head.data, i);
|
||||||
e2 = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
e2 = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
||||||
|
|
||||||
CustomData_data_multiply(type, e2, fac);
|
CustomData_data_multiply(type, e2, fac);
|
||||||
@@ -282,8 +288,9 @@ void bmesh_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) {
|
BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) {
|
||||||
BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) {
|
BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) {
|
||||||
if (l == firstl)
|
if (l == firstl) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, firstl->head.data, &l->head.data);
|
CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, firstl->head.data, &l->head.data);
|
||||||
}
|
}
|
||||||
@@ -310,7 +317,7 @@ void bmesh_vert_average_facedata_exec(BMesh *bm, BMOperator *op)
|
|||||||
BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) {
|
BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) {
|
||||||
BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) {
|
BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) {
|
||||||
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
|
||||||
CustomData_data_dominmax(type, block, &min, &max);
|
CustomData_data_dominmax(type, block, &min, &max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +353,7 @@ void bmesh_pointmerge_exec(BMesh *bm, BMOperator *op)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BMO_Insert_MapPointer(bm, &weldop, "targetmap", v, snapv);
|
BMO_Insert_MapPointer(bm, &weldop, "targetmap", v, snapv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BMO_Exec_Op(bm, &weldop);
|
BMO_Exec_Op(bm, &weldop);
|
||||||
@@ -397,7 +404,7 @@ void bmesh_collapse_exec(BMesh *bm, BMOperator *op)
|
|||||||
copy_v3_v3(edges[i]->v2->co, min);
|
copy_v3_v3(edges[i]->v2->co, min);
|
||||||
|
|
||||||
if (edges[i]->v1 != edges[0]->v1)
|
if (edges[i]->v1 != edges[0]->v1)
|
||||||
BMO_Insert_MapPointer(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);
|
BMO_Insert_MapPointer(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);
|
||||||
if (edges[i]->v2 != edges[0]->v1)
|
if (edges[i]->v2 != edges[0]->v1)
|
||||||
BMO_Insert_MapPointer(bm, &weldop, "targetmap", edges[i]->v2, edges[0]->v1);
|
BMO_Insert_MapPointer(bm, &weldop, "targetmap", edges[i]->v2, edges[0]->v1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ static BMVert *bm_subdivide_edge_addvert(BMesh *bm, BMEdge *edge, BMEdge *oedge,
|
|||||||
co[2] = 0.0f;
|
co[2] = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
@@ -288,8 +288,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
|
|||||||
float percent, percent2 = 0.0f;
|
float percent, percent2 = 0.0f;
|
||||||
|
|
||||||
if (BMO_TestFlag(bm, edge, EDGE_PERCENT) && totpoint == 1)
|
if (BMO_TestFlag(bm, edge, EDGE_PERCENT) && totpoint == 1)
|
||||||
percent = BMO_Get_MapFloat(bm, params->op,
|
percent = BMO_Get_MapFloat(bm, params->op, "edgepercents", edge);
|
||||||
"edgepercents", edge);
|
|
||||||
else {
|
else {
|
||||||
percent = 1.0f / (float)(totpoint + 1-curpoint);
|
percent = 1.0f / (float)(totpoint + 1-curpoint);
|
||||||
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
|
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
|
||||||
@@ -312,8 +311,7 @@ static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const subdparams *par
|
|||||||
temp.v2 = &ov2;
|
temp.v2 = &ov2;
|
||||||
|
|
||||||
for (i = 0; i < numcuts; i++) {
|
for (i = 0; i < numcuts; i++) {
|
||||||
v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params,
|
v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params, &newe, vsta, vend);
|
||||||
&newe, vsta, vend);
|
|
||||||
|
|
||||||
BMO_SetFlag(bm, v, SUBD_SPLIT);
|
BMO_SetFlag(bm, v, SUBD_SPLIT);
|
||||||
BMO_SetFlag(bm, eed, SUBD_SPLIT);
|
BMO_SetFlag(bm, eed, SUBD_SPLIT);
|
||||||
@@ -388,7 +386,7 @@ static SubDPattern quad_1edge = {
|
|||||||
* | s s |
|
* | s s |
|
||||||
* v7-v0--v1-v2
|
* v7-v0--v1-v2
|
||||||
*/
|
*/
|
||||||
static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
||||||
const subdparams *params)
|
const subdparams *params)
|
||||||
{
|
{
|
||||||
BMFace *nf;
|
BMFace *nf;
|
||||||
@@ -414,7 +412,7 @@ static SubDPattern quad_2edge_path = {
|
|||||||
* | s s |
|
* | s s |
|
||||||
* v7-v0--v1-v2
|
* v7-v0--v1-v2
|
||||||
*/
|
*/
|
||||||
static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
||||||
const subdparams *params)
|
const subdparams *params)
|
||||||
{
|
{
|
||||||
BMFace *nf;
|
BMFace *nf;
|
||||||
@@ -520,7 +518,7 @@ static SubDPattern quad_3edge = {
|
|||||||
* first line | | last line
|
* first line | | last line
|
||||||
* |v10s s s|v3
|
* |v10s s s|v3
|
||||||
* v11-v0--v1-v2
|
* v11-v0--v1-v2
|
||||||
*
|
*
|
||||||
* it goes from bottom up
|
* it goes from bottom up
|
||||||
*/
|
*/
|
||||||
static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
|
||||||
@@ -1037,7 +1035,9 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
|
|||||||
|
|
||||||
j = a = 0;
|
j = a = 0;
|
||||||
for (nl = BMIter_New(&liter, bmesh, BM_LOOPS_OF_FACE, face);
|
for (nl = BMIter_New(&liter, bmesh, BM_LOOPS_OF_FACE, face);
|
||||||
nl; nl = BMIter_Step(&liter)) {
|
nl;
|
||||||
|
nl = BMIter_Step(&liter))
|
||||||
|
{
|
||||||
if (nl->v == facedata[i].start) {
|
if (nl->v == facedata[i].start) {
|
||||||
a = j + 1;
|
a = j + 1;
|
||||||
break;
|
break;
|
||||||
@@ -1085,9 +1085,9 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
|
|||||||
|
|
||||||
/* editmesh-emulating functio */
|
/* editmesh-emulating functio */
|
||||||
void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth,
|
void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth,
|
||||||
float fractal, int beauty, int numcuts,
|
float fractal, int beauty, int numcuts,
|
||||||
int seltype, int cornertype, int singleedge,
|
int seltype, int cornertype, int singleedge,
|
||||||
int gridfill, int seed)
|
int gridfill, int seed)
|
||||||
{
|
{
|
||||||
BMOperator op;
|
BMOperator op;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ typedef struct subdparams {
|
|||||||
float off[3];
|
float off[3];
|
||||||
} subdparams;
|
} subdparams;
|
||||||
|
|
||||||
typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
|
typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
|
||||||
const subdparams *params);
|
const subdparams *params);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -65,12 +65,10 @@ void triangulate_exec(BMesh *bm, BMOperator *op)
|
|||||||
BLI_array_growone(newfaces);
|
BLI_array_growone(newfaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BM_Triangulate_Face(bm, face, projectverts, EDGE_NEW,
|
|
||||||
FACE_NEW, newfaces);
|
|
||||||
|
|
||||||
BMO_Insert_MapPointer(bm, op, "facemap",
|
BM_Triangulate_Face(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces);
|
||||||
face, face);
|
|
||||||
|
BMO_Insert_MapPointer(bm, op, "facemap", face, face);
|
||||||
for (i = 0; newfaces[i]; i++) {
|
for (i = 0; newfaces[i]; i++) {
|
||||||
BMO_Insert_MapPointer(bm, op, "facemap",
|
BMO_Insert_MapPointer(bm, op, "facemap",
|
||||||
newfaces[i], face);
|
newfaces[i], face);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
#include "DNA_customdata_types.h"
|
#include "DNA_customdata_types.h"
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
/*
|
/*
|
||||||
* UTILS.C
|
* UTILS.C
|
||||||
*
|
*
|
||||||
* utility bmesh operators, e.g. transform,
|
* utility bmesh operators, e.g. transform,
|
||||||
* translate, rotate, scale, etc.
|
* translate, rotate, scale, etc.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -63,7 +63,7 @@ void bmesh_makevert_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
BMO_Get_Vec(op, "co", vec);
|
BMO_Get_Vec(op, "co", vec);
|
||||||
|
|
||||||
BMO_SetFlag(bm, BM_Make_Vert(bm, vec, NULL), 1);
|
BMO_SetFlag(bm, BM_Make_Vert(bm, vec, NULL), 1);
|
||||||
BMO_Flag_To_Slot(bm, op, "newvertout", 1, BM_VERT);
|
BMO_Flag_To_Slot(bm, op, "newvertout", 1, BM_VERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1256,8 +1256,9 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
|
|||||||
|
|
||||||
h = BLI_heap_new();
|
h = BLI_heap_new();
|
||||||
|
|
||||||
for (i = 0; i < num_total; i++ )
|
for (i = 0; i < num_total; i++) {
|
||||||
vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
|
vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
|
||||||
|
}
|
||||||
|
|
||||||
while (!BLI_heap_empty(h)) {
|
while (!BLI_heap_empty(h)) {
|
||||||
BMEdge *e;
|
BMEdge *e;
|
||||||
@@ -1280,7 +1281,7 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
|
|||||||
e_weight += len_v3v3(e->v1->co, e->v2->co);
|
e_weight += len_v3v3(e->v1->co, e->v2->co);
|
||||||
else e_weight += 1.0f;
|
else e_weight += 1.0f;
|
||||||
|
|
||||||
u = ( e->v1 == v ) ? e->v2 : e->v1;
|
u = (e->v1 == v) ? e->v2 : e->v1;
|
||||||
|
|
||||||
if (e_weight < vert_list[BM_GetIndex(u)].weight) { /* is this path shorter ? */
|
if (e_weight < vert_list[BM_GetIndex(u)].weight) { /* is this path shorter ? */
|
||||||
/* add it if so */
|
/* add it if so */
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v,
|
|||||||
|
|
||||||
if (BMO_TestFlag(bm, v, BME_BEVEL_NONMAN)) return;
|
if (BMO_TestFlag(bm, v, BME_BEVEL_NONMAN)) return;
|
||||||
BMO_SetFlag(bm, v, BME_BEVEL_BEVEL);
|
BMO_SetFlag(bm, v, BME_BEVEL_BEVEL);
|
||||||
if ( (vtd = BME_get_transdata(td, v)) ) {
|
if ((vtd = BME_get_transdata(td, v))) {
|
||||||
if (options & BME_BEVEL_EMIN) {
|
if (options & BME_BEVEL_EMIN) {
|
||||||
vtd->factor = 1.0;
|
vtd->factor = 1.0;
|
||||||
if (vtd->weight < 0 || weight < vtd->weight) {
|
if (vtd->weight < 0 || weight < vtd->weight) {
|
||||||
|
|||||||
Reference in New Issue
Block a user