1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
20 "name": "Stored Views",
21 "description": "Save and restore User defined views, pov, layers and display configs",
22 "author": "nfloyd, Francesco Siddi",
24 "blender": (2, 80, 0),
25 "location": "View3D > Sidebar > View > Stored Views",
27 "doc_url": "{BLENDER_MANUAL_URL}/addons/3d_view/stored_views.html",
34 import/export functionality is mostly based
35 on Bart Crouch's Theme Manager Addon
37 TODO: quadview complete support : investigate. Where's the data?
38 TODO: lock_camera_and_layers. investigate usage
41 NOTE: logging setup has to be provided by the user in a separate config file
42 as Blender will not try to configure logging by default in an add-on
43 The Config File should be in the Blender Config folder > /scripts/startup/config_logging.py
44 For setting up /location of the config folder see:
45 https://docs.blender.org/manual/en/latest/getting_started/
46 installing/configuration/directories.html
47 For configuring logging itself in the file, general Python documentation should work
48 As the logging calls are not configured, they can be kept in the other modules of this add-on
49 and will not have output until the logging configuration is set up
52 # if "bpy" in locals():
54 # importlib.reload(core)
55 # importlib.reload(ui)
56 # importlib.reload(properties)
57 # importlib.reload(operators)
58 # importlib.reload(io)
63 from . import properties
64 from . import operators
68 from bpy
.props
import (
73 from bpy
.types
import (
79 class VIEW3D_stored_views_initialize(Operator
):
80 bl_idname
= "view3d.stored_views_initialize"
81 bl_label
= "Initialize"
84 def poll(cls
, context
):
85 return not hasattr(bpy
.types
.Scene
, 'stored_views')
87 def execute(self
, context
):
88 bpy
.types
.Scene
.stored_views
= PointerProperty(
89 type=properties
.StoredViewsData
91 scenes
= bpy
.data
.scenes
93 core
.DataStore
.sanitize_data(scene
)
99 class VIEW3D_stored_views_preferences(AddonPreferences
):
102 show_exporters
: BoolProperty(
103 name
="Enable I/O Operators",
105 description
="Enable Import/Export Operations in the UI:\n"
106 "Import Stored Views preset,\n"
107 "Export Stored Views preset and \n"
108 "Import stored views from scene",
110 view_3d_update_rate
: IntProperty(
111 name
="3D view update",
112 description
="Update rate of the 3D view redraw\n"
113 "Increse the value if the UI feels sluggish",
118 def draw(self
, context
):
121 row
= layout
.row(align
=True)
122 row
.prop(self
, "view_3d_update_rate", toggle
=True)
123 row
.prop(self
, "show_exporters", toggle
=True)
128 properties
.register()
131 bpy
.utils
.register_class(VIEW3D_stored_views_initialize
)
132 bpy
.utils
.register_class(VIEW3D_stored_views_preferences
)
137 properties
.unregister()
138 operators
.unregister()
140 bpy
.utils
.unregister_class(VIEW3D_stored_views_initialize
)
141 bpy
.utils
.unregister_class(VIEW3D_stored_views_preferences
)
142 ui
.VIEW3D_stored_views_draw
.handle_remove(bpy
.context
)
143 if hasattr(bpy
.types
.Scene
, "stored_views"):
144 del bpy
.types
.Scene
.stored_views
147 if __name__
== "__main__":