hidden wireframe option for mesh editmode, important for retopology mode (can be...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 20 Jul 2013 03:51:49 +0000 (03:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 20 Jul 2013 03:51:49 +0000 (03:51 +0000)
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/util/CMakeLists.txt
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index 2bbfd26f5f366213000768539d7ce5ca9cd122d5..fcd1529bb449cd993d2805b096cd85eceac64c52 100644 (file)
@@ -2580,6 +2580,8 @@ class VIEW3D_PT_view3d_display(Panel):
             if view.use_matcap:
                 col.template_icon_view(view, "matcap_icon")
         col.prop(view, "show_backface_culling")
+        if ob.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
+            col.prop(view, "show_occlude_wire")
 
         layout.separator()
 
index 5c46040a2f9af2189cf5f45cc4f76f81816c2ca0..7f7a97c68369117cb56e520fe286f141a38637f6 100644 (file)
@@ -3092,6 +3092,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
        BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, true); /* annoying but active faces is stored differently */
        BMEdge *eed_act = NULL;
        BMVert *eve_act = NULL;
+       bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
        
        // if (cageDM)  BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS));
        if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS));
@@ -3130,7 +3131,13 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                }
        }
        else if (dt > OB_WIRE) {
-               if (check_object_draw_texture(scene, v3d, dt)) {
+               if (use_occlude_wire) {
+                       glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+                       finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts,
+                                                GPU_enable_material, NULL, me->edit_btmesh, 0);
+                       glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+               }
+               else if (check_object_draw_texture(scene, v3d, dt)) {
                        if (draw_glsl_material(scene, ob, v3d, dt)) {
                                glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
@@ -3171,8 +3178,8 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                        finalDM->drawEdges(finalDM, 1, 0);
                }
        }
-       
-       if (me->drawflag & ME_DRAWFACES) {  /* transp faces */
+
+       if ((me->drawflag & ME_DRAWFACES) && (use_occlude_wire == false)) {  /* transp faces */
                unsigned char col1[4], col2[4], col3[4];
 #ifdef WITH_FREESTYLE
                unsigned char col4[4];
@@ -3311,6 +3318,11 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                bglPolygonOffset(rv3d->dist, 0.0);
                GPU_disable_material();
        }
+#if 0  /* currently not needed */
+       else if (use_occlude_wire) {
+               bglPolygonOffset(rv3d->dist, 0.0);
+       }
+#endif
 }
 
 /* Mesh drawing routines */
index ea5e806647fd05a91119c32ebbaad353a277b37a..e72385b311d92a1813cf91945cdc2838c9985f59 100644 (file)
@@ -47,6 +47,7 @@ set(SRC
        ../include/BIF_glutil.h
        ../include/ED_anim_api.h
        ../include/ED_armature.h
+       ../include/ED_buttons.h
        ../include/ED_clip.h
        ../include/ED_curve.h
        ../include/ED_datafiles.h
index fc67d2ddd7e9def84cd07a34367479d084d98b5a..5436b9debfa80ddba84fa828cf075b6a96a8683a 100644 (file)
@@ -279,6 +279,8 @@ typedef struct View3D {
 #define V3D_RENDER_BORDER              2048
 #define V3D_SOLID_MATCAP               4096    /* user flag */
 #define V3D_SHOW_SOLID_MATCAP  8192    /* runtime flag */
+#define V3D_OCCLUDE_WIRE               16384
+
 
 /* View3D->around */
 #define V3D_CENTER              0
index 2555e925eed0e85d8b27ea3e5cfc88c414969e43..f7a0d865274a1d28c5cf649acd90937f3dc47aae 100644 (file)
@@ -1921,6 +1921,11 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
+       prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE);
+       RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
        prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
        RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");