forked from bartvdbraak/blender
Fix #22317 View reamins in camera's view after camera is deleted (again)
The problem was not in the editors, the code in blenkernel have a XXX in the perspective value. Now unlink_object also update the ARegion.
This commit is contained in:
parent
1a36867017
commit
e2bc4ca9ce
@ -320,6 +320,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec
|
||||
ob->recalc |= OB_RECALC;
|
||||
}
|
||||
}
|
||||
|
||||
void unlink_object(Scene *scene, Object *ob)
|
||||
{
|
||||
Object *obt;
|
||||
@ -334,6 +335,8 @@ void unlink_object(Scene *scene, Object *ob)
|
||||
bConstraint *con;
|
||||
//bActionStrip *strip; // XXX animsys
|
||||
ModifierData *md;
|
||||
ARegion *ar;
|
||||
RegionView3D *rv3d;
|
||||
int a;
|
||||
|
||||
unlink_controllers(&ob->controllers);
|
||||
@ -606,17 +609,27 @@ void unlink_object(Scene *scene, Object *ob)
|
||||
while(sa) {
|
||||
SpaceLink *sl;
|
||||
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
for (ar= sa->regionbase.first; ar; ar= ar->next) {
|
||||
if (ar->regiontype==RGN_TYPE_WINDOW) {
|
||||
rv3d= (RegionView3D *)ar->regiondata;
|
||||
if (rv3d->persp == RV3D_CAMOB)
|
||||
rv3d->persp= RV3D_PERSP;
|
||||
if (rv3d->localvd && rv3d->localvd->persp == RV3D_CAMOB)
|
||||
rv3d->localvd->persp= RV3D_PERSP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
||||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *v3d= (View3D*) sl;
|
||||
|
||||
if(v3d->camera==ob) {
|
||||
v3d->camera= NULL;
|
||||
// XXX if(v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP;
|
||||
}
|
||||
if(v3d->localvd && v3d->localvd->camera==ob ) {
|
||||
v3d->localvd->camera= NULL;
|
||||
// XXX if(v3d->localvd->persp==V3D_CAMOB) v3d->localvd->persp= V3D_PERSP;
|
||||
}
|
||||
}
|
||||
else if(sl->spacetype==SPACE_OUTLINER) {
|
||||
|
@ -826,8 +826,6 @@ void ED_base_object_free_and_unlink(Scene *scene, Base *base)
|
||||
static int object_delete_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d= CTX_wm_region_view3d(C);
|
||||
int islamp= 0;
|
||||
|
||||
if(CTX_data_edit_object(C))
|
||||
@ -836,17 +834,6 @@ static int object_delete_exec(bContext *C, wmOperator *op)
|
||||
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
|
||||
|
||||
if(base->object->type==OB_LAMP) islamp= 1;
|
||||
else if (base->object->type == OB_CAMERA) {
|
||||
/* If we don't reset this, Blender crash
|
||||
* in fly mode because still have the
|
||||
* old object here!.
|
||||
* See Bug #22317
|
||||
*/
|
||||
if (v3d && rv3d && rv3d->persp == RV3D_CAMOB && base->object == v3d->camera) {
|
||||
rv3d->persp= RV3D_PERSP;
|
||||
v3d->camera= NULL;
|
||||
}
|
||||
}
|
||||
/* remove from current scene only */
|
||||
ED_base_object_free_and_unlink(scene, base);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user