Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfieldOfView <aldo@fieldofview.com>2018-03-15 11:03:50 +0300
committerfieldOfView <aldo@fieldofview.com>2018-03-15 11:03:50 +0300
commite4a416258b96c2927adba04d0c8ffd89abc3a8a7 (patch)
tree8cd0c5822a1dfee54e78e7aa61596c0aab5956ac /cura/PickingPass.py
parent7e4cb1c36ecb4aed44bc9da4aab676eed21e1ae3 (diff)
Fix code-style and type hinting
Diffstat (limited to 'cura/PickingPass.py')
-rw-r--r--cura/PickingPass.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cura/PickingPass.py b/cura/PickingPass.py
index 4bd893e926..2a1abe8f63 100644
--- a/cura/PickingPass.py
+++ b/cura/PickingPass.py
@@ -24,7 +24,6 @@ class PickingPass(RenderPass):
self._shader = None
self._scene = Application.getInstance().getController().getScene()
-
def render(self) -> None:
if not self._shader:
self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "camera_distance.shader"))
@@ -47,7 +46,7 @@ class PickingPass(RenderPass):
self.release()
## Get the distance in mm from the camera to at a certain pixel coordinate.
- def getPickedDepth(self, x, y) -> float:
+ def getPickedDepth(self, x: int, y: int) -> float:
output = self.getOutput()
window_size = self._renderer.getWindowSize()
@@ -56,14 +55,14 @@ class PickingPass(RenderPass):
py = (0.5 + y / 2.0) * window_size[1]
if px < 0 or px > (output.width() - 1) or py < 0 or py > (output.height() - 1):
- return None
+ return -1
distance = output.pixel(px, py) # distance in micron, from in r, g & b channels
distance = (distance & 0x00ffffff) / 1000. # drop the alpha channel and covert to mm
return distance
## Get the world coordinates of a picked point
- def getPickedPosition(self, x, y) -> Vector:
+ def getPickedPosition(self, x: int, y: int) -> Vector:
distance = self.getPickedDepth(x, y)
ray = self._scene.getActiveCamera().getRay(x, y)