change python scripts so modules which register with blender have a register() functi...
[blender.git] / release / scripts / modules / bpy / utils.py
index 3f7a38f87c9776f864866f0493d336c44a88838a..8e2e86acb66a4017c9174a2aac11f053b8e8dac4 100644 (file)
@@ -12,7 +12,7 @@
 #
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ##### END GPL LICENSE BLOCK #####
 
@@ -56,7 +56,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
 
     def test_reload(module):
         try:
-            reload(module)
+            return reload(module)
         except:
             traceback.print_exc()
 
@@ -97,7 +97,15 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
 
                     if reload_scripts and mod:
                         print("Reloading:", mod)
-                        test_reload(mod)
+                        mod = test_reload(mod)
+
+                    if mod:
+                        register = getattr(mod, "register", None)
+                        if register:
+                            register()
+                        else:
+                            print("\nWarning! '%s%s%s' has no register function, this is now a requirement for registerable scripts." % (path, _os.sep, f))
+
 
     if _bpy.app.debug:
         print("Time %.4f" % (time.time() - t_main))
@@ -180,7 +188,6 @@ def script_paths(*args):
                 scripts.append(path)
 
     if not args:
-        print(scripts)
         return scripts
 
     subdir = _os.path.join(*args)