本文整理汇总了Python中suit.cf.BaseModeLogic类的典型用法代码示例。如果您正苦于以下问题:Python BaseModeLogic类的具体用法?Python BaseModeLogic怎么用?Python BaseModeLogic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseModeLogic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
"""Constructor
"""
BaseModeLogic.__init__(self)
# view modes
self._modes = {ois.KC_V: flash_modes.FlashDefaultViewMode(self)}
self.switchMode(ois.KC_V)
self.gui = render_engine._gui
self.x, self.y = render_engine._ogreRenderWindow.getWidth(),render_engine._ogreRenderWindow.getHeight()
self.panel = False
self.isRoot = False
self.playing = False
self.material = None
self.swfFile = None
self.mat_size = [1024, 1024]
self.coord_mult = [1.0, 1.0]
self.coord_offset = [0, 0]
self.rectAttached = False
self.listenersRegistered = False
# creating rectangle (surface)
self.rect_corners = [-1.0, 1.0, 1.0, -1.0]
self.rect = None
self._createRect()
示例2: _setSheet
def _setSheet(self, _sheet):
"""Sets sheet for a logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
# getting data from content and save to temporary file
import os
import suit.core.sc_utils as sc_utils
_addr = _sheet._getScAddr()
if _addr is None: return
kernel = Kernel.getSingleton()
session = kernel.session()
fmt = sc_utils.getContentFormat(session, _addr)
assert fmt is not None
file_name = "%s.%s" %(str(_addr.this), session.get_idtf(fmt).lower())
# saving data to file
_cont = session.get_content_const(_addr)
assert _cont is not None
_cont_data = _cont.convertToCont()
data = _cont.get_data(_cont_data.d.size)
path = os.path.join(kernel.cache_path, 'video')
out_file = os.path.join(path, file_name)
file(out_file, "wb").write(data)
ogre.ResourceGroupManager.getSingleton().initialiseResourceGroup("video")
self.setVideo(file_name)
示例3: _setSheet
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRoot
_sheet.eventContentUpdate = self._onContentUpdate
# trying to get data for showing
import suit.core.sc_utils as sc_utils
session = core.Kernel.session()
_addr = _sheet._getScAddr()
_fmt = sc_utils.getContentFormat(session, _addr)
assert _fmt is not None
_cont = session.get_content_const(_addr)
assert _cont is not None
_cont_data = _cont.convertToCont()
self.file_addr = _cont_data
_type = session.get_idtf(_fmt).lower()
global count
count += 1
# import os, pm.pm
# self.imageName = os.path.join(env.res_tmp_dir, "%s.jpg" % str(_addr.this))
# pm.pm.saveContentToFile(self.imageName + "%d.jpg" % count, _cont)
# file(self.imageName + "_", "wb").write(_cont.get_data(_cont_data.d.size))
"""data = _cont.get_data(_cont_data.d.size)
示例4: _onRootChanged
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
示例5: __init__
def __init__(self):
"""Constructor
"""
BaseModeLogic.__init__(self)
#ogre.FrameListener.__init__(self)
self.gui = render_engine._gui
self.x, self.y = render_engine._ogreRenderWindow.getWidth(), render_engine._ogreRenderWindow.getHeight()
self.panel = False
self.wpanel = None
self.isRoot = False
#self.kernel.ogreRoot.addFrameListener(self)
# video player
self.videoPlayer = None
self.videoFile = ""
self.materialName = None
self.playing = False
self.runTime = 0
self.needUpdateMaterial = True
# attach flags
# self.listenerRegistered = False
self.rectAttached = False
# creating rectangle (surface)
self.rect = ogre.Rectangle2D(True)
self.rect.setCorners(-1.0, 1.0, 1.0, -1.0)
self.rect.setRenderQueueGroup(ogre.RENDER_QUEUE_8)
self.rect.setBoundingBox(ogre.AxisAlignedBox(ogre.Vector3(-100000.0, -100000.0, -100000.0), ogre.Vector3(100000.0, 100000.0, 100000.0)))
示例6: __init__
def __init__(self):
BaseModeLogic.__init__(self)
self._old_color_back = None
import ogre.io.OIS as ois
self.appendMode(ois.KC_V, chem_modes.ChemistryViewMode(self))
self.switchMode(ois.KC_V)
示例7: _setSheet
def _setSheet(self, _sheet):
"""Sets sheet that controls by this logic
"""
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventContentUpdate = self._onContentUpdate
self.createTextureAndMaterialNames()
示例8: __init__
def __init__(self):
BaseModeLogic.__init__(self)
# view modes
self._modes = {}
self.mode = None
self.is_root = False # flag for root mode, need to store there for grow speed up
示例9: _setSheet
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventContentUpdate = self._onContentUpdate
import suit.core.layout.LayoutGroupForceDirected as layout
_sheet.setLayoutGroup(layout.LayoutGroupForceSimple())
示例10: _setSheet
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
_sheet.eventUpdate = self._onUpdate
_sheet.eventObjectUnderMouse = self._getObjectsUnderMouse
_sheet.eventContentUpdate = self._onContentUpdate
_sheet.eventHaveChild = self._haveChild
示例11: _setSheet
def _setSheet(self, _sheet):
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRoot
self._createFieldFromContent()
self._createMaterial()
self.rect.setMaterial(self.getMaterialName())
self._redraw()
示例12: _setSheet
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
示例13: _setSheet
def _setSheet(self, _sheet):
"""Notification on sheet changed
@param _sheet: new sheet controlled by logic
@type _sheet: objects.ObjectSheet
"""
self._viewer._setSheet(_sheet)
BaseModeLogic._setSheet(self, _sheet)
_sheet.eventRootChanged = self._onRootChanged
示例14: __init__
def __init__(self):
"""constructor
"""
BaseModeLogic.__init__(self)
# view modes
# self.appendMode(ois.KC_X, FlyMode(self))
# self._active_mode = self._modes[ois.KC_X]
self.appendMode(ois.KC_S, SpaceViewMode(self))
self.switchMode(ois.KC_S)
self.is_root = False
示例15: __init__
def __init__(self):
"""Constructor
"""
BaseModeLogic.__init__(self)
# addr of viewed set
self.view_set_addr = None
# view modes
self.appendMode(ois.KC_V, scg_modes.SCgViewMode(self))
self.switchMode(ois.KC_V)