change python scripts so modules which register with blender have a register() functi...
[blender.git] / release / scripts / ui / space_console.py
index 992a087a554f28ae7cf9cc2b4eeebbc8490a851b..6e0cc9ceba8b5412ff04fac8721e7c82ad7bfac4 100644 (file)
@@ -198,15 +198,27 @@ class ConsoleLanguage(bpy.types.Operator):
         return {'FINISHED'}
 
 
-bpy.types.register(CONSOLE_HT_header)
-bpy.types.register(CONSOLE_MT_console)
-bpy.types.register(CONSOLE_MT_report)
-bpy.types.register(CONSOLE_MT_language)
-
-# Stubs that call the language operators
-bpy.types.register(ConsoleExec)
-bpy.types.register(ConsoleAutocomplete)
-bpy.types.register(ConsoleBanner)
-
-# Set the language and call the banner
-bpy.types.register(ConsoleLanguage)
+classes = [
+    CONSOLE_HT_header,
+    CONSOLE_MT_console,
+    CONSOLE_MT_report,
+    CONSOLE_MT_language,
+
+    # Stubs that call the language operators
+    ConsoleExec,
+    ConsoleAutocomplete,
+    ConsoleBanner,
+
+    # Set the language and call the banner
+    ConsoleLanguage]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)