From 68cb6a52988896eee1701afb58a72b80fb6fc621 Mon Sep 17 00:00:00 2001 From: Spacek531 Date: Fri, 31 Jan 2025 23:18:07 -0800 Subject: [PATCH] add better error messages --- loco-graphics-helper/rct_graphics_helper_panel.py | 7 +++++-- loco-graphics-helper/vehicle.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/loco-graphics-helper/rct_graphics_helper_panel.py b/loco-graphics-helper/rct_graphics_helper_panel.py index 03b7b61..a456663 100644 --- a/loco-graphics-helper/rct_graphics_helper_panel.py +++ b/loco-graphics-helper/rct_graphics_helper_panel.py @@ -229,7 +229,10 @@ def draw_vehicle_panel(self, scene, layout): components = get_car_components(cars) if len(components) == 0: - return + col = layout.column() + col.label(text="No cars detected.") + col.label(text="Ensure at least one BODY is parented to a CAR") + return row = layout.row() row.label("Car(s) details:") @@ -250,7 +253,7 @@ def draw_vehicle_panel(self, scene, layout): back_name = '' if back is None else back.name mid_point_x = component.get_preferred_body_midpoint() if not math.isclose(body.matrix_world.translation[0], mid_point_x, rel_tol=1e-4): - warning = "BODY LOCATION IS NOT AT PREFERRED MID X POINT! {}".format(mid_point_x) + warning = "BODY LOCATION IS NOT AT PREFERRED MID X POINT! {}".format(round(mid_point_x,1)) if not front is None: front_position = component.get_bogie_position(SubComponent.FRONT) diff --git a/loco-graphics-helper/vehicle.py b/loco-graphics-helper/vehicle.py index d16d0d3..6bf383f 100644 --- a/loco-graphics-helper/vehicle.py +++ b/loco-graphics-helper/vehicle.py @@ -168,7 +168,7 @@ def get_car_components(cars) -> List[VehicleComponent]: component_animations = [x for x in car.children if x.loco_graphics_helper_object_properties.object_type == 'ANIMATION'] if len(component_bodies) != 1: - print("Malformed car {}".format(car.name)) + print("Car {} requires at least one child BODY".format(car.name)) continue if len(component_bogies) != 2: