diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 07:39:20 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 07:39:20 +0400 |
commit | d120ec146d3c28b7243371b0de1edf4ba590470c (patch) | |
tree | a05f182978c6007bb9193f6ad0b4f2b210394ee8 /source/blender/editors/mesh | |
parent | 3df023ae82eef0ea105dc61c9730af87b59a07d1 (diff) | |
parent | 93c3593d825aafe30aaf051182e50bde4c6084dd (diff) |
Merged changes in the trunk up to revision 54802.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 17 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 10 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 202 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 2 |
7 files changed, 34 insertions, 207 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 3fbfaabbc0d..7ac27e038a4 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -34,6 +34,8 @@ #include "BLI_math.h" #include "BLI_edgehash.h" +#include "BLF_translation.h" + #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -429,7 +431,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) if (me == 0 || me->totpoly == 0) return; if (mode == 0) - mode = pupmenu("Seams %t|Mark Border Seam %x1|Clear Seam %x2"); + mode = pupmenu(IFACE_("Seams %t|Mark Border Seam %x1|Clear Seam %x2")); if (mode != 1 && mode != 2) return; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index bc7fe783e78..d7dbe3506b1 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -41,6 +41,8 @@ #include "BLI_smallhash.h" #include "BLI_memarena.h" +#include "BLF_translation.h" + #include "BKE_DerivedMesh.h" #include "BKE_context.h" @@ -212,15 +214,16 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], static void knife_update_header(bContext *C, KnifeTool_OpData *kcd) { - #define HEADER_LENGTH 190 + #define HEADER_LENGTH 256 char header[HEADER_LENGTH]; - BLI_snprintf(header, HEADER_LENGTH, "LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, E: new cut, Ctrl: midpoint snap (%s), " - "Shift: ignore snap (%s), C: angle constrain (%s), Z: cut through (%s)", - kcd->snap_midpoints ? "On" : "Off", - kcd->ignore_edge_snapping ? "On" : "Off", - kcd->angle_snapping ? "On" : "Off", - kcd->cut_through ? "On" : "Off"); + BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, " + "E: new cut, Ctrl: midpoint snap (%s), Shift: ignore snap (%s), " + "C: angle constrain (%s), Z: cut through (%s)"), + kcd->snap_midpoints ? IFACE_("On") : IFACE_("Off"), + kcd->ignore_edge_snapping ? IFACE_("On") : IFACE_("Off"), + kcd->angle_snapping ? IFACE_("On") : IFACE_("Off"), + kcd->cut_through ? IFACE_("On") : IFACE_("Off")); ED_area_headerprint(CTX_wm_area(C), header); } diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index d1373363992..83542915ec2 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -37,6 +37,8 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_modifier.h" #include "BKE_report.h" @@ -411,10 +413,8 @@ static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt) lcd->eed = edge; ringsel_find_edge(lcd, 1); } - ED_area_headerprint(sa, - "Select a ring to be cut, " - "use mouse-wheel or page-up/down for number of cuts, " - "Hold Alt for smooth"); + ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, " + "hold Alt for smooth")); return OPERATOR_RUNNING_MODAL; } @@ -543,7 +543,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) if (show_cuts) { char buf[64]; - BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d, Smooth: %.2f (Alt)", cuts, smoothness); + BLI_snprintf(buf, sizeof(buf), IFACE_("Number of Cuts: %d, Smooth: %.2f (Alt)"), cuts, smoothness); ED_area_headerprint(CTX_wm_area(C), buf); } diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 88d826c2f98..57f116693f8 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2678,7 +2678,7 @@ void MESH_OT_select_nth(wmOperatorType *ot) /* identifiers */ ot->name = "Checker Deselect"; ot->idname = "MESH_OT_select_nth"; - ot->description = "Deselect every Nth element starting from a selected vertex, edge or face"; + ot->description = "Deselect every Nth element starting from the active vertex, edge or face"; /* api callbacks */ ot->exec = edbm_select_nth_exec; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index b58e393811d..dcb25423b80 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -47,6 +47,8 @@ #include "BLI_math.h" #include "BLI_rand.h" +#include "BLF_translation.h" + #include "BKE_material.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -2387,7 +2389,7 @@ static void shape_propagate(BMEditMesh *em, wmOperator *op) //TAG Mesh Objects that share this data for (base = scene->base.first; base; base = base->next) { if (base->object && base->object->data == me) { - base->object->recalc = OB_RECALC_DATA; + DAG_id_tag_update(&base->object->id, OB_RECALC_DATA); } } #endif @@ -3040,7 +3042,7 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE); base_new = ED_object_add_duplicate(bmain, scene, base_old, USER_DUP_MESH); - /* DAG_scene_sort(bmain, scene); */ /* normally would call directly after but in this case delay recalc */ + /* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */ assign_matarar(base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */ ED_base_object_select(base_new, BA_SELECT); @@ -3274,7 +3276,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) if (retval) { /* delay depsgraph recalc until all objects are duplicated */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); return OPERATOR_FINISHED; } @@ -4651,15 +4653,9 @@ void MESH_OT_noise(wmOperatorType *ot) RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f); } -#define NEW_BEVEL 1 - typedef struct { BMEditMesh *em; BMBackup mesh_backup; -#ifndef NEW_BEVEL - float *weights; - int li; -#endif int mcenter[2]; float initial_length; float pixel_size; /* use when mouse input is interpreted as spatial distance */ @@ -4672,104 +4668,34 @@ typedef struct { static void edbm_bevel_update_header(wmOperator *op, bContext *C) { -#ifdef NEW_BEVEL - static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), offset: %s, segments: %d"; -#else - static char str[] = "Confirm: Enter/LClick, Cancel: (Esc/RMB), factor: %s, Use Dist (D): %s: Use Even (E): %s"; - BevelData *opdata = op->customdata; -#endif + const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RMB), Offset: %s, Segments: %d"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); if (sa) { -#ifdef NEW_BEVEL char offset_str[NUM_STR_REP_LEN]; BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset")); BLI_snprintf(msg, HEADER_LENGTH, str, offset_str, RNA_int_get(op->ptr, "segments") ); -#else - char factor_str[NUM_STR_REP_LEN]; - if (hasNumInput(&opdata->num_input)) - outputNumInput(&opdata->num_input, factor_str); - else - BLI_snprintf(factor_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "percent")); - BLI_snprintf(msg, HEADER_LENGTH, str, - factor_str, - RNA_boolean_get(op->ptr, "use_dist") ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_even") ? "On" : "Off" - ); -#endif ED_area_headerprint(sa, msg); } } -#ifndef NEW_BEVEL -static void edbm_bevel_recalc_weights(wmOperator *op) -{ - float df, s, ftot; - int i; - int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */ - BevelData *opdata = op->customdata; - - if (opdata->weights) { - /* TODO should change to free only when new recursion is greater than old */ - MEM_freeN(opdata->weights); - } - opdata->weights = MEM_mallocN(sizeof(float) * recursion, "bevel weights"); - - /* ugh, stupid math depends somewhat on angles!*/ - /* dfac = 1.0/(float)(recursion + 1); */ /* UNUSED */ - df = 1.0; - for (i = 0, ftot = 0.0f; i < recursion; i++) { - s = powf(df, 1.25f); - - opdata->weights[i] = s; - ftot += s; - - df *= 2.0f; - } - - mul_vn_fl(opdata->weights, recursion, 1.0f / (float)ftot); -} -#endif - static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); -#ifdef NEW_BEVEL - BevelData *opdata; -#else - BMIter iter; - BMEdge *eed; BevelData *opdata; - int li; -#endif if (em == NULL) { return 0; } op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator"); - -#ifndef NEW_BEVEL - BM_data_layer_add(em->bm, &em->bm->edata, CD_PROP_FLT); - li = CustomData_number_of_layers(&em->bm->edata, CD_PROP_FLT) - 1; - - BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - float d = len_v3v3(eed->v1->co, eed->v2->co); - float *dv = CustomData_bmesh_get_n(&em->bm->edata, eed->head.data, CD_PROP_FLT, li); - - *dv = d; - } - - opdata->li = li; - opdata->weights = NULL; -#endif opdata->em = em; opdata->is_modal = is_modal; @@ -4781,9 +4707,6 @@ static int edbm_bevel_init(bContext *C, wmOperator *op, int is_modal) /* avoid the cost of allocating a bm copy */ if (is_modal) opdata->mesh_backup = EDBM_redo_state_store(em); -#ifndef NEW_BEVEL - edbm_bevel_recalc_weights(op); -#endif return 1; } @@ -4793,7 +4716,6 @@ static int edbm_bevel_calc(wmOperator *op) BevelData *opdata = op->customdata; BMEditMesh *em = opdata->em; BMOperator bmop; -#ifdef NEW_BEVEL float offset = RNA_float_get(op->ptr, "offset"); int segments = RNA_int_get(op->ptr, "segments"); int vertex_only = RNA_boolean_get(op->ptr, "vertex_only"); @@ -4822,35 +4744,6 @@ static int edbm_bevel_calc(wmOperator *op) /* no need to de-select existing geometry */ if (!EDBM_op_finish(em, &bmop, op, TRUE)) return 0; -#else - int i; - - float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */; - int recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */ - const int use_even = RNA_boolean_get(op->ptr, "use_even"); - const int use_dist = RNA_boolean_get(op->ptr, "use_dist"); - - /* revert to original mesh */ - if (opdata->is_modal) { - EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE); - } - - for (i = 0; i < recursion; i++) { - float fac = opdata->weights[recursion - i - 1] * factor; - - - if (!EDBM_op_init(em, &bmop, op, - "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b", - BM_ELEM_SELECT, fac, opdata->li, TRUE, use_even, use_dist)) - { - return 0; - } - - BMO_op_exec(em->bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) - return 0; - } -#endif EDBM_mesh_normals_update(opdata->em); @@ -4868,12 +4761,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) if (sa) { ED_area_headerprint(sa, NULL); } -#ifndef NEW_BEVEL - BM_data_layer_free_n(opdata->em->bm, &opdata->em->bm->edata, CD_PROP_FLT, opdata->li); - if (opdata->weights) - MEM_freeN(opdata->weights); -#endif if (opdata->is_modal) { EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE); } @@ -4954,11 +4842,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event) static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event) { BevelData *opdata = op->customdata; -#ifdef NEW_BEVEL int use_dist = TRUE; -#else - int use_dist = RNA_boolean_get(op->ptr, "use_dist"); -#endif float mdiff[2]; float factor; @@ -4976,11 +4860,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event) /* Fake shift-transform... */ if (event->shift) { if (opdata->shift_factor < 0.0f) { -#ifdef NEW_BEVEL opdata->shift_factor = RNA_float_get(op->ptr, "offset"); -#else - opdata->shift_factor = RNA_float_get(op->ptr, "factor"); -#endif } factor = (factor - opdata->shift_factor) * 0.1f + opdata->shift_factor; } @@ -5005,7 +4885,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { /* Try to handle numeric inputs... */ -#ifdef NEW_BEVEL if (handleNumInput(&opdata->num_input, event)) { float value = RNA_float_get(op->ptr, "offset"); @@ -5015,18 +4894,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_update_header(op, C); return OPERATOR_RUNNING_MODAL; } -#else - if (handleNumInput(&opdata->num_input, event)) { - float factor = RNA_float_get(op->ptr, "percent"); - applyNumInput(&opdata->num_input, &factor); - CLAMP(factor, 0.0f, 1.0f); - RNA_float_set(op->ptr, "percent", factor); - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - return OPERATOR_RUNNING_MODAL; - } -#endif } switch (event->type) { @@ -5038,11 +4905,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) case MOUSEMOVE: if (!hasNumInput(&opdata->num_input)) { const float factor = edbm_bevel_mval_factor(op, event); -#ifdef NEW_BEVEL RNA_float_set(op->ptr, "offset", factor); -#else - RNA_float_set(op->ptr, "percent", factor); -#endif edbm_bevel_calc(op); edbm_bevel_update_header(op, C); @@ -5056,7 +4919,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_exit(C, op); return OPERATOR_FINISHED; -#ifdef NEW_BEVEL case WHEELUPMOUSE: /* change number of segments */ case PAGEUPKEY: if (event->val == KM_RELEASE) @@ -5078,33 +4940,6 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, wmEvent *event) edbm_bevel_calc(op); edbm_bevel_update_header(op, C); break; - -#else - case EKEY: - if (event->val == KM_PRESS) { - int use_even = RNA_boolean_get(op->ptr, "use_even"); - RNA_boolean_set(op->ptr, "use_even", !use_even); - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - } - break; - - case DKEY: - if (event->val == KM_PRESS) { - int use_dist = RNA_boolean_get(op->ptr, "use_dist"); - RNA_boolean_set(op->ptr, "use_dist", !use_dist); - - { - const float factor = edbm_bevel_mval_factor(op, event); - RNA_float_set(op->ptr, "percent", factor); - } - - edbm_bevel_calc(C, op); - edbm_bevel_update_header(op, C); - } - break; -#endif } return OPERATOR_RUNNING_MODAL; @@ -5127,20 +4962,9 @@ void MESH_OT_bevel(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING; -#ifdef NEW_BEVEL RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f); RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8); RNA_def_boolean(ot->srna, "vertex_only", FALSE, "Vertex only", "Bevel only vertices"); -#else - /* take note, used as a factor _and_ a distance depending on 'use_dist' */ - RNA_def_float(ot->srna, "percent", 0.0f, -FLT_MAX, FLT_MAX, "Percentage", "", 0.0f, 1.0f); - /* XXX, disabled for 2.63 release, needs to work much better without overlap before we can give to users. */ -/* RNA_def_int(ot->srna, "recursion", 1, 1, 50, "Recursion Level", "Recursion Level", 1, 8); */ - - RNA_def_boolean(ot->srna, "use_even", FALSE, "Even", "Calculate evenly spaced bevel"); - RNA_def_boolean(ot->srna, "use_dist", FALSE, "Distance", "Interpret the percent in blender units"); -#endif - } static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) @@ -5212,12 +5036,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) { InsetData *opdata = op->customdata; - static const char str[] = "Confirm: Enter/LClick, " - "Cancel: (Esc/RClick), " - "thickness: %s, " - "depth (Ctrl to tweak): %s (%s), " - "Outset (O): (%s), " - "Boundary (B): (%s)"; + const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " + "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); @@ -5233,9 +5053,9 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) BLI_snprintf(msg, HEADER_LENGTH, str, flts_str, flts_str + NUM_STR_REP_LEN, - opdata->modify_depth ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_outset") ? "On" : "Off", - RNA_boolean_get(op->ptr, "use_boundary") ? "On" : "Off" + opdata->modify_depth ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off") ); ED_area_headerprint(sa, msg); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index d62eba9728c..fd90246f791 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -136,8 +136,10 @@ void EDBM_mesh_clear(BMEditMesh *em) /* free tessellation data */ em->tottri = 0; - if (em->looptris) + if (em->looptris) { MEM_freeN(em->looptris); + em->looptris = NULL; + } } void EDBM_stats_update(BMEditMesh *em) diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index cb69faa5b51..f983a43f573 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -559,7 +559,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) } - DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call + DAG_relations_tag_update(bmain); // removed objects, need to rebuild dag #if 0 ED_object_enter_editmode(C, EM_WAITCURSOR); |