[#26482] Solidify / Animation Opengl render. no texture.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 13 Mar 2011 02:44:25 +0000 (02:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 13 Mar 2011 02:44:25 +0000 (02:44 +0000)
workaround for view3d datamask not being correct on opengl render.

source/blender/blenloader/intern/readfile.c
source/blender/editors/include/ED_view3d.h
source/blender/editors/render/render_opengl.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_scene_types.h
source/blender/windowmanager/intern/wm_event_system.c

index eb5d2de738394634b0c3e9efb9d3ef06a6451008..1146f844b5e3d512fd9dc60aca0f95b5ad357496 100644 (file)
@@ -4469,6 +4469,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
        sce->obedit= NULL;
        sce->stats= NULL;
        sce->fps_info= NULL;
+       sce->customdata_mask_modal= 0;
 
        sound_create_scene(sce);
 
index 9b70b655b3d3346e935ed31ab12f37b079c85851..a48e311ae9798e0b262aeb72bec843ca9b12ba74 100644 (file)
@@ -179,6 +179,7 @@ Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval);
 void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
 int ED_view3d_lock(struct RegionView3D *rv3d);
 
+unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
 unsigned int ED_viewedit_datamask(struct bScreen *screen);
 
 #endif /* ED_VIEW3D_H */
index 43fb41a5e3d28fd389e159f2045c7c31dade19c2..364b080523733dbc6318c901de3b524c81b1aeb8 100644 (file)
@@ -294,6 +294,9 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
                oglrender->v3d= CTX_wm_view3d(C);
                oglrender->ar= CTX_wm_region(C);
                oglrender->rv3d= CTX_wm_region_view3d(C);
+
+               /* MUST be cleared on exit */
+               oglrender->scene->customdata_mask_modal= ED_view3d_datamask(oglrender->scene, oglrender->v3d);
        }
 
        /* create image and image user */
@@ -337,6 +340,8 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
 
        GPU_offscreen_free(oglrender->ofs);
 
+       oglrender->scene->customdata_mask_modal= 0;
+
        MEM_freeN(oglrender);
 }
 
index 6e286578dad29412e94412480782b4555e85a1ed..dadc51b89fe0248bfcb1d5e35cc155b7297ae5e4 100644 (file)
@@ -1943,6 +1943,22 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 
 /* *********************** customdata **************** */
 
+CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
+{
+       CustomDataMask mask= 0;
+       if(v3d->drawtype == OB_SHADED) {
+               /* this includes normals for mesh_create_shadedColors */
+               mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
+       }
+       if((v3d->drawtype == OB_TEXTURE) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) {
+               mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
+
+               if(scene->gm.matmode == GAME_MAT_GLSL)
+                       mask |= CD_MASK_ORCO;
+       }
+
+       return mask;
+}
 /* goes over all modes and view3d settings */
 CustomDataMask ED_viewedit_datamask(bScreen *screen)
 {
@@ -1958,17 +1974,7 @@ CustomDataMask ED_viewedit_datamask(bScreen *screen)
        /* check if we need tfaces & mcols due to view mode */
        for(sa = screen->areabase.first; sa; sa = sa->next) {
                if(sa->spacetype == SPACE_VIEW3D) {
-                       View3D *view = sa->spacedata.first;
-                       if(view->drawtype == OB_SHADED) {
-                               /* this includes normals for mesh_create_shadedColors */
-                               mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
-                       }
-                       if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) {
-                               mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
-
-                               if(scene->gm.matmode == GAME_MAT_GLSL)
-                                       mask |= CD_MASK_ORCO;
-                       }
+                       mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first);
                }
        }
        
index 00818f3b92c9a1f9345f5a6c1fe3a0a9374cf2c6..cc35658b63f8a265919e14cc8e0d91487ea13b10 100644 (file)
@@ -784,6 +784,8 @@ typedef struct Scene {
        unsigned int lay;                       /* bitflags for layer visibility */
        int layact;             /* active layer */
        unsigned int customdata_mask;   /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */
+       unsigned int customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
+       unsigned int pad4;
        
        short flag;                                                             /* various settings */
        
index e7bbdf074074c725f9db7c32e666e053cc0dac36..20f9a4b7a517cee77f1d34d6a69d55804925a2a8 100644 (file)
@@ -313,6 +313,9 @@ void wm_event_do_notifiers(bContext *C)
                        /* copied to set's in scene_update_tagged_recursive() */
                        win->screen->scene->customdata_mask= win_combine_v3d_datamask;
 
+                       /* XXX, hack so operators can enforce datamasks [#26482], gl render */
+                       win->screen->scene->customdata_mask |= win->screen->scene->customdata_mask_modal;
+
                        scene_update_tagged(CTX_data_main(C), win->screen->scene);
                }
        }