Академический Документы
Профессиональный Документы
Культура Документы
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 # as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. # of the License, or (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
bl_info = { bl_info = {
"name": "Screencast Keys", "name": "Screencast Keys",
"author": "Paulo Gomes, Bart Crouch, John E. Herrenyo, Gaia Clary, Pablo Vazquez", "author": "Paulo Gomes, Bart Crouch, John E. Herrenyo, Gaia Clary, Pablo Vazquez",
"version": (1, 7), "version": (1, 7),
"blender": (2, 66, 0), "blender": (2, 66, 0),
"location": "3D View > Properties Panel > Screencast Keys", "location": "3D View > Properties Panel > Screencast Keys",
"warning": "", "warning": "",
"description": "Display keys pressed in the 3D View, " "description": "Display keys pressed in the 3D View, "
"useful for screencasts.", "useful for screencasts.",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/" "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/"
"Py/Scripts/3D_interaction/Screencast_Key_Status_Tool", "Py/Scripts/3D_interaction/Screencast_Key_Status_Tool",
"tracker_url": "http://projects.blender.org/tracker/index.php?" "tracker_url": "http://projects.blender.org/tracker/index.php?"
"func=detail&aid=21612", "func=detail&aid=21612",
"category": "3D View"} "category": "3D View"}
pos_x = int( (context.region.width - mouse_size * MOUSE_RATIO) * \ pos_x = int( (context.region.width - mouse_size * MOUSE_RATIO) * \
scene.screencast_keys_pos_x / 100) scene.screencast_keys_pos_x / 100)
pos_y = int( (context.region.height - mouse_size) * pos_y = int( (context.region.height - mouse_size) *
scene.screencast_keys_pos_y / 100) scene.screencast_keys_pos_y / 100)
font_color_r, font_color_g, font_color_b, font_color_alpha = sc.screencast_keys_text_color font_color_r, font_color_g, font_color_b, font_color_alpha = sc.screencast_keys_text_color
final = 0 final = 0
row_count = len(self.key) row_count = len(self.key)
shift = 0 shift = 0
# we want to make sure we can shift vertically the text if the mouse is big, # we want to make sure we can shift vertically the text if the mouse is big,
# but don't care if aligned to right # but don't care if aligned to right
if mouse_size > font_size*row_count and not sc.screencast_keys_mouse_position == 'right': if mouse_size > font_size*row_count and not sc.screencast_keys_mouse_position == 'right':
shift = (mouse_size - font_size*row_count) / 2 shift = (mouse_size - font_size*row_count) / 2