Fix/workarond for scenes rendered for sequencer preview

This is really a workaround which brings back direct display
list creation from drawing code. This is rather nasty to do
but proper solution would require some major sequencer redesign.
This commit is contained in:
Sergey Sharybin 2014-02-12 14:06:13 +06:00
parent 5b0f03323b
commit 2dd2bcf2de

@ -97,6 +97,19 @@
#include "view3d_intern.h" /* bad level include */
/* Workaround for sequencer scene render mode.
*
* Strips doesn't use DAG to update objects or so, which
* might lead to situations when object is drawing without
* curve cache ready.
*
* Ideally we don't want to evaluate objects from drawing,
* but it'll require some major sequencer re-design. So
* for now just fallback to legacy behaior with calling
* display ist creating from draw().
*/
#define SEQUENCER_DAG_WORKAROUND
typedef enum eWireDrawMode {
OBDRAW_WIRE_OFF = 0,
OBDRAW_WIRE_ON = 1,
@ -1892,6 +1905,27 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
}
}
#ifdef SEQUENCER_DAG_WORKAROUND
static void ensure_curve_cache(Scene *scene, Object *object)
{
if (object->curve_cache == NULL) {
switch (object->type) {
case OB_CURVE:
case OB_SURF:
case OB_FONT:
BKE_displist_make_curveTypes(scene, object, FALSE);
break;
case OB_MBALL:
BKE_displist_make_mball(G.main->eval_ctx, scene, object);
break;
case OB_LATTICE:
BKE_lattice_modifiers_calc(scene, object);
break;
}
}
}
#endif
/* lattice color is hardcoded, now also shows weightgroup values in edit mode */
static void drawlattice(View3D *v3d, Object *ob)
{
@ -4107,6 +4141,10 @@ static bool drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *ba
glCullFace(GL_BACK);
}
#ifdef SEQUENCER_DAG_WORKAROUND
ensure_curve_cache(scene, base->object);
#endif
retval = drawDispList_nobackface(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
if (v3d->flag2 & V3D_BACKFACE_CULLING) {
@ -6930,6 +6968,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
else if (dt == OB_BOUNDBOX) {
if ((render_override && v3d->drawtype >= OB_WIRE) == 0) {
#ifdef SEQUENCER_DAG_WORKAROUND
ensure_curve_cache(scene, base->object);
#endif
draw_bounding_volume(ob, ob->boundtype);
}
}
@ -6948,6 +6989,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
else if (dt == OB_BOUNDBOX) {
if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) {
#ifdef SEQUENCER_DAG_WORKAROUND
ensure_curve_cache(scene, base->object);
#endif
draw_bounding_volume(ob, ob->boundtype);
}
}
@ -6966,6 +7010,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
drawmball(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
else if (dt == OB_BOUNDBOX) {
if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) {
#ifdef SEQUENCER_DAG_WORKAROUND
ensure_curve_cache(scene, base->object);
#endif
draw_bounding_volume(ob, ob->boundtype);
}
}
@ -7008,6 +7055,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
draw_bounding_volume(ob, ob->boundtype);
}
else {
#ifdef SEQUENCER_DAG_WORKAROUND
ensure_curve_cache(scene, ob);
#endif
drawlattice(v3d, ob);
}
}