diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 51 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 23 |
2 files changed, 13 insertions, 61 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 3cd810d5c16..8681a5bcd14 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1879,57 +1879,6 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } -/* ********************* draw type operator ****************** */ - -static int view3d_drawtype_exec(bContext *C, wmOperator *op) -{ - View3D *v3d = CTX_wm_view3d(C); - int dt, dt_alt; - - dt = RNA_int_get(op->ptr, "draw_type"); - dt_alt = RNA_int_get(op->ptr, "draw_type_alternate"); - - if (dt_alt != -1) { - if (v3d->drawtype == dt) - v3d->drawtype = dt_alt; - else - v3d->drawtype = dt; - } - else - v3d->drawtype = dt; - - ED_area_tag_redraw(CTX_wm_area(C)); - - return OPERATOR_FINISHED; -} - -static int view3d_drawtype_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - return view3d_drawtype_exec(C, op); -} - -/* toggles */ -void VIEW3D_OT_drawtype(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Change draw type"; - ot->description = "Change the draw type of the view."; - ot->idname= "VIEW3D_OT_drawtype"; - - /* api callbacks */ - ot->invoke= view3d_drawtype_invoke; - ot->exec= view3d_drawtype_exec; - - ot->poll= ED_operator_view3d_active; - - /* flags */ - ot->flag= 0; - - /* rna XXX should become enum */ - RNA_def_int(ot->srna, "draw_type", 0, INT_MIN, INT_MAX, "Draw Type", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "draw_type_alternate", -1, INT_MIN, INT_MAX, "Draw Type Alternate", "", INT_MIN, INT_MAX); -} - /* ***************** 3d cursor cursor op ******************* */ /* mx my in region coords */ diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 758bf803fb8..0ac62652b52 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -83,7 +83,6 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_select_lasso); WM_operatortype_append(VIEW3D_OT_setcameratoview); WM_operatortype_append(VIEW3D_OT_setobjectascamera); - WM_operatortype_append(VIEW3D_OT_drawtype); WM_operatortype_append(VIEW3D_OT_localview); WM_operatortype_append(VIEW3D_OT_game_start); WM_operatortype_append(VIEW3D_OT_fly); @@ -174,17 +173,21 @@ void view3d_keymap(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10); /* drawtype */ - km = WM_keymap_add_item(keymap, "VIEW3D_OT_drawtype", ZKEY, KM_PRESS, 0, 0); - RNA_int_set(km->ptr, "draw_type", OB_SOLID); - RNA_int_set(km->ptr, "draw_type_alternate", OB_WIRE); - km = WM_keymap_add_item(keymap, "VIEW3D_OT_drawtype", ZKEY, KM_PRESS, KM_ALT, 0); - RNA_int_set(km->ptr, "draw_type", OB_TEXTURE); - RNA_int_set(km->ptr, "draw_type_alternate", OB_SOLID); + km = WM_keymap_add_item(keymap, "WM_OT_context_toggle_values", ZKEY, KM_PRESS, 0, 0); + RNA_string_set(km->ptr, "path", "space_data.viewport_shading"); + RNA_string_set(km->ptr, "value_1", "'SOLID'"); + RNA_string_set(km->ptr, "value_2", "'WIREFRAME'"); - km = WM_keymap_add_item(keymap, "VIEW3D_OT_drawtype", ZKEY, KM_PRESS, KM_SHIFT, 0); - RNA_int_set(km->ptr, "draw_type", OB_SHADED); - RNA_int_set(km->ptr, "draw_type_alternate", OB_WIRE); + km = WM_keymap_add_item(keymap, "WM_OT_context_toggle_values", ZKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(km->ptr, "path", "space_data.viewport_shading"); + RNA_string_set(km->ptr, "value_1", "'TEXTURED'"); + RNA_string_set(km->ptr, "value_2", "'SOLID'"); + + km = WM_keymap_add_item(keymap, "WM_OT_context_toggle_values", ZKEY, KM_PRESS, KM_SHIFT, 0); + RNA_string_set(km->ptr, "path", "space_data.viewport_shading"); + RNA_string_set(km->ptr, "value_1", "'SHADED'"); + RNA_string_set(km->ptr, "value_2", "'WIREFRAME'"); /* selection*/ WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); |