[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4131] contrib/py/scripts/addons/ io_atomblend_utilities/__init__.py: According to Campbell's demand ( see email below, bpy.context.scene issue) I have

Clemens Barth barth at root-1.de
Thu Jan 3 12:27:23 CET 2013


Revision: 4131
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4131
Author:   blendphys
Date:     2013-01-03 11:27:18 +0000 (Thu, 03 Jan 2013)
Log Message:
-----------
According to Campbell's demand (see email below, bpy.context.scene issue) I have 
changed the code. 

Blendphys.


******************* Campbells email from 20.12.2012 03:38 ********************

Recently I've noticed addons using bpy.context.scene when being
imported or in the register() function.

This is really bad practice and will cause inconsistency if the addon
is enabled and a different blend file is loaded.
In the worst case accessing a removed datablock can crash which is
likely if a datablock is stored as a global variable on activation -
object_laplace_lightning.py does this.

I've changed addon loading so that they only get access to a
restricted context which only exposes 'window_manager' - needed for
adding keymaps.

.....

Modified Paths:
--------------
    contrib/py/scripts/addons/io_atomblend_utilities/__init__.py

Modified: contrib/py/scripts/addons/io_atomblend_utilities/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_atomblend_utilities/__init__.py	2013-01-03 03:19:42 UTC (rev 4130)
+++ contrib/py/scripts/addons/io_atomblend_utilities/__init__.py	2013-01-03 11:27:18 UTC (rev 4131)
@@ -24,7 +24,7 @@
 #
 #  Start of project              : 2011-12-01 by Clemens Barth
 #  First publication in Blender  : 2012-11-03
-#  Last modified                 : 2012-11-09
+#  Last modified                 : 2013-01-03
 #
 #  Acknowledgements 
 #  ================
@@ -256,7 +256,6 @@
     bpy.utils.register_module(__name__)
     bpy.types.Scene.atom_blend = bpy.props.CollectionProperty(type=
                                                    PanelProperties)
-    bpy.context.scene.atom_blend.add()
 
 def unregister():
     bpy.utils.unregister_module(__name__)



More information about the Bf-extensions-cvs mailing list