Style Cleanup
This commit is contained in:
@@ -334,21 +334,25 @@ int BMO_Vert_CountEdgeFlags(BMesh *bm, BMVert *v, const short oflag);
|
||||
/* inserts a key/value mapping into a mapping slot. note that it copies the
|
||||
* value, it doesn't store a reference to it. */
|
||||
|
||||
//BM_INLINE void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, const char *slotname,
|
||||
//void *element, void *data, int len);
|
||||
#if 0
|
||||
|
||||
BM_INLINE void BMO_Insert_Mapping(BMesh *bm, BMOperator *op, const char *slotname,
|
||||
void *element, void *data, int len);
|
||||
|
||||
/* inserts a key/float mapping pair into a mapping slot. */
|
||||
//BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
||||
//void *element, float val);
|
||||
BM_INLINE void BMO_Insert_MapFloat(BMesh *bm, BMOperator *op, const char *slotname,
|
||||
void *element, float val);
|
||||
|
||||
//returns 1 if the specified pointer is in the map.
|
||||
//BM_INLINE int BMO_InMap(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
/* returns 1 if the specified pointer is in the map. */
|
||||
BM_INLINE int BMO_InMap(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
|
||||
/* returns a point to the value of a specific key. */
|
||||
//BM_INLINE void *BMO_Get_MapData(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
BM_INLINE void *BMO_Get_MapData(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
|
||||
/* returns the float part of a key/float pair. */
|
||||
//BM_INLINE float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
BM_INLINE float BMO_Get_MapFloat(BMesh *bm, BMOperator *op, const char *slotname, void *element);
|
||||
|
||||
#endif
|
||||
|
||||
/* flags all elements in a mapping. note that the mapping must only have
|
||||
* bmesh elements in it.*/
|
||||
@@ -360,10 +364,10 @@ void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
|
||||
* do NOT use these for non-operator-api-allocated memory! instead
|
||||
* 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,
|
||||
//void *key, void *val);
|
||||
//BM_INLINE void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, const char *slotname,
|
||||
//void *key);
|
||||
#if 0
|
||||
BM_INLINE void BMO_Insert_MapPointer(BMesh *bm, BMOperator *op, const char *slotname, void *key, void *val);
|
||||
BM_INLINE void *BMO_Get_MapPointer(BMesh *bm, BMOperator *op, const char *slotname, void *key);
|
||||
#endif
|
||||
|
||||
/* this part of the API is used to iterate over element buffer or
|
||||
* mapping slots.
|
||||
|
||||
@@ -929,8 +929,8 @@ static BMOpDefine def_create_icosphere = {
|
||||
"create_icosphere",
|
||||
{{BMOP_OPSLOT_ELEMENT_BUF, "vertout"}, //output verts
|
||||
{BMOP_OPSLOT_INT, "subdivisions"}, //how many times to recursively subdivide the sphere
|
||||
{BMOP_OPSLOT_FLT, "diameter"}, //diameter
|
||||
{BMOP_OPSLOT_MAT, "mat"}, //matrix to multiply the new geometry with
|
||||
{BMOP_OPSLOT_FLT, "diameter"}, //diameter
|
||||
{BMOP_OPSLOT_MAT, "mat"}, //matrix to multiply the new geometry with
|
||||
{0, /* null-terminating sentine */}},
|
||||
bmesh_create_icosphere_exec,
|
||||
0,
|
||||
|
||||
@@ -236,7 +236,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
if (BMO_TestFlag(bm, l->f, BEVEL_FLAG))
|
||||
continue;
|
||||
|
||||
|
||||
BM_ITER(l2, &liter2, bm, BM_LOOPS_OF_FACE, l->f) {
|
||||
BM_SetIndex(l2, BLI_array_count(tags)); /* set_loop */
|
||||
BLI_array_growone(tags);
|
||||
@@ -302,7 +302,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_SetFlag(bm, l2->e, EDGE_OLD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BLI_smallhash_insert(&hash, (intptr_t)l->f, NULL);
|
||||
BMO_SetFlag(bm, l->f, BEVEL_FLAG);
|
||||
BLI_array_append(faces, l->f);
|
||||
@@ -369,10 +369,10 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
normalize_v3(co);
|
||||
mul_v3_fl(co, elen);
|
||||
}
|
||||
|
||||
|
||||
mul_v3_fl(co, fac);
|
||||
add_v3_v3(co, l->v->co);
|
||||
|
||||
|
||||
tag->newv = BM_Make_Vert(bm, co, l->v);
|
||||
|
||||
ETAG_SET(l->prev->e, l->v, tag->newv);
|
||||
@@ -382,7 +382,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
else if (BMO_TestFlag(bm, l->v, BEVEL_FLAG)) {
|
||||
tag = tags + BM_GetIndex(l);
|
||||
tag->newv = ETAG_GET(l->e, l->v);
|
||||
|
||||
|
||||
if (!tag->newv) {
|
||||
sub_v3_v3v3(co, l->next->v->co, l->v->co);
|
||||
if (has_elens) {
|
||||
@@ -394,7 +394,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
mul_v3_fl(co, fac);
|
||||
add_v3_v3(co, l->v->co);
|
||||
|
||||
|
||||
tag = tags + BM_GetIndex(l);
|
||||
tag->newv = BM_Make_Vert(bm, co, l->v);
|
||||
|
||||
@@ -462,7 +462,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
printf("%s: could not make face!\n", __func__);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
BMO_SetFlag(bm, f, FACE_NEW);
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
|
||||
int rad, insorig = 0, err = 0;
|
||||
|
||||
BLI_smallhash_init(&tmphash);
|
||||
|
||||
|
||||
if (!BMO_TestFlag(bm, v, BEVEL_FLAG))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *tar
|
||||
*
|
||||
*/
|
||||
static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
|
||||
BMEdge *source_edge, BMesh *target_mesh,
|
||||
GHash *vhash, GHash *ehash)
|
||||
BMEdge *source_edge, BMesh *target_mesh,
|
||||
GHash *vhash, GHash *ehash)
|
||||
{
|
||||
BMEdge *target_edge = NULL;
|
||||
BMVert *target_vert1, *target_vert2;
|
||||
@@ -84,7 +84,9 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
|
||||
* add it to the new/old map. */
|
||||
rlen = 0;
|
||||
for (face = BMIter_New(&fiter, source_mesh, BM_FACES_OF_EDGE, source_edge);
|
||||
face; face = BMIter_Step(&fiter)) {
|
||||
face;
|
||||
face = BMIter_Step(&fiter))
|
||||
{
|
||||
if (BMO_TestFlag(source_mesh, face, DUPE_INPUT)) {
|
||||
rlen++;
|
||||
}
|
||||
@@ -321,7 +323,7 @@ void dupeop_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
if (!bm2)
|
||||
bm2 = bm;
|
||||
|
||||
|
||||
/* flag inpu */
|
||||
BMO_Flag_Buffer(bm, dupeop, "geom", DUPE_INPUT, BM_ALL);
|
||||
|
||||
@@ -458,7 +460,7 @@ void delop_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
void spinop_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
BMOperator dupop, extop;
|
||||
BMOperator dupop, extop;
|
||||
float cent[3], dvec[3];
|
||||
float axis[3] = {0.0f, 0.0f, 1.0f};
|
||||
float q[4];
|
||||
@@ -488,16 +490,16 @@ void spinop_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_InitOpf(bm, &dupop, "dupe geom=%s", op, "lastout");
|
||||
BMO_Exec_Op(bm, &dupop);
|
||||
BMO_CallOpf(bm, "rotate cent=%v mat=%m3 verts=%s",
|
||||
cent, rmat, &dupop, "newout");
|
||||
cent, rmat, &dupop, "newout");
|
||||
BMO_CopySlot(&dupop, op, "newout", "lastout");
|
||||
BMO_Finish_Op(bm, &dupop);
|
||||
}
|
||||
else {
|
||||
BMO_InitOpf(bm, &extop, "extrudefaceregion edgefacein=%s",
|
||||
op, "lastout");
|
||||
op, "lastout");
|
||||
BMO_Exec_Op(bm, &extop);
|
||||
BMO_CallOpf(bm, "rotate cent=%v mat=%m3 verts=%s",
|
||||
cent, rmat, &extop, "geomout");
|
||||
cent, rmat, &extop, "geomout");
|
||||
BMO_CopySlot(&extop, op, "geomout", "lastout");
|
||||
BMO_Finish_Op(bm, &extop);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void connectverts_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BLI_array_growone(verts);
|
||||
verts[BLI_array_count(verts) - 1] = loops[i * 2]->v;
|
||||
|
||||
|
||||
BLI_array_growone(verts);
|
||||
verts[BLI_array_count(verts) - 1] = loops[i * 2 + 1]->v;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
if (!e2)
|
||||
e2 = e;
|
||||
|
||||
|
||||
e = e2;
|
||||
ov = v;
|
||||
do {
|
||||
@@ -317,7 +317,7 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
* for v3 than v4, the loops are in opposite directions, so reverse
|
||||
* the order of reads from vv1. We can avoid sqrt for comparison */
|
||||
if (len_squared_v3v3(v1->co, v3->co) > len_squared_v3v3(v1->co, v4->co) &&
|
||||
len_squared_v3v3(v2->co, v4->co) > len_squared_v3v3(v2->co, v3->co))
|
||||
len_squared_v3v3(v2->co, v4->co) > len_squared_v3v3(v2->co, v3->co))
|
||||
{
|
||||
dir1 = -1;
|
||||
starti = clamp_index(-1, lenv1);
|
||||
@@ -389,7 +389,7 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
|
||||
i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
|
||||
i2 = i;
|
||||
i2next = clamp_index(i + 1, lenv2);
|
||||
|
||||
|
||||
if (vv1[i1] == vv1[i1next]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ static int count_edge_faces(BMesh *bm, BMEdge *e);
|
||||
|
||||
|
||||
static int rotsys_append_edge(struct BMEdge *e, struct BMVert *v,
|
||||
EdgeData *edata, VertData *vdata)
|
||||
EdgeData *edata, VertData *vdata)
|
||||
{
|
||||
EdgeData *ed = &edata[BM_GetIndex(e)];
|
||||
VertData *vd = &vdata[BM_GetIndex(v)];
|
||||
@@ -255,10 +255,10 @@ static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertDa
|
||||
ok = 1;
|
||||
if (!v || !e2)
|
||||
continue;
|
||||
|
||||
|
||||
do {
|
||||
if (BLI_smallhash_haskey(hash, (intptr_t)e2) ||
|
||||
BLI_smallhash_haskey(hash, (intptr_t)v))
|
||||
BLI_smallhash_haskey(hash, (intptr_t)v))
|
||||
{
|
||||
ok = 0;
|
||||
break;
|
||||
@@ -268,7 +268,7 @@ static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertDa
|
||||
BLI_array_append(edges, e2);
|
||||
|
||||
BLI_smallhash_insert(hash, (intptr_t)e2, NULL);
|
||||
|
||||
|
||||
v = BM_OtherEdgeVert(e2, v);
|
||||
e2 = i ? rotsys_prevedge(e2, v, edata, vdata) : rotsys_nextedge(e2, v, edata, vdata);
|
||||
} while (e2 != starte && v != startv);
|
||||
@@ -368,7 +368,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
/* BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE); */ /* UNUSE */
|
||||
int i;
|
||||
|
||||
#define SIGN(n) ((n)<0.0f)
|
||||
#define SIGN(n) ((n)<0.0f)
|
||||
|
||||
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
|
||||
BMIter eiter;
|
||||
@@ -517,7 +517,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
vd1 = vdata + BM_GetIndex(v1);
|
||||
vd2 = vdata + BM_GetIndex(v2);
|
||||
vd3 = vdata + BM_GetIndex(v3);
|
||||
|
||||
|
||||
sub_v3_v3v3(vec1, vd1->sco, cent);
|
||||
sub_v3_v3v3(vec2, vd2->sco, cent);
|
||||
sub_v3_v3v3(vec3, vd3->sco, cent);
|
||||
@@ -531,7 +531,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
|
||||
s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
|
||||
s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
|
||||
|
||||
|
||||
normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
|
||||
|
||||
if (s1 || s2 || s3) {
|
||||
@@ -542,8 +542,8 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
|
||||
}
|
||||
else {
|
||||
SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge])
|
||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge])
|
||||
SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge]);
|
||||
SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -598,7 +598,7 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
|
||||
|
||||
if (!e)
|
||||
break;
|
||||
|
||||
|
||||
if (!BM_OtherEdgeVert(e, v))
|
||||
continue;
|
||||
|
||||
@@ -795,7 +795,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
|
||||
if (e == edge || !BMO_TestFlag(bm, e, EDGE_MARK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
v2 = BM_OtherEdgeVert(e, last->v);
|
||||
|
||||
if (BLI_ghash_haskey(gh, v2)) {
|
||||
@@ -839,7 +839,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
|
||||
edge_free_path(pathbase, path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
|
||||
BLI_array_free(verts);
|
||||
BLI_heap_free(heap, NULL);
|
||||
BLI_ghash_free(gh, NULL, NULL);
|
||||
@@ -923,11 +923,11 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
||||
/* if restrict is on, only start on faces in the restrict map */
|
||||
if (use_restrict && !BMO_InMap(bm, op, "restrict", e))
|
||||
continue;
|
||||
|
||||
|
||||
if (edata[BM_GetIndex(e)].tag < 2) {
|
||||
edge = e;
|
||||
|
||||
if (use_restrict) {
|
||||
if (use_restrict) {
|
||||
int i = 0, j = 0, gi = 0;
|
||||
|
||||
group = BMO_Get_MapInt(bm, op, "restrict", e);
|
||||
|
||||
@@ -380,11 +380,11 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
BMO_CallOpf(bm, "dissolvefaces faces=%ff", FACE_MARK);
|
||||
if (BMO_HasError(bm)) {
|
||||
const char *msg;
|
||||
const char *msg;
|
||||
|
||||
BMO_GetError(bm, &msg, NULL);
|
||||
BMO_ClearStack(bm);
|
||||
BMO_RaiseError(bm, op, BMERR_DISSOLVEVERTS_FAILED, msg);
|
||||
BMO_GetError(bm, &msg, NULL);
|
||||
BMO_ClearStack(bm);
|
||||
BMO_RaiseError(bm, op, BMERR_DISSOLVEVERTS_FAILED, msg);
|
||||
}
|
||||
|
||||
/* clean up any remainin */
|
||||
|
||||
@@ -152,7 +152,7 @@ void bmesh_extrude_onlyedge_exec(BMesh *bm, BMOperator *op)
|
||||
v3 = e->v2;
|
||||
v4 = e->v1;
|
||||
}
|
||||
/* not sure what to do about example face, pass NULL for now */
|
||||
/* not sure what to do about example face, pass NULL for now */
|
||||
f = BM_Make_Face_QuadTri(bm, v1, v2, v3, v4, NULL, FALSE);
|
||||
|
||||
if (BMO_TestFlag(bm, e, EXT_INPUT))
|
||||
@@ -221,7 +221,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!found && (rlen > 1)) BMO_SetFlag(bm, e, EXT_DEL);
|
||||
}
|
||||
}
|
||||
@@ -573,7 +573,7 @@ void bmesh_solidify_face_region_exec(BMesh *bm, BMOperator *op)
|
||||
BMOperator extrudeop;
|
||||
BMOperator reverseop;
|
||||
float thickness;
|
||||
|
||||
|
||||
thickness = BMO_Get_Float(op, "thickness");
|
||||
|
||||
/* Flip original faces (so the shell is extruded inward) */
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
/* assumes edges are validated before reaching this poin */
|
||||
static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
|
||||
BMVert *v3, BMVert *v4, float limit)
|
||||
BMVert *v3, BMVert *v4, float limit)
|
||||
{
|
||||
/* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would mak */
|
||||
/* Note: this is more complicated than it needs to be and should be cleaned up.. */
|
||||
@@ -97,12 +97,14 @@ static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
|
||||
sub_v3_v3v3(edgeVec4, v4->co, v1->co);
|
||||
|
||||
/* a completely skinny face is 'pi' after halving */
|
||||
diff = 0.25f * (
|
||||
fabsf(angle_v3v3(edgeVec1, edgeVec2) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec2, edgeVec3) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec3, edgeVec4) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec4, edgeVec1) - (float)M_PI_2));
|
||||
if (!diff) return 0.0;
|
||||
diff = 0.25f * (fabsf(angle_v3v3(edgeVec1, edgeVec2) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec2, edgeVec3) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec3, edgeVec4) - (float)M_PI_2) +
|
||||
fabsf(angle_v3v3(edgeVec4, edgeVec1) - (float)M_PI_2));
|
||||
|
||||
if (!diff) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
measure += diff;
|
||||
if (measure > limit) {
|
||||
@@ -196,10 +198,10 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (luv1->uv[0] + T2QUV_LIMIT > luv3->uv[0] && luv1->uv[0] - T2QUV_LIMIT < luv3->uv[0] &&
|
||||
luv1->uv[1] + T2QUV_LIMIT > luv3->uv[1] && luv1->uv[1] - T2QUV_LIMIT < luv3->uv[1])
|
||||
luv1->uv[1] + T2QUV_LIMIT > luv3->uv[1] && luv1->uv[1] - T2QUV_LIMIT < luv3->uv[1])
|
||||
{
|
||||
if (luv2->uv[0] + T2QUV_LIMIT > luv4->uv[0] && luv2->uv[0] - T2QUV_LIMIT < luv4->uv[0] &&
|
||||
luv2->uv[1] + T2QUV_LIMIT > luv4->uv[1] && luv2->uv[1] - T2QUV_LIMIT < luv4->uv[1])
|
||||
luv2->uv[1] + T2QUV_LIMIT > luv4->uv[1] && luv2->uv[1] - T2QUV_LIMIT < luv4->uv[1])
|
||||
{
|
||||
mergeok_uvs = 1;
|
||||
}
|
||||
@@ -314,7 +316,7 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
jedges[i].e = e;
|
||||
jedges[i].weight = measure;
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,26 +320,29 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
|
||||
BMEdge *edge;
|
||||
BMFace *face;
|
||||
BMVert **vertex_array = MEM_callocN(sizeof(BMVert *) * bm->totvert,
|
||||
"Selection Conversion Vertex Pointer Array");
|
||||
"Selection Conversion Vertex Pointer Array");
|
||||
BMEdge **edge_array = MEM_callocN(sizeof(BMEdge *) * bm->totedge,
|
||||
"Selection Conversion Edge Pointer Array");
|
||||
"Selection Conversion Edge Pointer Array");
|
||||
BMFace **face_array = MEM_callocN(sizeof(BMFace *) * bm->totface,
|
||||
"Selection Conversion Face Pointer Array");
|
||||
"Selection Conversion Face Pointer Array");
|
||||
|
||||
for (i = 0, vertex = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
|
||||
vertex; i++, vertex = BMIter_Step(&iter))
|
||||
vertex;
|
||||
i++, vertex = BMIter_Step(&iter))
|
||||
{
|
||||
vertex_array[i] = vertex;
|
||||
}
|
||||
|
||||
for (i = 0, edge = BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL);
|
||||
edge; i++, edge = BMIter_Step(&iter))
|
||||
edge;
|
||||
i++, edge = BMIter_Step(&iter))
|
||||
{
|
||||
edge_array[i] = edge;
|
||||
}
|
||||
|
||||
for (i = 0, face = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
|
||||
face; i++, face = BMIter_Step(&iter))
|
||||
face;
|
||||
i++, face = BMIter_Step(&iter))
|
||||
{
|
||||
face_array[i] = face;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
/* ************************ primitives ******************* */
|
||||
|
||||
static float icovert[12][3] = {
|
||||
{0.0f,0.0f,-200.0f},
|
||||
{0.0f,0.0f,-200.0f},
|
||||
{144.72f, -105.144f,-89.443f},
|
||||
{-55.277f, -170.128,-89.443f},
|
||||
{-55.277f, -170.128,-89.443f},
|
||||
{-178.885f,0.0f,-89.443f},
|
||||
{-55.277f,170.128f,-89.443f},
|
||||
{-55.277f,170.128f,-89.443f},
|
||||
{144.72f,105.144f,-89.443f},
|
||||
{55.277f,-170.128f,89.443f},
|
||||
{-144.72f,-105.144f,89.443f},
|
||||
@@ -86,146 +86,146 @@ static short icoface[20][3] = {
|
||||
|
||||
// HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
|
||||
// this hack is only used so that scons & mingw + split-sources hack works
|
||||
// ------------------------------- start copied code
|
||||
// ------------------------------- start copied code
|
||||
/* these are not the monkeys you are looking for */
|
||||
static int monkeyo = 4;
|
||||
static int monkeynv = 271;
|
||||
static int monkeynf = 250;
|
||||
static signed char monkeyv[271][3] = {
|
||||
{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
|
||||
{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
|
||||
{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
|
||||
{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
|
||||
{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
|
||||
{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
|
||||
{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
|
||||
{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
|
||||
{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
|
||||
{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
|
||||
{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
|
||||
{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
|
||||
{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
|
||||
{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
|
||||
{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
|
||||
{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
|
||||
{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
|
||||
{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
|
||||
{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
|
||||
{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
|
||||
{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
|
||||
{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
|
||||
{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
|
||||
{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
|
||||
{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
|
||||
{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
|
||||
{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
|
||||
{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
|
||||
{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
|
||||
{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
|
||||
{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
|
||||
{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
|
||||
{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
|
||||
{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
|
||||
{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
|
||||
{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
|
||||
{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
|
||||
{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
|
||||
{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
|
||||
{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
|
||||
{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
|
||||
{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
|
||||
{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
|
||||
{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
|
||||
{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
|
||||
{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
|
||||
{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
|
||||
{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
|
||||
{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
|
||||
{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
|
||||
{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
|
||||
{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
|
||||
{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
|
||||
{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
|
||||
{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
|
||||
{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
|
||||
{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
|
||||
{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
|
||||
{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
|
||||
{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
|
||||
{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
|
||||
{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
|
||||
{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
|
||||
{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
|
||||
{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
|
||||
{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
|
||||
{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
|
||||
{-26,-16,-42},{-17,49,-49},
|
||||
{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
|
||||
{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
|
||||
{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
|
||||
{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
|
||||
{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
|
||||
{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
|
||||
{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
|
||||
{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
|
||||
{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
|
||||
{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
|
||||
{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
|
||||
{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
|
||||
{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
|
||||
{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
|
||||
{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
|
||||
{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
|
||||
{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
|
||||
{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
|
||||
{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
|
||||
{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
|
||||
{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
|
||||
{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
|
||||
{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
|
||||
{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
|
||||
{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
|
||||
{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
|
||||
{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
|
||||
{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
|
||||
{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
|
||||
{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
|
||||
{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
|
||||
{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
|
||||
{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
|
||||
{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
|
||||
{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
|
||||
{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
|
||||
{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
|
||||
{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
|
||||
{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
|
||||
{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
|
||||
{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
|
||||
{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
|
||||
{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
|
||||
{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
|
||||
{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
|
||||
{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
|
||||
{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
|
||||
{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
|
||||
{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
|
||||
{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
|
||||
{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
|
||||
{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
|
||||
{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
|
||||
{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
|
||||
{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
|
||||
{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
|
||||
{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
|
||||
{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
|
||||
{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
|
||||
{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
|
||||
{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
|
||||
{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
|
||||
{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
|
||||
{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
|
||||
{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
|
||||
{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
|
||||
{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
|
||||
{-26,-16,-42},{-17,49,-49},
|
||||
};
|
||||
|
||||
static signed char monkeyf[250][4] = {
|
||||
{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4},
|
||||
{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6},
|
||||
{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8},
|
||||
{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12},
|
||||
{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12},
|
||||
{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4},
|
||||
{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4},
|
||||
{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23},
|
||||
{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15},
|
||||
{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
|
||||
{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
|
||||
{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44},
|
||||
{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19},
|
||||
{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38},
|
||||
{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39},
|
||||
{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42},
|
||||
{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16},
|
||||
{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32},
|
||||
{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35},
|
||||
{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21},
|
||||
{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11},
|
||||
{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38},
|
||||
{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39},
|
||||
{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34},
|
||||
{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34},
|
||||
{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36},
|
||||
{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27},
|
||||
{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42},
|
||||
{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34},
|
||||
{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26},
|
||||
{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35},
|
||||
{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35},
|
||||
{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58},
|
||||
{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52},
|
||||
{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49},
|
||||
{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24},
|
||||
{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100},
|
||||
{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24},
|
||||
{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110},
|
||||
{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48},
|
||||
{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43},
|
||||
{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6},
|
||||
{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30},
|
||||
{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5},
|
||||
{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13},
|
||||
{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30},
|
||||
{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31},
|
||||
{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35},
|
||||
{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27},
|
||||
{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23},
|
||||
{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35},
|
||||
{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4},
|
||||
{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35},
|
||||
{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33},
|
||||
{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35},
|
||||
{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36},
|
||||
{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39},
|
||||
{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17},
|
||||
{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19},
|
||||
{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30},
|
||||
{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30},
|
||||
{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66},
|
||||
{-68,-67,24,-33},
|
||||
{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4},
|
||||
{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6},
|
||||
{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8},
|
||||
{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12},
|
||||
{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12},
|
||||
{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4},
|
||||
{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4},
|
||||
{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23},
|
||||
{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15},
|
||||
{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
|
||||
{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
|
||||
{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44},
|
||||
{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19},
|
||||
{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38},
|
||||
{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39},
|
||||
{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42},
|
||||
{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16},
|
||||
{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32},
|
||||
{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35},
|
||||
{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21},
|
||||
{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11},
|
||||
{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38},
|
||||
{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39},
|
||||
{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34},
|
||||
{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34},
|
||||
{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36},
|
||||
{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27},
|
||||
{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42},
|
||||
{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34},
|
||||
{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26},
|
||||
{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35},
|
||||
{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35},
|
||||
{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58},
|
||||
{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52},
|
||||
{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49},
|
||||
{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24},
|
||||
{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100},
|
||||
{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24},
|
||||
{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110},
|
||||
{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48},
|
||||
{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43},
|
||||
{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6},
|
||||
{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30},
|
||||
{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5},
|
||||
{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13},
|
||||
{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30},
|
||||
{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31},
|
||||
{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35},
|
||||
{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27},
|
||||
{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23},
|
||||
{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35},
|
||||
{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4},
|
||||
{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35},
|
||||
{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33},
|
||||
{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35},
|
||||
{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36},
|
||||
{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39},
|
||||
{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17},
|
||||
{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19},
|
||||
{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30},
|
||||
{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30},
|
||||
{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66},
|
||||
{-68,-67,24,-33},
|
||||
};
|
||||
|
||||
#define VERT_MARK 1
|
||||
|
||||
@@ -540,7 +540,7 @@ void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, c
|
||||
|
||||
BMO_SetFlag(bm, v2, VERT_DOUBLE);
|
||||
BMO_SetFlag(bm, v, VERT_TARGET);
|
||||
|
||||
|
||||
BMO_Insert_MapPointer(bm, optarget, targetmapname, v2, v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,61 +71,6 @@
|
||||
* split the edge only?
|
||||
*/
|
||||
|
||||
#if 0 //misc. code, maps a parametric coordinate to a fractal line
|
||||
float lastrnd[3], vec2[3] = {0.0f, 0.0f, 0.0f};
|
||||
int seed = BLI_rand();
|
||||
int d, i, j, dp, lvl, wid;
|
||||
float df;
|
||||
|
||||
BLI_srandom(seed);
|
||||
|
||||
wid = (params->numcuts + 2);
|
||||
dp = perc * wid;
|
||||
wid /= 2;
|
||||
d = lvl = 0;
|
||||
while (1) {
|
||||
if (d > dp) {
|
||||
d -= wid;
|
||||
}
|
||||
else if (d < dp) {
|
||||
d += wid;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
wid = MAX2((wid / 2), 1);
|
||||
lvl++;
|
||||
}
|
||||
|
||||
zero_v3(vec1);
|
||||
df = 1.0f;
|
||||
for (i = 0; i < lvl; i++, df /= 4.0f) {
|
||||
int tot = (1 << i);
|
||||
|
||||
lastrnd[0] = BLI_drand() - 0.5f;
|
||||
lastrnd[1] = BLI_drand() - 0.5f;
|
||||
lastrnd[2] = BLI_drand() - 0.5f;
|
||||
for (j = 0; j < tot; j++) {
|
||||
float a, b, rnd[3], rnd2[3];
|
||||
|
||||
rnd[0] = BLI_drand() - 0.5f;
|
||||
rnd[1] = BLI_drand() - 0.5f;
|
||||
rnd[2] = BLI_drand() - 0.5f;
|
||||
|
||||
a = (float)j * (float)((float)params->numcuts / (float)tot);
|
||||
b = (float)(j + 1) * (float)((float)params->numcuts / (float)tot);
|
||||
if (d >= a && d <= b) {
|
||||
interp_v3_v3v3(rnd2, lastrnd, rnd, (((float)d) - a) / (b - a));
|
||||
mul_v3_fl(rnd2, df);
|
||||
add_v3_v3(vec1, rnd2);
|
||||
}
|
||||
|
||||
copy_v3_v3(lastrnd, rnd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* connects face with smallest len, which I think should always be correct for
|
||||
* edge subdivision */
|
||||
static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_nf)
|
||||
@@ -276,7 +221,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
|
||||
{
|
||||
BMVert *ev;
|
||||
float percent, percent2 = 0.0f;
|
||||
|
||||
|
||||
if (BMO_TestFlag(bm, edge, EDGE_PERCENT) && totpoint == 1)
|
||||
percent = BMO_Get_MapFloat(bm, params->op, "edgepercents", edge);
|
||||
else {
|
||||
@@ -555,7 +500,7 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
|
||||
temp = *e;
|
||||
for (a = 0; a < numcuts; a++) {
|
||||
v = subdivideedgenum(bm, e, &temp, a, numcuts, params, &ne,
|
||||
v1, v2);
|
||||
v1, v2);
|
||||
if (!v)
|
||||
bmesh_error();
|
||||
|
||||
@@ -823,7 +768,9 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
|
||||
EDGE_PERCENT);
|
||||
|
||||
for (face = BMIter_New(&fiter, bmesh, BM_FACES_OF_MESH, NULL);
|
||||
face; face = BMIter_Step(&fiter)) {
|
||||
face;
|
||||
face = BMIter_Step(&fiter))
|
||||
{
|
||||
BMEdge *e1 = NULL, *e2 = NULL;
|
||||
float vec1[3], vec2[3];
|
||||
|
||||
@@ -973,7 +920,7 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
|
||||
|
||||
/* find the boundary of one of the split edge */
|
||||
for (a = 1; a < vlen; a++) {
|
||||
if ( !BMO_TestFlag(bmesh, loops[a - 1]->v, ELE_INNER) &&
|
||||
if (!BMO_TestFlag(bmesh, loops[a - 1]->v, ELE_INNER) &&
|
||||
BMO_TestFlag(bmesh, loops[a]->v, ELE_INNER))
|
||||
{
|
||||
break;
|
||||
@@ -987,7 +934,7 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
|
||||
/* find the boundary of the other edge. */
|
||||
for (j = 0; j < vlen; j++) {
|
||||
b = (j + a + numcuts + 1) % vlen;
|
||||
if ( !BMO_TestFlag(bmesh, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) &&
|
||||
if (!BMO_TestFlag(bmesh, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) &&
|
||||
BMO_TestFlag(bmesh, loops[b]->v, ELE_INNER))
|
||||
{
|
||||
break;
|
||||
@@ -1116,7 +1063,7 @@ void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth
|
||||
BMIter eiter;
|
||||
|
||||
BM_ITER(e, &eiter, bm, BM_EDGES_OF_VERT, ele) {
|
||||
if ( !BM_TestHFlag(e, BM_SELECT) &&
|
||||
if (!BM_TestHFlag(e, BM_SELECT) &&
|
||||
BM_TestHFlag(e->v1, BM_SELECT) &&
|
||||
BM_TestHFlag(e->v2, BM_SELECT))
|
||||
{
|
||||
@@ -1158,8 +1105,7 @@ void esplit_exec(BMesh *bm, BMOperator *op)
|
||||
bm_subdivide_multicut(bm, e, ¶ms, e->v1, e->v2);
|
||||
}
|
||||
|
||||
BMO_Flag_To_Slot(bm, op, "outsplit",
|
||||
ELE_SPLIT, BM_ALL);
|
||||
BMO_Flag_To_Slot(bm, op, "outsplit", ELE_SPLIT, BM_ALL);
|
||||
|
||||
BM_free_data_layer_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
|
||||
}
|
||||
|
||||
@@ -125,15 +125,15 @@ void bmesh_beautify_fill_exec(BMesh *bm, BMOperator *op)
|
||||
len4 = len_v3v3(v4->co, v1->co);
|
||||
len5 = len_v3v3(v1->co, v3->co);
|
||||
len6 = len_v3v3(v2->co, v4->co);
|
||||
|
||||
|
||||
opp1 = area_tri_v3(v1->co, v2->co, v3->co);
|
||||
opp2 = area_tri_v3(v1->co, v3->co, v4->co);
|
||||
|
||||
|
||||
fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5);
|
||||
|
||||
|
||||
opp1 = area_tri_v3(v2->co, v3->co, v4->co);
|
||||
opp2 = area_tri_v3(v2->co, v4->co, v1->co);
|
||||
|
||||
|
||||
fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
|
||||
|
||||
if (fac1 > fac2) {
|
||||
|
||||
@@ -259,7 +259,7 @@ void bmesh_regionextend_exec(BMesh *bm, BMOperator *op)
|
||||
/* NOTE: these are the original righthandfaces comment in editmesh_mods.c,
|
||||
* copied here for reference. */
|
||||
|
||||
/* based at a select-connected to witness loose objects */
|
||||
/* based at a select-connected to witness loose objects */
|
||||
|
||||
/* count per edge the amount of faces
|
||||
* find the ultimate left, front, upper face (not manhattan dist!!)
|
||||
@@ -573,34 +573,34 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
|
||||
if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE) {
|
||||
for (i = 0; i < num_total; i++) {
|
||||
switch (type) {
|
||||
case SIMFACE_PERIMETER:
|
||||
/* set the perimeter */
|
||||
f_ext[i].perim = ngon_perimeter(bm, f_ext[i].f);
|
||||
break;
|
||||
case SIMFACE_PERIMETER:
|
||||
/* set the perimeter */
|
||||
f_ext[i].perim = ngon_perimeter(bm, f_ext[i].f);
|
||||
break;
|
||||
|
||||
case SIMFACE_COPLANAR:
|
||||
/* compute the center of the polygon */
|
||||
BM_Compute_Face_CenterMean(bm, f_ext[i].f, f_ext[i].c);
|
||||
case SIMFACE_COPLANAR:
|
||||
/* compute the center of the polygon */
|
||||
BM_Compute_Face_CenterMean(bm, f_ext[i].f, f_ext[i].c);
|
||||
|
||||
/* normalize the polygon normal */
|
||||
copy_v3_v3(t_no, f_ext[i].f->no);
|
||||
normalize_v3(t_no);
|
||||
/* normalize the polygon normal */
|
||||
copy_v3_v3(t_no, f_ext[i].f->no);
|
||||
normalize_v3(t_no);
|
||||
|
||||
/* compute the plane distance */
|
||||
f_ext[i].d = dot_v3v3(t_no, f_ext[i].c);
|
||||
break;
|
||||
/* compute the plane distance */
|
||||
f_ext[i].d = dot_v3v3(t_no, f_ext[i].c);
|
||||
break;
|
||||
|
||||
case SIMFACE_AREA:
|
||||
f_ext[i].area = ngon_fake_area(bm, f_ext[i].f);
|
||||
break;
|
||||
case SIMFACE_AREA:
|
||||
f_ext[i].area = ngon_fake_area(bm, f_ext[i].f);
|
||||
break;
|
||||
|
||||
case SIMFACE_IMAGE:
|
||||
f_ext[i].t = NULL;
|
||||
if (CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY)) {
|
||||
MTexPoly *mtpoly = CustomData_bmesh_get(&bm->pdata, f_ext[i].f->head.data, CD_MTEXPOLY);
|
||||
f_ext[i].t = mtpoly->tpage;
|
||||
}
|
||||
break;
|
||||
case SIMFACE_IMAGE:
|
||||
f_ext[i].t = NULL;
|
||||
if (CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY)) {
|
||||
MTexPoly *mtpoly = CustomData_bmesh_get(&bm->pdata, f_ext[i].f->head.data, CD_MTEXPOLY);
|
||||
f_ext[i].t = mtpoly->tpage;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -613,51 +613,51 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
|
||||
for (idx = 0; idx < num_sels && cont == 1; idx++) {
|
||||
fs = f_ext[indices[idx]].f;
|
||||
switch (type) {
|
||||
case SIMFACE_MATERIAL:
|
||||
if (fm->mat_nr == fs->mat_nr) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_IMAGE:
|
||||
if (f_ext[i].t == f_ext[indices[idx]].t) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_NORMAL:
|
||||
angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* if the angle between the normals -> 0 */
|
||||
if (angle / 180.0f <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_COPLANAR:
|
||||
angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* angle -> 0 */
|
||||
if (angle / 180.0f <= thresh) { /* and dot product difference -> 0 */
|
||||
if (fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh) {
|
||||
case SIMFACE_MATERIAL:
|
||||
if (fm->mat_nr == fs->mat_nr) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SIMFACE_AREA:
|
||||
if (fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMFACE_IMAGE:
|
||||
if (f_ext[i].t == f_ext[indices[idx]].t) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_PERIMETER:
|
||||
if (fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMFACE_NORMAL:
|
||||
angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* if the angle between the normals -> 0 */
|
||||
if (angle / 180.0f <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_COPLANAR:
|
||||
angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* angle -> 0 */
|
||||
if (angle / 180.0f <= thresh) { /* and dot product difference -> 0 */
|
||||
if (fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_AREA:
|
||||
if (fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMFACE_PERIMETER:
|
||||
if (fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh) {
|
||||
BMO_SetFlag(bm, fm, FACE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -736,8 +736,8 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
/* iterate through all selected edges and mark them */
|
||||
BMO_ITER(es, &es_iter, bm, op, "edges", BM_EDGE) {
|
||||
BMO_SetFlag(bm, es, EDGE_MARK);
|
||||
num_sels++;
|
||||
BMO_SetFlag(bm, es, EDGE_MARK);
|
||||
num_sels++;
|
||||
}
|
||||
|
||||
/* allocate memory for the selected edges indices and for all temporary edges */
|
||||
@@ -758,23 +758,23 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
|
||||
if (type == SIMEDGE_LENGTH || type == SIMEDGE_FACE || type == SIMEDGE_DIR || type == SIMEDGE_FACE_ANGLE) {
|
||||
for (i = 0; i < num_total; i++) {
|
||||
switch (type) {
|
||||
case SIMEDGE_LENGTH: /* compute the length of the edge */
|
||||
e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
||||
break;
|
||||
case SIMEDGE_LENGTH: /* compute the length of the edge */
|
||||
e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
||||
break;
|
||||
|
||||
case SIMEDGE_DIR: /* compute the direction */
|
||||
sub_v3_v3v3(e_ext[i].dir, e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
||||
break;
|
||||
case SIMEDGE_DIR: /* compute the direction */
|
||||
sub_v3_v3v3(e_ext[i].dir, e_ext[i].e->v1->co, e_ext[i].e->v2->co);
|
||||
break;
|
||||
|
||||
case SIMEDGE_FACE: /* count the faces around the edge */
|
||||
e_ext[i].faces = BM_Edge_FaceCount(e_ext[i].e);
|
||||
break;
|
||||
case SIMEDGE_FACE: /* count the faces around the edge */
|
||||
e_ext[i].faces = BM_Edge_FaceCount(e_ext[i].e);
|
||||
break;
|
||||
|
||||
case SIMEDGE_FACE_ANGLE:
|
||||
e_ext[i].faces = BM_Edge_FaceCount(e_ext[i].e);
|
||||
if (e_ext[i].faces == 2)
|
||||
e_ext[i].angle = edge_angle(bm, e_ext[i].e);
|
||||
break;
|
||||
case SIMEDGE_FACE_ANGLE:
|
||||
e_ext[i].faces = BM_Edge_FaceCount(e_ext[i].e);
|
||||
if (e_ext[i].faces == 2)
|
||||
e_ext[i].angle = edge_angle(bm, e_ext[i].e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -787,74 +787,74 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
|
||||
for (idx = 0; idx < num_sels && cont == 1; idx++) {
|
||||
es = e_ext[indices[idx]].e;
|
||||
switch (type) {
|
||||
case SIMEDGE_LENGTH:
|
||||
if (fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMEDGE_LENGTH:
|
||||
if (fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMEDGE_DIR:
|
||||
/* compute the angle between the two edges */
|
||||
angle = RAD2DEGF(angle_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir));
|
||||
case SIMEDGE_DIR:
|
||||
/* compute the angle between the two edges */
|
||||
angle = RAD2DEGF(angle_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir));
|
||||
|
||||
if (angle > 90.0f) /* use the smallest angle between the edges */
|
||||
angle = fabsf(angle - 180.0f);
|
||||
if (angle > 90.0f) /* use the smallest angle between the edges */
|
||||
angle = fabsf(angle - 180.0f);
|
||||
|
||||
if (angle / 90.0f <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
if (angle / 90.0f <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMEDGE_FACE:
|
||||
if (e_ext[i].faces == e_ext[indices[idx]].faces) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMEDGE_FACE:
|
||||
if (e_ext[i].faces == e_ext[indices[idx]].faces) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMEDGE_FACE_ANGLE:
|
||||
if (e_ext[i].faces == 2) {
|
||||
if (e_ext[indices[idx]].faces == 2) {
|
||||
if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
|
||||
case SIMEDGE_FACE_ANGLE:
|
||||
if (e_ext[i].faces == 2) {
|
||||
if (e_ext[indices[idx]].faces == 2) {
|
||||
if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMEDGE_CREASE:
|
||||
if (CustomData_has_layer(&bm->edata, CD_CREASE)) {
|
||||
float *c1, *c2;
|
||||
|
||||
c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
|
||||
c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
|
||||
|
||||
if (c1 && c2 && fabsf(*c1 - *c2) <= thresh) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SIMEDGE_CREASE:
|
||||
if (CustomData_has_layer(&bm->edata, CD_CREASE)) {
|
||||
float *c1, *c2;
|
||||
|
||||
c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
|
||||
c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
|
||||
|
||||
if (c1 && c2 && fabsf(*c1 - *c2) <= thresh) {
|
||||
case SIMEDGE_SEAM:
|
||||
if (BM_TestHFlag(e, BM_SEAM) == BM_TestHFlag(es, BM_SEAM)) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case SIMEDGE_SEAM:
|
||||
if (BM_TestHFlag(e, BM_SEAM) == BM_TestHFlag(es, BM_SEAM)) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMEDGE_SHARP:
|
||||
if (BM_TestHFlag(e, BM_SHARP) == BM_TestHFlag(es, BM_SHARP)) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMEDGE_SHARP:
|
||||
if (BM_TestHFlag(e, BM_SHARP) == BM_TestHFlag(es, BM_SHARP)) {
|
||||
BMO_SetFlag(bm, e, EDGE_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -917,19 +917,19 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op)
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SIMVERT_FACE:
|
||||
/* calling BM_Vert_FaceCount every time is time consumming, so call it only once per vertex */
|
||||
v_ext[i].num_faces = BM_Vert_FaceCount(v);
|
||||
break;
|
||||
case SIMVERT_FACE:
|
||||
/* calling BM_Vert_FaceCount every time is time consumming, so call it only once per vertex */
|
||||
v_ext[i].num_faces = BM_Vert_FaceCount(v);
|
||||
break;
|
||||
|
||||
case SIMVERT_VGROUP:
|
||||
if (CustomData_has_layer(&(bm->vdata), CD_MDEFORMVERT)) {
|
||||
v_ext[i].dvert = CustomData_bmesh_get(&bm->vdata, v_ext[i].v->head.data, CD_MDEFORMVERT);
|
||||
}
|
||||
else {
|
||||
v_ext[i].dvert = NULL;
|
||||
}
|
||||
break;
|
||||
case SIMVERT_VGROUP:
|
||||
if (CustomData_has_layer(&(bm->vdata), CD_MDEFORMVERT)) {
|
||||
v_ext[i].dvert = CustomData_bmesh_get(&bm->vdata, v_ext[i].v->head.data, CD_MDEFORMVERT);
|
||||
}
|
||||
else {
|
||||
v_ext[i].dvert = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -943,35 +943,35 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op)
|
||||
for (idx = 0; idx < num_sels && cont == 1; idx++) {
|
||||
vs = v_ext[indices[idx]].v;
|
||||
switch (type) {
|
||||
case SIMVERT_NORMAL:
|
||||
/* compare the angle between the normals */
|
||||
if (RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMVERT_FACE:
|
||||
/* number of adjacent faces */
|
||||
if (v_ext[i].num_faces == v_ext[indices[idx]].num_faces) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMVERT_NORMAL:
|
||||
/* compare the angle between the normals */
|
||||
if (RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
case SIMVERT_FACE:
|
||||
/* number of adjacent faces */
|
||||
if (v_ext[i].num_faces == v_ext[indices[idx]].num_faces) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIMVERT_VGROUP:
|
||||
if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
|
||||
int v1, v2;
|
||||
for (v1 = 0; v1 < v_ext[i].dvert->totweight && cont == 1; v1++) {
|
||||
for (v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++) {
|
||||
if (v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
break;
|
||||
case SIMVERT_VGROUP:
|
||||
if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
|
||||
int v1, v2;
|
||||
for (v1 = 0; v1 < v_ext[i].dvert->totweight && cont == 1; v1++) {
|
||||
for (v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++) {
|
||||
if (v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr) {
|
||||
BMO_SetFlag(bm, v, VERT_MARK);
|
||||
cont = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1225,10 +1225,12 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
|
||||
int num_total = 0 /*, num_sels = 0 */, i = 0;
|
||||
int type = BMO_Get_Int(op, "type");
|
||||
|
||||
BMO_ITER(vs, &vs_iter, bm, op, "startv", BM_VERT)
|
||||
sv = vs;
|
||||
BMO_ITER(vs, &vs_iter, bm, op, "endv", BM_VERT)
|
||||
ev = vs;
|
||||
BMO_ITER(vs, &vs_iter, bm, op, "startv", BM_VERT) {
|
||||
sv = vs;
|
||||
}
|
||||
BMO_ITER(vs, &vs_iter, bm, op, "endv", BM_VERT) {
|
||||
ev = vs;
|
||||
}
|
||||
|
||||
num_total = BM_Count_Element(bm, BM_VERT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user