From 005b37643d2cc59f55f91fc776810d9925a526c7 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Fri, 15 Apr 2011 02:13:37 +0000 Subject: [PATCH] fixed idling problem --- intern/ghost/intern/GHOST_EventManager.cpp | 5 ++++- source/blender/bmesh/bmesh_error.h | 7 ++++--- source/blender/bmesh/intern/bmesh_mods.c | 3 ++- source/blender/bmesh/intern/bmesh_newcore.c | 12 ++++++++---- source/blender/bmesh/intern/bmesh_operators.c | 1 + .../editors/transform/transform_conversions.c | 14 +++++++++----- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp index 80b99552988..de816b5a677 100644 --- a/intern/ghost/intern/GHOST_EventManager.cpp +++ b/intern/ghost/intern/GHOST_EventManager.cpp @@ -197,6 +197,9 @@ bool GHOST_EventManager::dispatchEvent(GHOST_IEvent* event) } bool GHOST_EventManager::playingEvents(bool *hasevent) { + if (!m_playfile) + return false; + if (hasevent && m_events.size()) { GHOST_IEvent *event = m_events[m_events.size()-1]; GHOST_System *sys; @@ -209,7 +212,7 @@ bool GHOST_EventManager::playingEvents(bool *hasevent) { } else if (hasevent) *hasevent = true; - return m_playfile != NULL; + return 1; } bool GHOST_EventManager::dispatchEvent() diff --git a/source/blender/bmesh/bmesh_error.h b/source/blender/bmesh/bmesh_error.h index 482de844cd4..3482402b45b 100644 --- a/source/blender/bmesh/bmesh_error.h +++ b/source/blender/bmesh/bmesh_error.h @@ -32,11 +32,12 @@ int BMO_CatchOpError(BMesh *bm, BMOperator *catchop, int errorcode, char **msg); #define BMERR_SELF_INTERSECTING 1 #define BMERR_DISSOLVEDISK_FAILED 2 #define BMERR_CONNECTVERT_FAILED 3 -#define BMERR_WALKER_FAILED 4 +#define BMERR_WALKER_FAILED 4 #define BMERR_DISSOLVEFACES_FAILED 5 #define BMERR_DISSOLVEVERTS_FAILED 6 -#define BMERR_TESSELATION 7 -#define BMERR_NONMANIFOLD 8 +#define BMERR_TESSELATION 7 +#define BMERR_NONMANIFOLD 8 #define BMERR_INVALID_SELECTION 9 +#define BMERR_MESH_ERROR 10 #endif /* _BMESH_ERROR_H */ diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 68be8e8127b..45547a60c44 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -56,7 +56,8 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v) { } if (len == 1) { - BM_Kill_Edge(bm, v->e); + if (v->e) + BM_Kill_Edge(bm, v->e); BM_Kill_Vert(bm, v); return 1; } diff --git a/source/blender/bmesh/intern/bmesh_newcore.c b/source/blender/bmesh/intern/bmesh_newcore.c index 82f83c0bbb9..611b6937fbc 100644 --- a/source/blender/bmesh/intern/bmesh_newcore.c +++ b/source/blender/bmesh/intern/bmesh_newcore.c @@ -771,7 +771,7 @@ void bmesh_clear_systag_elements(BMesh *UNUSED(bm), void *veles, int tot, int fl #define FACE_MARK (1<<10) -static int count_flagged_radial(BMLoop *l, int flag) +static int count_flagged_radial(BMesh *bm, BMLoop *l, int flag) { BMLoop *l2 = l; int i = 0, c=0; @@ -779,19 +779,23 @@ static int count_flagged_radial(BMLoop *l, int flag) do { if (!l2) { bmesh_error(); - return 0; + goto error; } i += bmesh_api_getflag(l2->f, flag) ? 1 : 0; l2 = bmesh_radial_nextloop(l2); if (c >= 800000) { bmesh_error(); - return 0; + goto error; } c++; } while (l2 != l); return i; + +error: + BMO_RaiseError(bm, bm->currentop, BMERR_MESH_ERROR, NULL); + return 0; } static int count_flagged_disk(BMVert *v, int flag) @@ -874,7 +878,7 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface) f = faces[i]; l = bm_firstfaceloop(f); do { - int rlen = count_flagged_radial(l, _FLAG_JF); + int rlen = count_flagged_radial(bm, l, _FLAG_JF); if (rlen > 2) { err = "Input faces do not form a contiguous manifold region"; diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 27c545b4f79..bdb69f974d2 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -32,6 +32,7 @@ static const char *bmop_error_messages[] = { "Tesselation error", "Can not deal with non-manifold geometry", "Invalid selection", + "Internal mesh error", }; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2b308ffeb70..418f6c194e6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1850,8 +1850,9 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f BLI_array_empty(stack); BLI_array_append(stack, v); - BLI_smallhash_insert(visit, (uintptr_t)v, NULL); BLI_array_append(dstack, 0.0f); + + BLI_smallhash_insert(visit, (uintptr_t)v, NULL); while (BLI_array_count(stack)) { BMIter eiter; @@ -1860,15 +1861,16 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f float d, d2, vec[3]; v2 = BLI_array_pop(stack); - - d = dstack[BLI_array_count(dstack)-1]; - BLI_array_pop(dstack); + d = BLI_array_pop(dstack); dists[BMINDEX_GET(v2)] = d; BM_ITER(e, &eiter, em->bm, BM_EDGES_OF_VERT, v2) { float d2; v3 = BM_OtherEdgeVert(e, v2); + if (BM_TestHFlag(v3, BM_SELECT) || BM_TestHFlag(v3, BM_HIDDEN)) + continue; + sub_v3_v3v3(vec, v2->co, v3->co); mul_m3_v3(mtx, vec); @@ -1877,7 +1879,9 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f if (d2 >= dists[BMINDEX_GET(v3)] && BLI_smallhash_haskey(visit, (uintptr_t)v3)) continue; - BLI_smallhash_insert(visit, (uintptr_t)v3, NULL); + dists[BMINDEX_GET(v3)] = d2; + if (!BLI_smallhash_haskey(visit, (uintptr_t)v3)) + BLI_smallhash_insert(visit, (uintptr_t)v3, NULL); BLI_array_append(stack, v3); BLI_array_append(dstack, d2);