Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-24 05:32:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-24 05:32:03 +0400
commitf148aa696ef069fb58c4b817ee980d36449a0e85 (patch)
tree46c6591e56b613bb2d9167d08e2919fce92b15de /source/blender/editors/space_view3d/view3d_edit.c
parenta732678217d5d7abf3d975f5eaad9de8ef3e3589 (diff)
bugfix [#22769] Undo Looses Active Camera
The problem was that the v3d could have a different camera to the scene even when locked. VIEW3D_OT_viewnumpad was ignoring v3d->scenelock option and allowing an invalid state.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index b07704cbf69..bce4a7e8f58 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1924,11 +1924,12 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
/* lastview - */
if(rv3d->persp != RV3D_CAMOB) {
+ Object *ob= OBACT;
if (!rv3d->smooth_timer) {
/* store settings of current view before allowing overwriting with camera view
* only if we're not currently in a view transition */
- QUATCOPY(rv3d->lviewquat, rv3d->viewquat);
+ copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
rv3d->lview= rv3d->view;
rv3d->lpersp= rv3d->persp;
}
@@ -1941,20 +1942,35 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
handle_view3d_lock();
}
#endif
-
- if(BASACT) {
- /* check both G.vd as G.scene cameras */
- if((v3d->camera==NULL || scene->camera==NULL) && OBACT->type==OB_CAMERA) {
- v3d->camera= OBACT;
- /*handle_view3d_lock();*/
+
+ /* first get the default camera for the view lock type */
+ if(v3d->scenelock) {
+ /* sets the camera view if available */
+ v3d->camera= scene->camera;
+ }
+ else {
+ /* use scene camera if one is not set (even though we're unlocked) */
+ if(v3d->camera==NULL) {
+ v3d->camera= scene->camera;
}
}
- if(v3d->camera==NULL) {
- v3d->camera= scene_find_camera(scene);
- if (v3d->camera == NULL)
- return OPERATOR_CANCELLED;
- }
+ /* if the camera isnt found, check a number of options */
+ if(v3d->camera==NULL && ob && ob->type==OB_CAMERA)
+ v3d->camera= ob;
+
+ if(v3d->camera==NULL)
+ v3d->camera= scene_find_camera(scene);
+
+ /* couldnt find any useful camera, bail out */
+ if(v3d->camera==NULL)
+ return OPERATOR_CANCELLED;
+
+ /* important these dont get out of sync for locked scenes */
+ if(v3d->scenelock)
+ scene->camera= v3d->camera;
+
+ /* finally do snazzy view zooming */
rv3d->persp= RV3D_CAMOB;
smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);