mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
add force depsgraph update method
This commit is contained in:
@@ -248,6 +248,15 @@ class Blender:
|
||||
def update_viewport(cls):
|
||||
tool.Blender.get_viewport_context()["area"].tag_redraw()
|
||||
|
||||
@classmethod
|
||||
def force_depsgraph_update(cls):
|
||||
"""useful if you need to trigger callbacks like `depsgraph_update_pre`"""
|
||||
# blender is requiring some ID to be changed
|
||||
# to trigger depsgraph update
|
||||
scene = bpy.context.scene
|
||||
scene.show_subframe = scene.show_subframe
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
@classmethod
|
||||
def ensure_unique_name(cls, name, objects, iteration=0):
|
||||
"""returns a unique name for the given name and dictionary of objects
|
||||
|
||||
@@ -681,9 +681,6 @@ class TestDrawingMaintainingSheetPosition(NewFile):
|
||||
obj = bpy.data.objects["Cube"]
|
||||
bpy.ops.bim.assign_class(ifc_class="IfcActuator", predefined_type="ELECTRICACTUATOR", userdefined_type="")
|
||||
|
||||
def update_depsgraph():
|
||||
obj.hide_render = obj.hide_render # hacky way to trigger depsgraph_update_pre
|
||||
|
||||
bpy.ops.bim.load_sheets()
|
||||
bpy.ops.bim.add_sheet()
|
||||
|
||||
@@ -714,7 +711,7 @@ class TestDrawingMaintainingSheetPosition(NewFile):
|
||||
|
||||
bpy.context.scene.camera.data.BIMCameraProperties.width = 25
|
||||
bpy.context.scene.camera.data.BIMCameraProperties.height = 25
|
||||
update_depsgraph()
|
||||
tool.Blender.force_depsgraph_update()
|
||||
|
||||
bpy.ops.bim.create_drawing()
|
||||
bpy.ops.bim.open_sheet()
|
||||
|
||||
Reference in New Issue
Block a user