error message on setting flow direction for disconnected port

previously it just did nothing which was a bit confusing
This commit is contained in:
Andrej730
2023-08-01 13:17:35 +05:00
parent 0ef14bad6f
commit c5c8a3ba0b
@@ -201,6 +201,11 @@ class SetFlowDirection(bpy.types.Operator, Operator):
direction: bpy.props.StringProperty()
def _execute(self, context):
port = tool.Ifc.get_entity(context.active_object)
second_port = tool.System.get_connected_port(port)
if not second_port:
self.report({"ERROR"}, "To set flow direction port has to be connected to another one.")
return
core.set_flow_direction(
tool.Ifc, tool.System, port=tool.Ifc.get_entity(context.active_object), direction=self.direction
)