Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-08-16 18:11:58 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-16 18:11:58 +0400
commit23807d1fb43de44ca7c4db5dc7bd92178f4b6a14 (patch)
tree6d2e17c8405789363e69df000cf14207110428b2 /release/scripts/modules
parent02d2472baacd8ac091a29392a2bc9ac8693fb5e7 (diff)
parentdddfb5e1738830c325e796a474d0ea14d64654f3 (diff)
Merging trunk up to r39447.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r--release/scripts/modules/bpy/__init__.py14
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py10
2 files changed, 16 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index a43b42e49a1..5c371fd750a 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -44,14 +44,18 @@ from . import utils, path, ops
ops = ops.ops_fake_module
-def _main():
- import sys as _sys
+def main():
+ import sys
# Possibly temp. addons path
from os.path import join, dirname, normpath
- _sys.path.append(normpath(join(dirname(__file__),
+ sys.path.append(normpath(join(dirname(__file__),
"..", "..", "addons", "modules")))
+ # fake module to allow:
+ # from bpy.types import Panel
+ sys.modules["bpy.types"] = types
+
# if "-d" in sys.argv: # Enable this to measure startup speed
if 0:
import cProfile
@@ -65,6 +69,6 @@ def _main():
utils.load_scripts()
-_main()
+main()
-del _main
+del main
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index bb4e95c051f..6271c1f77b5 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -439,7 +439,7 @@ def path_reference_copy(copy_set, report=print):
shutil.copy(file_src, file_dst)
-def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
+def unique_name(key, name, name_dict, name_max=-1, clean_func=None, sep="."):
"""
Helper function for storing unique names which may have special characters
stripped and restricted to a maximum length.
@@ -456,6 +456,9 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
:type name_dict: dict
:arg clean_func: Function to call on *name* before creating a unique value.
:type clean_func: function
+ :arg sep: Separator to use when between the name and a number when a
+ duplicate name is found.
+ :type sep: string
"""
name_new = name_dict.get(key)
if name_new is None:
@@ -466,14 +469,15 @@ def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
if name_max == -1:
while name_new in name_dict_values:
- name_new = "%s.%03d" % (name_new_orig, count)
+ name_new = "%s%s%03d" % (name_new_orig, sep, 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 = "%.*s%s%s" % (name_max - (len(count_str) + 1),
name_new_orig,
+ sep,
count_str,
)
count += 1