Skip to content

Commit

Permalink
Imagix/issue13 (#15)
Browse files Browse the repository at this point in the history
* Round all points to one decimal place.
Fixes #13

* Round all pixel coordinates to 1 decimal point.

* Round to 1 decmal place (unwinds the truncation to
int)
  • Loading branch information
Imagix committed Aug 26, 2021
1 parent 28ae58f commit a7daafc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions uvtt2fgu.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def composeId(id: int) -> ET.Element:


class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y

def __init__(self, x: float, y: float):
# FGU only wants 1 decimal point
self.x = round(x, 1)
self.y = round(y, 1)

def translatePortalAdjustment(gridsize: int, adjustment: str) -> float:
'''Converts from the adjustment value to the actual pixel count
Expand Down Expand Up @@ -239,7 +239,7 @@ def __init__(self, filepath: Path, portalWidthAdjustment: str, portalLengthAdjus

def translateCoord(self, coord, dimension) -> float:
'''Translate from a grid coordinate to a pixel coordinate'''
return coord * self.gridsize + (dimension * self.gridsize) // 2
return round(coord * self.gridsize + (dimension * self.gridsize) // 2, 1)

def translateX(self, x_coord) -> float:
'''Translate from an X grid coordinate to an X pixel coordinate'''
Expand Down Expand Up @@ -460,7 +460,7 @@ def init_argparse() -> argparse.ArgumentParser:
'-r', '--remove', help='Remove the input dd2vtt file after conversion'
)
parser.add_argument(
'-v', '--version', action='version', version=f'{parser.prog} version 1.2.0'
'-v', '--version', action='version', version=f'{parser.prog} version 1.2.1'
)
parser.add_argument('files', nargs='*',
help='Files to convert to .png + .xml for FGU')
Expand Down

0 comments on commit a7daafc

Please sign in to comment.