fix an error rendering opengl weightpaint data wasn't working when python initialized opengl render on startup (needed for testing script).

This commit is contained in:
Campbell Barton 2012-01-09 02:50:09 +00:00
parent eca9a4ff40
commit ecd463d20d
4 changed files with 38 additions and 17 deletions

@ -287,7 +287,8 @@ void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_
int ED_view3d_lock(struct RegionView3D *rv3d);
uint64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
uint64_t ED_viewedit_datamask(struct bScreen *screen);
uint64_t ED_view3d_screen_datamask(struct bScreen *screen);
uint64_t ED_view3d_object_datamask(struct Scene *scene);
/* camera lock functions */
int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);

@ -309,7 +309,13 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->rv3d= CTX_wm_region_view3d(C);
/* MUST be cleared on exit */
oglrender->scene->customdata_mask_modal= ED_view3d_datamask(oglrender->scene, oglrender->v3d);
oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) |
ED_view3d_object_datamask(oglrender->scene) );
/* apply immediately incase we're rendeing from a script,
* running notifiers again will overwrite */
oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
}
/* create render */

@ -2251,32 +2251,46 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
return mask;
}
CustomDataMask ED_view3d_object_datamask(Scene *scene)
{
Object *ob= scene->basact ? scene->basact->object : NULL;
CustomDataMask mask= 0;
if (ob) {
/* check if we need tfaces & mcols due to face select or texture paint */
if (paint_facesel_test(ob) || (ob->mode & OB_MODE_TEXTURE_PAINT)) {
mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
}
/* check if we need mcols due to vertex paint or weightpaint */
if (ob->mode & OB_MODE_VERTEX_PAINT) {
mask |= CD_MASK_MCOL;
}
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
mask |= CD_MASK_WEIGHT_MCOL;
}
}
return mask;
}
/* goes over all modes and view3d settings */
CustomDataMask ED_viewedit_datamask(bScreen *screen)
CustomDataMask ED_view3d_screen_datamask(bScreen *screen)
{
Scene *scene= screen->scene;
Object *ob= scene->basact ? scene->basact->object : NULL;
CustomDataMask mask = CD_MASK_BAREMESH;
ScrArea *sa;
/* check if we need tfaces & mcols due to face select or texture paint */
if(paint_facesel_test(ob) || (ob && ob->mode & OB_MODE_TEXTURE_PAINT))
mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
/* check if we need tfaces & mcols due to view mode */
for(sa = screen->areabase.first; sa; sa = sa->next) {
if(sa->spacetype == SPACE_VIEW3D) {
mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first);
}
}
/* check if we need mcols due to vertex paint or weightpaint */
if(ob) {
if(ob->mode & OB_MODE_VERTEX_PAINT)
mask |= CD_MASK_MCOL;
if(ob->mode & OB_MODE_WEIGHT_PAINT)
mask |= CD_MASK_WEIGHT_MCOL;
}
mask |= ED_view3d_object_datamask(scene);
return mask;
}

@ -282,7 +282,7 @@ void wm_event_do_notifiers(bContext *C)
/* combine datamasks so 1 win doesn't disable UV's in another [#26448] */
for(win= wm->windows.first; win; win= win->next) {
win_combine_v3d_datamask |= ED_viewedit_datamask(win->screen);
win_combine_v3d_datamask |= ED_view3d_screen_datamask(win->screen);
}
/* cached: editor refresh callbacks now, they get context */