Пример #1
0
    def __init__(self, _viewer=None):
        BaseModeLogic.__init__(self)

        if not _viewer:
            self._viewer = ChemistryViewer()
        else:
            raise RuntimeError(
                "Chemistry editor doesn't support existing viewers for now")

        self.mergeModes(self._viewer)

        import ogre.io.OIS as ois
        self.appendMode(ois.KC_E, chem_modes.ChemistryEditMode(self))
        self.switchMode(ois.KC_E)
Пример #2
0
    def __init__(self, _viewer = None):
        BaseModeLogic.__init__(self)
        
        if not _viewer:
            self._viewer = ChemistryViewer()
        else:
            raise RuntimeError("Chemistry editor doesn't support existing viewers for now")
        
        self.mergeModes(self._viewer)

        import ogre.io.OIS as ois
        self.appendMode(ois.KC_E, chem_modes.ChemistryEditMode(self))
        self.switchMode(ois.KC_E)
Пример #3
0
class ChemistryEditor(BaseModeLogic):
    
    def __init__(self, _viewer = None):
        BaseModeLogic.__init__(self)
        
        if not _viewer:
            self._viewer = ChemistryViewer()
        else:
            raise RuntimeError("Chemistry editor doesn't support existing viewers for now")
        
        self.mergeModes(self._viewer)

        import ogre.io.OIS as ois
        self.appendMode(ois.KC_E, chem_modes.ChemistryEditMode(self))
        self.switchMode(ois.KC_E)
        
    def __del__(self):
        BaseModeLogic.__del__(self)
        
    def __getattr__(self, _name):
        """Returning attributes that exists in viewer to unify
        calling from modes
        """
        return getattr(self._viewer, _name)
        
    def delete(self):
        """Deletion message
        """
        BaseModeLogic.delete(self)
        
    def _setSheet(self, _sheet):
        # process event to viewer
        self._viewer._setSheet(_sheet)
        
        BaseModeLogic._setSheet(self, _sheet)
        
        #subscribe events
        _sheet.eventRootChanged = self._onRootChanged
        _sheet.eventUpdate = self._onUpdate
        
    def _onUpdate(self, _timeSinceLastFrame):
        """Viewer update message
        """
        if self._active_mode is not None:
            self._active_mode._update(_timeSinceLastFrame)
        else:
            self._viewer._onUpdate(_timeSinceLastFrame)
        
        
    def _onRootChanged(self, _isRoot):
        """Root changing
        """
        self._viewer._onRootChanged(_isRoot)
        
        BaseModeLogic._onRootChanged(self, _isRoot)
Пример #4
0
class ChemistryEditor(BaseModeLogic):
    def __init__(self, _viewer=None):
        BaseModeLogic.__init__(self)

        if not _viewer:
            self._viewer = ChemistryViewer()
        else:
            raise RuntimeError(
                "Chemistry editor doesn't support existing viewers for now")

        self.mergeModes(self._viewer)

        import ogre.io.OIS as ois
        self.appendMode(ois.KC_E, chem_modes.ChemistryEditMode(self))
        self.switchMode(ois.KC_E)

    def __del__(self):
        BaseModeLogic.__del__(self)

    def __getattr__(self, _name):
        """Returning attributes that exists in viewer to unify
        calling from modes
        """
        return getattr(self._viewer, _name)

    def delete(self):
        """Deletion message
        """
        BaseModeLogic.delete(self)

    def _setSheet(self, _sheet):
        # process event to viewer
        self._viewer._setSheet(_sheet)

        BaseModeLogic._setSheet(self, _sheet)

        #subscribe events
        _sheet.eventRootChanged = self._onRootChanged
        _sheet.eventUpdate = self._onUpdate

    def _onUpdate(self, _timeSinceLastFrame):
        """Viewer update message
        """
        if self._active_mode is not None:
            self._active_mode._update(_timeSinceLastFrame)
        else:
            self._viewer._onUpdate(_timeSinceLastFrame)

    def _onRootChanged(self, _isRoot):
        """Root changing
        """
        self._viewer._onRootChanged(_isRoot)

        BaseModeLogic._onRootChanged(self, _isRoot)