def _onRootChanged(self, isRoot):
        """Root changed event
        """
        global prev_background
        global prev_back_visible
        BaseModeLogic._onRootChanged(self, isRoot)
        if isRoot:
            render_engine.setMode(render_engine.Mode_Perspective)
            self.prev_cam_pos = render_engine._ogreCameraNode.getPosition()
            self.prev_cam_dir = render_engine._ogreCameraNode.getOrientation()
            prev_background = render_engine._ogreViewport.getBackgroundColour()
            render_engine._ogreViewport.setBackgroundColour(
                ogre.ColourValue(0, 0, 0))
            #            space_panel.activate(self._getSheet().getChilds())
            prev_back_visible = render_engine.SceneManager.isBackVisible()
            if prev_back_visible:
                render_engine.SceneManager.hideBack()
        else:
            render_engine.setMode(render_engine.Mode_Isometric)
            render_engine._ogreCameraNode.setPosition(self.prev_cam_pos)
            render_engine._ogreCameraNode.setOrientation(self.prev_cam_dir)
            render_engine._ogreViewport.setBackgroundColour(prev_background)
            #            space_panel.deactivate()
            space_window.deactivate()

            if prev_back_visible:
                render_engine.SceneManager.showBack()
        self.is_root = isRoot
Exemple #2
0
    def _onRootChanged(self, isRoot):
        """Root changed event
        """
        global prev_background
        global prev_back_visible
        BaseModeLogic._onRootChanged(self, isRoot)
        if isRoot:
            render_engine.setMode(render_engine.Mode_Perspective)            
            self.prev_cam_pos = render_engine._ogreCameraNode.getPosition()
            self.prev_cam_dir = render_engine._ogreCameraNode.getOrientation()
            prev_background = render_engine._ogreViewport.getBackgroundColour()
            render_engine._ogreViewport.setBackgroundColour(ogre.ColourValue(0, 0, 0)) 
#            space_panel.activate(self._getSheet().getChilds())
            prev_back_visible = render_engine.SceneManager.isBackVisible()
            if prev_back_visible:
                render_engine.SceneManager.hideBack()
        else:
            render_engine.setMode(render_engine.Mode_Isometric)
            render_engine._ogreCameraNode.setPosition(self.prev_cam_pos)
            render_engine._ogreCameraNode.setOrientation(self.prev_cam_dir)
            render_engine._ogreViewport.setBackgroundColour(prev_background)
#            space_panel.deactivate()
            space_window.deactivate()
            
            if prev_back_visible:
                render_engine.SceneManager.showBack()
        self.is_root = isRoot                
Exemple #3
0
 def _onMousePressed(self, _evt, _id):
     """Mouse button pressed event
     """
     if _id == ois.MB_Left:
         mstate = _evt.get_state()
         mpos = (mstate.X.abs, mstate.Y.abs)
         # getting objects under mouse
         mobjects = []
         objects_tuple = self._logic._getSheet()._getObjectsUnderMouse(True, True, mpos)
         
         if len(objects_tuple) is not 0:
             parent_tuple = objects_tuple[0]
             mobjects.append(parent_tuple)
             childs = parent_tuple[1]._getObjectsUnderMouse(True, True, mpos);
             mobjects = mobjects + childs
             mobjects.sort();
             mobjects.reverse();
             
         if len(mobjects) is not 0 and self.object_active != mobjects[0][1]:
             if self.object_active is not None:
                 self.object_active.sceneNode2.showBoundingBox(False)
                 space_window.deactivate()          
             self.object_active = mobjects[0][1]
             if self.object_active is not None:
                 self._selectObject(self.object_active)
                 self.object_active.sceneNode2.showBoundingBox(True)
                 space_window.activate(self.object_active)
                 return True
         if self._logic._getSheet().haveSelected():
             # removing selection from all nodes
             self._logic._getSheet().unselectAll()
             self.object_active.sceneNode2.showBoundingBox(False)
             self.object_active = None
             space_window.deactivate()
             return True   
     return False