Import_3ds: Improved distance cue node setup
[blender-addons.git] / space_view3d_stored_views / __init__.py
blob110f5fab8d2fa949ac1ba0e50f769ed3d458ec5d
1 # SPDX-FileCopyrightText: 2017-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 bl_info = {
6 "name": "Stored Views",
7 "description": "Save and restore User defined views, pov, layers and display configs",
8 "author": "nfloyd, Francesco Siddi",
9 "version": (0, 3, 7),
10 "blender": (2, 80, 0),
11 "location": "View3D > Sidebar > View > Stored Views",
12 "warning": "",
13 "doc_url": "{BLENDER_MANUAL_URL}/addons/3d_view/stored_views.html",
14 "category": "3D View"
17 """
18 ACKNOWLEDGMENT
19 ==============
20 import/export functionality is mostly based
21 on Bart Crouch's Theme Manager Addon
23 TODO: quadview complete support : investigate. Where's the data?
24 TODO: lock_camera_and_layers. investigate usage
25 TODO: list reordering
27 NOTE: logging setup has to be provided by the user in a separate config file
28 as Blender will not try to configure logging by default in an add-on
29 The Config File should be in the Blender Config folder > /scripts/startup/config_logging.py
30 For setting up /location of the config folder see:
31 https://docs.blender.org/manual/en/latest/getting_started/
32 installing/configuration/directories.html
33 For configuring logging itself in the file, general Python documentation should work
34 As the logging calls are not configured, they can be kept in the other modules of this add-on
35 and will not have output until the logging configuration is set up
36 """
38 # if "bpy" in locals():
39 # import importlib
40 # importlib.reload(core)
41 # importlib.reload(ui)
42 # importlib.reload(properties)
43 # importlib.reload(operators)
44 # importlib.reload(io)
45 # else:
46 import bpy
47 from . import core
48 from . import ui
49 from . import properties
50 from . import operators
51 from . import io
54 from bpy.props import (
55 BoolProperty,
56 IntProperty,
57 PointerProperty,
59 from bpy.types import (
60 AddonPreferences,
61 Operator,
65 class VIEW3D_stored_views_initialize(Operator):
66 bl_idname = "view3d.stored_views_initialize"
67 bl_label = "Initialize"
69 @classmethod
70 def poll(cls, context):
71 return not hasattr(bpy.types.Scene, 'stored_views')
73 def execute(self, context):
74 bpy.types.Scene.stored_views = PointerProperty(
75 type=properties.StoredViewsData
77 scenes = bpy.data.scenes
78 for scene in scenes:
79 core.DataStore.sanitize_data(scene)
80 return {'FINISHED'}
83 # Addon Preferences
85 class VIEW3D_stored_views_preferences(AddonPreferences):
86 bl_idname = __name__
88 show_exporters : BoolProperty(
89 name="Enable I/O Operators",
90 default=False,
91 description="Enable Import/Export Operations in the UI:\n"
92 "Import Stored Views preset,\n"
93 "Export Stored Views preset and \n"
94 "Import stored views from scene",
96 view_3d_update_rate : IntProperty(
97 name="3D view update",
98 description="Update rate of the 3D view redraw\n"
99 "Increase the value if the UI feels sluggish",
100 min=1, max=10,
101 default=1
104 def draw(self, context):
105 layout = self.layout
107 row = layout.row(align=True)
108 row.prop(self, "view_3d_update_rate", toggle=True)
109 row.prop(self, "show_exporters", toggle=True)
112 def register():
113 ui.register()
114 properties.register()
115 operators.register()
116 io.register()
117 bpy.utils.register_class(VIEW3D_stored_views_initialize)
118 bpy.utils.register_class(VIEW3D_stored_views_preferences)
121 def unregister():
122 ui.unregister()
123 properties.unregister()
124 operators.unregister()
125 io.unregister()
126 bpy.utils.unregister_class(VIEW3D_stored_views_initialize)
127 bpy.utils.unregister_class(VIEW3D_stored_views_preferences)
128 ui.VIEW3D_stored_views_draw.handle_remove(bpy.context)
129 if hasattr(bpy.types.Scene, "stored_views"):
130 del bpy.types.Scene.stored_views
133 if __name__ == "__main__":
134 register()