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
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')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c40
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
4 files changed, 31 insertions, 15 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);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 3e8bc71c351..846300ff9a6 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -144,7 +144,7 @@ void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
-void VIEW3D_OT_setobjectascamera(struct wmOperatorType *ot);
+void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot);
void VIEW3D_OT_fly(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index faeab482f72..22fab5887ee 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -83,7 +83,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_cursor3d);
WM_operatortype_append(VIEW3D_OT_select_lasso);
WM_operatortype_append(VIEW3D_OT_setcameratoview);
- WM_operatortype_append(VIEW3D_OT_setobjectascamera);
+ WM_operatortype_append(VIEW3D_OT_object_as_camera);
WM_operatortype_append(VIEW3D_OT_localview);
WM_operatortype_append(VIEW3D_OT_game_start);
WM_operatortype_append(VIEW3D_OT_fly);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 29d9986c093..d8982fb68ca 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -458,7 +458,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW3D_OT_setobjectascamera(wmOperatorType *ot)
+void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
{
/* identifiers */