View3d: ensure locked views are on an axis - behavior wasn't well defined.
This commit is contained in:
parent
bfd0b582ca
commit
5c8d5c70cf
Notes:
blender-bot
2023-02-14 11:13:24 +01:00
Referenced by issue #38615, Blender Cycles Render results looking different at the BMW MikePan Benchmark File. Referenced by issue #38615, Blender Cycles Render results looking different at the BMW MikePan Benchmark File. Referenced by issue #38615, Blender Cycles Render results looking different at the BMW MikePan Benchmark File. Referenced by issue #38531, Quad view Unexpected Behaviour
|
@ -308,6 +308,7 @@ void ED_view3d_offscreen_sky_color_get(struct Scene *scene, float sky_color[3]);
|
|||
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
|
||||
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
|
||||
void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4]);
|
||||
char ED_view3d_lock_view_from_index(int index);
|
||||
bool ED_view3d_lock(struct RegionView3D *rv3d);
|
||||
|
||||
uint64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
|
||||
|
|
|
@ -2896,6 +2896,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
|
|||
/* lock views and set them */
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = sa->spacedata.first;
|
||||
int index_qsplit = 0;
|
||||
|
||||
/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
|
||||
* otherwise when restoring rv3d->localvd the 'viewquat' won't
|
||||
|
@ -2907,9 +2908,9 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
|
|||
const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ?
|
||||
(rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) : RV3D_LOCKED;
|
||||
|
||||
region_quadview_init_rv3d(sa, ar, viewlock, RV3D_VIEW_FRONT, RV3D_ORTHO);
|
||||
region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, RV3D_VIEW_TOP, RV3D_ORTHO);
|
||||
region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, RV3D_VIEW_RIGHT, RV3D_ORTHO);
|
||||
region_quadview_init_rv3d(sa, ar, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
|
||||
region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
|
||||
region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
|
||||
if (v3d->camera) region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB);
|
||||
else region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_PERSPORTHO, RV3D_PERSP);
|
||||
|
||||
|
|
|
@ -85,26 +85,6 @@
|
|||
/* for ndof prints */
|
||||
// #define DEBUG_NDOF_MOTION
|
||||
|
||||
/**
|
||||
* Mostly this function just checks ``rv3d->viewlock & RV3D_LOCKED`` however there is a
|
||||
* special case where the flag is set but the user already switched out of an axis locked view.
|
||||
*
|
||||
* The 'view' in the function name refers to #RegionView3D.view which we may be locked.
|
||||
*
|
||||
* Functions which change the 'view' should call this check first, or...
|
||||
* only apply to the user view (in the instance of a quad-view setup).
|
||||
*/
|
||||
bool ED_view3d_view_lock_check(View3D *UNUSED(v3d), RegionView3D *rv3d)
|
||||
{
|
||||
if (rv3d->viewlock & RV3D_LOCKED) {
|
||||
if ((RV3D_VIEW_IS_AXIS(rv3d->view) || rv3d->view == RV3D_VIEW_CAMERA)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ED_view3d_offset_lock_check(struct View3D *v3d, struct RegionView3D *rv3d)
|
||||
{
|
||||
return (rv3d->persp != RV3D_CAMOB) && (v3d->ob_centre_cursor || v3d->ob_centre);
|
||||
|
@ -410,6 +390,24 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
|
|||
view3d_boxview_copy(sa, ar_sync ? ar_sync : sa->regionbase.last);
|
||||
}
|
||||
|
||||
/* ensure locked regions have an axis, locked user views don't make much sense */
|
||||
if (viewlock & RV3D_LOCKED) {
|
||||
int index_qsplit = 0;
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar->alignment == RGN_ALIGN_QSPLIT) {
|
||||
rv3d = ar->regiondata;
|
||||
if (rv3d->viewlock) {
|
||||
if (!RV3D_VIEW_IS_AXIS(rv3d->view)) {
|
||||
rv3d->view = ED_view3d_lock_view_from_index(index_qsplit);
|
||||
rv3d->persp = RV3D_ORTHO;
|
||||
ED_view3d_lock(rv3d);
|
||||
}
|
||||
}
|
||||
index_qsplit++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1004,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
vod = op->customdata;
|
||||
|
||||
/* poll should check but in some cases fails, see poll func for details */
|
||||
if (ED_view3d_view_lock_check(vod->v3d, vod->rv3d)) {
|
||||
if (vod->rv3d->viewlock & RV3D_LOCKED) {
|
||||
viewops_data_free(C, op);
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
@ -2282,7 +2280,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
vod = op->customdata;
|
||||
|
||||
/* poll should check but in some cases fails, see poll func for details */
|
||||
if (ED_view3d_view_lock_check(vod->v3d, vod->rv3d)) {
|
||||
if (vod->rv3d->viewlock & RV3D_LOCKED) {
|
||||
viewops_data_free(C, op);
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
|
|
@ -803,6 +803,17 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
|
|||
mat3_to_quat(rv3d->viewquat, tmat);
|
||||
}
|
||||
|
||||
char ED_view3d_lock_view_from_index(int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0: return RV3D_VIEW_FRONT;
|
||||
case 1: return RV3D_VIEW_TOP;
|
||||
case 2: return RV3D_VIEW_RIGHT;
|
||||
default: return RV3D_VIEW_USER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool ED_view3d_lock(RegionView3D *rv3d)
|
||||
{
|
||||
switch (rv3d->view) {
|
||||
|
|
Loading…
Reference in New Issue