Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_view3d / view3d_ops.c
index 4b2f254..3b800c2 100644 (file)
@@ -71,9 +71,9 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        char str[FILE_MAX];
-       
+
        BKE_copybuffer_begin(bmain);
-       
+
        /* context, selection, could be generalized */
        CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
        {
@@ -93,10 +93,10 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
                        }
                }
        }
-       
+
        BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend");
        BKE_copybuffer_save(bmain, str, op->reports);
-       
+
        BKE_report(op->reports, RPT_INFO, "Copied selected objects to buffer");
 
        return OPERATOR_FINISHED;
@@ -104,12 +104,12 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
 
 static void VIEW3D_OT_copybuffer(wmOperatorType *ot)
 {
-       
+
        /* identifiers */
        ot->name = "Copy Selection to Buffer";
        ot->idname = "VIEW3D_OT_copybuffer";
        ot->description = "Selected objects are saved in a temp file";
-       
+
        /* api callbacks */
        ot->exec = view3d_copybuffer_exec;
        ot->poll = ED_operator_scene;
@@ -141,16 +141,16 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op)
 
 static void VIEW3D_OT_pastebuffer(wmOperatorType *ot)
 {
-       
+
        /* identifiers */
        ot->name = "Paste Selection from Buffer";
        ot->idname = "VIEW3D_OT_pastebuffer";
        ot->description = "Contents of copy buffer gets pasted";
-       
+
        /* api callbacks */
        ot->exec = view3d_pastebuffer_exec;
        ot->poll = ED_operator_scene_editable;
-       
+
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
@@ -209,10 +209,10 @@ void view3d_operatortypes(void)
        WM_operatortype_append(VIEW3D_OT_layers);
        WM_operatortype_append(VIEW3D_OT_copybuffer);
        WM_operatortype_append(VIEW3D_OT_pastebuffer);
-       
+
        WM_operatortype_append(VIEW3D_OT_properties);
        WM_operatortype_append(VIEW3D_OT_toolshelf);
-       
+
        WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
        WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
        WM_operatortype_append(VIEW3D_OT_snap_selected_to_active);
@@ -233,17 +233,17 @@ void view3d_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        wmKeyMapItem *kmi;
-       
+
        keymap = WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
 
        WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
-       
+
        /* only for region 3D window */
        keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
 
        WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_CLICK, 0, 0);
-       
+
        WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -259,20 +259,20 @@ void view3d_keymap(wmKeyConfig *keyconf)
        WM_keymap_verify_item(keymap, "VIEW3D_OT_navigate", FKEY, KM_PRESS, KM_SHIFT, 0);
 
        WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
-       
+
        WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEPAN, 0, KM_CTRL, 0);
-       
+
        /*numpad +/-*/
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
        /*ctrl +/-*/
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
-       
+
        /*wheel mouse forward/back*/
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
        RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
@@ -308,7 +308,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
        WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
-       
+
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
@@ -334,7 +334,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
-       
+
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELUPMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
 
@@ -357,7 +357,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
        RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
        RNA_boolean_set(kmi->ptr, "align_active", true);
-       
+
 #ifdef WITH_INPUT_NDOF
        /* note: positioned here so keymaps show keyboard keys if assigned */
        /* 3D mouse */
@@ -376,7 +376,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
-       
+
        /* 3D mouse align */
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
        RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
@@ -467,7 +467,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "deselect", true);
        WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
-       
+
        WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
 
@@ -477,19 +477,19 @@ void view3d_keymap(wmKeyConfig *keyconf)
        RNA_boolean_set(kmi->ptr, "camera_only", false);
 
        WM_keymap_add_item(keymap, "VIEW3D_OT_clear_render_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
-       
+
        WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT | KM_CTRL, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
-       
+
        WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
-       
+
 #ifdef __APPLE__
        WM_keymap_add_item(keymap, "VIEW3D_OT_copybuffer", CKEY, KM_PRESS, KM_OSKEY, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_pastebuffer", VKEY, KM_PRESS, KM_OSKEY, 0);
 #endif
        WM_keymap_add_item(keymap, "VIEW3D_OT_copybuffer", CKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_pastebuffer", VKEY, KM_PRESS, KM_CTRL, 0);
-       
+
        /* context ops */
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
        RNA_string_set(kmi->ptr, "data_path", "tool_settings.transform_pivot_point");