Blender  V3.3
Classes | Typedefs | Functions
view3d_camera_control.c File Reference
#include "DNA_camera_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_object.h"
#include "DEG_depsgraph.h"
#include "view3d_intern.h"

Go to the source code of this file.

Classes

struct  View3DCameraControl
 

Typedefs

typedef struct View3DCameraControl View3DCameraControl
 

Functions

BLI_INLINE Objectview3d_cameracontrol_object (const View3DCameraControl *vctrl)
 
ObjectED_view3d_cameracontrol_object_get (View3DCameraControl *vctrl)
 
struct 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, struct 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:

Definition in file view3d_camera_control.c.

Typedef Documentation

◆ View3DCameraControl

Function Documentation

◆ ED_view3d_cameracontrol_acquire()

struct View3DCameraControl* ED_view3d_cameracontrol_acquire ( struct Depsgraph depsgraph,
struct Scene scene,
View3D v3d,
RegionView3D rv3d 
)

◆ ED_view3d_cameracontrol_object_get()

Object* ED_view3d_cameracontrol_object_get ( struct View3DCameraControl vctrl)

Returns the object which is being manipulated or NULL.

Definition at line 91 of file view3d_camera_control.c.

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

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

◆ ED_view3d_cameracontrol_release()

void ED_view3d_cameracontrol_release ( struct View3DCameraControl vctrl,
bool  restore 
)

◆ ED_view3d_cameracontrol_update()

void ED_view3d_cameracontrol_update ( struct View3DCameraControl vctrl,
bool  use_autokey,
struct bContext C,
bool  do_rotate,
bool  do_translate 
)

◆ 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 184 of file view3d_camera_control.c.

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(), View3DCameraControl::obtfm, RegionView3D::ofs, Object::protectflag, and RegionView3D::viewquat.

Referenced by ED_view3d_cameracontrol_update().

◆ view3d_cameracontrol_object()

BLI_INLINE Object* view3d_cameracontrol_object ( const View3DCameraControl vctrl)