Skip to content

Commit 7fc45c8

Browse files
Provide warnings if location not set correct
1 parent 6791195 commit 7fc45c8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

loco-graphics-helper/loco_object_helper_panel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def draw_bogie_panel(self, context, layout):
4949
if vehicle_properties.is_clone_bogie:
5050
row.prop(vehicle_properties, "index",text="Clone of bogie index:")
5151
row = layout.row()
52+
53+
row.prop(vehicle_properties, "bogie_parent_index")
54+
row = layout.row()
5255
return
5356

5457
box = layout.box()

loco-graphics-helper/rct_graphics_helper_panel.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'''
99

1010
import bpy
11-
#import math
11+
import math
1212
import os
1313
from mathutils import Vector
1414

@@ -316,18 +316,25 @@ def draw_vehicle_panel(self, scene, layout):
316316
back_position = 0
317317
front_idx = 255
318318
back_idx = 255
319-
319+
warning = None
320320
if not front is None:
321321
front_position = self.get_bogie_position_from_component(front, body, half_width)
322322
back_position = self.get_bogie_position_from_component(back, body, half_width)
323323

324324
front_idx = front.loco_graphics_helper_vehicle_properties.index - 1
325325
back_idx = back.loco_graphics_helper_vehicle_properties.index - 1
326+
mid_point_x = (front.location[0] - back.location[0]) / 2 + back.location[0]
327+
if not math.isclose(body.location[0], mid_point_x, rel_tol=1e-4):
328+
warning = "BODY LOCATION IS NOT AT MID X POINT BETWEEN BOGIES! {}".format(mid_point_x)
329+
326330

327331
row = layout.row()
328332
row.label(" {}. {}, Half-Width: {}, Front Position: {}, Back Position: {}".format(idx, body.name, self.blender_to_loco_dist(half_width), self.blender_to_loco_dist(front_position), self.blender_to_loco_dist(back_position)))
329333
row = layout.row()
330334
row.label(" Body Sprite Index: {}, Front Bogie Sprite Index: {}, Back Bogie Sprite Index: {},".format(idx - 1, front_idx, back_idx))
335+
if not warning is None:
336+
row = layout.row()
337+
row.label(" WARNING: {},".format(warning))
331338

332339
if len(bodies) > 0:
333340
row = layout.row()

0 commit comments

Comments
 (0)