Blender V4.3
view3d_camera_control.cc File Reference
#include "DNA_camera_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BKE_object.hh"
#include "DEG_depsgraph.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  View3DCameraControl
 

Functions

BLI_INLINE Objectview3d_cameracontrol_object (const View3DCameraControl *vctrl)
 
ObjectED_view3d_cameracontrol_object_get (View3DCameraControl *vctrl)
 
View3DCameraControlED_view3d_cameracontrol_acquire (Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d)
 
static bool object_apply_mat4_with_protect (Object *ob, const float obmat[4][4], const bool use_parent, RegionView3D *rv3d, const float view_mat[4][4])
 
void ED_view3d_cameracontrol_update (View3DCameraControl *vctrl, const bool use_autokey, bContext *C, const bool do_rotate, const bool do_translate)
 
void ED_view3d_cameracontrol_release (View3DCameraControl *vctrl, const bool restore)
 

Detailed Description

The purpose of View3DCameraControl is to allow editing rv3d manipulation (mainly ofs and viewquat) for the purpose of view navigation without having to worry about positioning the camera, its parent... or other details. Typical view-control usage:

Notes:

  • when acquiring rv3d->dist is set to zero (so rv3d->ofs is always the view-point)
  • updating can optionally keyframe the camera object.

Definition in file view3d_camera_control.cc.

Function Documentation

◆ ED_view3d_cameracontrol_acquire()

◆ ED_view3d_cameracontrol_object_get()

Object * ED_view3d_cameracontrol_object_get ( View3DCameraControl * vctrl)

Returns the object which is being manipulated or NULL.

Definition at line 101 of file view3d_camera_control.cc.

References View3DCameraControl::ctx_rv3d, RegionView3D::persp, RV3D_CAMOB, and view3d_cameracontrol_object().

Referenced by drawFlyPixel(), drawWalkPixel(), fly_modal(), initFlyInfo(), and walk_modal().

◆ ED_view3d_cameracontrol_release()

◆ ED_view3d_cameracontrol_update()

◆ object_apply_mat4_with_protect()

static bool object_apply_mat4_with_protect ( Object * ob,
const float obmat[4][4],
const bool use_parent,
RegionView3D * rv3d,
const float view_mat[4][4] )
static

A version of BKE_object_apply_mat4 that respects Object.protectflag, applying the locking back to the view to avoid the view. This is needed so the view doesn't get out of sync with the object, causing visible jittering when in fly/walk mode for e.g.

Note
This could be exposed as an API option, as we might not want the view to be constrained by the thing it's controlling.

Definition at line 194 of file view3d_camera_control.cc.

References BKE_object_apply_mat4(), BKE_object_tfm_protected_backup(), BKE_object_tfm_protected_restore(), BKE_object_to_mat4(), RegionView3D::dist, ED_view3d_from_m4(), equals_m4m4(), invert_m4_m4(), mul_m4_m4m4(), RegionView3D::ofs, Object::protectflag, and RegionView3D::viewquat.

Referenced by ED_view3d_cameracontrol_update().

◆ view3d_cameracontrol_object()