diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-06 17:24:34 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-06 17:24:34 +0400 |
commit | acfc0ea5111bcab5ea5795187d08b2f6ec5addaa (patch) | |
tree | d9fb7e477ac551859ca95c1f0482eca8b3af1077 /source/blender/editors | |
parent | 72d0cc1f6123900f5593cd0fe428568f5aa7f682 (diff) | |
parent | 2ed2226ee753cc6a7a19806d99772efa61af897f (diff) |
svn merge ^/trunk/blender -r55815:55840
Diffstat (limited to 'source/blender/editors')
20 files changed, 144 insertions, 45 deletions
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 649ef90f7ba..665c5f628d9 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -26,13 +26,13 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" - #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_ghash.h" +#include "BKE_context.h" + #include "reeb.h" #if 0 /* UNUSED 2.5 */ diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 3d2cd260fb9..7edf723022f 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -38,12 +38,12 @@ #include "DNA_listBase.h" #include "DNA_windowmanager_types.h" +#include "BLI_listbase.h" + #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_gpencil.h" -#include "BLI_listbase.h" - #include "ED_gpencil.h" #include "WM_api.h" diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 63741ee08ba..3d04675348f 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -311,4 +311,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis); -#endif /* UI_RESOURCES_H */ +#endif /* __UI_RESOURCES_H__ */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c40d91378b1..16f3cb9c7c2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2233,6 +2233,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval = WM_UI_HANDLER_BREAK; break; + case AKEY: + /* Ctrl + A: Select all */ + if (event->ctrl && !(event->alt || event->shift || event->oskey)) { + ui_textedit_move(but, data, STRCUR_DIR_PREV, + false, STRCUR_JUMP_ALL); + ui_textedit_move(but, data, STRCUR_DIR_NEXT, + true, STRCUR_JUMP_ALL); + retval = WM_UI_HANDLER_BREAK; + } + break; + case TABKEY: /* there is a key conflict here, we can't tab with autocomplete */ if (but->autocomplete_func || data->searchbox) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index e5f9e48c3b0..905c914352f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2506,8 +2506,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int /* make the progress bar a proportion of the original height */ /* hardcoded 4px high for now */ - rect_prog.ymax = rect_prog.ymin + 4; - rect_bar.ymax = rect_bar.ymin + 4; + rect_prog.ymax = rect_prog.ymin + 4 * UI_DPI_FAC; + rect_bar.ymax = rect_bar.ymin + 4 * UI_DPI_FAC; w = value * BLI_rcti_size_x(&rect_prog); @@ -2520,8 +2520,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); /* raise text a bit */ - rect->ymin += 6; - rect->xmin -= 6; + rect->ymin += 6 * UI_DPI_FAC; + rect->xmin -= 6 * UI_DPI_FAC; } static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index f7cf32a074f..a9093824a9d 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) InsetData *opdata = op->customdata; const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " - "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); + "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); @@ -98,7 +98,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) flts_str + NUM_STR_REP_LEN, 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") + RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "individual") ? IFACE_("On") : IFACE_("Off") ); ED_area_headerprint(sa, msg); @@ -191,6 +192,7 @@ static int edbm_inset_calc(wmOperator *op) const float depth = RNA_float_get(op->ptr, "depth"); const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ + const bool individual = RNA_boolean_get(op->ptr, "individual"); opdata = op->customdata; em = opdata->em; @@ -199,12 +201,18 @@ static int edbm_inset_calc(wmOperator *op) EDBM_redo_state_restore(opdata->mesh_backup, em, false); } - EDBM_op_init(em, &bmop, op, - "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " - "thickness=%f depth=%f use_outset=%b", - BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, - thickness, depth, use_outset); - + if (individual) { + EDBM_op_init(em, &bmop, op, + "inset_individual faces=%hf thickness=%f depth=%f use_even_offset=%b", + BM_ELEM_SELECT, thickness, depth, use_even_offset); + } + else { + EDBM_op_init(em, &bmop, op, + "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " + "thickness=%f depth=%f use_outset=%b", + BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, + thickness, depth, use_outset); + } BMO_op_exec(em->bm, &bmop); if (use_select_inset) { @@ -410,6 +418,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) } } break; + case IKEY: + if (event->val == KM_PRESS) { + int individual = RNA_boolean_get(op->ptr, "individual"); + RNA_boolean_set(op->ptr, "individual", !individual); + if (edbm_inset_calc(op)) { + edbm_inset_update_header(op, C); + } + else { + edbm_inset_cancel(C, op); + return OPERATOR_CANCELLED; + } + } + break; + } return OPERATOR_RUNNING_MODAL; @@ -448,4 +470,5 @@ void MESH_OT_inset(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces"); + RNA_def_boolean(ot->srna, "individual", false, "Individual", "Individual Face Inset"); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0e4161d232d..4f691efe950 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2632,6 +2632,67 @@ void MESH_OT_beautify_fill(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } + +/********************** Poke Face **********************/ + +static int edbm_poke_face_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); + BMOperator bmop; + + const float offset = RNA_float_get(op->ptr, "offset"); + const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); + const int center_mode = RNA_enum_get(op->ptr, "center_mode"); + + EDBM_op_init(em, &bmop, op, "poke faces=%hf offset=%f use_relative_offset=%b center_mode=%i", + BM_ELEM_SELECT, offset, use_relative_offset, center_mode); + BMO_op_exec(em->bm, &bmop); + + EDBM_flag_disable_all(em, BM_ELEM_SELECT); + + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); + + if (!EDBM_op_finish(em, &bmop, op, true)) { + return OPERATOR_CANCELLED; + } + + EDBM_mesh_normals_update(em); + + EDBM_update_generic(em, true, true); + + return OPERATOR_FINISHED; + +} + +void MESH_OT_poke(wmOperatorType *ot) +{ + + static EnumPropertyItem poke_center_modes[] = { + {BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"}, + {BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"}, + {BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"}, + {0, NULL, 0, NULL, NULL}}; + + + /* identifiers */ + ot->name = "Poke Faces"; + ot->idname = "MESH_OT_poke"; + ot->description = "Splits a face into a fan"; + + /* api callbacks */ + ot->exec = edbm_poke_face_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Poke Offset", "Poke Offset", -1.0f, 1.0f); + RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry"); + RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEAN_WEIGHTED, "Poke Center", "Poke Face Center Calculation"); +} + /********************** Quad/Tri Operators *************************/ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) @@ -2660,6 +2721,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } + void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4a0bbbb8dbf..5b447bf254f 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -202,6 +202,7 @@ void MESH_OT_edge_face_add(struct wmOperatorType *ot); void MESH_OT_duplicate(struct wmOperatorType *ot); void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot); +void MESH_OT_poke(struct wmOperatorType *ot); #ifdef WITH_FREESTYLE void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index a17b0f5551b..06f920ef16c 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -158,6 +158,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_bridge_edge_loops); WM_operatortype_append(MESH_OT_inset); + WM_operatortype_append(MESH_OT_poke); WM_operatortype_append(MESH_OT_wireframe); WM_operatortype_append(MESH_OT_edge_split); @@ -266,7 +267,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0); - + WM_keymap_add_item(keymap, "MESH_OT_poke", PKEY, KM_PRESS, KM_ALT, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "vertex_only", false); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index b851dc3be94..08349e2e0bb 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -43,13 +43,13 @@ #endif #include "MEM_guardedalloc.h" -#include "BLO_readfile.h" - #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLO_readfile.h" + #include "DNA_world_types.h" #include "DNA_camera_types.h" #include "DNA_material_types.h" diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 796bb99ebaf..f480725277e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -993,8 +993,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */ RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex"); - WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke"); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index b1be9217819..382b0b75c5e 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -35,10 +35,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" - #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_string.h" @@ -46,6 +42,10 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" + #include "ED_screen.h" #include "ED_clip.h" diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 1000aced3a9..1d2ea8d7305 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -37,11 +37,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" -#include "BKE_mask.h" - #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -52,6 +47,11 @@ #include "BLI_rect.h" #include "BLI_math_base.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" +#include "BKE_mask.h" + #include "ED_screen.h" #include "ED_clip.h" #include "ED_mask.h" diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 7b070fde6ba..973200dc340 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -35,14 +35,14 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" - #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_string.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" + #include "ED_screen.h" #include "ED_clip.h" diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 35179511563..d6f644ab330 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -28,13 +28,12 @@ * \ingroup spfile */ +#include "BLI_blenlib.h" +#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" -#include "BLI_blenlib.h" -#include "BLI_utildefines.h" - #include "BLF_translation.h" #include "DNA_screen_types.h" diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 698c355fad3..d2624c7fa97 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -35,14 +35,14 @@ #include "BIF_gl.h" -#include "BLO_readfile.h" - #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_utildefines.h" #include "BLI_fileops_types.h" +#include "BLO_readfile.h" + #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_global.h" diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1b4ff44bb6b..9bc23ca17c2 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -438,7 +438,6 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) case NC_WINDOW: /* notifier comes from editing color space */ image_scopes_tag_refresh(sa); - ED_area_tag_refresh(sa); ED_area_tag_redraw(sa); break; case NC_SCENE: diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 513bde4375c..0155750fbf8 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -31,10 +31,10 @@ #include "DNA_node_types.h" -#include "BKE_context.h" - #include "BLI_utildefines.h" +#include "BKE_context.h" + #include "ED_node.h" /* own include */ #include "ED_screen.h" #include "ED_transform.h" diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 7678051fd38..2752d76fbf0 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -49,12 +49,12 @@ #include "BIF_gl.h" #include "BIF_glutil.h" -#include "BKE_context.h" - #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_string.h" +#include "BKE_context.h" + #include "ED_image.h" #include "ED_view3d.h" diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index fc603f7a593..e1451ee43e6 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -186,6 +186,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) //#ifdef WITH_PYTHON // XXX BPY_scripts_clear_pyobjects(); //#endif + + /* for global undo/redo we should just clear the editmode stack */ + /* for example, texface stores image pointers */ + undo_editmode_clear(); + if (undoname) BKE_undo_name(C, undoname); else |