mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Fix #4213. Allow having separate windows to trigger drawing operators.
This commit is contained in:
@@ -166,6 +166,13 @@ class Blender(blenderbim.core.tool.Blender):
|
|||||||
|
|
||||||
bpy.context.window_manager.popup_menu(message_ui, title=message_type.capitalize(), icon=message_type)
|
bpy.context.window_manager.popup_menu(message_ui, title=message_type.capitalize(), icon=message_type)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_view3d_area(cls):
|
||||||
|
for window in bpy.context.window_manager.windows:
|
||||||
|
for area in window.screen.areas:
|
||||||
|
if area.type == "VIEW_3D":
|
||||||
|
return area
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_blender_prop_default_value(cls, props, prop_name):
|
def get_blender_prop_default_value(cls, props, prop_name):
|
||||||
prop_bl_rna = props.bl_rna.properties[prop_name]
|
prop_bl_rna = props.bl_rna.properties[prop_name]
|
||||||
@@ -184,7 +191,7 @@ class Blender(blenderbim.core.tool.Blender):
|
|||||||
It's a bit naive since it's just taking the first available `VIEW_3D` area
|
It's a bit naive since it's just taking the first available `VIEW_3D` area
|
||||||
when in real life you can have a couple of those but should work for the most cases.
|
when in real life you can have a couple of those but should work for the most cases.
|
||||||
"""
|
"""
|
||||||
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
|
area = cls.get_view3d_area()
|
||||||
region = next(region for region in area.regions if region.type == "WINDOW")
|
region = next(region for region in area.regions if region.type == "WINDOW")
|
||||||
space = next(space for space in area.spaces if space.type == "VIEW_3D")
|
space = next(space for space in area.spaces if space.type == "VIEW_3D")
|
||||||
context_override = {"area": area, "region": region, "space_data": space}
|
context_override = {"area": area, "region": region, "space_data": space}
|
||||||
|
|||||||
@@ -1592,12 +1592,8 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def is_drawing_active(cls):
|
def is_drawing_active(cls):
|
||||||
camera = bpy.context.scene.camera
|
camera = bpy.context.scene.camera
|
||||||
return (
|
area = tool.Blender.get_view3d_area()
|
||||||
camera
|
return camera and camera.type == "CAMERA" and camera.BIMObjectProperties.ifc_definition_id and area
|
||||||
and camera.type == "CAMERA"
|
|
||||||
and camera.BIMObjectProperties.ifc_definition_id
|
|
||||||
and any(a.type == "VIEW_3D" for a in bpy.context.screen.areas)
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_camera_orthographic(cls):
|
def is_camera_orthographic(cls):
|
||||||
@@ -1614,7 +1610,7 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def activate_drawing(cls, camera):
|
def activate_drawing(cls, camera):
|
||||||
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
|
area = tool.Blender.get_view3d_area()
|
||||||
is_local_view = area.spaces[0].local_view is not None
|
is_local_view = area.spaces[0].local_view is not None
|
||||||
if is_local_view:
|
if is_local_view:
|
||||||
bpy.ops.view3d.localview()
|
bpy.ops.view3d.localview()
|
||||||
@@ -1742,8 +1738,8 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
local_x = [v.x for v in local_bbox]
|
local_x = [v.x for v in local_bbox]
|
||||||
local_y = [v.y for v in local_bbox]
|
local_y = [v.y for v in local_bbox]
|
||||||
local_z = [v.z for v in local_bbox]
|
local_z = [v.z for v in local_bbox]
|
||||||
aabb1_min = (-x/2, -y/2, -clip_end)
|
aabb1_min = (-x / 2, -y / 2, -clip_end)
|
||||||
aabb1_max = (x/2, y/2, -clip_start)
|
aabb1_max = (x / 2, y / 2, -clip_start)
|
||||||
aabb2_min = (min(local_x), min(local_y), min(local_z))
|
aabb2_min = (min(local_x), min(local_y), min(local_z))
|
||||||
aabb2_max = (max(local_x), max(local_y), max(local_z))
|
aabb2_max = (max(local_x), max(local_y), max(local_z))
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
|||||||
Reference in New Issue
Block a user