Skip to content

Commit

Permalink
Provide warnings if location not set correct
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanspumpkin committed Sep 26, 2024
1 parent 6791195 commit 7fc45c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions loco-graphics-helper/loco_object_helper_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def draw_bogie_panel(self, context, layout):
if vehicle_properties.is_clone_bogie:
row.prop(vehicle_properties, "index",text="Clone of bogie index:")
row = layout.row()

row.prop(vehicle_properties, "bogie_parent_index")
row = layout.row()
return

box = layout.box()
Expand Down
11 changes: 9 additions & 2 deletions loco-graphics-helper/rct_graphics_helper_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'''

import bpy
#import math
import math
import os
from mathutils import Vector

Expand Down Expand Up @@ -316,18 +316,25 @@ def draw_vehicle_panel(self, scene, layout):
back_position = 0
front_idx = 255
back_idx = 255

warning = None
if not front is None:
front_position = self.get_bogie_position_from_component(front, body, half_width)
back_position = self.get_bogie_position_from_component(back, body, half_width)

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


row = layout.row()
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)))
row = layout.row()
row.label(" Body Sprite Index: {}, Front Bogie Sprite Index: {}, Back Bogie Sprite Index: {},".format(idx - 1, front_idx, back_idx))
if not warning is None:
row = layout.row()
row.label(" WARNING: {},".format(warning))

if len(bodies) > 0:
row = layout.row()
Expand Down

0 comments on commit 7fc45c8

Please sign in to comment.