Example #1
0
    def on_notify(self, event):

        # Suppress error dialog on access denied
        log_null = wx.LogNull()  # noqa: F841

        for shader_type, (path, last_mtime) in self.file_infos.items():
            mtime = os.path.getmtime(path)
            if last_mtime < mtime:
                logger.debug('Reloading {}...'.format(path))
                self.attach_shader(path, shader_type)
                post_redisplay()

        self.timer.Start(100, True)
Example #2
0
    def refresh_position(self):
        center = self.camera.scene.bounding_box.center
        dummy_cam = Camera()
        dummy_cam.matrix = self.default_matrix
        z_shift = dummy_cam.distance_to_point(center)
        self.camera.matrix = Matrix44.from_translation([self._shift_x, self._shift_y, self._distance]) * \
                             Matrix44.from_translation([0, 0, -z_shift]) * \
                             Matrix44.from_x_rotation(-self._angle_y) * \
                             Matrix44.from_y_rotation(-self._angle_x) * \
                             Matrix44.from_translation([0, 0, z_shift]) * \
                             self.default_matrix

        post_redisplay()
Example #3
0
 def on_animate(self, event):
     self.animation_value = self.animation_value + 0.1 if self.animation_value <= 1.0 else -1
     post_redisplay()
Example #4
0
 def update_camera_to_keyframe(self, index: int):
     p = self.get_keyframe_at_index(index)
     self.camera.look_at(p.position, p.position + p.direction, p.up)
     post_redisplay()
Example #5
0
 def __del__(self):
     post_redisplay()
Example #6
0
 def unsync_camera(self):
     self.is_sync = False
     self.need_state_saved = False
     self.global_interactor = None
     self.notify_observers()
     post_redisplay()
Example #7
0
 def sync_camera(self, interactor, save_state):
     self.is_sync = True
     self.need_state_saved = save_state
     self.global_interactor = interactor
     self.notify_observers()
     post_redisplay()
Example #8
0
 def refresh_position(self):
     self.camera.matrix = Matrix44.from_x_rotation(self._angle_x) * \
                          Matrix44.from_y_rotation(-self._angle_y) * self.default_matrix
     post_redisplay()