Blender V5.3
view3d_navigate_walk.cc File Reference
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_enum_flags.hh"
#include "BLI_kdopbvh.hh"
#include "BLI_listbase.hh"
#include "BLI_math_matrix.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_math_rotation.hh"
#include "BLI_math_rotation_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_rect.hh"
#include "BLI_time.hh"
#include "BKE_camera.h"
#include "BKE_constraint.h"
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "BLT_translation.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_screen.hh"
#include "ED_space_api.hh"
#include "ED_transform_snap_object_context.hh"
#include "ED_undo.hh"
#include "UI_resources.hh"
#include "GPU_immediate.hh"
#include "view3d_intern.hh"
#include "view3d_navigate.hh"
#include <fmt/format.h>
#include "BLI_strict_flags.hh"

Go to the source code of this file.

Classes

struct  blender::WalkTeleport
struct  blender::WalkInfo

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define USE_TABLET_SUPPORT
#define JUMP_SPEED_MIN   1.0f
#define JUMP_TIME_MAX   0.2f
#define JUMP_SPEED_MAX   sqrtf(2.0f * walk->gravity * walk->jump_height)
#define JUMP_HEIGHT_FACTOR   1.5f
#define JUMP_HEIGHT_MIN   0.1f
#define JUMP_HEIGHT_MAX   10.0f
#define WALK_ROTATE_TABLET_FAC   8.8f
#define WALK_ROTATE_CONSTANT_FAC   DEG2RADF(0.15f)
#define WALK_TOP_LIMIT   DEG2RADF(85.0f)
#define WALK_BOTTOM_LIMIT   DEG2RADF(-80.0f)
#define WALK_MOVE_SPEED   (0 ? 0.0f : g_walk.base_speed)
#define WALK_JUMP_HEIGHT   (0 ? 0.0f : g_walk.jump_height)
#define WALK_BOOST_FACTOR   ((void)0, walk->speed_factor)
#define WALK_ZUP_CORRECT_FAC   0.1f
#define WALK_ZUP_CORRECT_ACCEL   0.05f

Enumerations

Internal Walk Structs
enum  blender::eWalkState { blender::WALK_RUNNING = 0 , blender::WALK_CANCEL = 1 , blender::WALK_CONFIRM = 2 }

Functions

Internal Walk Drawing
static int blender::walkApply (bContext *C, WalkInfo *walk, bool is_confirm)
static float blender::walk_calc_velocity_zero_time (const float gravity, const float velocity)
static void blender::drawWalkPixel (const bContext *, ARegion *region, void *arg)
Walk Operator
static void blender::walk_draw_status (bContext *C, wmOperator *op)
static wmOperatorStatus blender::walk_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::walk_cancel (bContext *C, wmOperator *op)
static wmOperatorStatus blender::walk_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::VIEW3D_OT_walk (wmOperatorType *ot)

Modal Key-map

enum  {
  blender::WALK_MODAL_CANCEL = 1 , blender::WALK_MODAL_CONFIRM , blender::WALK_MODAL_DIR_FORWARD , blender::WALK_MODAL_DIR_FORWARD_STOP ,
  blender::WALK_MODAL_DIR_BACKWARD , blender::WALK_MODAL_DIR_BACKWARD_STOP , blender::WALK_MODAL_DIR_LEFT , blender::WALK_MODAL_DIR_LEFT_STOP ,
  blender::WALK_MODAL_DIR_RIGHT , blender::WALK_MODAL_DIR_RIGHT_STOP , blender::WALK_MODAL_DIR_UP , blender::WALK_MODAL_DIR_UP_STOP ,
  blender::WALK_MODAL_DIR_DOWN , blender::WALK_MODAL_DIR_DOWN_STOP , blender::WALK_MODAL_FAST_ENABLE , blender::WALK_MODAL_FAST_DISABLE ,
  blender::WALK_MODAL_SLOW_ENABLE , blender::WALK_MODAL_SLOW_DISABLE , blender::WALK_MODAL_JUMP , blender::WALK_MODAL_JUMP_STOP ,
  blender::WALK_MODAL_TELEPORT , blender::WALK_MODAL_GRAVITY_TOGGLE , blender::WALK_MODAL_ACCELERATE , blender::WALK_MODAL_DECELERATE ,
  blender::WALK_MODAL_AXIS_LOCK_Z , blender::WALK_MODAL_INCREASE_JUMP , blender::WALK_MODAL_DECREASE_JUMP , blender::WALK_MODAL_DIR_LOCAL_UP ,
  blender::WALK_MODAL_DIR_LOCAL_UP_STOP , blender::WALK_MODAL_DIR_LOCAL_DOWN , blender::WALK_MODAL_DIR_LOCAL_DOWN_STOP
}
enum  blender::eWalkDirectionFlag {
  blender::WALK_BIT_LOCAL_FORWARD = 1 << 0 , blender::WALK_BIT_LOCAL_BACKWARD = 1 << 1 , blender::WALK_BIT_LOCAL_LEFT = 1 << 2 , blender::WALK_BIT_LOCAL_RIGHT = 1 << 3 ,
  blender::WALK_BIT_LOCAL_UP = 1 << 4 , blender::WALK_BIT_LOCAL_DOWN = 1 << 5 , blender::WALK_BIT_GLOBAL_UP = 1 << 6 , blender::WALK_BIT_GLOBAL_DOWN = 1 << 7
}
enum  blender::eWalkTeleportState { blender::WALK_TELEPORT_STATE_OFF = 0 , blender::WALK_TELEPORT_STATE_ON }
enum  blender::eWalkMethod { blender::WALK_MODE_FREE = 0 , blender::WALK_MODE_GRAVITY }
enum  blender::eWalkGravityState { blender::WALK_GRAVITY_STATE_OFF = 0 , blender::WALK_GRAVITY_STATE_JUMP , blender::WALK_GRAVITY_STATE_START , blender::WALK_GRAVITY_STATE_ON }
enum  blender::eWalkLockState { blender::WALK_AXISLOCK_STATE_OFF = 0 , blender::WALK_AXISLOCK_STATE_ACTIVE = 2 , blender::WALK_AXISLOCK_STATE_DONE = 3 }
void blender::walk_modal_keymap (wmKeyConfig *keyconf)

Internal Walk Logic

static struct  blender::g_walk
static void blender::walk_navigation_mode_set (WalkInfo *walk, eWalkMethod mode)
static bool blender::walk_floor_distance_get (RegionView3D *rv3d, WalkInfo *walk, const float dvec[3], float *r_distance)
static bool blender::walk_ray_cast (RegionView3D *rv3d, WalkInfo *walk, float r_location[3], float r_normal[3], float *r_ray_distance)
static bool blender::initWalkInfo (bContext *C, WalkInfo *walk, wmOperator *op, const int mval[2])
static wmOperatorStatus blender::walkEnd (bContext *C, WalkInfo *walk)
static void blender::walkEvent (WalkInfo *walk, const wmEvent *event)
static void blender::walkMoveCamera (bContext *C, WalkInfo *walk, const bool do_rotate, const bool do_translate, const bool is_confirm)
static float blender::walk_calc_free_fall_distance (const float gravity, const float time)

Detailed Description

Interactive walk navigation modal operator (similar to walking around in a first person game).

Defines #VIEW3D_OT_navigate, walk modal operator.

Note
Similar logic to view3d_navigate_fly.cc changes here may apply there too.

Definition in file view3d_navigate_walk.cc.

Macro Definition Documentation

◆ JUMP_HEIGHT_FACTOR

#define JUMP_HEIGHT_FACTOR   1.5f

Referenced by blender::walkEvent().

◆ JUMP_HEIGHT_MAX

#define JUMP_HEIGHT_MAX   10.0f

Referenced by blender::walkEvent().

◆ JUMP_HEIGHT_MIN

#define JUMP_HEIGHT_MIN   0.1f

Referenced by blender::walkEvent().

◆ JUMP_SPEED_MAX

#define JUMP_SPEED_MAX   sqrtf(2.0f * walk->gravity * walk->jump_height)

Referenced by blender::walkEvent().

◆ JUMP_SPEED_MIN

#define JUMP_SPEED_MIN   1.0f

Referenced by blender::walkEvent().

◆ JUMP_TIME_MAX

#define JUMP_TIME_MAX   0.2f

Referenced by blender::walkEvent().

◆ USE_TABLET_SUPPORT

#define USE_TABLET_SUPPORT

Definition at line 68 of file view3d_navigate_walk.cc.

◆ WALK_BOOST_FACTOR

#define WALK_BOOST_FACTOR   ((void)0, walk->speed_factor)

Referenced by blender::walkApply().

◆ WALK_BOTTOM_LIMIT

#define WALK_BOTTOM_LIMIT   DEG2RADF(-80.0f)

Referenced by blender::walkApply().

◆ WALK_JUMP_HEIGHT

#define WALK_JUMP_HEIGHT   (0 ? 0.0f : g_walk.jump_height)

Referenced by blender::walkApply().

◆ WALK_MOVE_SPEED

#define WALK_MOVE_SPEED   (0 ? 0.0f : g_walk.base_speed)

Referenced by blender::walkApply().

◆ WALK_ROTATE_CONSTANT_FAC

#define WALK_ROTATE_CONSTANT_FAC   DEG2RADF(0.15f)

Referenced by blender::walkApply().

◆ WALK_ROTATE_TABLET_FAC

#define WALK_ROTATE_TABLET_FAC   8.8f

Referenced by blender::walkApply().

◆ WALK_TOP_LIMIT

#define WALK_TOP_LIMIT   DEG2RADF(85.0f)

Referenced by blender::walkApply().

◆ WALK_ZUP_CORRECT_ACCEL

#define WALK_ZUP_CORRECT_ACCEL   0.05f

Referenced by blender::walkApply().

◆ WALK_ZUP_CORRECT_FAC

#define WALK_ZUP_CORRECT_FAC   0.1f

Referenced by blender::walkApply().