StructureNode.py 770 B

12345678910111213141516171819202122
  1. # Copyright (c) 2022 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from UM.Resources import Resources
  4. from UM.View.GL.OpenGL import OpenGL
  5. from UM.Scene.SceneNode import SceneNode
  6. class StructureNode(SceneNode):
  7. def __init__(self, parent):
  8. super().__init__(parent)
  9. self._shader = None
  10. def render(self, renderer):
  11. if not self.isVisible():
  12. return True
  13. if not self._shader:
  14. self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "default.shader"))
  15. if self.getMeshData():
  16. renderer.queueNode(self, shader = self._shader, transparent = False, backface_cull = False, sort = 10)
  17. return True
  18. return False