Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_walk.c
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| #include "PIL_time.h" /* smoothview */ | #include "PIL_time.h" /* smoothview */ | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "RE_engine.h" | |||||
| #include "view3d_intern.h" /* own include */ | #include "view3d_intern.h" /* own include */ | ||||
| #ifdef WITH_INPUT_NDOF | #ifdef WITH_INPUT_NDOF | ||||
| //# define NDOF_WALK_DEBUG | //# define NDOF_WALK_DEBUG | ||||
| //# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */ | //# define NDOF_WALK_DRAW_TOOMUCH /* is this needed for ndof? - commented so redraw doesnt thrash - campbell */ | ||||
| #endif | #endif | ||||
| #define USE_TABLET_SUPPORT | #define USE_TABLET_SUPPORT | ||||
| ▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | |||||
| typedef struct WalkInfo { | typedef struct WalkInfo { | ||||
| /* context stuff */ | /* context stuff */ | ||||
| RegionView3D *rv3d; | RegionView3D *rv3d; | ||||
| View3D *v3d; | View3D *v3d; | ||||
| ARegion *ar; | ARegion *ar; | ||||
| Scene *scene; | Scene *scene; | ||||
| SceneLayer *scene_layer; | SceneLayer *scene_layer; | ||||
| RenderEngineType *engine; | |||||
| wmTimer *timer; /* needed for redraws */ | wmTimer *timer; /* needed for redraws */ | ||||
| short state; | short state; | ||||
| bool redraw; | bool redraw; | ||||
| int prev_mval[2]; /* previous 2D mouse values */ | int prev_mval[2]; /* previous 2D mouse values */ | ||||
| int center_mval[2]; /* center mouse values */ | int center_mval[2]; /* center mouse values */ | ||||
| ▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| walk->rv3d = CTX_wm_region_view3d(C); | walk->rv3d = CTX_wm_region_view3d(C); | ||||
| walk->v3d = CTX_wm_view3d(C); | walk->v3d = CTX_wm_view3d(C); | ||||
| walk->ar = CTX_wm_region(C); | walk->ar = CTX_wm_region(C); | ||||
| walk->scene = CTX_data_scene(C); | walk->scene = CTX_data_scene(C); | ||||
| walk->scene_layer = CTX_data_scene_layer(C); | walk->scene_layer = CTX_data_scene_layer(C); | ||||
| walk->engine = CTX_data_engine(C); | |||||
| #ifdef NDOF_WALK_DEBUG | #ifdef NDOF_WALK_DEBUG | ||||
| puts("\n-- walk begin --"); | puts("\n-- walk begin --"); | ||||
| #endif | #endif | ||||
| /* sanity check: for rare but possible case (if lib-linking the camera fails) */ | /* sanity check: for rare but possible case (if lib-linking the camera fails) */ | ||||
| if ((walk->rv3d->persp == RV3D_CAMOB) && (walk->v3d->camera == NULL)) { | if ((walk->rv3d->persp == RV3D_CAMOB) && (walk->v3d->camera == NULL)) { | ||||
| walk->rv3d->persp = RV3D_PERSP; | walk->rv3d->persp = RV3D_PERSP; | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | #endif | ||||
| walk->time_lastdraw = PIL_check_seconds_timer(); | walk->time_lastdraw = PIL_check_seconds_timer(); | ||||
| walk->draw_handle_pixel = ED_region_draw_cb_activate(walk->ar->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL); | walk->draw_handle_pixel = ED_region_draw_cb_activate(walk->ar->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL); | ||||
| walk->rv3d->rflag |= RV3D_NAVIGATING; | walk->rv3d->rflag |= RV3D_NAVIGATING; | ||||
| walk->snap_context = ED_transform_snap_object_context_create_view3d( | walk->snap_context = ED_transform_snap_object_context_create_view3d( | ||||
| CTX_data_main(C), walk->scene, walk->scene_layer, 0, | CTX_data_main(C), walk->scene, walk->scene_layer, walk->engine, 0, | ||||
| walk->ar, walk->v3d); | walk->ar, walk->v3d); | ||||
| walk->v3d_camera_control = ED_view3d_cameracontrol_acquire( | walk->v3d_camera_control = ED_view3d_cameracontrol_acquire( | ||||
| C, walk->scene, walk->v3d, walk->rv3d, | C, walk->scene, walk->v3d, walk->rv3d, | ||||
| (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0); | (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0); | ||||
| /* center the mouse */ | /* center the mouse */ | ||||
| walk->center_mval[0] = walk->ar->winx * 0.5f; | walk->center_mval[0] = walk->ar->winx * 0.5f; | ||||
| ▲ Show 20 Lines • Show All 844 Lines • Show Last 20 Lines | |||||