from Cura.View.View import View

class MeshView(View):
    def __init__(self):
        super(MeshView, self).__init__()

    def render(self):
        scene = self.getController().getScene()
        renderer = self.getRenderer()

        self._renderObject(scene.getRoot(), renderer)

    def _renderObject(self, object, renderer):
        if object.getMeshData():
            renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())

        for child in object.getChildren():
            self._renderObject(child, renderer)

from Cura.View.View import View

class MeshView(View):
    def __init__(self):
        super(MeshView, self).__init__()

    def render(self):
        scene = self.getController().getScene()
        renderer = self.getRenderer()

        self._renderObject(scene.getRoot(), renderer)

    def _renderObject(self, object, renderer):
        if not object.render():
            if object.getMeshData():
                renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())

        for child in object.getChildren():
            self._renderObject(child, renderer)

Allow SceneObjects to render themselves
Allow SceneObjects to render themselves

  from Cura.View.View import View
  
  class MeshView(View):
      def __init__(self):
          super(MeshView, self).__init__()
  
      def render(self):
          scene = self.getController().getScene()
          renderer = self.getRenderer()
  
          self._renderObject(scene.getRoot(), renderer)
  
      def _renderObject(self, object, renderer):
+         if not object.render():
-         if object.getMeshData():
+             if object.getMeshData():
-             renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())
+                 renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())
  
          for child in object.getChildren():
              self._renderObject(child, renderer)
  
Allow SceneObjects to render themselves
## Code Before:
from Cura.View.View import View

class MeshView(View):
    def __init__(self):
        super(MeshView, self).__init__()

    def render(self):
        scene = self.getController().getScene()
        renderer = self.getRenderer()

        self._renderObject(scene.getRoot(), renderer)

    def _renderObject(self, object, renderer):
        if object.getMeshData():
            renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())

        for child in object.getChildren():
            self._renderObject(child, renderer)

## Instruction:
Allow SceneObjects to render themselves
## Code After:
from Cura.View.View import View

class MeshView(View):
    def __init__(self):
        super(MeshView, self).__init__()

    def render(self):
        scene = self.getController().getScene()
        renderer = self.getRenderer()

        self._renderObject(scene.getRoot(), renderer)

    def _renderObject(self, object, renderer):
        if not object.render():
            if object.getMeshData():
                renderer.renderMesh(object.getGlobalTransformation(), object.getMeshData())

        for child in object.getChildren():
            self._renderObject(child, renderer)
