[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3637] contrib/py/scripts/addons/ space_view3d_enhanced_3d_cursor.py: Added (hacky) cursor visibility toggle

dima glib dima.glib at gmail.com
Thu Jul 19 21:13:11 CEST 2012


Revision: 3637
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3637
Author:   dairin0d
Date:     2012-07-19 19:13:11 +0000 (Thu, 19 Jul 2012)
Log Message:
-----------
Added (hacky) cursor visibility toggle

Modified Paths:
--------------
    contrib/py/scripts/addons/space_view3d_enhanced_3d_cursor.py

Modified: contrib/py/scripts/addons/space_view3d_enhanced_3d_cursor.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_enhanced_3d_cursor.py	2012-07-19 08:46:24 UTC (rev 3636)
+++ contrib/py/scripts/addons/space_view3d_enhanced_3d_cursor.py	2012-07-19 19:13:11 UTC (rev 3637)
@@ -3980,6 +3980,11 @@
         type=TransformExtraOptionsProp,
         options={'HIDDEN'})
     
+    cursor_visible = bpy.props.BoolProperty(
+        name="Cursor visibility",
+        description="Cursor visibility",
+        default=True)
+    
     draw_guides = bpy.props.BoolProperty(
         name="Guides",
         description="Display guides",
@@ -4140,7 +4145,12 @@
             text="", icon='SNAP_ON', toggle=True)
         
         row = layout.row()
-        row.label(text="Draw")
+        #row.label(text="Draw")
+        #row.prop(settings, "cursor_visible", text="", toggle=True,
+        #         icon=('RESTRICT_VIEW_OFF' if settings.cursor_visible
+        #               else 'RESTRICT_VIEW_ON'))
+        row.prop(settings, "cursor_visible", text="", toggle=True,
+                 icon='RESTRICT_VIEW_OFF')
         row = row.split(1 / 3, align=True)
         row.prop(settings, "draw_N",
             text="N", toggle=True, index=0)
@@ -5073,11 +5083,19 @@
 
 
 # ===== DRAWING CALLBACKS ===== #
+cursor_save_location = Vector()
+
 def draw_callback_view(self, context):
+    global cursor_save_location
+    
     settings = find_settings()
     if settings is None:
         return
     
+    cursor_save_location = Vector(bpy.context.space_data.cursor_location)
+    if not settings.cursor_visible:
+        bpy.context.space_data.cursor_location = Vector([float('nan')] * 3)
+    
     update_stick_to_obj(context)
     
     if "EDIT" not in context.mode:
@@ -5152,11 +5170,15 @@
     bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
 
 def draw_callback_px(self, context):
+    global cursor_save_location
     settings = find_settings()
     if settings is None:
         return
     library = settings.libraries.get_item()
     
+    if not settings.cursor_visible:
+        bpy.context.space_data.cursor_location = cursor_save_location
+    
     tfm_operator = CursorDynamicSettings.active_transform_operator
     
     if settings.show_bookmarks and library:



More information about the Bf-extensions-cvs mailing list