Fix camera snapping in camera View

The `T_CAMERA` flag was being set in the wrong place.
This commit is contained in:
Germano Cavalcante 2020-06-23 16:14:06 -03:00
parent 11a390e85e
commit ede1a247d8
1 changed files with 14 additions and 15 deletions

View File

@ -1148,21 +1148,6 @@ void createTransData(bContext *C, TransInfo *t)
}
t->flag |= T_OBJECT;
/* Check if we're transforming the camera from the camera */
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
View3D *v3d = t->view;
RegionView3D *rv3d = t->region->regiondata;
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) {
/* we could have a flag to easily check an object is being transformed */
if (v3d->camera->id.tag & LIB_TAG_DOIT) {
t->flag |= T_CAMERA;
}
}
else if (v3d->ob_center && v3d->ob_center->id.tag & LIB_TAG_DOIT) {
t->flag |= T_CAMERA;
}
}
convert_type = TC_OBJECT;
}
@ -1224,6 +1209,20 @@ void createTransData(bContext *C, TransInfo *t)
break;
case TC_OBJECT:
createTransObject(C, t);
/* Check if we're transforming the camera from the camera */
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
View3D *v3d = t->view;
RegionView3D *rv3d = t->region->regiondata;
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) {
/* we could have a flag to easily check an object is being transformed */
if (v3d->camera->id.tag & LIB_TAG_DOIT) {
t->flag |= T_CAMERA;
}
}
else if (v3d->ob_center && v3d->ob_center->id.tag & LIB_TAG_DOIT) {
t->flag |= T_CAMERA;
}
}
break;
case TC_OBJECT_TEXSPACE:
createTransTexspace(t);