Blender
V3.3
|
#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 Object * | view3d_cameracontrol_object (const View3DCameraControl *vctrl) |
Object * | ED_view3d_cameracontrol_object_get (View3DCameraControl *vctrl) |
struct View3DCameraControl * | ED_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) |
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:
rv3d->ofs
, rv3d->viewquat
.Notes:
rv3d->dist
is set to zero (so rv3d->ofs
is always the view-point)Definition in file view3d_camera_control.c.
typedef struct View3DCameraControl View3DCameraControl |
struct View3DCameraControl* ED_view3d_cameracontrol_acquire | ( | struct Depsgraph * | depsgraph, |
struct Scene * | scene, | ||
View3D * | v3d, | ||
RegionView3D * | rv3d | ||
) |
Creates a View3DCameraControl handle and sets up the view for first-person style navigation.
Definition at line 102 of file view3d_camera_control.c.
References BKE_object_tfm_backup(), BKE_object_where_is_calc(), CAM_PERSP, View3D::camera, copy_qt_qt(), copy_v3_v3(), View3DCameraControl::ctx_rv3d, View3DCameraControl::ctx_scene, View3DCameraControl::ctx_v3d, Object::data, depsgraph, RegionView3D::dist, View3DCameraControl::dist_backup, ED_view3d_distance_set(), ED_view3d_to_m4(), View3DCameraControl::is_ortho_cam, RegionView3D::is_persp, MEM_callocN, negate_v3_v3(), NULL, OB_TRANSFORM_ADJUST_ROOT_PARENT_FOR_VIEW_LOCK, Object::obmat, View3DCameraControl::obtfm, RegionView3D::ofs, View3DCameraControl::ofs_backup, Object::parent, RegionView3D::persp, View3DCameraControl::persp_backup, View3DCameraControl::root_parent, View3DCameraControl::rot_backup, RV3D_CAMOB, RV3D_ORTHO, RV3D_PERSP, scene, Object::transflag, View3DCameraControl::use_parent_root, View3DCameraControl::view_mat_prev, and RegionView3D::viewquat.
Referenced by initFlyInfo(), and initWalkInfo().
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().
void ED_view3d_cameracontrol_release | ( | struct View3DCameraControl * | vctrl, |
bool | restore | ||
) |
Release view control.
restore | Sets the view state to the values that were set before #ED_view3d_control_acquire was called. |
Definition at line 296 of file view3d_camera_control.c.
References BKE_object_tfm_restore(), CAM_ORTHO, View3D::camera, copy_qt_qt(), copy_v3_v3(), View3DCameraControl::ctx_rv3d, View3DCameraControl::ctx_v3d, Object::data, DEG_id_tag_update(), RegionView3D::dist, View3DCameraControl::dist_backup, ED_view3d_distance_set(), Object::id, ID_RECALC_TRANSFORM, View3DCameraControl::is_ortho_cam, MEM_freeN, View3DCameraControl::obtfm, RegionView3D::ofs, View3DCameraControl::ofs_backup, RegionView3D::persp, View3DCameraControl::persp_backup, View3DCameraControl::rot_backup, RV3D_CAMOB, view3d_cameracontrol_object(), and RegionView3D::viewquat.
void ED_view3d_cameracontrol_update | ( | struct View3DCameraControl * | vctrl, |
bool | use_autokey, | ||
struct bContext * | C, | ||
bool | do_rotate, | ||
bool | do_translate | ||
) |
Updates cameras from the rv3d
values, optionally auto-keyframing.
Definition at line 225 of file view3d_camera_control.c.
References C, View3D::camera, copy_m4_m4(), copy_v3_v3(), View3DCameraControl::ctx_rv3d, View3DCameraControl::ctx_scene, View3DCameraControl::ctx_v3d, DEG_id_tag_update(), RegionView3D::dist, ED_view3d_camera_autokey(), ED_view3d_to_m4(), Object::id, ID_RECALC_TRANSFORM, invert_m4_m4(), mul_m4_m4m4(), object_apply_mat4_with_protect(), Object::obmat, RegionView3D::ofs, Object::parent, View3DCameraControl::root_parent, Object::scale, scene, size_to_mat4(), View3DCameraControl::view_mat_prev, and RegionView3D::viewquat.
Referenced by flyMoveCamera(), and walkMoveCamera().
|
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.
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().
BLI_INLINE Object* view3d_cameracontrol_object | ( | const View3DCameraControl * | vctrl | ) |
Definition at line 86 of file view3d_camera_control.c.
References View3D::camera, View3DCameraControl::ctx_v3d, and View3DCameraControl::root_parent.
Referenced by ED_view3d_cameracontrol_object_get(), and ED_view3d_cameracontrol_release().