Figured a new way to update viewport to preview changes in ifc text

This commit is contained in:
Andrej730
2023-03-16 10:02:23 +05:00
parent 296cec02e8
commit 2d32bc609a
3 changed files with 11 additions and 6 deletions
@@ -1364,11 +1364,7 @@ class DisableEditingText(bpy.types.Operator, Operator):
# force update this object's font size for viewport display
DecoratorData.data.pop(context.object.name, None)
# TODO: just needed some way to trigger UI update
# probably there is more proper way to do it
props = context.object.BIMTextProperties
props.font_size = props.font_size
tool.Blender.update_viewport()
class EditAssignedProduct(bpy.types.Operator, Operator):
+1
View File
@@ -80,6 +80,7 @@ def set_active_object(cls, obj): pass
def apply_bmesh(cls, mesh, bm): pass
def get_bmesh_for_mesh(cls, mesh, clean=False): pass
def get_viewport_context(cls): pass
def update_viewport(cls): pass
@interface
+9 -1
View File
@@ -143,4 +143,12 @@ class Blender:
"""
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
context_override = {"area": area}
return context_override
return context_override
@classmethod
def update_viewport(cls):
# if it stops working in future Blender versions
# there is an alternative:
# bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
tool.Blender.get_viewport_context()['area'].tag_redraw()