diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 17:41:00 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:18:11 +0300 |
commit | d140e70c496122915eb5c05aba83153e2e0d7998 (patch) | |
tree | 1e589247d69da64aa7b0e7802319237ec050b5d6 /source/blender/editors/mesh/editmesh_loopcut.c | |
parent | 147bd16ed1bb3415b30408b0eab110d0854eadd2 (diff) | |
parent | 295d0c52a26730edc6d4ed1276e4051cce006be5 (diff) |
Merge branch 'master' into temp-ghash-experimentstemp-ghash-experiments
Note that 'store hash' feature was removed for now - to complex to maintain (conflicts)
and relatively easy to re-add if we ever really want this one day.
Conflicts:
source/blender/blenlib/BLI_ghash.h
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/hash_mm2a.c
source/blender/bmesh/tools/bmesh_region_match.c
tests/gtests/blenlib/BLI_ghash_performance_test.cc
tests/gtests/blenlib/BLI_ghash_test.cc
tests/gtests/blenlib/CMakeLists.txt
Diffstat (limited to 'source/blender/editors/mesh/editmesh_loopcut.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 3d93210382c..74a40a23fe1 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -32,7 +32,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" +#include "BLI_stack.h" #include "BLI_string.h" #include "BLI_math.h" @@ -224,7 +224,8 @@ static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, con BMEdge *eed, *eed_last; BMVert *v[2][2] = {{NULL}}, *v_last; float (*edges)[2][3] = NULL; - BLI_array_declare(edges); + BLI_Stack *edge_stack; + int i, tot = 0; BMW_init(&walker, bm, BMW_EDGERING, @@ -232,10 +233,27 @@ static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, con BMW_FLAG_TEST_HIDDEN, BMW_NIL_LAY); + + edge_stack = BLI_stack_new(sizeof(BMEdge *), __func__); + + eed_last = NULL; + for (eed = eed_last = BMW_begin(&walker, lcd->eed); eed; eed = BMW_step(&walker)) { + BLI_stack_push(edge_stack, &eed); + } + BMW_end(&walker); + + + eed_start = *(BMEdge **)BLI_stack_peek(edge_stack); + + edges = MEM_mallocN( + (sizeof(*edges) * (BLI_stack_count(edge_stack) + (eed_last != eed_start))) * previewlines, __func__); + v_last = NULL; eed_last = NULL; - for (eed = eed_start = BMW_begin(&walker, eed_start); eed; eed = BMW_step(&walker)) { + while (!BLI_stack_is_empty(edge_stack)) { + BLI_stack_pop(edge_stack, &eed); + if (eed_last) { if (v_last) { v[1][0] = v[0][0]; @@ -250,8 +268,6 @@ static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, con edgering_find_order(eed_last, eed, v_last, v); v_last = v[0][0]; - BLI_array_grow_items(edges, previewlines); - for (i = 1; i <= previewlines; i++) { const float fac = (i / ((float)previewlines + 1)); float v_cos[2][2][3]; @@ -279,8 +295,6 @@ static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, con edgering_find_order(eed_last, eed_start, v_last, v); - BLI_array_grow_items(edges, previewlines); - for (i = 1; i <= previewlines; i++) { const float fac = (i / ((float)previewlines + 1)); float v_cos[2][2][3]; @@ -297,7 +311,8 @@ static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, con } } - BMW_end(&walker); + BLI_stack_free(edge_stack); + lcd->edges = edges; lcd->totedge = tot; } @@ -553,6 +568,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) /* add a modal handler for this operator - handles loop selection */ if (is_interactive) { + op->flag |= OP_IS_MODAL_CURSOR_REGION; WM_event_add_modal_handler(C, op); } @@ -639,6 +655,9 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) bool show_cuts = false; const bool has_numinput = hasNumInput(&lcd->num); + em_setup_viewcontext(C, &lcd->vc); + lcd->ar = lcd->vc.ar; + view3d_operator_needs_opengl(C); /* using the keyboard to input the number of cuts */ @@ -825,21 +844,21 @@ void MESH_OT_loopcut(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* properties */ - prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 100); + prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 1000000, "Number of Cuts", "", 1, 100); /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */ RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -FLT_MAX, FLT_MAX, + prop = RNA_def_float(ot->srna, "smoothness", 0.0f, -1e3f, 1e3f, "Smoothness", "Smoothness factor", -SUBD_SMOOTH_MAX, SUBD_SMOOTH_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_property(ot->srna, "falloff", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items); - RNA_def_property_enum_default(prop, PROP_ROOT); + RNA_def_property_enum_default(prop, PROP_INVSQUARE); RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather"); RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ - prop = RNA_def_int(ot->srna, "edge_index", -1, -1, INT_MAX, "Number of Cuts", "", 0, INT_MAX); + prop = RNA_def_int(ot->srna, "edge_index", -1, -1, INT_MAX, "Edge Index", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN); #ifdef USE_LOOPSLIDE_HACK |