[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36448] trunk/blender/release/scripts: fix [#27148] *Invalid Path* in all "operator presets" dropdowns
Campbell Barton
ideasman42 at gmail.com
Mon May 2 19:29:31 CEST 2011
Revision: 36448
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36448
Author: campbellbarton
Date: 2011-05-02 17:29:30 +0000 (Mon, 02 May 2011)
Log Message:
-----------
fix [#27148] *Invalid Path* in all "operator presets" dropdowns
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy/utils.py
trunk/blender/release/scripts/startup/bl_operators/presets.py
trunk/blender/release/scripts/startup/bl_operators/wm.py
trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
trunk/blender/release/scripts/startup/bl_ui/space_image.py
Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/modules/bpy/utils.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -226,21 +226,35 @@
return None
-def script_paths(subdir=None, user=True):
+def script_paths(subdir=None, user_pref=True, all=False):
"""
- Returns a list of valid script paths from the home directory and user preferences.
+ Returns a list of valid script paths.
- Accepts any number of string arguments which are joined to make a path.
+ :arg subdir: Optional subdir.
+ :type subdir: string
+ :arg user_pref: Include the user preference script path.
+ :type user_pref: bool
+ :arg all: Include local, user and system paths rather just the paths blender uses.
+ :type all: bool
+ :return: script paths.
+ :rtype: list
"""
scripts = list(_scripts)
# add user scripts dir
- if user:
+ if user_pref:
user_script_path = _bpy.context.user_preferences.filepaths.script_directory
else:
user_script_path = None
- for path in _bpy_script_paths() + (user_script_path, ):
+ if all:
+ # all possible paths
+ base_paths = tuple(_os.path.join(resource_path(res), "scripts") for res in ('LOCAL', 'USER', 'SYSTEM'))
+ else:
+ # only paths blender uses
+ base_paths = _bpy_script_paths()
+
+ for path in base_paths + (user_script_path, ):
if path:
path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path):
@@ -266,7 +280,7 @@
Returns a list of paths for a specific preset.
"""
dirs = []
- for path in script_paths("presets"):
+ for path in script_paths("presets", all=True):
directory = _os.path.join(path, subdir)
if _os.path.isdir(directory):
dirs.append(directory)
Modified: trunk/blender/release/scripts/startup/bl_operators/presets.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/presets.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/startup/bl_operators/presets.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -48,11 +48,11 @@
preset_menu_class = getattr(bpy.types, self.preset_menu)
if not self.remove_active:
-
- if not self.name:
+ name = self.name.strip()
+ if not name:
return {'FINISHED'}
- filename = self.as_filename(self.name)
+ filename = self.as_filename(name)
target_path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", self.preset_subdir), create=True)
@@ -118,7 +118,7 @@
return {'FINISHED'}
def check(self, context):
- self.name = self.as_filename(self.name)
+ self.name = self.as_filename(self.name.strip())
def invoke(self, context, event):
if not self.remove_active:
@@ -327,7 +327,7 @@
ret = []
for prop_id, prop in operator_rna.properties.items():
if (not prop.is_hidden) and prop_id not in properties_blacklist:
- ret.append("op.%s" % prop_id)
+ ret.append("op.%s" % prop_id)
return ret
Modified: trunk/blender/release/scripts/startup/bl_operators/wm.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/wm.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/startup/bl_operators/wm.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -837,6 +837,7 @@
item[property] = 1.0
return {'FINISHED'}
+
class WM_OT_properties_context_change(bpy.types.Operator):
"Change the context tab in a Properties Window"
bl_idname = "wm.properties_context_change"
@@ -846,7 +847,6 @@
def execute(self, context):
context.space_data.context = (self.context)
-
return {'FINISHED'}
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -581,7 +581,7 @@
col.prop(md, "use_even_offset")
col.prop(md, "use_quality_normals")
col.prop(md, "use_rim")
-
+
sub = col.column()
sub.label()
row = sub.split(align=True, percentage=0.4)
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -723,9 +723,9 @@
col.prop(pd, "falloff_soft")
if pd.falloff == "PARTICLE_VELOCITY":
col.prop(pd, "falloff_speed_scale")
-
+
col.prop(pd, "use_falloff_curve")
-
+
if pd.use_falloff_curve:
col = layout.column()
col.label(text="Falloff Curve")
Modified: trunk/blender/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_image.py 2011-05-02 15:59:24 UTC (rev 36447)
+++ trunk/blender/release/scripts/startup/bl_ui/space_image.py 2011-05-02 17:29:30 UTC (rev 36448)
@@ -370,7 +370,7 @@
layout.prop(toolsettings, "use_uv_select_sync", text="")
if toolsettings.use_uv_select_sync:
- layout.template_edit_mode_selection()
+ layout.template_edit_mode_selection()
else:
layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)
More information about the Bf-blender-cvs
mailing list