[Bf-blender-cvs] [61f66ccb60] app-templates: Don't raise error when there is a missing __init__.py file
Campbell Barton
noreply at git.blender.org
Fri Mar 24 08:53:52 CET 2017
Commit: 61f66ccb608aa40a19c3a5e6fd9465f45438f1d7
Author: Campbell Barton
Date: Fri Mar 24 18:53:58 2017 +1100
Branches: app-templates
https://developer.blender.org/rB61f66ccb608aa40a19c3a5e6fd9465f45438f1d7
Don't raise error when there is a missing __init__.py file
===================================================================
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 0ff75a7c81..79fd35254d 100644
--- a/release/scripts/modules/bl_app_template_utils.py
+++ b/release/scripts/modules/bl_app_template_utils.py
@@ -153,6 +153,7 @@ def import_from_path(path, ignore_not_found=False):
def import_from_id(template_id, ignore_not_found=False):
+ import os
path = next(iter(_bpy.utils.app_template_paths(template_id)), None)
if path is None:
if ignore_not_found:
@@ -160,6 +161,9 @@ def import_from_id(template_id, ignore_not_found=False):
else:
raise Exception("%r template not found!" % template_id)
else:
+ if ignore_not_found:
+ if not os.path.exists(os.path.join(path, "__init__.py")):
+ return None
return import_from_path(path, ignore_not_found=ignore_not_found)
More information about the Bf-blender-cvs
mailing list