Fix T52520: Metaballs in edit mode causes infinite Cycles viewport reset

The issue was introduced by eb016eb as a fix for T41258, which added depsgraph
tagging with zero flag. The comment was saying that it's to make derived caches
to be updated, however bot sure how that could possibly work: tagging ID for
update with 0 flag only sets updated tags in bmain in old dependency graph.

In the new depsgraph, where object data is a part of depsgraph, doing such a
tag forces object to be updated, which re-triggers viewport rendering, which
is causing such an infinite viewport render rest.

Can not reproduce any crashes here, so maybe it's fine to move on with this
change.
This commit is contained in:
Sergey Sharybin 2018-01-30 14:14:26 +01:00
parent c80b1f5410
commit b3c4a2a8da
Notes: blender-bot 2023-05-03 10:14:48 +02:00
Referenced by issue #52520, Viewport Shading (rendered) is wrong with Cycles for metaball on Edit Mode (with "--enable-new-depsgraph")
6 changed files with 8 additions and 17 deletions

View File

@ -452,7 +452,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx,
/* render */
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
void ED_view3d_shade_update(struct Main *bmain, struct Scene *scene, struct View3D *v3d, struct ScrArea *sa);
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
#define V3D_IS_ZBUF(v3d) \
(((v3d)->flag & V3D_ZBUF_SELECT) && ((v3d)->drawtype > OB_WIRE))

View File

@ -398,11 +398,6 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
if (freedata) ED_mball_editmball_free(obedit);
}
/* Tag update so no access to freed data referenced from
* derived cache will happen.
*/
DAG_id_tag_update((ID *)obedit->data, 0);
return true;
}

View File

@ -290,7 +290,7 @@ void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *ar)
}
}
void ED_view3d_shade_update(Main *bmain, Scene *scene, View3D *v3d, ScrArea *sa)
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa)
{
wmWindowManager *wm = bmain->wm.first;
@ -302,10 +302,6 @@ void ED_view3d_shade_update(Main *bmain, Scene *scene, View3D *v3d, ScrArea *sa)
ED_view3d_stop_render_preview(wm, ar);
}
}
else if (scene->obedit != NULL && scene->obedit->type == OB_MESH) {
/* Tag mesh to load edit data. */
DAG_id_tag_update(scene->obedit->data, 0);
}
}
/* ******************** default callbacks for view3d space ***************** */

View File

@ -4729,7 +4729,7 @@ static int toggle_render_exec(bContext *C, wmOperator *UNUSED(op))
v3d->prev_drawtype = v3d->drawtype;
v3d->drawtype = OB_RENDER;
}
ED_view3d_shade_update(CTX_data_main(C), CTX_data_scene(C), v3d, CTX_wm_area(C));
ED_view3d_shade_update(CTX_data_main(C), v3d, CTX_wm_area(C));
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
}

View File

@ -1164,7 +1164,7 @@ static bool view3d_localview_init(
return ok;
}
static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmain, Scene *scene, ScrArea *sa, const int smooth_viewtx)
static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmain, ScrArea *sa, const int smooth_viewtx)
{
const bool free = true;
ARegion *ar;
@ -1214,7 +1214,7 @@ static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmai
}
}
ED_view3d_shade_update(bmain, scene, v3d, sa);
ED_view3d_shade_update(bmain, v3d, sa);
}
}
}
@ -1231,7 +1231,7 @@ static bool view3d_localview_exit(
locallay = v3d->lay & 0xFF000000;
restore_localviewdata(wm, win, bmain, scene, sa, smooth_viewtx);
restore_localviewdata(wm, win, bmain, sa, smooth_viewtx);
/* for when in other window the layers have changed */
if (v3d->scenelock) v3d->lay = scene->lay;

View File

@ -535,12 +535,12 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin
DAG_on_visible_update(bmain, false);
}
static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
View3D *v3d = (View3D *)(ptr->data);
ScrArea *sa = rna_area_from_space(ptr);
ED_view3d_shade_update(bmain, scene, v3d, sa);
ED_view3d_shade_update(bmain, v3d, sa);
}
static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)