예제 #1
0
 def move(self, editor, buttons, event):
     if editor.gizmo.was_hit["gizmo_z"]:
         editor.gizmo.hidden = True
         editor.gizmo.set_render_axis(AXIS_Z)
         delta_z = event.y() - self.first_click.y
         self.first_click = Vector2(event.x(), event.y())
         editor.move_points.emit(0, 0, delta_z*editor.zoom_factor)
예제 #2
0
    def move(self, editor, buttons, event):
        if editor.gizmo.was_hit["rotation_y"]:
            editor.gizmo.hidden = True
            self.was_hidden = True
            #editor.gizmo.set_render_axis(AXIS_Z)

            x, y = editor.mouse_coord_to_world_coord(self.first_click.x, self.first_click.y)
            angle_start = atan2(-(y + editor.gizmo.position.z), x - editor.gizmo.position.x)

            x, y = editor.mouse_coord_to_world_coord(event.x(), event.y())
            angle = atan2(-(y + editor.gizmo.position.z), x - editor.gizmo.position.x)
            delta = angle_start - angle


            editor.rotate_current.emit(Vector3(0, delta, 0))

            self.first_click = Vector2(event.x(), event.y())
예제 #3
0
    def move(self, editor, buttons, event):
        curr_x, curr_y = event.x(), event.y()
        last_x, last_y = self.first_click.x, self.first_click.y

        diff_x = curr_x - last_x
        diff_y = curr_y - last_y

        self.first_click = Vector2(curr_x, curr_y)

        editor.camera_horiz = (editor.camera_horiz - diff_x * (pi / 500)) % (2 * pi)
        editor.camera_vertical = (editor.camera_vertical - diff_y * (pi / 600))
        if editor.camera_vertical > pi / 2.0:
            editor.camera_vertical = pi / 2.0
        elif editor.camera_vertical < -pi / 2.0:
            editor.camera_vertical = -pi / 2.0

        # print(self.camera_vertical, "hello")
        editor.do_redraw()
예제 #4
0
    def move(self, editor, buttons, event):
        if editor.gizmo.was_hit[self.axis_name]:
            editor.gizmo.hidden = True
            editor.gizmo.set_render_axis(self.axis)

            proj = numpy.dot(editor.modelviewmatrix, self.dir)
            proj[2] = proj[3] = 0.0
            proj = proj/numpy.linalg.norm(proj)
            delta = numpy.array([event.x() - self.first_click.x, event.y() - self.first_click.y, 0, 0])
            delta[1] = -delta[1]
            self.first_click = Vector2(event.x(), event.y())
            delta_x = numpy.dot(delta, proj)

            if editor.shift_is_pressed:
                editor.move_points.emit(*self.do_delta(delta_x))

            else:
                fac = 1/3.0
                editor.move_points.emit(*self.do_delta(delta_x * editor.gizmo_scale * fac))
예제 #5
0
 def just_clicked(self, editor, buttons, event):
     self.first_click = Vector2(event.x(), event.y())