fixed idling problem

This commit is contained in:
Joseph Eagar 2011-04-15 02:13:37 +00:00
parent c98148a963
commit 005b37643d
6 changed files with 28 additions and 14 deletions

@ -197,6 +197,9 @@ bool GHOST_EventManager::dispatchEvent(GHOST_IEvent* event)
} }
bool GHOST_EventManager::playingEvents(bool *hasevent) { bool GHOST_EventManager::playingEvents(bool *hasevent) {
if (!m_playfile)
return false;
if (hasevent && m_events.size()) { if (hasevent && m_events.size()) {
GHOST_IEvent *event = m_events[m_events.size()-1]; GHOST_IEvent *event = m_events[m_events.size()-1];
GHOST_System *sys; GHOST_System *sys;
@ -209,7 +212,7 @@ bool GHOST_EventManager::playingEvents(bool *hasevent) {
} else if (hasevent) } else if (hasevent)
*hasevent = true; *hasevent = true;
return m_playfile != NULL; return 1;
} }
bool GHOST_EventManager::dispatchEvent() bool GHOST_EventManager::dispatchEvent()

@ -38,5 +38,6 @@ int BMO_CatchOpError(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
#define BMERR_TESSELATION 7 #define BMERR_TESSELATION 7
#define BMERR_NONMANIFOLD 8 #define BMERR_NONMANIFOLD 8
#define BMERR_INVALID_SELECTION 9 #define BMERR_INVALID_SELECTION 9
#define BMERR_MESH_ERROR 10
#endif /* _BMESH_ERROR_H */ #endif /* _BMESH_ERROR_H */

@ -56,6 +56,7 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v) {
} }
if (len == 1) { if (len == 1) {
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 1; return 1;

@ -771,7 +771,7 @@ void bmesh_clear_systag_elements(BMesh *UNUSED(bm), void *veles, int tot, int fl
#define FACE_MARK (1<<10) #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; BMLoop *l2 = l;
int i = 0, c=0; int i = 0, c=0;
@ -779,19 +779,23 @@ static int count_flagged_radial(BMLoop *l, int flag)
do { do {
if (!l2) { if (!l2) {
bmesh_error(); bmesh_error();
return 0; goto error;
} }
i += bmesh_api_getflag(l2->f, flag) ? 1 : 0; i += bmesh_api_getflag(l2->f, flag) ? 1 : 0;
l2 = bmesh_radial_nextloop(l2); l2 = bmesh_radial_nextloop(l2);
if (c >= 800000) { if (c >= 800000) {
bmesh_error(); bmesh_error();
return 0; goto error;
} }
c++; c++;
} while (l2 != l); } while (l2 != l);
return i; return i;
error:
BMO_RaiseError(bm, bm->currentop, BMERR_MESH_ERROR, NULL);
return 0;
} }
static int count_flagged_disk(BMVert *v, int flag) 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]; f = faces[i];
l = bm_firstfaceloop(f); l = bm_firstfaceloop(f);
do { do {
int rlen = count_flagged_radial(l, _FLAG_JF); int rlen = count_flagged_radial(bm, l, _FLAG_JF);
if (rlen > 2) { if (rlen > 2) {
err = "Input faces do not form a contiguous manifold region"; err = "Input faces do not form a contiguous manifold region";

@ -32,6 +32,7 @@ static const char *bmop_error_messages[] = {
"Tesselation error", "Tesselation error",
"Can not deal with non-manifold geometry", "Can not deal with non-manifold geometry",
"Invalid selection", "Invalid selection",
"Internal mesh error",
}; };

@ -1850,9 +1850,10 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f
BLI_array_empty(stack); BLI_array_empty(stack);
BLI_array_append(stack, v); BLI_array_append(stack, v);
BLI_smallhash_insert(visit, (uintptr_t)v, NULL);
BLI_array_append(dstack, 0.0f); BLI_array_append(dstack, 0.0f);
BLI_smallhash_insert(visit, (uintptr_t)v, NULL);
while (BLI_array_count(stack)) { while (BLI_array_count(stack)) {
BMIter eiter; BMIter eiter;
BMEdge *e; BMEdge *e;
@ -1860,15 +1861,16 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f
float d, d2, vec[3]; float d, d2, vec[3];
v2 = BLI_array_pop(stack); v2 = BLI_array_pop(stack);
d = BLI_array_pop(dstack);
d = dstack[BLI_array_count(dstack)-1];
BLI_array_pop(dstack);
dists[BMINDEX_GET(v2)] = d; dists[BMINDEX_GET(v2)] = d;
BM_ITER(e, &eiter, em->bm, BM_EDGES_OF_VERT, v2) { BM_ITER(e, &eiter, em->bm, BM_EDGES_OF_VERT, v2) {
float d2; float d2;
v3 = BM_OtherEdgeVert(e, v2); 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); sub_v3_v3v3(vec, v2->co, v3->co);
mul_m3_v3(mtx, vec); mul_m3_v3(mtx, vec);
@ -1877,6 +1879,8 @@ 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)) if (d2 >= dists[BMINDEX_GET(v3)] && BLI_smallhash_haskey(visit, (uintptr_t)v3))
continue; continue;
dists[BMINDEX_GET(v3)] = d2;
if (!BLI_smallhash_haskey(visit, (uintptr_t)v3))
BLI_smallhash_insert(visit, (uintptr_t)v3, NULL); BLI_smallhash_insert(visit, (uintptr_t)v3, NULL);
BLI_array_append(stack, v3); BLI_array_append(stack, v3);