space_view3d_stored_views: initial working update 2.8
authormeta-androcto <meta.androcto1@gmail.com>
Sat, 8 Jun 2019 07:00:44 +0000 (17:00 +1000)
committermeta-androcto <meta.androcto1@gmail.com>
Sat, 8 Jun 2019 07:00:44 +0000 (17:00 +1000)
space_view3d_stored_views/__init__.py
space_view3d_stored_views/core.py
space_view3d_stored_views/io.py
space_view3d_stored_views/operators.py
space_view3d_stored_views/properties.py
space_view3d_stored_views/ui.py

index aae9add..f17d19d 100644 (file)
@@ -21,7 +21,7 @@ bl_info = {
     "description": "Save and restore User defined views, pov, layers and display configs",
     "author": "nfloyd, Francesco Siddi",
     "version": (0, 3, 7),
-    "blender": (2, 78, 0),
+    "blender": (2, 80, 0),
     "location": "View3D > Properties > Stored Views",
     "warning": "",
     "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.5/"
@@ -50,21 +50,22 @@ NOTE: logging setup has to be provided by the user in a separate config file
     and will not have output until the logging configuration is set up
 """
 
-if "bpy" in locals():
-    import importlib
-    importlib.reload(core)
-    importlib.reload(ui)
-    importlib.reload(properties)
-    importlib.reload(operators)
-    importlib.reload(io)
-else:
-    from . import core
-    from . import ui
-    from . import properties
-    from . import operators
-    from . import io
-
+# if "bpy" in locals():
+#     import importlib
+#     importlib.reload(core)
+#     importlib.reload(ui)
+#     importlib.reload(properties)
+#     importlib.reload(operators)
+#     importlib.reload(io)
+# else:
 import bpy
+from . import core
+from . import ui
+from . import properties
+from . import operators
+from . import io
+
+
 from bpy.props import (
     BoolProperty,
     IntProperty,
@@ -99,15 +100,15 @@ class VIEW3D_stored_views_initialize(Operator):
 class VIEW3D_stored_views_preferences(AddonPreferences):
     bl_idname = __name__
 
-    show_exporters: BoolProperty(
-        name="Enable I/O Operators",
-        default=False,
-        description="Enable Import/Export Operations in the UI:\n"
-                    "Import Stored Views preset,\n"
-                    "Export Stored Views preset and \n"
-                    "Import stored views from scene",
-    )
-    view_3d_update_rate: IntProperty(
+    # show_exporters : BoolProperty(
+        name="Enable I/O Operators",
+        default=False,
+        description="Enable Import/Export Operations in the UI:\n"
+                    "Import Stored Views preset,\n"
+                    "Export Stored Views preset and \n"
+                    "Import stored views from scene",
+    )
+    view_3d_update_rate : IntProperty(
         name="3D view update",
         description="Update rate of the 3D view redraw\n"
                     "Increse the value if the UI feels sluggish",
@@ -120,16 +121,24 @@ class VIEW3D_stored_views_preferences(AddonPreferences):
 
         row = layout.row(align=True)
         row.prop(self, "view_3d_update_rate", toggle=True)
-        row.prop(self, "show_exporters", toggle=True)
#       row.prop(self, "show_exporters", toggle=True)
 
 
 def register():
-    bpy.utils.register_module(__name__)
+    ui.register()
+    properties.register()
+    operators.register()
+    bpy.utils.register_class(VIEW3D_stored_views_initialize)
+    bpy.utils.register_class(VIEW3D_stored_views_preferences)
 
 
 def unregister():
+    ui.unregister()
+    properties.unregister()
+    operators.unregister()
+    bpy.utils.unregister_class(VIEW3D_stored_views_initialize)
+    bpy.utils.unregister_class(VIEW3D_stored_views_preferences)
     ui.VIEW3D_stored_views_draw.handle_remove(bpy.context)
-    bpy.utils.unregister_module(__name__)
     if hasattr(bpy.types.Scene, "stored_views"):
         del bpy.types.Scene.stored_views
 
index d7fb72b..b57bdd6 100644 (file)
@@ -8,13 +8,13 @@ import hashlib
 import bpy
 
 
-# Utility function get preferences setting for exporters
+#Utility function get preferences setting for exporters
 def get_preferences():
     # replace the key if the add-on name changes
     addon = bpy.context.preferences.addons[__package__]
-    show_warn = (addon.preferences.show_exporters if addon else False)
+#    show_warn = (addon.preferences.show_exporters if addon else False)
 
-    return show_warn
+    return True
 
 
 class StoredView():
@@ -75,7 +75,7 @@ class POV(StoredView):
         else:
             stored_view.lock_object_name = ""
         stored_view.lock_cursor = view3d.lock_cursor
-        stored_view.cursor_location = view3d.cursor_location
+        stored_view.cursor_location = bpy.context.scene.cursor.location
 
     def update_v3d(self, stored_view):
         view3d = self.view3d
@@ -131,95 +131,95 @@ class POV(StoredView):
         return md5
 
 
-class Layers(StoredView):
-    def __init__(self, index=None):
-        super().__init__(mode='LAYERS', index=index)
-        self.logger = logging.getLogger('%s.Layers' % __name__)
-
-    def from_v3d(self, stored_view):
-        view3d = self.view3d
-        stored_view.view_layers = view3d.layers
-        stored_view.scene_layers = self.scene.layers
-        stored_view.lock_camera_and_layers = view3d.lock_camera_and_layers
-
-    def update_v3d(self, stored_view):
-        view3d = self.view3d
-        view3d.lock_camera_and_layers = stored_view.lock_camera_and_layers
-        if stored_view.lock_camera_and_layers is True:
-            self.scene.layers = stored_view.scene_layers
-        else:
-            view3d.layers = stored_view.view_layers
-
-    @staticmethod
-    def is_modified(context, stored_view):
-        Layers.logger = logging.getLogger('%s.Layers' % __name__)
-        if stored_view.lock_camera_and_layers != context.space_data.lock_camera_and_layers:
-            Layers.logger.debug('lock_camera_and_layers')
-            return True
-        if stored_view.lock_camera_and_layers is True:
-            for i in range(20):
-                if stored_view.scene_layers[i] != context.scene.layers[i]:
-                    Layers.logger.debug('scene_layers[%s]' % (i, ))
-                    return True
-        else:
-            for i in range(20):
-                if stored_view.view_layers[i] != context.space_data.view3d.layers[i]:
-                    return True
-        return False
-
-
-class Display(StoredView):
-    def __init__(self, index=None):
-        super().__init__(mode='DISPLAY', index=index)
-        self.logger = logging.getLogger('%s.Display' % __name__)
-
-    def from_v3d(self, stored_view):
-        view3d = self.view3d
-        stored_view.viewport_shade = view3d.viewport_shade
-        stored_view.show_only_render = view3d.show_only_render
-        stored_view.show_outline_selected = view3d.show_outline_selected
-        stored_view.show_all_objects_origin = view3d.show_all_objects_origin
-        stored_view.show_relationship_lines = view3d.show_relationship_lines
-        stored_view.show_floor = view3d.show_floor
-        stored_view.show_axis_x = view3d.show_axis_x
-        stored_view.show_axis_y = view3d.show_axis_y
-        stored_view.show_axis_z = view3d.show_axis_z
-        stored_view.grid_lines = view3d.grid_lines
-        stored_view.grid_scale = view3d.grid_scale
-        stored_view.grid_subdivisions = view3d.grid_subdivisions
-        stored_view.material_mode = self.scene.game_settings.material_mode
-        stored_view.show_textured_solid = view3d.show_textured_solid
-
-    def update_v3d(self, stored_view):
-        view3d = self.view3d
-        view3d.viewport_shade = stored_view.viewport_shade
-        view3d.show_only_render = stored_view.show_only_render
-        view3d.show_outline_selected = stored_view.show_outline_selected
-        view3d.show_all_objects_origin = stored_view.show_all_objects_origin
-        view3d.show_relationship_lines = stored_view.show_relationship_lines
-        view3d.show_floor = stored_view.show_floor
-        view3d.show_axis_x = stored_view.show_axis_x
-        view3d.show_axis_y = stored_view.show_axis_y
-        view3d.show_axis_z = stored_view.show_axis_z
-        view3d.grid_lines = stored_view.grid_lines
-        view3d.grid_scale = stored_view.grid_scale
-        view3d.grid_subdivisions = stored_view.grid_subdivisions
-        self.scene.game_settings.material_mode = stored_view.material_mode
-        view3d.show_textured_solid = stored_view.show_textured_solid
-
-    @staticmethod
-    def is_modified(context, stored_view):
-        Display.logger = logging.getLogger('%s.Display' % __name__)
-        view3d = context.space_data
-        excludes = ["material_mode", "quad_view", "lock_rotation", "show_sync_view", "use_box_clip", "name"]
-        for k, v in stored_view.items():
-            if k not in excludes:
-                if getattr(view3d, k) != getattr(stored_view, k):
-                    return True
-
-        if stored_view.material_mode != context.scene.game_settings.material_mode:
-            Display.logger.debug('material_mode')
-            return True
+class Layers(StoredView):
+    def __init__(self, index=None):
+#         super().__init__(mode='COLLECTIONS', index=index)
+        self.logger = logging.getLogger('%s.Layers' % __name__)
+
+    def from_v3d(self, stored_view):
+        view3d = self.view3d
+#         stored_view.view_layers = bpy.types.layer.collection
+        stored_view.scene_layers = self.scene.layers
+#         stored_view.lock_camera = view3d.lock_camera
+
+    def update_v3d(self, stored_view):
+        view3d = self.view3d
+#         view3d.camera = stored_view.camera
+#         if stored_view.camera is True:
+            self.scene.layers = stored_view.scene_layers
+        else:
+            view3d.layers = stored_view.view_layers
+
+    @staticmethod
+    def is_modified(context, stored_view):
+        Layers.logger = logging.getLogger('%s.Layers' % __name__)
+    #     if stored_view.camera != context.space_data.camera:
+    #         Layers.logger.debug('lock_camera')
+            return True
+    #     if stored_view.camera is True:
+            for i in range(20):
+                if stored_view.scene_layers[i] != context.scene.layers[i]:
+                    Layers.logger.debug('scene_layers[%s]' % (i, ))
+                    return True
+        else:
+            for i in range(20):
+                if stored_view.view_layers[i] != context.space_data.view3d.layers[i]:
+                    return True
+        return False
+
+
+class Display(StoredView):
+    def __init__(self, index=None):
+        super().__init__(mode='DISPLAY', index=index)
+        self.logger = logging.getLogger('%s.Display' % __name__)
+
+    def from_v3d(self, stored_view):
+        view3d = self.view3d
+        stored_view.viewport_shade = view3d.viewport_shade
+        stored_view.show_only_render = view3d.show_only_render
+        stored_view.show_outline_selected = view3d.show_outline_selected
+        stored_view.show_all_objects_origin = view3d.show_all_objects_origin
+        stored_view.show_relationship_lines = view3d.show_relationship_lines
+        stored_view.show_floor = view3d.show_floor
+        stored_view.show_axis_x = view3d.show_axis_x
+        stored_view.show_axis_y = view3d.show_axis_y
+        stored_view.show_axis_z = view3d.show_axis_z
+        stored_view.grid_lines = view3d.grid_lines
+        stored_view.grid_scale = view3d.grid_scale
+        stored_view.grid_subdivisions = view3d.grid_subdivisions
+        stored_view.material_mode = self.scene.game_settings.material_mode
+        stored_view.show_textured_solid = view3d.show_textured_solid
+
+    def update_v3d(self, stored_view):
+        view3d = self.view3d
+        view3d.viewport_shade = stored_view.viewport_shade
+        view3d.show_only_render = stored_view.show_only_render
+        view3d.show_outline_selected = stored_view.show_outline_selected
+        view3d.show_all_objects_origin = stored_view.show_all_objects_origin
+        view3d.show_relationship_lines = stored_view.show_relationship_lines
+        view3d.show_floor = stored_view.show_floor
+        view3d.show_axis_x = stored_view.show_axis_x
+        view3d.show_axis_y = stored_view.show_axis_y
+        view3d.show_axis_z = stored_view.show_axis_z
+        view3d.grid_lines = stored_view.grid_lines
+        view3d.grid_scale = stored_view.grid_scale
+        view3d.grid_subdivisions = stored_view.grid_subdivisions
+        self.scene.game_settings.material_mode = stored_view.material_mode
+        view3d.show_textured_solid = stored_view.show_textured_solid
+
+    @staticmethod
+    def is_modified(context, stored_view):
+        Display.logger = logging.getLogger('%s.Display' % __name__)
+        view3d = context.space_data
+        excludes = ["material_mode", "quad_view", "lock_rotation", "show_sync_view", "use_box_clip", "name"]
+        for k, v in stored_view.items():
+            if k not in excludes:
+                if getattr(view3d, k) != getattr(stored_view, k):
+                    return True
+
+        if stored_view.material_mode != context.scene.game_settings.material_mode:
+            Display.logger.debug('material_mode')
+            return True
 
 
 class View(StoredView):
@@ -227,26 +227,26 @@ class View(StoredView):
         super().__init__(mode='VIEW', index=index)
         self.logger = logging.getLogger('%s.View' % __name__)
         self.pov = POV()
-        self.layers = Layers()
-        self.display = Display()
+        self.layers = Layers()
+        self.display = Display()
 
     def from_v3d(self, stored_view):
         self.pov.from_v3d(stored_view.pov)
-        self.layers.from_v3d(stored_view.layers)
-        self.display.from_v3d(stored_view.display)
+        self.layers.from_v3d(stored_view.layers)
+        self.display.from_v3d(stored_view.display)
 
     def update_v3d(self, stored_view):
         self.pov.update_v3d(stored_view.pov)
-        self.layers.update_v3d(stored_view.layers)
-        self.display.update_v3d(stored_view.display)
+        self.layers.update_v3d(stored_view.layers)
+        self.display.update_v3d(stored_view.display)
 
     @staticmethod
     def is_modified(context, stored_view):
-        if POV.is_modified(context, stored_view.pov) or \
-           Layers.is_modified(context, stored_view.layers) or \
-           Display.is_modified(context, stored_view.display):
-            return True
-        return False
+        POV.is_modified(context, stored_view.pov) #or \
+           Layers.is_modified(context, stored_view.layers) or \
+           Display.is_modified(context, stored_view.display):
+        return True
+        return False
 
 
 class DataStore():
index a3125fc..260c3e7 100644 (file)
@@ -15,7 +15,7 @@ from bpy_extras.io_utils import (
     ExportHelper,
     ImportHelper,
 )
-from . import bl_info
+from .import bl_info
 from .core import get_preferences
 from .operators import DataStore
 
@@ -209,11 +209,11 @@ class VIEW3D_stored_views_import(Operator, ImportHelper):
     bl_description = "Import a .blsv preset file to the current Stored Views"
 
     filename_ext = ".blsv"
-    filter_glob: StringProperty(
+    filter_glob = StringProperty(
         default="*.blsv",
         options={'HIDDEN'}
     )
-    replace: BoolProperty(
+    replace = BoolProperty(
         name="Replace",
         default=True,
         description="Replace current stored views, otherwise append"
@@ -258,12 +258,12 @@ class VIEW3D_stored_views_import_from_scene(Operator):
     bl_label = "Import stored views from scene"
     bl_description = "Import currently stored views from an another scene"
 
-    scene_name: StringProperty(
+    scene_name = StringProperty(
         name="Scene Name",
         description="A current blend scene",
         default=""
     )
-    replace: BoolProperty(
+    replace = BoolProperty(
         name="Replace",
         default=True,
         description="Replace current stored views, otherwise append"
@@ -306,14 +306,14 @@ class VIEW3D_stored_views_export(Operator, ExportHelper):
     bl_description = "Export the current Stored Views to a .blsv preset file"
 
     filename_ext = ".blsv"
-    filepath: StringProperty(
+    filepath = StringProperty(
         default=os.path.join(IO_Utils.get_preset_path()[0], "untitled")
     )
-    filter_glob: StringProperty(
+    filter_glob = StringProperty(
         default="*.blsv",
         options={'HIDDEN'}
     )
-    preset_name: StringProperty(
+    preset_name = StringProperty(
         name="Preset name",
         default="",
         description="Name of the stored views preset"
index 5d8a472..4cf8a2c 100644 (file)
@@ -15,7 +15,7 @@ class VIEW3D_stored_views_save(Operator):
     bl_label = "Save Current"
     bl_description = "Save the view 3d current state"
 
-    index: IntProperty()
+    index : IntProperty()
 
     def execute(self, context):
         mode = context.scene.stored_views.mode
@@ -32,7 +32,7 @@ class VIEW3D_stored_views_set(Operator):
     bl_label = "Set"
     bl_description = "Update the view 3D according to this view"
 
-    index: IntProperty()
+    index : IntProperty()
 
     def execute(self, context):
         mode = context.scene.stored_views.mode
@@ -49,7 +49,7 @@ class VIEW3D_stored_views_delete(Operator):
     bl_label = "Delete"
     bl_description = "Delete this view"
 
-    index: IntProperty()
+    index : IntProperty()
 
     def execute(self, context):
         data = DataStore()
@@ -102,7 +102,7 @@ class SetSceneCamera(Operator):
             for c in [o for o in scene.objects if o.type == 'CAMERA']:
                 c.hide = (c != chosen_camera)
         scene.camera = chosen_camera
-        bpy.ops.object.select_all(action='DESELECT')
+        bpy.ops.object.select_all(action ='DESELECT')
         chosen_camera.select_set(True)
         return {'FINISHED'}
 
@@ -159,6 +159,24 @@ class AddCameraMarker(Operator):
         marker.select = True
 
         for other_marker in [m for m in scene.timeline_markers if m != marker]:
-            other_marker.select = False
+            other_marker.select = True
 
         return {'FINISHED'}
+
+classes = (
+    VIEW3D_stored_views_save,
+    VIEW3D_stored_views_set,
+    VIEW3D_stored_views_delete,
+    VIEW3D_New_Camera_to_View,
+    SetSceneCamera,
+    PreviewSceneCamera,
+    AddCameraMarker
+)
+
+def register():
+  for cls in classes:
+    bpy.utils.register_class(cls)
+
+def unregister():
+  for cls in classes:
+    bpy.utils.unregister_class(cls)
\ No newline at end of file
index 78498f6..0bf9509 100644 (file)
@@ -1,5 +1,5 @@
 # gpl authors: nfloyd, Francesco Siddi
-
+import bpy
 from bpy.types import PropertyGroup
 from bpy.props import (
         BoolProperty,
@@ -16,41 +16,41 @@ from bpy.props import (
 
 
 class POVData(PropertyGroup):
-    distance: FloatProperty()
-    location: FloatVectorProperty(
+    distance : FloatProperty()
+    location : FloatVectorProperty(
             subtype='TRANSLATION'
             )
-    rotation: FloatVectorProperty(
+    rotation : FloatVectorProperty(
             subtype='QUATERNION',
             size=4
             )
-    name: StringProperty()
-    perspective: EnumProperty(
+    name : StringProperty()
+    perspective : EnumProperty(
             items=[('PERSP', '', ''),
                    ('ORTHO', '', ''),
                    ('CAMERA', '', '')]
             )
-    lens: FloatProperty()
-    clip_start: FloatProperty()
-    clip_end: FloatProperty()
-    lock_cursor: BoolProperty()
-    cursor_location: FloatVectorProperty()
-    perspective_matrix_md5: StringProperty()
-    camera_name: StringProperty()
-    camera_type: StringProperty()
-    lock_object_name: StringProperty()
+    lens : FloatProperty()
+    clip_start : FloatProperty()
+    clip_end : FloatProperty()
+    lock_cursor : BoolProperty()
+    cursor_location : FloatVectorProperty()
+    perspective_matrix_md5 = StringProperty()
+    camera_name : StringProperty()
+    camera_type : StringProperty()
+    lock_object_name : StringProperty()
 
 
 class LayersData(PropertyGroup):
-    view_layers = BoolVectorProperty(size=20)
-    scene_layers = BoolVectorProperty(size=20)
-    lock_camera_and_layers: BoolProperty()
-    name: StringProperty()
+    view_layers : BoolVectorProperty(size=20)
+    scene_layers : BoolVectorProperty(size=20)
+    lock_camera_and_layers : BoolProperty()
+    name : StringProperty()
 
 
 class DisplayData(PropertyGroup):
-    name: StringProperty()
-    viewport_shade: EnumProperty(
+    name = StringProperty()
+    viewport_shade = EnumProperty(
             items=[('BOUNDBOX', 'BOUNDBOX', 'BOUNDBOX'),
                    ('WIREFRAME', 'WIREFRAME', 'WIREFRAME'),
                    ('SOLID', 'SOLID', 'SOLID'),
@@ -58,52 +58,52 @@ class DisplayData(PropertyGroup):
                    ('MATERIAL', 'MATERIAL', 'MATERIAL'),
                    ('RENDERED', 'RENDERED', 'RENDERED')]
             )
-    show_only_render: BoolProperty()
-    show_outline_selected: BoolProperty()
-    show_all_objects_origin: BoolProperty()
-    show_relationship_lines: BoolProperty()
-    show_floor: BoolProperty()
-    show_axis_x: BoolProperty()
-    show_axis_y: BoolProperty()
-    show_axis_z: BoolProperty()
-    grid_lines: IntProperty()
-    grid_scale: FloatProperty()
-    grid_subdivisions: IntProperty()
-    material_mode: StringProperty()
-    show_textured_solid: BoolProperty()
-    quad_view: BoolProperty()
-    lock_rotation: BoolProperty()
-    show_sync_view: BoolProperty()
-    use_box_clip: BoolProperty()
+    show_only_render : BoolProperty()
+    show_outline_selected : BoolProperty()
+    show_all_objects_origin : BoolProperty()
+    show_relationship_lines : BoolProperty()
+    show_floor : BoolProperty()
+    show_axis_x : BoolProperty()
+    show_axis_y : BoolProperty()
+    show_axis_z : BoolProperty()
+    grid_lines : IntProperty()
+    grid_scale : FloatProperty()
+    grid_subdivisions : IntProperty()
+    material_mode : StringProperty()
+    show_textured_solid : BoolProperty()
+    quad_view : BoolProperty()
+    lock_rotation : BoolProperty()
+    show_sync_view : BoolProperty()
+    use_box_clip : BoolProperty()
 
 
 class ViewData(PropertyGroup):
-    pov: PointerProperty(
+    pov : PointerProperty(
             type=POVData
             )
-    layers: PointerProperty(
+    layers : PointerProperty(
             type=LayersData
             )
-    display: PointerProperty(
+    display : PointerProperty(
             type=DisplayData
             )
-    name: StringProperty()
+    name : StringProperty()
 
 
 class StoredViewsData(PropertyGroup):
-    pov_list: CollectionProperty(
+    pov_list : CollectionProperty(
             type=POVData
             )
-    layers_list: CollectionProperty(
+    layers_list : CollectionProperty(
             type=LayersData
             )
-    display_list: CollectionProperty(
+    display_list : CollectionProperty(
             type=DisplayData
             )
-    view_list: CollectionProperty(
+    view_list : CollectionProperty(
             type=ViewData
             )
-    mode: EnumProperty(
+    mode : EnumProperty(
             name="Mode",
             items=[('VIEW', "View", "3D View settings"),
                    ('POV', "POV", "POV settings"),
@@ -111,10 +111,27 @@ class StoredViewsData(PropertyGroup):
                    ('DISPLAY', "Display", "Display settings")],
             default='VIEW'
             )
-    current_indices: IntVectorProperty(
+    current_indices : IntVectorProperty(
             size=4,
             default=[-1, -1, -1, -1]
             )
-    view_modified: BoolProperty(
+    view_modified : BoolProperty(
             default=False
             )
+
+
+classes = (
+    POVData,
+    LayersData,
+    DisplayData,
+    ViewData,
+    StoredViewsData,
+)
+
+def register():
+  for cls in classes:
+    bpy.utils.register_class(cls)
+
+def unregister():
+  for cls in classes:
+    bpy.utils.unregister_class(cls)
\ No newline at end of file
index 9388128..5bec030 100644 (file)
@@ -79,7 +79,7 @@ class VIEW3D_stored_views_draw(Operator):
         VIEW3D_stored_views_draw._handle = bpy.types.SpaceView3D.draw_handler_add(
             _draw_callback_px, (self, context), 'WINDOW', 'POST_PIXEL')
         VIEW3D_stored_views_draw._timer = \
-            context.window_manager.event_timer_add(get_preferences_timer(), context.window)
+            context.window_manager.event_timer_add(get_preferences_timer(), window=context.window)
 
     @staticmethod
     def handle_remove(context):
@@ -154,6 +154,7 @@ class VIEW3D_PT_properties_stored_views(Panel):
     bl_label = "Stored Views"
     bl_space_type = "VIEW_3D"
     bl_region_type = "UI"
+    bl_category = "StoredViews"
 
     def draw(self, context):
         self.logger = logging.getLogger('%s Properties panel' % __name__)
@@ -174,19 +175,19 @@ class VIEW3D_PT_properties_stored_views(Panel):
 
         row = col.row(align=True)
         row.prop_enum(stored_views, "mode", 'POV')
-        row.prop_enum(stored_views, "mode", 'LAYERS')
-        row.prop_enum(stored_views, "mode", 'DISPLAY')
+        row.prop_enum(stored_views, "mode", 'LAYERS')
+        row.prop_enum(stored_views, "mode", 'DISPLAY')
 
         # UI : operators
         row = layout.row()
         row.operator("stored_views.save").index = -1
 
         # IO Operators
-        if core.get_preferences():
-            row = layout.row(align=True)
-            row.operator("stored_views.import_from_scene", text="Import from Scene")
-            row.operator("stored_views.import_blsv", text="", icon="IMPORT")
-            row.operator("stored_views.export_blsv", text="", icon="EXPORT")
+        if core.get_preferences():
+            row = layout.row(align=True)
+            row.operator("stored_views.import_from_scene", text="Import from Scene")
+            row.operator("stored_views.import_blsv", text="", icon="IMPORT")
+            row.operator("stored_views.export_blsv", text="", icon="EXPORT")
 
         data_store = core.DataStore()
         list = data_store.list
@@ -261,3 +262,19 @@ class VIEW3D_PT_properties_stored_views(Panel):
                                    text='', icon='MARKER')
         else:
             layout.label(text="No cameras in this scene")
+
+classes = (
+    VIEW3D_stored_views_draw,
+    VIEW3D_PT_properties_stored_views
+)
+
+def register():
+  for cls in classes:
+    bpy.utils.register_class(cls)
+
+def unregister():
+  for cls in classes:
+    bpy.utils.unregister_class(cls)
+
+if __name__ == "__main__":
+    register()
\ No newline at end of file