[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25038] trunk/blender: User Script support added back.
Campbell Barton
ideasman42 at gmail.com
Mon Nov 30 23:32:07 CET 2009
Revision: 25038
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25038
Author: campbellbarton
Date: 2009-11-30 23:32:04 +0100 (Mon, 30 Nov 2009)
Log Message:
-----------
User Script support added back.
- the scripts path set in the user preferences or ~/.blender/scripts/ui (io, op, io etc..) will be used to load scripts.
- the default home dir part probably only works in *nix os's
- Added a missing sync callback to vector.toTuple()
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy/__init__.py
trunk/blender/release/scripts/modules/bpy/utils.py
trunk/blender/source/blender/python/generic/vector.c
Modified: trunk/blender/release/scripts/modules/bpy/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/__init__.py 2009-11-30 20:20:00 UTC (rev 25037)
+++ trunk/blender/release/scripts/modules/bpy/__init__.py 2009-11-30 22:32:04 UTC (rev 25038)
@@ -46,20 +46,21 @@
for base_path in utils.script_paths():
for path_subdir in ("ui", "op", "io"):
path = os.path.join(base_path, path_subdir)
- sys.path.insert(0, path)
- for f in sorted(os.listdir(path)):
- if f.endswith(".py"):
- # python module
- mod = test_import(f[0:-3])
- elif "." not in f:
- # python package
- mod = test_import(f)
- else:
- mod = None
+ if os.path.isdir(path):
+ sys.path.insert(0, path)
+ for f in sorted(os.listdir(path)):
+ if f.endswith(".py"):
+ # python module
+ mod = test_import(f[0:-3])
+ elif "." not in f:
+ # python package
+ mod = test_import(f)
+ else:
+ mod = None
- if reload_scripts and mod:
- print("Reloading:", mod)
- reload(mod)
+ if reload_scripts and mod:
+ print("Reloading:", mod)
+ reload(mod)
def _main():
Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py 2009-11-30 20:20:00 UTC (rev 25037)
+++ trunk/blender/release/scripts/modules/bpy/utils.py 2009-11-30 22:32:04 UTC (rev 25038)
@@ -57,12 +57,26 @@
_scripts = (os.path.normpath(_scripts), )
def script_paths(*args):
+ scripts = list(_scripts)
+
+ # add user scripts dir
+ user_script_path = bpy.context.user_preferences.filepaths.python_scripts_directory
+
+ if not user_script_path:
+ # XXX - WIN32 needs checking, perhaps better call a blender internal function.
+ user_script_path = os.path.join(os.path.expanduser("~"), ".blender", "scripts")
+
+ user_script_path = os.path.normpath(user_script_path)
+
+ if user_script_path not in scripts and os.path.isdir(user_script_path):
+ scripts.append(user_script_path)
+
if not args:
- return _scripts
+ return scripts
subdir = os.path.join(*args)
script_paths = []
- for path in _scripts:
+ for path in scripts:
script_paths.append(os.path.join(path, subdir))
return script_paths
Modified: trunk/blender/source/blender/python/generic/vector.c
===================================================================
--- trunk/blender/source/blender/python/generic/vector.c 2009-11-30 20:20:00 UTC (rev 25037)
+++ trunk/blender/source/blender/python/generic/vector.c 2009-11-30 22:32:04 UTC (rev 25038)
@@ -253,6 +253,9 @@
return NULL;
}
+ if(!BaseMath_ReadCallback(self))
+ return NULL;
+
ret= PyTuple_New(self->size);
for(x = 0; x < self->size; x++) {
More information about the Bf-blender-cvs
mailing list