diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-03-16 15:46:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-03-16 15:46:10 +0300 |
commit | 147bd16ed1bb3415b30408b0eab110d0854eadd2 (patch) | |
tree | 8b232d5867b47e7364aa6d1db1c2a519096ec507 /source/blender/editors | |
parent | e7a33d8bf4c736efe7e99fe780b3664543c365a0 (diff) | |
parent | 86c828d9fdf6df9f392f70d8ed1f0e10ce10e098 (diff) |
Merge branch 'master' into temp-ghash-experiments
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_console/console_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_console/console_ops.c | 88 | ||||
-rw-r--r-- | source/blender/editors/space_console/space_console.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 5 |
9 files changed, 111 insertions, 8 deletions
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 932a00d1687..2d869d272bd 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -774,7 +774,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float /* First de-select existing FCurve's keyframes */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { - bezt->f2 &= ~SELECT; + BEZ_DESEL(bezt); } /* mix mode with existing data */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index e14b3036743..f7d51eb403f 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -571,8 +571,8 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) ToolSettings *toolsettings = CTX_data_tool_settings(C); if (!is_mode_set) { - Scene *scene = CTX_data_scene(C); - if (!ED_object_mode_compat_set(C, scene->basact->object, mode_flag, op->reports)) { + Object *ob = CTX_data_active_object(C); + if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 3fe8c86ef5c..fb9687da6df 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -120,9 +120,16 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob) kb = BLI_findlink(&key->block, ob->shapenr - 1); if (kb) { - for (rkb = key->block.first; rkb; rkb = rkb->next) - if (rkb->relative == ob->shapenr - 1) + for (rkb = key->block.first; rkb; rkb = rkb->next) { + if (rkb->relative == ob->shapenr - 1) { + /* remap to the 'Basis' */ rkb->relative = 0; + } + else if (rkb->relative >= ob->shapenr) { + /* Fix positional shift of the keys when kb is deleted from the list */ + rkb->relative -= 1; + } + } BLI_remlink(&key->block, kb); key->totkey--; diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index 00f1f8c21c9..a3746e091ce 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -66,6 +66,7 @@ void CONSOLE_OT_history_cycle(struct wmOperatorType *ot); void CONSOLE_OT_copy(struct wmOperatorType *ot); void CONSOLE_OT_paste(struct wmOperatorType *ot); void CONSOLE_OT_select_set(struct wmOperatorType *ot); +void CONSOLE_OT_select_word(struct wmOperatorType *ot); enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD }; enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL }; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 8263268898f..92731c2f135 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -262,6 +262,40 @@ static int console_line_insert(ConsoleLine *ci, char *str) return len; } +/** + * Take an absolute index and give the line/column info. + * + * \note be sure to call console_scrollback_prompt_begin first + */ +static bool console_line_column_from_index( + SpaceConsole *sc, const int pos, + ConsoleLine **r_cl, int *r_cl_offset, int *r_col) +{ + ConsoleLine *cl; + int offset = 0; + + for (cl = sc->scrollback.last; cl; cl = cl->prev) { + offset += cl->len + 1; + if (offset >= pos) { + break; + } + } + + if (cl) { + offset -= 1; + *r_cl = cl; + *r_cl_offset = offset; + *r_col = offset - pos; + return true; + } + else { + *r_cl = NULL; + *r_cl_offset = -1; + *r_col = -1; + return false; + } +} + /* static funcs for text editing */ /* similar to the text editor, with some not used. keep compatible */ @@ -1134,3 +1168,57 @@ void CONSOLE_OT_select_set(wmOperatorType *ot) ot->cancel = console_modal_select_cancel; ot->poll = ED_operator_console_active; } + +static int console_selectword_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) +{ + SpaceConsole *sc = CTX_wm_space_console(C); + ARegion *ar = CTX_wm_region(C); + + ConsoleLine cl_dummy = {NULL}; + ConsoleLine *cl; + int ret = OPERATOR_CANCELLED; + int pos, offset, n; + + pos = console_char_pick(sc, ar, event->mval); + + console_scrollback_prompt_begin(sc, &cl_dummy); + + if (console_line_column_from_index(sc, pos, &cl, &offset, &n)) { + int sel[2] = {n, n}; + + BLI_str_cursor_step_utf8( + cl->line, cl->len, + &sel[0], STRCUR_DIR_NEXT, + STRCUR_JUMP_DELIM, true); + + BLI_str_cursor_step_utf8( + cl->line, cl->len, + &sel[1], STRCUR_DIR_PREV, + STRCUR_JUMP_DELIM, true); + + sel[0] = offset - sel[0]; + sel[1] = offset - sel[1]; + + if ((sel[0] != sc->sel_start) || (sel[1] != sc->sel_end)) { + sc->sel_start = sel[0]; + sc->sel_end = sel[1]; + ED_area_tag_redraw(CTX_wm_area(C)); + ret = OPERATOR_FINISHED; + } + } + + console_scrollback_prompt_end(sc, &cl_dummy); + return ret; +} + +void CONSOLE_OT_select_word(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Word"; + ot->description = "Select word at cursor position"; + ot->idname = "CONSOLE_OT_select_word"; + + /* api callbacks */ + ot->invoke = console_selectword_invoke; + ot->poll = ED_operator_console_active; +} diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index e4a61a8f06e..a592f35f629 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -270,6 +270,7 @@ static void console_operatortypes(void) WM_operatortype_append(CONSOLE_OT_copy); WM_operatortype_append(CONSOLE_OT_paste); WM_operatortype_append(CONSOLE_OT_select_set); + WM_operatortype_append(CONSOLE_OT_select_word); } static void console_keymap(struct wmKeyConfig *keyconf) @@ -348,6 +349,7 @@ static void console_keymap(struct wmKeyConfig *keyconf) #endif WM_keymap_add_item(keymap, "CONSOLE_OT_select_set", LEFTMOUSE, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "CONSOLE_OT_select_word", LEFTMOUSE, KM_DBL_CLICK, 0, 0); RNA_string_set(WM_keymap_add_item(keymap, "CONSOLE_OT_insert", TABKEY, KM_PRESS, KM_CTRL, 0)->ptr, "text", "\t"); /* fake tabs */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 2d8a0a3da29..a5c04ce2cb4 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -908,7 +908,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) glPointSize(7.0); glBegin(GL_POINTS); - glVertex2f(x, y); + glVertex2f(x, y); glEnd(); /* inner frame */ @@ -916,7 +916,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) glPointSize(3.0); glBegin(GL_POINTS); - glVertex2f(x, y); + glVertex2f(x, y); glEnd(); glPointSize(1.0f); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index a7799e79312..e2d83c243a2 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -314,7 +314,7 @@ void node_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "NODE_OT_group_separate", PKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "NODE_OT_group_edit", TABKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "exit", false); - kmi = WM_keymap_add_item(keymap, "NODE_OT_group_edit", TABKEY, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "NODE_OT_group_edit", TABKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "exit", true); WM_keymap_add_item(keymap, "NODE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 0ee5ab96a85..e33bc19fc92 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -1114,6 +1114,11 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac /* XXX release_confirm is set in the macro operator definition */ WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0); WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0); + + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap"); + kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.snap_element"); break; case SPACE_SEQ: WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0); |