Skip to content

Commit ec05f97

Browse files
Merge pull request #1 from spacek531/add-better-error-messages
add better error messages
2 parents 5b649c0 + 68cb6a5 commit ec05f97

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

loco-graphics-helper/rct_graphics_helper_panel.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ def draw_vehicle_panel(self, scene, layout):
229229

230230
components = get_car_components(cars)
231231
if len(components) == 0:
232-
return
232+
col = layout.column()
233+
col.label(text="No cars detected.")
234+
col.label(text="Ensure at least one BODY is parented to a CAR")
235+
return
233236
row = layout.row()
234237
row.label("Car(s) details:")
235238

@@ -250,7 +253,7 @@ def draw_vehicle_panel(self, scene, layout):
250253
back_name = '' if back is None else back.name
251254
mid_point_x = component.get_preferred_body_midpoint()
252255
if not math.isclose(body.matrix_world.translation[0], mid_point_x, rel_tol=1e-4):
253-
warning = "BODY LOCATION IS NOT AT PREFERRED MID X POINT! {}".format(mid_point_x)
256+
warning = "BODY LOCATION IS NOT AT PREFERRED MID X POINT! {}".format(round(mid_point_x,1))
254257

255258
if not front is None:
256259
front_position = component.get_bogie_position(SubComponent.FRONT)

loco-graphics-helper/vehicle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def get_car_components(cars) -> List[VehicleComponent]:
168168
component_animations = [x for x in car.children if x.loco_graphics_helper_object_properties.object_type == 'ANIMATION']
169169

170170
if len(component_bodies) != 1:
171-
print("Malformed car {}".format(car.name))
171+
print("Car {} requires at least one child BODY".format(car.name))
172172
continue
173173

174174
if len(component_bogies) != 2:

0 commit comments

Comments
 (0)