mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 04:59:52 +00:00
Fix polyline plane method decorator to show properly.
The `plane_method` where not being cleared after canceling or confirming the polyline operator.
This commit is contained in:
@@ -643,12 +643,22 @@ class PolylineOperator:
|
|||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
def choose_plane(self, event: bpy.types.Event, x: bool = True, y: bool = True, z: bool = True) -> None:
|
def choose_plane(self, event: bpy.types.Event, x: bool = True, y: bool = True, z: bool = True) -> None:
|
||||||
|
def get_plane_origin():
|
||||||
|
polyline_data = bpy.context.scene.BIMPolylineProperties.insertion_polyline
|
||||||
|
polyline_points = polyline_data[0].polyline_points if polyline_data else []
|
||||||
|
if len(polyline_points) > 0:
|
||||||
|
reference_point = polyline_points[-1]
|
||||||
|
else:
|
||||||
|
reference_point = Vector((0.0, 0.0, 0.0))
|
||||||
|
self.tool_state.plane_origin = Vector((reference_point.x, reference_point.y, reference_point.z))
|
||||||
|
|
||||||
if x:
|
if x:
|
||||||
if event.shift and event.value == "PRESS" and event.type == "X":
|
if event.shift and event.value == "PRESS" and event.type == "X":
|
||||||
self.tool_state.use_default_container = False
|
self.tool_state.use_default_container = False
|
||||||
self.tool_state.plane_method = "YZ" if self.tool_state.plane_method != "YZ" else None
|
self.tool_state.plane_method = "YZ" if self.tool_state.plane_method != "YZ" else None
|
||||||
self.tool_state.axis_method = None
|
self.tool_state.axis_method = None
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
get_plane_origin()
|
||||||
|
|
||||||
if y:
|
if y:
|
||||||
if event.shift and event.value == "PRESS" and event.type == "Y":
|
if event.shift and event.value == "PRESS" and event.type == "Y":
|
||||||
@@ -656,6 +666,7 @@ class PolylineOperator:
|
|||||||
self.tool_state.plane_method = "XZ" if self.tool_state.plane_method != "XZ" else None
|
self.tool_state.plane_method = "XZ" if self.tool_state.plane_method != "XZ" else None
|
||||||
self.tool_state.axis_method = None
|
self.tool_state.axis_method = None
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
get_plane_origin()
|
||||||
|
|
||||||
if z:
|
if z:
|
||||||
if event.shift and event.value == "PRESS" and event.type == "Z":
|
if event.shift and event.value == "PRESS" and event.type == "Z":
|
||||||
@@ -663,6 +674,8 @@ class PolylineOperator:
|
|||||||
self.tool_state.plane_method = "XY" if self.tool_state.plane_method != "XY" else None
|
self.tool_state.plane_method = "XY" if self.tool_state.plane_method != "XY" else None
|
||||||
self.tool_state.axis_method = None
|
self.tool_state.axis_method = None
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
get_plane_origin()
|
||||||
|
|
||||||
|
|
||||||
def handle_instructions(
|
def handle_instructions(
|
||||||
self, context: bpy.types.Context, custom_instructions: dict = {}, custom_info: str = "", overwrite: bool = False
|
self, context: bpy.types.Context, custom_instructions: dict = {}, custom_info: str = "", overwrite: bool = False
|
||||||
@@ -880,6 +893,7 @@ class PolylineOperator:
|
|||||||
else:
|
else:
|
||||||
if event.value == "RELEASE" and event.type in {"ESC"}:
|
if event.value == "RELEASE" and event.type in {"ESC"}:
|
||||||
self.tool_state.axis_method = None
|
self.tool_state.axis_method = None
|
||||||
|
self.tool_state.plane_method = None
|
||||||
context.workspace.status_text_set(text=None)
|
context.workspace.status_text_set(text=None)
|
||||||
PolylineDecorator.uninstall()
|
PolylineDecorator.uninstall()
|
||||||
tool.Polyline.clear_polyline()
|
tool.Polyline.clear_polyline()
|
||||||
|
|||||||
@@ -1196,6 +1196,7 @@ class DrawPolylineProfile(bpy.types.Operator, PolylineOperator, tool.Ifc.Operato
|
|||||||
):
|
):
|
||||||
self.create_profiles_from_polyline(context)
|
self.create_profiles_from_polyline(context)
|
||||||
context.workspace.status_text_set(text=None)
|
context.workspace.status_text_set(text=None)
|
||||||
|
self.tool_state.plane_method = None
|
||||||
ProductDecorator.uninstall()
|
ProductDecorator.uninstall()
|
||||||
PolylineDecorator.uninstall()
|
PolylineDecorator.uninstall()
|
||||||
tool.Polyline.clear_polyline()
|
tool.Polyline.clear_polyline()
|
||||||
|
|||||||
@@ -571,6 +571,7 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator):
|
|||||||
):
|
):
|
||||||
self.create_walls_from_polyline(context)
|
self.create_walls_from_polyline(context)
|
||||||
context.workspace.status_text_set(text=None)
|
context.workspace.status_text_set(text=None)
|
||||||
|
self.tool_state.plane_method = None
|
||||||
ProductDecorator.uninstall()
|
ProductDecorator.uninstall()
|
||||||
PolylineDecorator.uninstall()
|
PolylineDecorator.uninstall()
|
||||||
tool.Polyline.clear_polyline()
|
tool.Polyline.clear_polyline()
|
||||||
|
|||||||
@@ -2633,6 +2633,7 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
|
|||||||
and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE"}
|
and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE"}
|
||||||
) or single_mode:
|
) or single_mode:
|
||||||
context.workspace.status_text_set(text=None)
|
context.workspace.status_text_set(text=None)
|
||||||
|
self.tool_state.plane_method = None
|
||||||
PolylineDecorator.uninstall()
|
PolylineDecorator.uninstall()
|
||||||
tool.Polyline.move_polyline_to_measure(context, self.input_ui)
|
tool.Polyline.move_polyline_to_measure(context, self.input_ui)
|
||||||
tool.Polyline.clear_polyline()
|
tool.Polyline.clear_polyline()
|
||||||
|
|||||||
Reference in New Issue
Block a user