delete nodeset

This commit is contained in:
Frank DeMarco 2014-01-24 01:02:11 +09:00
parent 1b5aff80b3
commit 7cdca64d51
1 changed files with 11 additions and 4 deletions

View File

@ -177,7 +177,7 @@ class LinearSpline(Spline):
class GUI(GameChild):
B_WRITE, B_LINEAR, B_CUBIC = range(3)
B_DUPLICATE, B_WRITE, B_DELETE, B_LINEAR, B_CUBIC = range(5)
def __init__(self, parent):
GameChild.__init__(self, parent)
@ -234,9 +234,9 @@ class GUI(GameChild):
def set_buttons(self):
self.buttons = buttons = []
text = "Write", "Linear", "Cubic"
text = "Duplicate", "Write", "Delete", "Linear", "Cubic"
x = 0
for ii in xrange(3):
for ii in xrange(5):
buttons.append(Button(self, text[ii], x))
x += buttons[-1].location.w + 10
@ -357,7 +357,7 @@ class GUI(GameChild):
if bi is not None:
if bi == self.B_WRITE:
self.get_configuration().write()
else:
elif bi in (self.B_LINEAR, self.B_CUBIC):
nodeset = self.get_nodeset()
if bi == self.B_LINEAR:
nodeset.set_interpolation_method(Nodeset.LINEAR)
@ -365,6 +365,13 @@ class GUI(GameChild):
nodeset.set_interpolation_method(Nodeset.CUBIC)
self.store_in_configuration()
redraw = True
elif bi == self.B_DUPLICATE:
pass
elif bi == self.B_DELETE and len(self.parent) > 1:
self.parent.remove(self.get_nodeset())
self.set_nodeset_index(1)
self.store_in_configuration()
redraw = True
elif plot_rect.collidepoint(pos) and \
not self.collide_markers(pos):
xp, yp = pos[0] - plot_rect.left, pos[1] - plot_rect.top