diff options
author | Thomas Dinges <blender@dingto.org> | 2013-06-20 00:40:54 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-06-20 00:40:54 +0400 |
commit | e6fc17415223d97a5a8c8bca0af443fb3a655699 (patch) | |
tree | 8696c810b22464262db029f55e937782cd64cc7b /release | |
parent | ac4058a2117a24901f2462ba34d49e6714532148 (diff) | |
parent | 93af050824170913d716e42e918ab58c224ed7f1 (diff) |
Merged revision(s) 57499-57586 from trunk/blender into soc-2013-dingto
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/addon_utils.py | 20 | ||||
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/settings.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/utils_spell_check.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 10 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 26 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/__init__.py | 1 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_paint_common.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_properties.py | 46 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 23 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 20 |
10 files changed, 125 insertions, 27 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 7e7612e56d8..a197c20fdab 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -239,7 +239,7 @@ def _addon_remove(module_name): addons.remove(addon) -def enable(module_name, default_set=True, persistent=False): +def enable(module_name, default_set=True, persistent=False, handle_error=None): """ Enables an addon by name. @@ -253,9 +253,10 @@ def enable(module_name, default_set=True, persistent=False): import sys from bpy_restrict_state import RestrictBlend - def handle_error(): - import traceback - traceback.print_exc() + if handle_error is None: + def handle_error(): + import traceback + traceback.print_exc() # reload if the mtime changes mod = sys.modules.get(module_name) @@ -322,7 +323,7 @@ def enable(module_name, default_set=True, persistent=False): return mod -def disable(module_name, default_set=True): +def disable(module_name, default_set=True, handle_error=None): """ Disables an addon by name. @@ -330,6 +331,12 @@ def disable(module_name, default_set=True): :type module_name: string """ import sys + + if handle_error is None: + def handle_error(): + import traceback + traceback.print_exc() + mod = sys.modules.get(module_name) # possible this addon is from a previous session and didn't load a @@ -344,8 +351,7 @@ def disable(module_name, default_set=True): except: print("Exception in module unregister(): %r" % getattr(mod, "__file__", module_name)) - import traceback - traceback.print_exc() + handle_error() else: print("addon_utils.disable: %s not %s." % (module_name, "disabled" if mod is None else "loaded")) diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 4ca4c18cc7b..001f044f1c4 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -101,7 +101,7 @@ IMPORT_MIN_LEVEL = 0.0 # Languages in /branches we do not want to import in /trunk currently... IMPORT_LANGUAGES_SKIP = { - 'am_ET', 'bg_BG', 'fi_FI', 'el_GR', 'et_EE', 'ne_NP', 'nl_NL', 'pl_PL', 'ro_RO', 'uz_UZ', 'uz_UZ@cyrillic', + 'am_ET', 'bg_BG', 'fi_FI', 'el_GR', 'et_EE', 'ne_NP', 'pl_PL', 'ro_RO', 'uz_UZ', 'uz_UZ@cyrillic', } # Languages that need RTL pre-processing. diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index 99f311bad11..8c237840d96 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -58,6 +58,7 @@ class SpellChecker(): "arcsine", "arccosine", "arctangent", "autoclip", "autocomplete", + "autoexec", "autoname", "autosave", "autoscale", @@ -437,6 +438,7 @@ class SpellChecker(): "oren", "prewitt", "runge", + "sobol", "verlet", "worley", diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 7412d34940f..7d8caf449ca 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -25,7 +25,7 @@ __all__ = ( "object_add_grid_scale", "object_add_grid_scale_apply_operator", "object_image_guess", - "world_to_camera", + "world_to_camera_view", ) @@ -268,12 +268,14 @@ def object_image_guess(obj, bm=None): return None -def world_to_camera(scene, obj, coord): +def world_to_camera_view(scene, obj, coord): """ - Returns the 2d camera space coords for a 3d point. + Returns the camera space coords for a 3d point. + (also known as: normalized device coordinates - NDC). Where (0, 0) is the bottom left and (1, 1) is the top right of the camera frame. values outside 0-1 are also supported. + A negative 'z' value means the point is behind the camera. Takes shift-x/y, lens angle and sensor size into account as well as perspective/ortho projections. @@ -284,7 +286,7 @@ def world_to_camera(scene, obj, coord): :type obj: :class:`bpy.types.Object` :arg coord: World space location. :type coord: :class:`mathutils.Vector` - :return: normalized 2d vector. + :return: a vector where X and Y map to the view plane and Z is the depth on the view axis. :rtype: :class:`mathutils.Vector` """ from mathutils import Vector diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index fd1f538efd3..fba7672e846 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1574,8 +1574,15 @@ class WM_OT_addon_enable(Operator): def execute(self, context): import addon_utils + + err_str = "" + def err_cb(): + import traceback + nonlocal err_str + err_str = traceback.format_exc() + print(err_str) - mod = addon_utils.enable(self.module) + mod = addon_utils.enable(self.module, handle_error=err_cb) if mod: info = addon_utils.module_bl_info(mod) @@ -1590,6 +1597,10 @@ class WM_OT_addon_enable(Operator): info_ver) return {'FINISHED'} else: + + if err_str: + self.report({'ERROR'}, err_str) + return {'CANCELLED'} @@ -1606,7 +1617,18 @@ class WM_OT_addon_disable(Operator): def execute(self, context): import addon_utils - addon_utils.disable(self.module) + err_str = "" + def err_cb(): + import traceback + nonlocal err_str + err_str = traceback.format_exc() + print(err_str) + + addon_utils.disable(self.module, handle_error=err_cb) + + if err_str: + self.report({'ERROR'}, err_str) + return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 868fa2a311c..594f724c6e3 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -68,6 +68,7 @@ _modules = [ "space_nla", "space_node", "space_outliner", + "space_properties", "space_sequencer", "space_text", "space_time", diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 65ab1246c19..b3335f32231 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -134,8 +134,8 @@ def brush_mask_texture_settings(layout, brush): layout.operator("brush.stencil_reset_transform").mask = True if brush.mask_texture: - layout.label(text="Mask Mapping:") col = layout.column() + col.label(text="Angle:") col.active = brush.brush_capabilities.has_texture_angle col.prop(mask_tex_slot, "angle", text="") diff --git a/release/scripts/startup/bl_ui/space_properties.py b/release/scripts/startup/bl_ui/space_properties.py new file mode 100644 index 00000000000..758713b5cc4 --- /dev/null +++ b/release/scripts/startup/bl_ui/space_properties.py @@ -0,0 +1,46 @@ +# ##### 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> +import bpy +from bpy.types import Header + + +class PROPERTIES_HT_header(Header): + bl_space_type = 'PROPERTIES' + + def draw(self, context): + layout = self.layout + + view = context.space_data + + row = layout.row() + row.template_header(menus=False) + row.prop(view, "context", expand=True, icon_only=True) + + +def register(): + bpy.utils.register_module(__name__) + + +def unregister(): + bpy.utils.unregister_module(__name__) + + +if __name__ == "__main__": + register() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index ef4e5468194..a497ecfb927 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -867,8 +867,21 @@ class USERPREF_PT_file(Panel): colsplit = col.split(percentage=0.95) sub = colsplit.column() - sub.label(text="Author:") - sub.prop(system, "author", text="") + + row = sub.split(percentage=0.3) + row.label(text="Auto Execution:") + row.prop(system, "use_scripts_auto_execute") + + if system.use_scripts_auto_execute: + box = sub.box() + row = box.row() + row.label(text="Excluded Paths:") + row.operator("wm.userpref_autoexec_path_add", text="", icon='ZOOMIN', emboss=False) + for i, path_cmp in enumerate(userpref.autoexec_paths): + row = box.row() + row.prop(path_cmp, "path", text="") + row.prop(path_cmp, "use_glob", text="", icon='FILTER') + row.operator("wm.userpref_autoexec_path_remove", text="", icon='X', emboss=False).index = i col = split.column() col.label(text="Save & Load:") @@ -896,10 +909,12 @@ class USERPREF_PT_file(Panel): col.separator() - col.label(text="Scripts:") - col.prop(system, "use_scripts_auto_execute") + col.label(text="Text Editor:") col.prop(system, "use_tabs_as_spaces") + col.label(text="Author:") + col.prop(system, "author", text="") + from bl_ui.space_userpref_keymap import InputKeyMapPanel diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b8cbd058063..e0449931fc9 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -966,26 +966,30 @@ class VIEW3D_MT_object_specials(Menu): if scene.render.use_shading_nodes: try: value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value + except AttributeError: + value = None + if value is not None: props = layout.operator("wm.context_modal_mouse", text="Strength") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.node_tree.nodes[\"Emission\"].inputs[\"Strength\"].default_value" props.header_text = "Lamp Strength: %.3f" props.input_scale = 0.1 - except AttributeError: - pass + del value - if lamp.type == 'AREA' and lamp.shape == 'RECTANGLE': + if lamp.type == 'AREA': props = layout.operator("wm.context_modal_mouse", text="Size X") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.size" props.header_text = "Lamp Size X: %.3f" - props = layout.operator("wm.context_modal_mouse", text="Size Y") - props.data_path_iter = "selected_editable_objects" - props.data_path_item = "data.size" - props.header_text = "Lamp Size Y: %.3f" - elif lamp.type in {'SPOT', 'AREA', 'POINT', 'SUN'}: + if lamp.shape == 'RECTANGLE': + props = layout.operator("wm.context_modal_mouse", text="Size Y") + props.data_path_iter = "selected_editable_objects" + props.data_path_item = "data.size_y" + props.header_text = "Lamp Size Y: %.3f" + + elif lamp.type in {'SPOT', 'POINT', 'SUN'}: props = layout.operator("wm.context_modal_mouse", text="Size") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.shadow_soft_size" |