Workbench: drawtype_* => drawtype_options, drawtype_lighting
authorJeroen Bakker <j.bakker@atmind.nl>
Fri, 20 Apr 2018 11:40:18 +0000 (13:40 +0200)
committerJeroen Bakker <j.bakker@atmind.nl>
Fri, 20 Apr 2018 11:40:18 +0000 (13:40 +0200)
In the new design the lighting is shared across the drawtypes.
the drawtype_options will be used for viewport draw engine settings

source/blender/blenloader/intern/versioning_280.c
source/blender/draw/engines/workbench/workbench_materials.c
source/blender/draw/intern/draw_manager.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index 0d781322d4feeee6901d74270bb7ae76702c1b7c..493bf17a552bf418fc978ca4744e795693b907ae 100644 (file)
@@ -903,8 +903,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
                                for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_VIEW3D) {
                                                View3D *v3d = (View3D *)sl;
-                                               v3d->drawtype_solid = V3D_LIGHTING_STUDIO;
-                                               v3d->drawtype_wireframe = V3D_LIGHTING_STUDIO;
+                                               v3d->drawtype_lighting = V3D_LIGHTING_STUDIO;
 
                                                /* Assume (demo) files written with 2.8 want to show
                                                 * Eevee renders in the viewport. */
index 43872e521ef2510921da80c11393f19bafda1262..801ee3069b3423ce5ba0b73ef9b884db7fa2da30 100644 (file)
@@ -106,11 +106,11 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata)
                switch (v3d->drawtype) {
                        default:
                        case OB_SOLID:
-                               wpd->drawtype_lighting = v3d->drawtype_solid;
+                               wpd->drawtype_lighting = v3d->drawtype_lighting;
                                break;
                }
 #else
-               wpd->drawtype_lighting = v3d->drawtype_solid;
+               wpd->drawtype_lighting = v3d->drawtype_lighting;
 #endif
        }
        else {
index b620d1875d8bddc83dba4efeb28175cf38ba34aa..dcc005d190af98ef947ac8329a0aedb60cc3a6a6 100644 (file)
@@ -895,19 +895,18 @@ static void drw_engines_enable_external(void)
 /* TODO revisit this when proper layering is implemented */
 /* Gather all draw engines needed and store them in DST.enabled_engines
  * That also define the rendering order of engines */
-static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int drawtype,
-                                           int UNUSED(drawtype_wireframe), int drawtype_solid, int UNUSED(drawtype_texture))
+static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int drawtype, int drawtype_lighting)
 {
        switch (drawtype) {
                case OB_WIRE:
                        break;
 
                case OB_SOLID:
-                       if (drawtype_solid == V3D_LIGHTING_FLAT) {
+                       if (drawtype_lighting == V3D_LIGHTING_FLAT) {
                                use_drw_engine(&draw_engine_workbench_solid_flat);
 
                        } 
-                       else if (drawtype_solid == V3D_LIGHTING_STUDIO) {
+                       else if (drawtype_lighting == V3D_LIGHTING_STUDIO) {
                                use_drw_engine(&draw_engine_workbench_solid_studio);
 
                        }
@@ -1004,11 +1003,9 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
        const int mode = CTX_data_mode_enum_ex(DST.draw_ctx.object_edit, obact, DST.draw_ctx.object_mode);
        View3D * v3d = DST.draw_ctx.v3d;
        const int drawtype = v3d->drawtype;
-       const int drawtype_wireframe = v3d->drawtype_wireframe;
-       const int drawtype_solid = v3d->drawtype_solid;
-       const int drawtype_texture = v3d->drawtype_texture;
+       const int drawtype_lighting = v3d->drawtype_lighting;
 
-       drw_engines_enable_from_engine(engine_type, drawtype, drawtype_wireframe, drawtype_solid, drawtype_texture);
+       drw_engines_enable_from_engine(engine_type, drawtype, drawtype_lighting);
 
        if (DRW_state_draw_support()) {
                drw_engines_enable_from_overlays(v3d->overlays);
index 337d9c004adec2190279d7b4a2ceed4f771bb267..bb521a1a3d9abfa619811c5665b5e6ca5e054a6f 100644 (file)
@@ -331,8 +331,7 @@ static SpaceLink *view3d_new(const bContext *C)
        v3d->gridlines = 16;
        v3d->gridsubdiv = 10;
        v3d->drawtype = OB_SOLID;
-       v3d->drawtype_solid = V3D_LIGHTING_STUDIO;
-       v3d->drawtype_texture = V3D_LIGHTING_STUDIO;
+       v3d->drawtype_lighting = V3D_LIGHTING_STUDIO;
 
        v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
        
index 563ff188f0d48315726e64022906ff005c4317a1..0aa9a1700c3550caf5d46f4b41f6097b994038dc 100644 (file)
@@ -306,7 +306,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
        /* Draw type */
        uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
        if (v3d->drawtype == OB_SOLID) {
-               uiItemR(layout, &v3dptr, "viewport_shade_solid", 0, "", ICON_NONE);
+               uiItemR(layout, &v3dptr, "viewport_lighting", 0, "", ICON_NONE);
        }
 
        row = uiLayoutRow(layout, true);
index 09710664e344e692d0d61d13d940ac11296b8c11..46eb8081af23575a4fefec15e7f44a8752bacf1d 100644 (file)
@@ -245,15 +245,13 @@ typedef struct View3D {
         * Runtime-only, set in the rendered viewport toggle operator.
         */
        short prev_drawtype;
-       /* drawtype subtype (visibility) used when drawtype == OB_WIRE */
-       short drawtype_wireframe;
-       /* drawtype subtype (lighting) used when drawtype == OB_SOLID */
-       short drawtype_solid;
-       /* drawtype subtype (lighting) used when drawtype == OB_TEXTURE */
-       short drawtype_texture;
+       /* drawtype options (lighting, random) used for drawtype == OB_SOLID */
+       short drawtype_lighting;
+       short drawtype_options;
+       short pad5;
 
        int overlays;
-       int pad5;
+       int pad6;
 
        View3DDebug debug;
 } View3D;
index 82c19e63e203f5dba06d466174bd2adc08b8ea23..6c96c5ff9daab095564584a22d23c41d9c0b7273 100644 (file)
@@ -2269,16 +2269,10 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");
 
-       prop = RNA_def_property(srna, "viewport_shade_solid", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "drawtype_solid");
+       prop = RNA_def_property(srna, "viewport_lighting", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "drawtype_lighting");
        RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
-       RNA_def_property_ui_text(prop, "Viewport Lighting (Solid)", "Lighting Method for Solid Viewport Shading");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");
-
-       prop = RNA_def_property(srna, "viewport_shade_texture", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "drawtype_texture");
-       RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
-       RNA_def_property_ui_text(prop, "Viewport Lighting (Texture)", "Lighting Method for Texture Viewport Shading");
+       RNA_def_property_ui_text(prop, "Viewport Lighting", "Lighting Method for Solid/Texture Viewport Shading");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");
 
        prop = RNA_def_property(srna, "show_face_orientation_overlay", PROP_BOOLEAN, PROP_NONE);