diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-06-04 03:24:01 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-06-04 03:24:01 +0400 |
commit | cd04cff1800e8f60a06d8da6e79ac436808c9a7d (patch) | |
tree | 8c6aa631dab983e845ff8626725537d8b71dc9e4 /release | |
parent | 71419c46471586e93884aa151f5b160863025886 (diff) | |
parent | d84c6a3cdb60c4e31db75efc4c6f9a3ea9e9f034 (diff) |
Merge with trunk revision 37149.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy_extras/image_utils.py | 3 | ||||
-rw-r--r-- | release/scripts/modules/bpy_extras/io_utils.py | 41 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref_keymap.py | 4 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 3 | ||||
-rw-r--r-- | release/windows/installer/00.sconsblender.nsi | 9 |
6 files changed, 54 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index a7d0226fa23..f45f9c6f225 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -59,6 +59,7 @@ def load_image(imagepath, :rtype: :class:`Image` """ import os + import bpy # TODO: recursive @@ -88,7 +89,7 @@ def load_image(imagepath, for filepath_test in variants: if ncase_cmp: - ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath) + ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath_test) else: ncase_variants = (filepath_test, ) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index c444fd618a8..12c2d809132 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -29,6 +29,7 @@ __all__ = ( "path_reference", "path_reference_copy", "path_reference_mode", + "unique_name" ) import bpy @@ -298,3 +299,43 @@ def path_reference_copy(copy_set, report=print): os.makedirs(dir_to) shutil.copy(file_src, file_dst) + + +def unique_name(key, name, name_dict, name_max=-1, clean_func=None): + """ + Helper function for storing unique names which may have special characters + stripped and restricted to a maximum length. + + :arg key: unique item this name belongs to, name_dict[key] will be reused + when available. + This can be the object, mesh, material, etc instance its self. + :type key: any hashable object assosiated with the *name*. + :arg name: The name used to create a unique value in *name_dict*. + :type name: string + :arg name_dict: This is used to cache namespace to ensure no collisions + occur, this should be an empty dict initially and only modified by this + function. + :type name_dict: dict + :arg clean_func: Function to call on *name* before creating a unique value. + :type clean_func: function + """ + name_new = name_dict.get(key) + if name_new is None: + count = 1 + name_dict_values = name_dict.values() + name_new = name_new_orig = name if clean_func is None else clean_func(name) + + if name_max == -1: + while name_new in name_dict_values: + name_new = "%s.%03d" % (name_new_orig, count) + count += 1 + else: + name_new = name_new[:name_max] + while name_new in name_dict_values: + count_str = "%03d" % count + name_new = "%.*s.%s" % (name_max - (len(count_str) + 1), name_new_orig, count_str) + count += 1 + + name_dict[key] = name_new + + return name_new diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index e34755ae72e..f018785a925 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -890,7 +890,7 @@ class USERPREF_PT_addons(bpy.types.Panel): col = split.column() col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') col.label(text="Categories") - col.prop(context.window_manager, "addon_filter", text="") # , expand=True, too slow with dynamic enum. + col.prop(context.window_manager, "addon_filter", expand=True) col.label(text="Supported Level") col.prop(context.window_manager, "addon_support", expand=True) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 982e19e6234..e99cefb91b8 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -411,8 +411,8 @@ def export_properties(prefix, properties, lines=None): if lines is None: lines = [] - for pname in properties.keys(): - if not properties.is_property_hidden(pname): + for pname in properties.bl_rna.properties.keys(): + if pname != "rna_type" and not properties.is_property_hidden(pname): value = getattr(properties, pname) if isinstance(value, bpy.types.OperatorProperties): export_properties(prefix + "." + pname, value, lines) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index a4c2a7a4549..3ea5480a99e 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2322,7 +2322,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel): col.prop(toolsettings, "use_etch_autoname") col.prop(toolsettings, "etch_number") col.prop(toolsettings, "etch_side") - col.operator("sketch.convert", text="Convert") + + col.operator("sketch.convert", text="Convert") class VIEW3D_PT_context_properties(bpy.types.Panel): diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi index 42a9b1c13b6..eddd215c64d 100644 --- a/release/windows/installer/00.sconsblender.nsi +++ b/release/windows/installer/00.sconsblender.nsi @@ -205,6 +205,8 @@ Section "Uninstall" ; Remove files [DELROOTDIRCONTS] + [DELDATAFILES] + [DELDATADIRS] Delete "$INSTDIR\uninstall.exe" @@ -212,13 +214,14 @@ Section "Uninstall" RMDir /r "$BLENDERCONFIG\$SHORTVERSION" ${Endif} + ; Remove install directory if it's empty + RMDir $INSTDIR ; Remove shortcuts Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*" Delete "$DESKTOP\Blender.lnk" ; Remove all link related directories and files - RMDir /r "$SMPROGRAMS\Blender Foundation" - ; Clear out installation dir - RMDir /r "$INSTDIR" + RMDir "$SMPROGRAMS\Blender Foundation\Blender" + RMDir "$SMPROGRAMS\Blender Foundation" System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons SectionEnd |