Cleanup: avoid passing bContext to cameracontrol
This commit is contained in:
@@ -138,13 +138,10 @@ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl)
|
||||
* the view for first-person style navigation.
|
||||
*/
|
||||
struct View3DCameraControl *ED_view3d_cameracontrol_acquire(
|
||||
const bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d,
|
||||
const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d,
|
||||
const bool use_parent_root)
|
||||
{
|
||||
View3DCameraControl *vctrl;
|
||||
EvaluationContext eval_ctx;
|
||||
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
vctrl = MEM_callocN(sizeof(View3DCameraControl), __func__);
|
||||
|
||||
@@ -181,7 +178,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(
|
||||
/* store the original camera loc and rot */
|
||||
vctrl->obtfm = BKE_object_tfm_backup(ob_back);
|
||||
|
||||
BKE_object_where_is_calc(&eval_ctx, scene, v3d->camera);
|
||||
BKE_object_where_is_calc(eval_ctx, scene, v3d->camera);
|
||||
negate_v3_v3(rv3d->ofs, v3d->camera->obmat[3]);
|
||||
|
||||
rv3d->dist = 0.0;
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
#include "GPU_immediate.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "view3d_intern.h" /* own include */
|
||||
|
||||
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
|
||||
@@ -344,6 +346,10 @@ enum {
|
||||
static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
EvaluationContext eval_ctx;
|
||||
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
rctf viewborder;
|
||||
|
||||
float upvec[3]; /* tmp */
|
||||
@@ -419,7 +425,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
|
||||
}
|
||||
|
||||
fly->v3d_camera_control = ED_view3d_cameracontrol_acquire(
|
||||
C, fly->scene, fly->v3d, fly->rv3d,
|
||||
&eval_ctx, fly->scene, fly->v3d, fly->rv3d,
|
||||
(U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
|
||||
|
||||
/* calculate center */
|
||||
|
||||
@@ -296,7 +296,7 @@ void view3d_buttons_register(struct ARegionType *art);
|
||||
|
||||
/* view3d_camera_control.c */
|
||||
struct View3DCameraControl *ED_view3d_cameracontrol_acquire(
|
||||
const struct bContext *C, Scene *scene, View3D *v3d, RegionView3D *rv3d,
|
||||
const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d,
|
||||
const bool use_parent_root);
|
||||
void ED_view3d_cameracontrol_update(
|
||||
struct View3DCameraControl *vctrl,
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
|
||||
#include "RE_engine.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "view3d_intern.h" /* own include */
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
@@ -510,6 +512,9 @@ static float userdef_speed = -1.f;
|
||||
static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
EvaluationContext eval_ctx;
|
||||
|
||||
CTX_data_eval_ctx(C, &eval_ctx);
|
||||
|
||||
walk->rv3d = CTX_wm_region_view3d(C);
|
||||
walk->v3d = CTX_wm_view3d(C);
|
||||
@@ -610,7 +615,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
|
||||
walk->ar, walk->v3d);
|
||||
|
||||
walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(
|
||||
C, walk->scene, walk->v3d, walk->rv3d,
|
||||
&eval_ctx, walk->scene, walk->v3d, walk->rv3d,
|
||||
(U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
|
||||
|
||||
/* center the mouse */
|
||||
|
||||
Reference in New Issue
Block a user