[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45808] branches/soc-2011-tomato/release/ scripts/modules/addon_utils.py: Tomato branch: "persistent" parameter for addon_utils.enable(), so that we can
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri Apr 20 14:55:44 CEST 2012
Revision: 45808
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45808
Author: blendix
Date: 2012-04-20 12:55:44 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
Tomato branch: "persistent" parameter for addon_utils.enable(), so that we can
enable addons from a startup script and keep them enabled after loading .blend
files.
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/modules/addon_utils.py
Modified: branches/soc-2011-tomato/release/scripts/modules/addon_utils.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/modules/addon_utils.py 2012-04-20 12:26:16 UTC (rev 45807)
+++ branches/soc-2011-tomato/release/scripts/modules/addon_utils.py 2012-04-20 12:55:44 UTC (rev 45808)
@@ -212,10 +212,13 @@
loaded_state = False
+ if mod and getattr(mod, "__addon_persistent__", False):
+ loaded_default = True
+
return loaded_default, loaded_state
-def enable(module_name, default_set=True):
+def enable(module_name, default_set=True, persistent=False):
"""
Enables an addon by name.
@@ -283,6 +286,7 @@
ext.module = module_name
mod.__addon_enabled__ = True
+ mod.__addon_persistent__ = persistent
if _bpy.app.debug_python:
print("\taddon_utils.enable", mod.__name__)
@@ -305,6 +309,7 @@
# the addon in the user prefs.
if mod:
mod.__addon_enabled__ = False
+ mod.__addon_persistent = False
try:
mod.unregister()
More information about the Bf-blender-cvs
mailing list