[Bf-blender-cvs] [d997be26ad] app-templates: Fix for showing error when no template paths exist

Campbell Barton noreply at git.blender.org
Thu Mar 23 01:35:55 CET 2017


Commit: d997be26ad6f5054bc7d507fe468a0023e117cca
Author: Campbell Barton
Date:   Thu Mar 23 11:34:00 2017 +1100
Branches: app-templates
https://developer.blender.org/rBd997be26ad6f5054bc7d507fe468a0023e117cca

Fix for showing error when no template paths exist

===================================================================

M	release/scripts/modules/bl_app_template_utils.py

===================================================================

diff --git a/release/scripts/modules/bl_app_template_utils.py b/release/scripts/modules/bl_app_template_utils.py
index 148200dc1e..af0dbe507f 100644
--- a/release/scripts/modules/bl_app_template_utils.py
+++ b/release/scripts/modules/bl_app_template_utils.py
@@ -193,7 +193,10 @@ def import_from_path(path, ignore_not_found=False):
 def import_from_id(template_id, ignore_not_found=False):
     path = next(iter(_bpy.utils.app_template_paths(template_id)), None)
     if path is None:
-        raise Exception("%r template not found!" % template_id)
+        if ignore_not_found:
+            return None
+        else:
+            raise Exception("%r template not found!" % template_id)
     else:
         return import_from_path(path, ignore_not_found=ignore_not_found)




More information about the Bf-blender-cvs mailing list