mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
load clipping planes decorator reopening .blend file
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
from . import ui, prop, operator, workspace, gizmo
|
from . import ui, prop, operator, workspace, gizmo, decorator
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
operator.AppendEntireLibrary,
|
operator.AppendEntireLibrary,
|
||||||
@@ -81,6 +81,7 @@ def register():
|
|||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
bpy.utils.register_tool(workspace.ExploreTool, after={"builtin.transform"}, separator=True, group=False)
|
bpy.utils.register_tool(workspace.ExploreTool, after={"builtin.transform"}, separator=True, group=False)
|
||||||
bpy.types.Scene.BIMProjectProperties = bpy.props.PointerProperty(type=prop.BIMProjectProperties)
|
bpy.types.Scene.BIMProjectProperties = bpy.props.PointerProperty(type=prop.BIMProjectProperties)
|
||||||
|
bpy.app.handlers.load_post.append(decorator.toggle_decorations_on_load)
|
||||||
bpy.types.TOPBAR_MT_file.prepend(ui.file_menu)
|
bpy.types.TOPBAR_MT_file.prepend(ui.file_menu)
|
||||||
bpy.types.TOPBAR_MT_file_context_menu.prepend(ui.file_menu)
|
bpy.types.TOPBAR_MT_file_context_menu.prepend(ui.file_menu)
|
||||||
wm = bpy.context.window_manager
|
wm = bpy.context.window_manager
|
||||||
@@ -101,9 +102,10 @@ def register():
|
|||||||
def unregister():
|
def unregister():
|
||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
bpy.utils.unregister_tool(workspace.ExploreTool)
|
bpy.utils.unregister_tool(workspace.ExploreTool)
|
||||||
|
del bpy.types.Scene.BIMProjectProperties
|
||||||
|
bpy.app.handlers.load_post.remove(decorator.toggle_decorations_on_load)
|
||||||
bpy.types.TOPBAR_MT_file.remove(ui.file_menu)
|
bpy.types.TOPBAR_MT_file.remove(ui.file_menu)
|
||||||
bpy.types.TOPBAR_MT_file_context_menu.remove(ui.file_menu)
|
bpy.types.TOPBAR_MT_file_context_menu.remove(ui.file_menu)
|
||||||
del bpy.types.Scene.BIMProjectProperties
|
|
||||||
|
|
||||||
wm = bpy.context.window_manager
|
wm = bpy.context.window_manager
|
||||||
kc = wm.keyconfigs.addon
|
kc = wm.keyconfigs.addon
|
||||||
|
|||||||
@@ -17,11 +17,26 @@
|
|||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import gpu
|
import gpu
|
||||||
|
import bpy
|
||||||
import bmesh
|
import bmesh
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from bpy.types import SpaceView3D
|
from bpy.types import SpaceView3D
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
|
from bpy.app.handlers import persistent
|
||||||
|
|
||||||
|
|
||||||
|
@persistent
|
||||||
|
def toggle_decorations_on_load(*args):
|
||||||
|
if bpy.context.scene.BIMProjectProperties.clipping_planes:
|
||||||
|
ClippingPlaneDecorator.install(bpy.context)
|
||||||
|
else:
|
||||||
|
ClippingPlaneDecorator.uninstall()
|
||||||
|
|
||||||
|
# NOTE: ProjectDecorator cannot be loaded at reopening .blend file
|
||||||
|
# since selected_vertices and other data is stored in queried object's
|
||||||
|
# custom attributes and they get purged after Blender session is closed
|
||||||
|
# as queried object is linked from separate .blend file.
|
||||||
|
|
||||||
|
|
||||||
class ProjectDecorator:
|
class ProjectDecorator:
|
||||||
|
|||||||
Reference in New Issue
Block a user