Skip to content

Commit

Permalink
Fix #10.
Browse files Browse the repository at this point in the history
  • Loading branch information
airalcorn2 committed Feb 5, 2019
1 parent ff35cbb commit eed5a77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 10 additions & 8 deletions strike_with_a_pose/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def __init__(self):
self.mode = self.TRANS

self.screenshot = 0
self.make_prediction = True

def fill_entry_form(self):
params = self.scene.get_params()
Expand Down Expand Up @@ -461,7 +462,7 @@ def keyPressEvent(self, event):
self.scene.use_spec = not self.scene.use_spec

if key == QtCore.Qt.Key_Q:
self.get_prediction()
self.make_prediction = True

if key == QtCore.Qt.Key_L:
self.live = not self.live
Expand All @@ -485,8 +486,6 @@ def keyPressEvent(self, event):

def get_prediction(self):
# See: https://stackoverflow.com/questions/1733096/convert-pyqt-to-pil-image.
self.model.clear()

buffer = QtCore.QBuffer()
buffer.open(QtCore.QIODevice.ReadWrite)
qimage = self.grabFramebuffer()
Expand Down Expand Up @@ -586,7 +585,6 @@ def initialize_model(self):
self.model.CTX = self.scene.CTX
self.model.PROG = self.scene.PROG
self.model.init_scene_comps()
self.scene.MODEL = self.model

def initialize_wheel_tool(self):
(amb, dif, z, view) = (self.AMB, self.DIF, self.TRANS, self.VIEW)
Expand Down Expand Up @@ -648,14 +646,18 @@ def paintGL(self):
self.initialize_model()
self.initialize_wheel_tool()
self.initialize_drag_tools()
self.scene.render()
self.get_prediction()

self.wnd.time = time.clock() - self.start_time

self.scene.render()
if self.live:
if self.make_prediction or self.live:
self.model.clear()
self.scene.render()
self.get_prediction()
self.make_prediction = False
else:
self.scene.render()

self.model.render()

self.wnd.old_keys = np.copy(self.wnd.keys)
self.wnd.wheel = 0
Expand Down
2 changes: 0 additions & 2 deletions strike_with_a_pose/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ def render(self):
self.VAOS[RENDER_OBJ].render()
self.PROG["has_image"].value = False

self.MODEL.render()

def set_xy(self, xy):
self.PROG["x"].value = xy[0]
self.PROG["y"].value = xy[1]
Expand Down

0 comments on commit eed5a77

Please sign in to comment.