[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1699] contrib/py/scripts/addons/ space_view3d_screencast_keys.py: - Added option to set font colour ( idea by Bao2)

Bart Crouch bartius.crouch at gmail.com
Fri Mar 11 11:34:37 CET 2011


Revision: 1699
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1699
Author:   crouch
Date:     2011-03-11 10:34:35 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
- Added option to set font colour (idea by Bao2)
- Multiple keymodifiers are now displayed correctly (reported by Jonathan Williamson)

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

Modified: contrib/py/scripts/addons/space_view3d_screencast_keys.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_screencast_keys.py	2011-03-11 05:52:28 UTC (rev 1698)
+++ contrib/py/scripts/addons/space_view3d_screencast_keys.py	2011-03-11 10:34:35 UTC (rev 1699)
@@ -22,9 +22,9 @@
 bl_info = {
     'name': 'Display Keys Status for Screencasting',
     'author': 'Paulo Gomes, Bartius Crouch',
-    'version': (0, 8),
+    'version': (1, 0),
     'blender': (2, 5, 6),
-    'api': 35012,
+    'api': 35457,
     'location': 'View3D > Properties panel > Display tab',
     'warning': '',
     'description': 'Display keys pressed in the 3d-view, '\
@@ -36,8 +36,9 @@
     'category': '3D View'}
 
 
+import bgl
+import blf
 import bpy
-import blf
 import time
 
 
@@ -46,6 +47,8 @@
     if wm.display_keys:
         # draw text in the 3d-view
         blf.size(0, wm.display_font_size, 72)
+        r, g, b = wm.display_color
+        bgl.glColor3f(r, g, b)
         final = 0
         
         # only display key-presses of last 2 seconds
@@ -85,12 +88,12 @@
             # add key-press to display-list
             sc_keys = []
             
+            if event.ctrl:
+                sc_keys.append("Ctrl ")
+            if event.alt:
+                sc_keys.append("Alt ")
             if event.shift:
                 sc_keys.append("Shift ")
-            elif event.alt:
-                sc_keys.append("Alt ")
-            elif event.ctrl:
-                sc_keys.append("Ctrl ")
             
             if event.type not in ignore_keys:
                 sc_keys.append(event.type)
@@ -146,6 +149,13 @@
         name="Pos Y",
         description="Position of the font in y axis",
         default=60)
+    bpy.types.WindowManager.display_color = bpy.props.FloatVectorProperty(
+        name="Colour",
+        description="Font colour",
+        default=(1.0, 1.0, 1.0),
+        min=0,
+        max=1,
+        subtype='COLOR')
 
 
 # removal of properties when script is disabled
@@ -184,6 +194,9 @@
         row = col.row(align=True)
         row.prop(context.window_manager, "display_font_size")
         row.prop(context.window_manager, "display_mouse")
+        
+        row = self.layout.row()
+        row.prop(context.window_manager, "display_color")
 
 
 classes = [ScreencastKeysStatus,



More information about the Bf-extensions-cvs mailing list