Commit 7b4dae7b authored by cobaltcore's avatar cobaltcore
Browse files

Code Cleanup

parent 00e86b77
......@@ -15,6 +15,7 @@
define config.name = _("spline_edit")
define _game_menu_screen = None
define config.help_screen = False
## Determines if the title given above is shown on the main menu screen. Set
......
......@@ -212,36 +212,28 @@ class SplineEditor(renpy.exports.Displayable):
def recompute_spline(self):
self.spline_dots = []
spline_points = []
self.spline_points = spline_points
self.spline_points = []
if len(self.points) < 2:
return
spline_points.append(((self.points[0].x, self.points[0].y),))
self.spline_points.append(((self.points[0].x, self.points[0].y),))
for i in range(0, len(self.points) - 1):
spline_points.append((
(self.points[i + 1].x,
self.points[i + 1].y),
(self.trail_handle[i].x,
self.trail_handle[i].y),
(self.lead_handle[i + 1].x,
self.lead_handle[i + 1].y),
self.spline_points.append((
(self.points[i + 1].x, self.points[i + 1].y),
(self.trail_handle[i].x, self.trail_handle[i].y),
(self.lead_handle[i + 1].x, self.lead_handle[i + 1].y),
))
if self.closed:
spline_points.append((
(self.points[0].x,
self.points[0].y),
(self.trail_handle[-1].x,
self.trail_handle[-1].y),
(self.lead_handle[0].x,
self.lead_handle[0].y),
self.spline_points.append((
(self.points[0].x, self.points[0].y),
(self.trail_handle[-1].x, self.trail_handle[-1].y),
(self.lead_handle[0].x, self.lead_handle[0].y),
))
pi = renpy.store._SplineInterpolator(spline_points)
pi = renpy.store._SplineInterpolator(self.spline_points)
if self.closed:
numdots = len(self.points) * 15
......@@ -250,7 +242,6 @@ class SplineEditor(renpy.exports.Displayable):
for j in range(0, numdots + 1):
t = 1.0 * j / numdots
x, y, xo, yo = pi(t, (W, H, DOT_SIZE, DOT_SIZE))
self.spline_dots.append((x, y))
......@@ -259,12 +250,4 @@ class SplineEditor(renpy.exports.Displayable):
x, y = t
return (1.0 * (x - X) / W, 1.0 * (y - Y) / H)
return list(tuple(make_relative(i) for i in j) for j in self.spline_points)
def format(v):
# Nicely formats nested tuples and floats.
if isinstance(v, tuple):
return "(" + ", ".join(format(i) for i in v) + ",)"
else:
return "%.3f" % v
return [tuple(make_relative(i) for i in j) for j in self.spline_points]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment