[Bf-extensions-cvs] [d406b40] master: Removing screencast keys addons

Campbell Barton noreply at git.blender.org
Sun Jun 29 07:00:59 CEST 2014


Commit: d406b40b023409ff657c24a6e56e0660d83caddf
Author: Campbell Barton
Date:   Sun Jun 29 14:58:33 2014 +1000
https://developer.blender.org/rBAd406b40b023409ff657c24a6e56e0660d83caddf

Removing screencast keys addons

To properly support this functionality we would need to extend our API's
and there are better, dedicated tools to do this on each platform.

===================================================================

D	space_view3d_screencast_keys.py

===================================================================

diff --git a/space_view3d_screencast_keys.py b/space_view3d_screencast_keys.py
deleted file mode 100644
index 8232b05..0000000
--- a/space_view3d_screencast_keys.py
+++ /dev/null
@@ -1,898 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-bl_info = {
-    "name": "Screencast Keys",
-    "author": "Paulo Gomes, Bart Crouch, John E. Herrenyo, Gaia Clary, Pablo Vazquez",
-    "version": (1, 7),
-    "blender": (2, 66, 0),
-    "location": "3D View > Properties Panel > Screencast Keys",
-    "warning": "",
-    "description": "Display keys pressed in the 3D View, "
-       "useful for screencasts.",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
-                "Scripts/3D_interaction/Screencast_Key_Status_Tool",
-    "category": "3D View",
-}
-
-import bgl
-import blf
-import bpy
-import time
-import datetime
-
-
-MOUSE_RATIO = 0.535
-
-
-def getDisplayLocation(context):
-    scene   = context.scene
-    mouse_size = scene.screencast_keys_mouse_size
-
-    pos_x = int( (context.region.width  - mouse_size * MOUSE_RATIO) * \
-        scene.screencast_keys_pos_x / 100)
-    pos_y = int( (context.region.height - mouse_size) *
-        scene.screencast_keys_pos_y / 100)
-
-    return(pos_x, pos_y)
-
-
-def getBoundingBox(current_width, current_height, new_text):
-    w, h = blf.dimensions(0, new_text)
-    if w > current_width:
-        current_width = w
-    current_height += h
-
-    return(current_width, current_height)
-
-
-def draw_callback_px_text(self, context):
-    wm = context.window_manager
-    sc = context.scene
-    if not wm.screencast_keys_keys:
-        return
-
-    font_size  = sc.screencast_keys_font_size
-    mouse_size = sc.screencast_keys_mouse_size
-    box_draw   = sc.screencast_keys_box_draw
-    pos_x, pos_y = getDisplayLocation(context)
-    label_time_max = sc.screencast_keys_fade_time
-
-    # draw text in the 3D View
-    blf.size(0, sc.screencast_keys_font_size, 72)
-    blf.enable(0, blf.SHADOW)
-    blf.shadow_offset(0, 1, -1)
-    blf.shadow(0, 5, 0.0, 0.0, 0.0, 0.8)
-
-    font_color_r, font_color_g, font_color_b, font_color_alpha = sc.screencast_keys_text_color
-    final = 0
-    row_count = len(self.key)
-
-    keypos_x = pos_x
-
-    if sc.screencast_keys_mouse_position == 'left':
-        keypos_x += mouse_size * MOUSE_RATIO * 1.7
-    if sc.screencast_keys_mouse != 'icon':
-        keypos_x -= mouse_size * MOUSE_RATIO
-    if sc.screencast_keys_mouse_position == 'right' and sc.screencast_keys_mouse != 'icon':
-        keypos_x = pos_x
-
-    shift = 0
-
-    # we want to make sure we can shift vertically the text if the mouse is big,
-    # but don't care if aligned to right
-    if mouse_size > font_size*row_count and not sc.screencast_keys_mouse_position == 'right':
-        shift = (mouse_size - font_size*row_count) / 2
-
-    text_width = 0
-    text_height = 0
-    row_count = 0
-    alpha = 1.0
-
-    for i in range(len(self.key)):
-        label_time = time.time() - self.time[i]
-        if label_time < label_time_max: # only display key-presses of last 2 seconds
-            if label_time > (label_time_max / 1.2):
-                blf.blur(0, 1)
-            if label_time > (label_time_max / 1.1):
-                blf.blur(0, 3)
-            keypos_y = pos_y + shift + font_size*(i+0.1)
-
-            blf.position(0, keypos_x, keypos_y , 0)
-            alpha = min(1.0, max(0.0, label_time_max * (label_time_max - label_time)))
-            bgl.glColor4f(font_color_r, font_color_g, font_color_b, font_color_alpha * alpha)
-            blf.draw(0, self.key[i])
-            text_width, text_height = getBoundingBox(text_width, text_height,
-                self.key[i])
-            row_count += 1
-            final = i + 1
-        else:
-            break
-
-    # remove blurriness
-
-    # disable shadows so they don't appear all over blender
-    blf.blur(0,0)
-    blf.disable(0, blf.SHADOW)
-
-    # get rid of status texts that aren't displayed anymore
-    self.key = self.key[:final]
-    self.time = self.time[:final]
-
-    # draw graphical representation of the mouse
-    if sc.screencast_keys_mouse == 'icon':
-        for shape in ["mouse", "left_button", "middle_button", "right_button"]:
-            draw_mouse(context, shape, "outline", font_color_alpha * 0.4)
-        final = 0
-
-        for i in range(len(self.mouse)):
-            click_time = time.time() - self.mouse_time[i]
-            if click_time < 2:
-                shape = map_mouse_event(self.mouse[i])
-                if shape:
-                    alpha = min(1.0, max(0.0, 2 * (2 - click_time)))
-                    draw_mouse(context, shape, "filled", alpha)
-                final = i + 1
-            else:
-                break
-
-    # get rid of mouse clicks that aren't displayed anymore
-    self.mouse = self.mouse[:final]
-    self.mouse_time = self.mouse_time[:final]
-
-def draw_callback_px_box(self, context):
-    wm = context.window_manager
-    sc = context.scene
-
-    if not wm.screencast_keys_keys:
-        return
-
-    font_size  = sc.screencast_keys_font_size
-    mouse_size = sc.screencast_keys_mouse_size
-
-    if sc.screencast_keys_mouse_position == 'right':
-        mouse_size = 25
-
-    box_draw = sc.screencast_keys_box_draw
-    pos_x, pos_y = getDisplayLocation(context)
-
-    # get text-width/height to resize the box
-    blf.size(0, sc.screencast_keys_font_size, 72)
-    box_width_user = sc.screencast_keys_box_width
-    box_width = 0
-    box_height = 0
-    final = 0
-    row_count = 0
-    box_hide = sc.screencast_keys_box_hide
-    label_time_max = sc.screencast_keys_fade_time
-
-    for i in range(len(self.key)):
-        label_time = time.time() - self.time[i]
-
-        if label_time < label_time_max: # only display key-presses of last 4 seconds
-            box_width, box_height = getBoundingBox(box_width, box_height, self.key[i])
-            row_count += 1
-            final = i + 1
-            box_hide = False
-        else:
-            break
-
-    # Got the size right, now draw box using proper colors
-    box_color_r, box_color_g, box_color_b, box_color_alpha = sc.screencast_keys_box_color
-
-    if box_draw and not box_hide:
-        padding_x = 16
-        padding_y = 12
-        x0 = max(0, pos_x - padding_x)
-        y0 = max(0, pos_y - padding_y)
-        if sc.screencast_keys_mouse_position == 'left':
-            box_width += mouse_size * MOUSE_RATIO * bool(row_count)
-            x1 = max(box_width, box_width_user) + pos_x + mouse_size * MOUSE_RATIO + padding_x
-        else:
-            x1 = max(box_width, box_width_user) + pos_x + padding_x
-            
-        y1 = pos_y + max(mouse_size, font_size * row_count) + padding_y
-        positions = [[x0, y0], [x0, y1], [x1, y1], [x1, y0]]
-        settings = [[bgl.GL_QUADS, min(0.0, box_color_alpha)], [bgl.GL_LINE_LOOP, min(0.0, box_color_alpha)]]
-
-        for mode, box_alpha in settings:
-            bgl.glEnable(bgl.GL_BLEND)
-            bgl.glBegin(mode)
-            bgl.glColor4f(box_color_r, box_color_g, box_color_b, box_color_alpha)
-            for v1, v2 in positions:
-                bgl.glVertex2f(v1, v2)
-            bgl.glEnd()
-
-    if sc.screencast_keys_show_operator:
-        draw_last_operator(context, pos_x, pos_y)
-
-    if sc.screencast_keys_timer_show:
-        draw_timer(context, pos_x, pos_y)
-
-    # get rid of status texts that aren't displayed anymore
-    self.key = self.key[:final]
-    self.time = self.time[:final]
-
-
-def draw_callback_px(self, context):
-    draw_callback_px_box(self, context)
-    draw_callback_px_text(self, context)
-
-
-def draw_last_operator(context, pos_x, pos_y):
-
-    wm = context.window_manager
-    sc = context.scene
-    font_color_r, font_color_g, font_color_b, font_color_alpha = sc.screencast_keys_text_color
-    pos_x, pos_y = getDisplayLocation(context)
-
-    if wm.operators:
-        last_operator = wm.operators[-1].bl_label
-
-        blf.enable(0, blf.SHADOW)
-        blf.shadow_offset(0, 1, -1)
-        blf.shadow(0, 5, 0.0, 0.0, 0.0, 0.8)
-        blf.size(0, sc.screencast_keys_font_size, 36)
-        blf.position(0, pos_x - 14, pos_y - 30, 0)
-        bgl.glColor4f(font_color_r, font_color_g, font_color_b, font_color_alpha * 0.8)
-        blf.draw(0, "Last: %s" % (last_operator))
-        blf.disable(0, blf.SHADOW)
-
-def draw_timer(context, pos_x, pos_y):
-
-    sc = context.scene
-    #calculate overall time
-    overall_time = datetime.timedelta(seconds=int(time.time() - ScreencastKeysStatus.overall_time[0]))
-
-    timer_color_r, timer_color_g, timer_color_b, timer_color_alpha = sc.screencast_keys_timer_color
-    pos_x = context.region.width - (sc.screencast_keys_timer_size * 12) + 12
-    pos_y = 10
-
-    #draw time
-    blf.size(0, sc.screencast_keys_timer_size, 72)
-    blf.position(0, pos_x, pos_y, 0)
-    bgl.glColor4f(timer_color_r, timer_color_g, timer_color_b, timer_color_alpha)
-    blf.draw(0, "Elapsed Time: %s" % (overall_time))
-
-def draw_mouse(context, shape, style, alpha):
-    # shape and position
-    sc   = context.scene
-    mouse_size = sc.screencast_keys_mouse_size
-    font_size  = sc.screencast_keys_font_size
-    box_draw = sc.screencast_keys_box_draw
-
-    pos_x, pos_y = getDisplayLocation(context)
-
-    if sc.screencast_keys_mouse_position == 'left':
-        offset_x = pos_x
-    if sc.screencast_keys_mouse_position == 'r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list