change python scripts so modules which register with blender have a register() functi...
[blender.git] / release / scripts / ui / properties_material.py
index 88611766dd6230f36909de1861b0c4b84d30e2d3..cf705c8d693688ca180101638b41b76bb05d29fe 100644 (file)
@@ -773,22 +773,6 @@ class MATERIAL_PT_flare(MaterialButtonsPanel):
         col.prop(halo, "flares_sub", text="Subflares")
         col.prop(halo, "flare_subsize", text="Subsize")
 
-bpy.types.register(MATERIAL_PT_context_material)
-bpy.types.register(MATERIAL_PT_preview)
-bpy.types.register(MATERIAL_PT_diffuse)
-bpy.types.register(MATERIAL_PT_specular)
-bpy.types.register(MATERIAL_PT_shading)
-bpy.types.register(MATERIAL_PT_transp)
-bpy.types.register(MATERIAL_PT_mirror)
-bpy.types.register(MATERIAL_PT_sss)
-bpy.types.register(MATERIAL_PT_halo)
-bpy.types.register(MATERIAL_PT_flare)
-bpy.types.register(MATERIAL_PT_physics)
-bpy.types.register(MATERIAL_PT_strand)
-bpy.types.register(MATERIAL_PT_options)
-bpy.types.register(MATERIAL_PT_shadow)
-bpy.types.register(MATERIAL_PT_transp_game)
-
 
 class VolumeButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
@@ -927,14 +911,43 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
         col.label()
         col.prop(vol, "depth_cutoff")
 
-bpy.types.register(MATERIAL_MT_sss_presets)
-bpy.types.register(MATERIAL_MT_specials)
-
-bpy.types.register(MATERIAL_PT_volume_density)
-bpy.types.register(MATERIAL_PT_volume_shading)
-bpy.types.register(MATERIAL_PT_volume_lighting)
-bpy.types.register(MATERIAL_PT_volume_transp)
-
-bpy.types.register(MATERIAL_PT_volume_integration)
 
-bpy.types.register(MATERIAL_PT_custom_props)
+classes = [
+    MATERIAL_PT_context_material,
+    MATERIAL_PT_preview,
+    MATERIAL_PT_diffuse,
+    MATERIAL_PT_specular,
+    MATERIAL_PT_shading,
+    MATERIAL_PT_transp,
+    MATERIAL_PT_mirror,
+    MATERIAL_PT_sss,
+    MATERIAL_PT_halo,
+    MATERIAL_PT_flare,
+    MATERIAL_PT_physics,
+    MATERIAL_PT_strand,
+    MATERIAL_PT_options,
+    MATERIAL_PT_shadow,
+    MATERIAL_PT_transp_game,
+
+    MATERIAL_MT_sss_presets,
+    MATERIAL_MT_specials,
+
+    MATERIAL_PT_volume_density,
+    MATERIAL_PT_volume_shading,
+    MATERIAL_PT_volume_lighting,
+    MATERIAL_PT_volume_transp,
+
+    MATERIAL_PT_volume_integration,
+
+    MATERIAL_PT_custom_props]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)