Workbench: Show 3D Cursor Overlay
authorJeroen Bakker <j.bakker@atmind.nl>
Thu, 3 May 2018 08:55:28 +0000 (10:55 +0200)
committerJeroen Bakker <j.bakker@atmind.nl>
Thu, 3 May 2018 08:55:28 +0000 (10:55 +0200)
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenloader/intern/versioning_280.c
source/blender/draw/intern/draw_view.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index 2fa4061faaffa620389bfb19e9c4ad2d4554e84c..077af19da8cf16b408b2be0833756e57ed964143 100644 (file)
@@ -3594,13 +3594,17 @@ class VIEW3D_PT_overlay(Panel):
         overlay = view.overlay
         shading = view.shading
         scene = context.scene
+        display_all = overlay.show_overlays
 
         col = layout.column()
         col.prop(overlay, "show_overlays")
         col.separator()
-
         col.prop(view, "show_world")
 
+        col = layout.column()
+        col.active = display_all
+        col.prop(overlay, "show_3dcursor")
+
         if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
             engine_type = {
                 'PAINT_WEIGHT': 'WeightPaintMode',
@@ -3613,7 +3617,6 @@ class VIEW3D_PT_overlay(Panel):
             col.prop(view, "show_mode_shade_override")
 
         col = layout.column()
-        display_all = overlay.show_overlays
         col.active = display_all
         col.prop(view, "show_outline_selected")
         col.prop(view, "show_all_objects_origin")
index 07f51dfbc2f1971b4222f7510dffe92e53c9cd90..c9619137b9a070eddf5d9eb2cb9ac4706cb11cf6 100644 (file)
@@ -1068,6 +1068,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
                                                        }
                                                }
                                        }
+                                       if (sl->spacetype == SPACE_VIEW3D) {
+                                               View3D *v3d = (View3D *)sl;
+                                               v3d->overlays |= V3D_OVERLAY_3DCURSOR;
+                                       }
                                }
                        }
                }
index 42a81cd9839a10e203199e5d84a53f682f0d8eba..5a0c5d1f35c1c499f8a2eb6c768242159cd5f992 100644 (file)
@@ -614,6 +614,10 @@ void DRW_draw_background(void)
 static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer)
 {
        Object *ob = OBACT(view_layer);
+       View3D *v3d = draw_ctx->v3d;
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) > 0 || (v3d->overlays & V3D_OVERLAY_3DCURSOR) == 0) {
+               return false;
+       }
 
        /* don't draw cursor in paint modes, but with a few exceptions */
        if (ob && draw_ctx->object_mode & OB_MODE_ALL_PAINT) {
index c95ed9748438f4a5c4a5e48c633be97aa43b218a..086efbe9c34bcd101d0b95ae68d0319eba27b0b5 100644 (file)
@@ -323,6 +323,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
        v3d->gridsubdiv = 10;
        v3d->drawtype = OB_SOLID;
        v3d->drawtype_lighting = V3D_LIGHTING_STUDIO;
+       v3d->overlays = V3D_OVERLAY_3DCURSOR;
 
        v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
        
index 0644837727e3fd0a746b6e4ffaf78b7a2a4e24e2..545acf667b6edff954714712c72045da93b98eb0 100644 (file)
@@ -95,6 +95,7 @@ enum {
 
 enum {
        V3D_OVERLAY_FACE_ORIENTATION = (1 << 0),
+       V3D_OVERLAY_3DCURSOR         = (1 << 1),
 };
 
 typedef struct RegionView3D {
index 30c00b93867611b8ead774ac89988cc3b5fff4c1..8cef700e93419c2f01350a1b049f07f7f3f6eab8 100644 (file)
@@ -2252,6 +2252,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
        RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like manipulators and outlines");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+       prop = RNA_def_property(srna, "show_3dcursor", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "overlays", V3D_OVERLAY_3DCURSOR);
+       RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 }
 
 static void rna_def_space_view3d(BlenderRNA *brna)