def __init__(self, **options):

        options.setdefault('enableRaycasting', True)
        super(MyDeformerApp, self).__init__(**options)

        scene = self.getScene()

        # import the cube obj file
        objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
        importer = OBJImporter(scene, filePath=objPath)
        nodesList = importer.importAsset()

        # loop over all constructed nodes
        for name, node in nodesList.iteritems():
            if isinstance(node, PolygonMesh):
                self.__geometry = node
                break

        # add the bezier deformer and gizmo
        self.__deformerComp = BezierDeformComponent()
        self.__gizmoComp = BezierGizmoComponent(
            deformerComp=self.__deformerComp)
        self.__geometry.addComponent(self.__deformerComp)
        self.__geometry.addComponent(self.__gizmoComp)

        # setup the gizmo
        self.__manipulator = GizmoManipulator(scene)
        self.__gizmo = GizmoInstance(
            scene,
            source=self.__geometry,
            sourceDGNodeName='GeometryDGNode',
            sourceMemberName=self.__gizmoComp.getGizmoMember())
        self.__manipulator.addGizmoNode(self.__gizmo)
        self.__gizmoComp.setVisible(False)

        # listen to activation and deactivation of manipulators
        def onManipActivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(True)

        def onManipDeactivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(False)

        self.addEventListener("manipulatorActivated", onManipActivate)
        self.addEventListener("manipulatorDeactivated", onManipDeactivate)

        # check errors and show UI
        self.constructionCompleted()
    def __init__(self, **options):
        super(MyDeformerApp, self).__init__(**options)

        # Setup Application Services.
        self.setupUndoRedo()

        self.setupViewports()
        self.setupSunlight()
        self.setupCamera()
        self.setupGrid(gridSize=25.0)

        scene = self.getScene()

        # import the cube obj file
        importer = OBJImporter(scene, filePath='cube.obj')
        nodesList = importer.importAsset()

        # loop over all constructed nodes
        for name, node in nodesList.iteritems():
            if isinstance(node, PolygonMesh):

                # construct the bezier deformer
                deformerComp = BezierDeformComponent()
                gizmoComp = BezierGizmoComponent(deformerComp=deformerComp)
                node.addComponent(deformerComp)
                node.addComponent(gizmoComp)

                # setup the gizmo
                manipulator = GizmoManipulator(scene)
                gizmo = GizmoInstance(
                    scene,
                    source=node,
                    sourceDGNodeName='GeometryDGNode',
                    sourceMemberName=gizmoComp.getGizmoMember())
                manipulator.addGizmoNode(gizmo)

                self.getCameraManipulator().setChildManipulatorNode(
                    manipulator)

                # node inspector
                self.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
                                   SGNodeInspectorDockWidget({'node': node}))

        # check errors and show UI
        self.constructionCompleted()
  def __init__(self, **options):
    super(MyDeformerApp, self).__init__(**options)

    # Setup Application Services. 
    self.setupUndoRedo()

    self.setupViewports()
    self.setupSunlight()
    self.setupCamera()
    self.setupGrid(gridSize = 25.0)

    scene = self.getScene()

    # import the cube obj file
    importer = OBJImporter(scene, filePath='cube.obj')
    nodesList = importer.importAsset()

    # loop over all constructed nodes
    for name, node in nodesList.iteritems():
      if isinstance(node, PolygonMesh):

        # construct the bezier deformer
        deformerComp = BezierDeformComponent()
        gizmoComp = BezierGizmoComponent(deformerComp = deformerComp)
        node.addComponent(deformerComp)
        node.addComponent(gizmoComp)
   
        # setup the gizmo
        manipulator = GizmoManipulator(scene)
        gizmo = GizmoInstance(scene,
          source=node, 
          sourceDGNodeName='GeometryDGNode', 
          sourceMemberName=gizmoComp.getGizmoMember()
        )
        manipulator.addGizmoNode(gizmo)

        self.getCameraManipulator().setChildManipulatorNode(manipulator)

        # node inspector
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, SGNodeInspectorDockWidget({ 'node':node }))

    # check errors and show UI
    self.constructionCompleted()
Example #4
0
  def __init__(self):
    
    super(MyDeformerApp, self).__init__(
      enableRaycasting=True,
      gridSize=100.0,
      setupUndoRedo=False
    )
    
    # query the constructed components
    scene = self.getScene()
    
    # import the text obj file
    importer = OBJImporter(scene, filePath='text.obj')
    nodesList = importer.importAsset()

    # loop over all constructed nodes
    for name, node in nodesList.iteritems():
      if isinstance(node, PolygonMesh):

        # construct the bezier deformer
        deformerComp = BezierDeformComponent()
        gizmoComp = BezierGizmoComponent(deformerComp = deformerComp)
        node.addComponent(deformerComp)
        node.addComponent(gizmoComp)
   
        # setup the gizmo
        self.__manipulator = GizmoManipulator(scene)
        gizmo = GizmoInstance(scene,
          source=node, 
          sourceDGNodeName='GeometryDGNode', 
          sourceMemberName=gizmoComp.getGizmoMember()
        )
        self.__manipulator.addGizmoNode(gizmo)

    # for every client connecting, 
    # push the gizmo manipulator to the client's camera manipulator
    def onClientConnecting(webSocketHandler):
      webSocketHandler.getCameraManipulator().setChildManipulatorNode(self.__manipulator)

    self.setWebSocketConnectionCallback(onClientConnecting)
Example #5
0
    def __init__(self):

        super(MyDeformerApp, self).__init__(enableRaycasting=True,
                                            gridSize=100.0,
                                            setupUndoRedo=False)

        # query the constructed components
        scene = self.getScene()

        # import the text obj file
        importer = OBJImporter(scene, filePath='text.obj')
        nodesList = importer.importAsset()

        # loop over all constructed nodes
        for name, node in nodesList.iteritems():
            if isinstance(node, PolygonMesh):

                # construct the bezier deformer
                deformerComp = BezierDeformComponent()
                gizmoComp = BezierGizmoComponent(deformerComp=deformerComp)
                node.addComponent(deformerComp)
                node.addComponent(gizmoComp)

                # setup the gizmo
                self.__manipulator = GizmoManipulator(scene)
                gizmo = GizmoInstance(
                    scene,
                    source=node,
                    sourceDGNodeName='GeometryDGNode',
                    sourceMemberName=gizmoComp.getGizmoMember())
                self.__manipulator.addGizmoNode(gizmo)

        # for every client connecting,
        # push the gizmo manipulator to the client's camera manipulator
        def onClientConnecting(webSocketHandler):
            webSocketHandler.getCameraManipulator().setChildManipulatorNode(
                self.__manipulator)

        self.setWebSocketConnectionCallback(onClientConnecting)
  def __init__(self, **options):
    
    options.setdefault('enableRaycasting', True)
    super(MyDeformerApp, self).__init__(**options)

    scene = self.getScene()

    # import the cube obj file
    objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
    importer = OBJImporter(scene, filePath=objPath)
    nodesList = importer.importAsset()

    # loop over all constructed nodes
    for name, node in nodesList.iteritems():
      if isinstance(node, PolygonMesh):
        self.__geometry = node
        break

    # add the bezier deformer and gizmo
    self.__deformerComp = BezierDeformComponent()
    self.__gizmoComp = BezierGizmoComponent(deformerComp = self.__deformerComp)
    self.__geometry.addComponent(self.__deformerComp)
    self.__geometry.addComponent(self.__gizmoComp)

    # setup the gizmo
    self.__manipulator = GizmoManipulator(scene)
    self.__gizmo = GizmoInstance(scene,
      source=self.__geometry, 
      sourceDGNodeName='GeometryDGNode', 
      sourceMemberName=self.__gizmoComp.getGizmoMember()
    )
    self.__manipulator.addGizmoNode(self.__gizmo)
    self.__gizmoComp.setVisible(False)

    # listen to activation and deactivation of manipulators
    def onManipActivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(True)

    def onManipDeactivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(False)

    self.addEventListener("manipulatorActivated", onManipActivate)
    self.addEventListener("manipulatorDeactivated", onManipDeactivate)

    # check errors and show UI
    self.constructionCompleted()
    def __init__(self, **options):

        options.setdefault('enableRaycasting', True)
        super(MyDeformerApp, self).__init__(**options)

        scene = self.getScene()

        # setup an empty polygon mesh node
        self.__geometry = PolygonMesh(scene, name="DeformedMesh")
        self.__geometry.addComponent(PolygonMeshFromArraysComponent())
        self.__deformerComp = BezierDeformComponent()
        self.__gizmoComp = BezierGizmoComponent(
            deformerComp=self.__deformerComp)
        self.__geometry.addComponent(self.__deformerComp)
        self.__geometry.addComponent(self.__gizmoComp)

        if self.runsStandalone():

            # import the cube obj file
            objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
            importer = OBJImporter(scene,
                                   filePath=objPath,
                                   constructMaterials=False)
            nodesList = importer.importAsset()

            # loop over all constructed nodes
            for name, node in nodesList.iteritems():
                if isinstance(node, PolygonMesh):
                    node.addComponent(PolygonMeshToArraysComponent())

                    def connectMeshToMesh(data):
                        node = data['node']

                        # add an operator which will copy the arrays
                        self.__geometry.getGeometryDGNode().setDependency(
                            node.getGeometryDGNode(), 'inGeometry')
                        node.bindDGOperator(
                            self.__geometry.getGeometryDGNode().bindings,
                            name='copyPolygonMeshFromArray',
                            sourceCode=[
                                'operator copyPolygonMeshFromArray(',
                                '  Vec3 outputTopoPositions[],',
                                '  Integer outputTopoIndices[],',
                                '  io Vec3 inputTopoPositions[],',
                                '  io Integer inputTopoIndices[]', ') {',
                                '  inputTopoPositions = outputTopoPositions;',
                                '  inputTopoIndices = outputTopoIndices;', '}'
                            ],
                            layout=[
                                'inGeometry.outputTopoPositions',
                                'inGeometry.outputTopoIndices',
                                'self.inputTopoPositions',
                                'self.inputTopoIndices'
                            ],
                            index=0  # put this operator in the first place
                        )

                    self.__geometry.addReferenceInterface(
                        'InputGeometry', PolygonMesh, False, connectMeshToMesh)
                    self.__geometry.setInputGeometryNode(node)
                    break
        else:
            # if we are running integrated, provide the geometry back to the DCC
            self.__geometry.addComponent(PolygonMeshToArraysComponent())

        # setup the gizmo
        self.__manipulator = GizmoManipulator(scene)
        self.__gizmo = GizmoInstance(
            scene,
            source=self.__geometry,
            sourceDGNodeName='GeometryDGNode',
            sourceMemberName=self.__gizmoComp.getGizmoMember())
        self.__manipulator.addGizmoNode(self.__gizmo)
        self.__gizmoComp.setVisible(False)

        # listen to activation and deactivation of manipulators
        def onManipActivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(True)

        def onManipDeactivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(False)

        self.addEventListener("manipulatorActivated", onManipActivate)
        self.addEventListener("manipulatorDeactivated", onManipDeactivate)

        # check errors and show UI
        self.constructionCompleted()
  def __init__(self, **options):
    
    options.setdefault('enableRaycasting', True)
    super(MyDeformerApp, self).__init__(**options)

    scene = self.getScene()

    # setup an empty polygon mesh node
    self.__geometry = PolygonMesh(scene, name = "DeformedMesh")
    self.__geometry.addComponent(PolygonMeshFromArraysComponent())
    self.__deformerComp = BezierDeformComponent()
    self.__gizmoComp = BezierGizmoComponent(deformerComp = self.__deformerComp)
    self.__geometry.addComponent(self.__deformerComp)
    self.__geometry.addComponent(self.__gizmoComp)

    if self.runsStandalone():

      # import the cube obj file
      objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
      importer = OBJImporter(scene, filePath=objPath, constructMaterials = False)
      nodesList = importer.importAsset()
  
      # loop over all constructed nodes
      for name, node in nodesList.iteritems():
        if isinstance(node, PolygonMesh):
          node.addComponent(PolygonMeshToArraysComponent())

          def connectMeshToMesh(data):
            node = data['node']

            # add an operator which will copy the arrays
            self.__geometry.getGeometryDGNode().setDependency(node.getGeometryDGNode(), 'inGeometry')
            node.bindDGOperator(self.__geometry.getGeometryDGNode().bindings,
              name = 'copyPolygonMeshFromArray',
              sourceCode = [
                'operator copyPolygonMeshFromArray(',
                '  Vec3 outputTopoPositions[],',
                '  Integer outputTopoIndices[],',
                '  io Vec3 inputTopoPositions[],',
                '  io Integer inputTopoIndices[]',
                ') {',
                '  inputTopoPositions = outputTopoPositions;',
                '  inputTopoIndices = outputTopoIndices;',
                '}'
              ],
              layout = [
                'inGeometry.outputTopoPositions',
                'inGeometry.outputTopoIndices',
                'self.inputTopoPositions',
                'self.inputTopoIndices'
              ],
              index = 0 # put this operator in the first place
            )

          self.__geometry.addReferenceInterface('InputGeometry', PolygonMesh, False, connectMeshToMesh)
          self.__geometry.setInputGeometryNode(node)
          break
    else:
      # if we are running integrated, provide the geometry back to the DCC
      self.__geometry.addComponent(PolygonMeshToArraysComponent())

    # setup the gizmo
    self.__manipulator = GizmoManipulator(scene)
    self.__gizmo = GizmoInstance(scene,
      source=self.__geometry, 
      sourceDGNodeName='GeometryDGNode', 
      sourceMemberName=self.__gizmoComp.getGizmoMember()
    )
    self.__manipulator.addGizmoNode(self.__gizmo)
    self.__gizmoComp.setVisible(False)

    # listen to activation and deactivation of manipulators
    def onManipActivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(True)

    def onManipDeactivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(False)

    self.addEventListener("manipulatorActivated", onManipActivate)
    self.addEventListener("manipulatorDeactivated", onManipDeactivate)

    # check errors and show UI
    self.constructionCompleted()
Example #9
0
class MyDeformerApp(IntegratedApplication):
    def __init__(self, **options):

        options.setdefault('enableRaycasting', True)
        super(MyDeformerApp, self).__init__(**options)

        scene = self.getScene()

        # setup an empty polygon mesh node
        self.__geometry = PolygonMesh(scene, name="DeformedMesh")
        self.__geometry.addComponent(PolygonMeshFromArraysComponent())
        self.__deformerComp = BezierDeformComponent()
        self.__gizmoComp = BezierGizmoComponent(
            deformerComp=self.__deformerComp)
        self.__geometry.addComponent(self.__deformerComp)
        self.__geometry.addComponent(self.__gizmoComp)

        if self.runsStandalone():

            # import the cube obj file
            objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
            importer = OBJImporter(scene,
                                   filePath=objPath,
                                   constructMaterials=False)
            nodesList = importer.importAsset()

            # loop over all constructed nodes
            for name, node in nodesList.iteritems():
                if isinstance(node, PolygonMesh):
                    node.addComponent(PolygonMeshToArraysComponent())

                    def connectMeshToMesh(data):
                        node = data['node']

                        # add an operator which will copy the arrays
                        self.__geometry.getGeometryDGNode().setDependency(
                            'inGeometry', node.getGeometryDGNode())
                        node.bindDGOperator(
                            self.__geometry.getGeometryDGNode().bindings,
                            name='copyPolygonMeshFromArray',
                            sourceCode=[
                                'operator copyPolygonMeshFromArray(',
                                '  Vec3 outputTopoPositions[],',
                                '  Integer outputTopoIndices[],',
                                '  io Vec3 inputTopoPositions[],',
                                '  io Integer inputTopoIndices[]', ') {',
                                '  inputTopoPositions = outputTopoPositions;',
                                '  inputTopoIndices = outputTopoIndices;', '}'
                            ],
                            layout=[
                                'inGeometry.outputTopoPositions',
                                'inGeometry.outputTopoIndices',
                                'self.inputTopoPositions',
                                'self.inputTopoIndices'
                            ],
                            index=0  # put this operator in the first place
                        )

                    self.__geometry.addReferenceInterface(
                        'InputGeometry', PolygonMesh, False, connectMeshToMesh)
                    self.__geometry.setInputGeometryNode(node)
                    break

        # create the shaders
        phongMaterial = Material(scene, xmlFile='PhongMaterial')
        phongMaterial.addPreset(name='blue', diffuseColor=Color(0.0, 0.0, 1.0))

        # create transforms
        self.__transform = Transform(scene)

        # create the instances
        instance = GeometryInstance(scene,
                                    geometry=self.__geometry,
                                    transform=self.__transform,
                                    material=phongMaterial)

        # setup the gizmo
        self.__manipulator = GizmoManipulator(scene)
        self.__gizmo = GizmoInstance(
            scene,
            source=self.__geometry,
            sourceDGNodeName='GeometryDGNode',
            sourceMemberName=self.__gizmoComp.getGizmoMember())
        self.__manipulator.addGizmoNode(self.__gizmo)
        self.__gizmoComp.setVisible(False)

        # listen to activation and deactivation of manipulators
        def onManipActivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(True)

        def onManipDeactivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(False)

        self.addEventListener("manipulatorActivated", onManipActivate)
        self.addEventListener("manipulatorDeactivated", onManipDeactivate)

        # check errors and show UI
        self.constructionCompleted()

    def getWidgetNames(self):
        return ["BezierDeform Options"]

    def getWidget(self, name):
        if name == "BezierDeform Options":
            widget = IntegratedWidget(
                SGNodeInspector({'node': self.__geometry}), self)
            widget.setWindowTitle("Fur Options")
            return widget
        return None

    def getManipulatorNames(self):
        names = ["BezierManip"]
        if self.runsStandalone():
            names.append("Camera")
        return names

    def getManipulator(self, name):
        if name == "BezierManip":
            return self.__manipulator
        if name == "Camera":
            return self.getCameraManipulator()
        return None
class MyDeformerApp(IntegratedApplication):

  def __init__(self, **options):
    
    options.setdefault('enableRaycasting', True)
    super(MyDeformerApp, self).__init__(**options)

    scene = self.getScene()

    # import the cube obj file
    objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
    importer = OBJImporter(scene, filePath=objPath)
    nodesList = importer.importAsset()

    # loop over all constructed nodes
    for name, node in nodesList.iteritems():
      if isinstance(node, PolygonMesh):
        self.__geometry = node
        break

    # add the bezier deformer and gizmo
    self.__deformerComp = BezierDeformComponent()
    self.__gizmoComp = BezierGizmoComponent(deformerComp = self.__deformerComp)
    self.__geometry.addComponent(self.__deformerComp)
    self.__geometry.addComponent(self.__gizmoComp)

    # setup the gizmo
    self.__manipulator = GizmoManipulator(scene)
    self.__gizmo = GizmoInstance(scene,
      source=self.__geometry, 
      sourceDGNodeName='GeometryDGNode', 
      sourceMemberName=self.__gizmoComp.getGizmoMember()
    )
    self.__manipulator.addGizmoNode(self.__gizmo)
    self.__gizmoComp.setVisible(False)

    # listen to activation and deactivation of manipulators
    def onManipActivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(True)

    def onManipDeactivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(False)

    self.addEventListener("manipulatorActivated", onManipActivate)
    self.addEventListener("manipulatorDeactivated", onManipDeactivate)

    # check errors and show UI
    self.constructionCompleted()

  def getWidgetNames(self):
    return ["BezierDeform Options"]

  def getWidget(self, name):
    if name == "BezierDeform Options":
      widget = IntegratedWidget(SGNodeInspector({ 'node':self.__geometry }), self)
      widget.setWindowTitle("Fur Options")
      return widget
    return None

  def getManipulatorNames(self):
    names = ["BezierManip"]
    if self.runsStandalone():
      names.append("Camera")
    return names

  def getManipulator(self, name):
    if name == "BezierManip":
      return self.__manipulator
    if name == "Camera":
      return self.getCameraManipulator()
    return None
class MyDeformerApp(IntegratedApplication):

  def __init__(self, **options):
    
    options.setdefault('enableRaycasting', True)
    super(MyDeformerApp, self).__init__(**options)

    scene = self.getScene()

    # setup an empty polygon mesh node
    self.__geometry = PolygonMesh(scene, name = "DeformedMesh")
    self.__geometry.addComponent(PolygonMeshFromArraysComponent())
    self.__deformerComp = BezierDeformComponent()
    self.__gizmoComp = BezierGizmoComponent(deformerComp = self.__deformerComp)
    self.__geometry.addComponent(self.__deformerComp)
    self.__geometry.addComponent(self.__gizmoComp)

    if self.runsStandalone():

      # import the cube obj file
      objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
      importer = OBJImporter(scene, filePath=objPath, constructMaterials = False)
      nodesList = importer.importAsset()
  
      # loop over all constructed nodes
      for name, node in nodesList.iteritems():
        if isinstance(node, PolygonMesh):
          node.addComponent(PolygonMeshToArraysComponent())

          def connectMeshToMesh(data):
            node = data['node']

            # add an operator which will copy the arrays
            self.__geometry.getGeometryDGNode().setDependency('inGeometry', node.getGeometryDGNode())
            node.bindDGOperator(self.__geometry.getGeometryDGNode().bindings,
              name = 'copyPolygonMeshFromArray',
              sourceCode = [
                'operator copyPolygonMeshFromArray(',
                '  Vec3 outputTopoPositions[],',
                '  Integer outputTopoIndices[],',
                '  io Vec3 inputTopoPositions[],',
                '  io Integer inputTopoIndices[]',
                ') {',
                '  inputTopoPositions = outputTopoPositions;',
                '  inputTopoIndices = outputTopoIndices;',
                '}'
              ],
              layout = [
                'inGeometry.outputTopoPositions',
                'inGeometry.outputTopoIndices',
                'self.inputTopoPositions',
                'self.inputTopoIndices'
              ],
              index = 0 # put this operator in the first place
            )

          self.__geometry.addReferenceInterface('InputGeometry', PolygonMesh, False, connectMeshToMesh)
          self.__geometry.setInputGeometryNode(node)
          break

    # create the shaders
    phongMaterial = Material(scene, xmlFile='PhongMaterial')
    phongMaterial.addPreset(name='blue',diffuseColor=Color(0.0,0.0,1.0))
    
    # create transforms
    self.__transform = Transform(scene)

    # create the instances
    instance = GeometryInstance(scene,
      geometry=self.__geometry,
      transform=self.__transform,
      material=phongMaterial
    )

    # setup the gizmo
    self.__manipulator = GizmoManipulator(scene)
    self.__gizmo = GizmoInstance(scene,
      source=self.__geometry, 
      sourceDGNodeName='GeometryDGNode', 
      sourceMemberName=self.__gizmoComp.getGizmoMember()
    )
    self.__manipulator.addGizmoNode(self.__gizmo)
    self.__gizmoComp.setVisible(False)

    # listen to activation and deactivation of manipulators
    def onManipActivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(True)

    def onManipDeactivate(data):
      if data['manipulator'] == self.__manipulator:
        self.__gizmoComp.setVisible(False)

    self.addEventListener("manipulatorActivated", onManipActivate)
    self.addEventListener("manipulatorDeactivated", onManipDeactivate)

    # check errors and show UI
    self.constructionCompleted()

  def getWidgetNames(self):
    return ["BezierDeform Options"]

  def getWidget(self, name):
    if name == "BezierDeform Options":
      widget = IntegratedWidget(SGNodeInspector({ 'node':self.__geometry }), self)
      widget.setWindowTitle("Fur Options")
      return widget
    return None

  def getManipulatorNames(self):
    names = ["BezierManip"]
    if self.runsStandalone():
      names.append("Camera")
    return names

  def getManipulator(self, name):
    if name == "BezierManip":
      return self.__manipulator
    if name == "Camera":
      return self.getCameraManipulator()
    return None
class MyDeformerApp(IntegratedApplication):
    def __init__(self, **options):

        options.setdefault('enableRaycasting', True)
        super(MyDeformerApp, self).__init__(**options)

        scene = self.getScene()

        # import the cube obj file
        objPath = os.path.join(self.getApplicationFolder(), 'cube.obj')
        importer = OBJImporter(scene, filePath=objPath)
        nodesList = importer.importAsset()

        # loop over all constructed nodes
        for name, node in nodesList.iteritems():
            if isinstance(node, PolygonMesh):
                self.__geometry = node
                break

        # add the bezier deformer and gizmo
        self.__deformerComp = BezierDeformComponent()
        self.__gizmoComp = BezierGizmoComponent(
            deformerComp=self.__deformerComp)
        self.__geometry.addComponent(self.__deformerComp)
        self.__geometry.addComponent(self.__gizmoComp)

        # setup the gizmo
        self.__manipulator = GizmoManipulator(scene)
        self.__gizmo = GizmoInstance(
            scene,
            source=self.__geometry,
            sourceDGNodeName='GeometryDGNode',
            sourceMemberName=self.__gizmoComp.getGizmoMember())
        self.__manipulator.addGizmoNode(self.__gizmo)
        self.__gizmoComp.setVisible(False)

        # listen to activation and deactivation of manipulators
        def onManipActivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(True)

        def onManipDeactivate(data):
            if data['manipulator'] == self.__manipulator:
                self.__gizmoComp.setVisible(False)

        self.addEventListener("manipulatorActivated", onManipActivate)
        self.addEventListener("manipulatorDeactivated", onManipDeactivate)

        # check errors and show UI
        self.constructionCompleted()

    def getWidgetNames(self):
        return ["BezierDeform Options"]

    def getWidget(self, name):
        if name == "BezierDeform Options":
            widget = IntegratedWidget(
                SGNodeInspector({'node': self.__geometry}), self)
            widget.setWindowTitle("Fur Options")
            return widget
        return None

    def getManipulatorNames(self):
        names = ["BezierManip"]
        if self.runsStandalone():
            names.append("Camera")
        return names

    def getManipulator(self, name):
        if name == "BezierManip":
            return self.__manipulator
        if name == "Camera":
            return self.getCameraManipulator()
        return None