Fix #6452. Fix #6478. Disable camera clipping due to unpredictable Blender behaviour (reported upstream).

https://projects.blender.org/blender/blender/issues/137384
This commit is contained in:
Dion Moult
2025-04-13 11:20:57 +10:00
parent e596ac6b1b
commit c0190b5065
2 changed files with 13 additions and 9 deletions
@@ -2169,7 +2169,8 @@ class ActivateDrawingBase:
camera_props = camera.data.BIMCameraProperties
if camera_props.update_representation(camera):
bpy.ops.bim.update_representation(obj=camera.name, ifc_representation_class="")
bpy.ops.bim.refresh_clipping_planes("INVOKE_DEFAULT")
# See 6452 and 6478.
# bpy.ops.bim.refresh_clipping_planes("INVOKE_DEFAULT")
return {"FINISHED"}
@@ -2349,7 +2349,9 @@ class RefreshClippingPlanes(bpy.types.Operator):
data = region.data
props = tool.Project.get_project_props()
if not len(props.clipping_planes) and not self.camera:
# See 6452 and 6478.
# if not len(props.clipping_planes) and not self.camera:
if not len(props.clipping_planes):
data.use_clip_planes = False
else:
with bpy.context.temp_override(area=area, region=region):
@@ -2378,13 +2380,14 @@ class RefreshClippingPlanes(bpy.types.Operator):
clip_planes.append(clip_plane)
bm.free()
if self.camera:
normal = self.camera.matrix_world.col[2].to_3d()
normal *= -1
center = self.camera.matrix_world.translation
distance = -center.dot(normal)
clip_plane = (normal.x, normal.y, normal.z, distance)
clip_planes.append(clip_plane)
# See 6452 and 6478.
# if self.camera:
# normal = self.camera.matrix_world.col[2].to_3d()
# normal *= -1
# center = self.camera.matrix_world.translation
# distance = -center.dot(normal)
# clip_plane = (normal.x, normal.y, normal.z, distance)
# clip_planes.append(clip_plane)
clip_planes = cycle(clip_planes)
data.clip_planes = [tuple(next(clip_planes)) for i in range(0, 6)]