mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Add instruction to MeasureFaceArea tool
This commit is contained in:
@@ -662,7 +662,7 @@ class PolylineOperator:
|
||||
tool.Blender.update_viewport()
|
||||
|
||||
def handle_instructions(
|
||||
self, context: bpy.types.Context, custom_instructions: dict = {}, custom_info: str = ""
|
||||
self, context: bpy.types.Context, custom_instructions: dict = {}, custom_info: str = "", overwrite: bool = False
|
||||
) -> None:
|
||||
self.info = [
|
||||
f"Axis: {self.tool_state.axis_method}",
|
||||
@@ -670,9 +670,12 @@ class PolylineOperator:
|
||||
f"Snap: {self.snapping_points[0]['type']}",
|
||||
]
|
||||
instructions = self.instructions | custom_instructions if custom_instructions else self.instructions
|
||||
|
||||
infos = self.info + custom_info if custom_info else self.info
|
||||
|
||||
if overwrite:
|
||||
instructions = custom_instructions
|
||||
infos = custom_info
|
||||
|
||||
def draw_instructions(self: bpy.types.Header, context: bpy.types.Context) -> None:
|
||||
for action, settings in instructions.items():
|
||||
if settings["icons"]:
|
||||
@@ -683,10 +686,10 @@ class PolylineOperator:
|
||||
key = settings["keys"][0]
|
||||
self.layout.label(text=key + action)
|
||||
|
||||
self.layout.label(text="|")
|
||||
|
||||
for info in infos:
|
||||
self.layout.label(text=info)
|
||||
if infos:
|
||||
self.layout.label(text="|")
|
||||
for info in infos:
|
||||
self.layout.label(text=info)
|
||||
|
||||
context.workspace.status_text_set(draw_instructions)
|
||||
|
||||
|
||||
@@ -2716,6 +2716,13 @@ class MeasureFaceAreaTool(bpy.types.Operator, PolylineOperator):
|
||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||
tool.Blender.update_viewport()
|
||||
|
||||
custom_instructions = {
|
||||
"Select Face": {"icons": True, "keys": ["MOUSE_LMB"]},
|
||||
"Deselect Face": {"icons": True, "keys": ["EVENT_SHIFT", "MOUSE_LMB"]}
|
||||
}
|
||||
custom_info = []
|
||||
self.handle_instructions(context, custom_instructions, custom_info, overwrite=True)
|
||||
|
||||
if event.type in {"MIDDLEMOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE"}:
|
||||
self.handle_mouse_move(context, event)
|
||||
return {"PASS_THROUGH"}
|
||||
@@ -2757,6 +2764,7 @@ class MeasureFaceAreaTool(bpy.types.Operator, PolylineOperator):
|
||||
|
||||
if event.value == "RELEASE" and event.type in {"ESC", "RIGHTMOUSE"}:
|
||||
bpy.context.scene.BIMPolylineProperties.insertion_polyline.clear()
|
||||
context.workspace.status_text_set(text=None)
|
||||
PolylineDecorator.uninstall()
|
||||
FaceAreaDecorator.uninstall()
|
||||
tool.Blender.update_viewport()
|
||||
|
||||
Reference in New Issue
Block a user