mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Clean-up & requirements update
This commit is contained in:
parent
6be979c670
commit
036a69c9cd
3 changed files with 11 additions and 8 deletions
|
@ -5,6 +5,7 @@ from UM.Math.AxisAlignedBox import AxisAlignedBox
|
|||
from cura.PickingPass import PickingPass
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from cura.Scene.OverlayNode import OverlayNode, SceneNode
|
||||
from UM.Resources import Resources
|
||||
|
||||
class NavlibClient(pynav.NavlibNavigationModel):
|
||||
|
||||
|
@ -16,7 +17,7 @@ class NavlibClient(pynav.NavlibNavigationModel):
|
|||
self._was_pick = False
|
||||
self._hit_selection_only = False
|
||||
self._picking_pass = None
|
||||
self._pivot_node = OverlayNode(node=SceneNode(), image_path="resources/images/3dx_pivot.png", size=3.)
|
||||
self._pivot_node = OverlayNode(node=SceneNode(), image_path=Resources.getPath(Resources.Images, "3dx_pivot.png"), size=3.)
|
||||
|
||||
def pick(self, x, y, check_selection = False, radius = 0.):
|
||||
|
||||
|
@ -224,13 +225,13 @@ class NavlibClient(pynav.NavlibNavigationModel):
|
|||
if active_camera.isPerspective():
|
||||
camera_position = active_camera.getWorldPosition()
|
||||
dist = (camera_position - self._pivot_node.getWorldPosition()).length()
|
||||
scale = dist/400
|
||||
if scale < 1.0:
|
||||
scale = dist / 400.
|
||||
if scale < 1.:
|
||||
scale = scale * scale
|
||||
else:
|
||||
view_width = active_camera.getViewportWidth()
|
||||
current_size = view_width + (2 * active_camera.getZoomFactor() * view_width)
|
||||
scale = current_size / view_width * 5
|
||||
current_size = view_width + (2. * active_camera.getZoomFactor() * view_width)
|
||||
scale = current_size / view_width * 5.
|
||||
|
||||
self._pivot_node.scale(scale)
|
||||
|
||||
|
@ -253,7 +254,7 @@ class NavlibClient(pynav.NavlibNavigationModel):
|
|||
self._renderer.removeRenderPass(self._picking_pass)
|
||||
|
||||
def set_pivot_position(self, position):
|
||||
self._pivot_node._target_node.setPosition(position=Vector(position._x, position._y, position._z), transform_space = 3)
|
||||
self._pivot_node._target_node.setPosition(position=Vector(position._x, position._y, position._z), transform_space = SceneNode.TransformSpace.World)
|
||||
|
||||
def set_pivot_visible(self, visible):
|
||||
if visible:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue