本文整理汇总了Python中pandac.PandaModules.WindowProperties.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.getDefault方法的具体用法?Python WindowProperties.getDefault怎么用?Python WindowProperties.getDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.getDefault方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resetWindowProperties
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def resetWindowProperties(self, pipe, properties):
if base.win:
currentProperties = WindowProperties(base.win.getProperties())
gsg = base.win.getGsg()
else:
currentProperties = WindowProperties.getDefault()
gsg = None
newProperties = WindowProperties(currentProperties)
newProperties.addProperties(properties)
if base.pipe != pipe:
gsg = None
if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
self.notify.debug('window properties: %s' % properties)
self.notify.debug('gsg: %s' % gsg)
base.pipe = pipe
if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
self.notify.warning('OPEN MAIN WINDOW FAILED')
return 0
self.notify.info('OPEN MAIN WINDOW PASSED')
base.graphicsEngine.openWindows()
if base.win.isClosed():
self.notify.warning('Window did not open, removing.')
base.closeWindow(base.win)
return 0
base.disableShowbaseMouse()
if 'libotp' in sys.modules:
from libotp import NametagGlobals
NametagGlobals.setCamera(base.cam)
NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
else:
self.notify.debug('Adjusting properties')
base.win.requestProperties(properties)
base.graphicsEngine.renderFrame()
return 1
示例2: setupWindow
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def setupWindow(self, windowType, x, y, width, height,
parent):
""" Applies the indicated window parameters to the prc
settings, for future windows; or applies them directly to the
main window if the window has already been opened. This is
called by the browser. """
if self.started and base.win:
# If we've already got a window, this must be a
# resize/reposition request.
wp = WindowProperties()
if x or y or windowType == 'embedded':
wp.setOrigin(x, y)
if width or height:
wp.setSize(width, height)
if windowType == 'embedded':
wp.setParentWindow(parent)
wp.setFullscreen(False)
base.win.requestProperties(wp)
self.windowProperties = wp
return
# If we haven't got a window already, start 'er up. Apply the
# requested setting to the prc file, and to the default
# WindowProperties structure.
self.__clearWindowProperties()
if windowType == 'hidden':
data = 'window-type none\n'
else:
data = 'window-type onscreen\n'
wp = WindowProperties.getDefault()
wp.clearParentWindow()
wp.clearOrigin()
wp.clearSize()
wp.setFullscreen(False)
if windowType == 'fullscreen':
wp.setFullscreen(True)
if windowType == 'embedded':
wp.setParentWindow(parent)
if x or y or windowType == 'embedded':
wp.setOrigin(x, y)
if width or height:
wp.setSize(width, height)
self.windowProperties = wp
self.windowPrc = loadPrcFileData("setupWindow", data)
WindowProperties.setDefault(wp)
self.gotWindow = True
# Send this call to the main thread; don't call it directly.
messenger.send('AppRunner_startIfReady', taskChain = 'default')
示例3: init_wp
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def init_wp(window_type, size):
""" Initial / default WindowProperties """
if window_type == 'onscreen':
wp = WindowProperties.getDefault()
wp.setSize(size[0], size[1])
elif window_type == 'offscreen':
wp = WindowProperties.size(size[0], size[1])
return wp
示例4: initialize
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def initialize(self):
self.Update()
wp = WindowProperties()
wp.setOrigin(0, 0)
wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
assert self.GetHandle() != 0
wp.setParentWindow(self.GetHandle())
# initializing panda window
base.windowType = "onscreen"
props = WindowProperties.getDefault()
props.addProperties(wp)
self.win = base.openWindow(props = props, gsg = ViewportManager.gsg)
if self.win:
self.cam2d = base.makeCamera2d(self.win)
self.cam2d.node().setCameraMask(LE_CAM_MASKS[self.name])
if ViewportManager.gsg == None:
ViewportManager.gsg = self.win.getGsg()
self.cam = base.camList[-1]
self.camera = render.attachNewNode(self.name)
#self.camera.setName(self.name)
#self.camera.reparentTo(render)
self.cam.reparentTo(self.camera)
self.camNode = self.cam.node()
self.camNode.setCameraMask(LE_CAM_MASKS[self.name])
self.bt = base.setupMouse(self.win, True)
self.bt.node().setPrefix('_le_%s_'%self.name[:3])
mw = self.bt.getParent()
mk = mw.getParent()
winCtrl = WindowControls(
self.win, mouseWatcher=mw,
cam=self.camera,
camNode = self.camNode,
cam2d=None,
mouseKeyboard =mk,
grid = self.grid)
base.setupWindowControls(winCtrl)
self.initialized = True
if self.lens != None: self.cam.node().setLens(self.lens)
if self.camPos != None: self.camera.setPos(self.camPos)
if self.camLookAt != None: self.camera.lookAt(self.camLookAt)
self.camLens = self.camNode.getLens()
if self.name in ['top', 'front', 'left']:
x = self.ClientSize.GetWidth() * 0.1
y = self.ClientSize.GetHeight() * 0.1
self.camLens.setFilmSize(x, y)
self.Bind(wx.EVT_SIZE, self.onSize)
示例5: get_aspect_ratio
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def get_aspect_ratio(output):
""" Returns the actual aspect ratio of the indicated (or main
window), or the default aspect ratio if there is not yet a
main window."""
aspect_ratio = 1
if output.hasSize():
aspect_ratio = float(output.getSbsLeftXSize()) / \
float(output.getSbsLeftYSize())
else:
wp = output.getRequestedProperties()
if not wp.hasSize():
wp = WindowProperties.getDefault()
aspect_ratio = float(wp.getXSize()) / float(wp.getYSize())
return aspect_ratio
示例6: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def __init__(self, extraProps = None):
base.windowType = "onscreen"
props = WindowProperties.getDefault()
if extraProps != None:
props.addProperties(extraProps)
if not WindowManager.allowMultipleWindows:
base.openDefaultWindow(props = props, gsg = WindowManager.gsg)
self.win = base.win
assert len(WindowManager.windows) == 0
else:
self.win = base.openWindow(props = props, gsg = WindowManager.gsg)
if WindowManager.gsg == None:
WindowManager.gsg = self.win.getGsg()
self.camera = base.camList[-1]
self.camNode = self.camera.node()
self.camLens = self.camNode.getLens()
self.buttonThrowers = None
self.setupMouse(self.win)
WindowManager.windows.append(self)
示例7: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def __init__(self, *args, **kw):
gsg = None
if 'gsg' in kw:
gsg = kw['gsg']
del kw['gsg']
wx.Window.__init__(self, *args, **kw)
wp = WindowProperties.getDefault()
#if platform.system() != 'Darwin':
try:
wp.setParentWindow(self.GetHandle())
except OverflowError:
# Sheesh, a negative value from GetHandle(). This can
# only happen on 32-bit Windows.
wp.setParentWindow(self.GetHandle() & 0xffffffff)
self.win = base.openMainWindow(props = wp, gsg = gsg, type = 'onscreen',
unexposedDraw = False)
self.Bind(wx.EVT_SIZE, self.onSize)
示例8: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
def __init__(self, scene_file, pedestrian_file, dir, mode):
ShowBase.__init__(self)
self.globalClock = ClockObject.getGlobalClock()
self.globalClock.setMode(ClockObject.MSlave)
self.directory = dir
self.model = Model(dir)
self.loadScene(scene_file)
self.loadPedestrians(pedestrian_file)
#self.cam_label = OST("Top Down", pos=(0, 0.95), fg=(1,1,1,1),
# scale=0.05, mayChange=True)
#self.time_label = OST("Time: 0.0", pos=(-1.3, 0.95), fg=(1,1,1,1),
# scale=0.06, mayChange=True, align=TextNode.ALeft)
#self.accept("arrow_right", self.changeCamera, [1])
#self.accept("arrow_left", self.changeCamera, [-1])
self.accept("escape", self.exit)
self.accept("aspectRatioChanged", self.setAspectRatio)
self.accept("window-event", self.windowChanged)
new_window_fbp = FrameBufferProperties.getDefault()
new_window_properties = WindowProperties.getDefault()
self.new_window = base.graphicsEngine.makeOutput(base.pipe, 'Top Down View Window', 0, new_window_fbp, new_window_properties, GraphicsPipe.BFRequireWindow)
self.new_window_display_region = self.new_window.makeDisplayRegion()
#base.disableMouse()
lens = OrthographicLens()
lens.setFilmSize(1500, 1500)
lens.setNearFar(-5000, 5000)
self.default_camera = render.attachNewNode(Camera("top down"))
self.default_camera.node().setLens(lens)
#self.default_camera.setPosHpr(Vec3( -75, 0, 2200), Vec3(0, -90, 0))
self.default_camera.setPosHpr(Vec3(-75, 0, 0), Vec3(0, -90, 0))
#self.new_window = base.openWindow()
self.display_regions = []
self.display_regions.append(self.new_window_display_region)
self.display_regions.append(base.win.makeDisplayRegion(0, 0.32, 0.52, 1))
self.display_regions.append(base.win.makeDisplayRegion(0.34, 0.66, 0.52, 1))
self.display_regions.append(base.win.makeDisplayRegion(0.68, 1, 0.52, 1))
self.display_regions.append(base.win.makeDisplayRegion(0, 0.32, 0, 0.48))
self.display_regions.append(base.win.makeDisplayRegion(0.34, 0.66, 0, 0.48))
self.display_regions.append(base.win.makeDisplayRegion(0.68, 1, 0, 0.48))
self.display_regions[0].setCamera(self.default_camera)
self.border_regions = []
self.border_regions.append(base.win.makeDisplayRegion(0.32, 0.34, 0.52, 1))
self.border_regions.append(base.win.makeDisplayRegion(0.66, 0.68, 0.52, 1))
self.border_regions.append(base.win.makeDisplayRegion(0, 1, 0.48, 0.52))
self.border_regions.append(base.win.makeDisplayRegion(0.32, 0.34, 0, 0.48))
self.border_regions.append(base.win.makeDisplayRegion(0.66, 0.68, 0, 0.48))
for i in range(0, len(self.border_regions)):
border_region = self.border_regions[i]
border_region.setClearColor(VBase4(0, 0, 0, 1))
border_region.setClearColorActive(True)
border_region.setClearDepthActive(True)
#self.setCamera(0)
self.controller = Controller(self, mode)
self.taskMgr.add(self.updateCameraModules, "Update Camera Modules", 80)
self.globalClock.setFrameTime(0.0)
self.width = WIDTH
self.height = HEIGHT
props = WindowProperties( )
props.setTitle( 'Virtual Vision Simulator' )
base.win.requestProperties( props )
"""new_window_2d_display_region = self.new_window.makeDisplayRegion()
new_window_2d_display_region.setSort(20)
new_window_camera_2d = NodePath(Camera('2d camera of new window'))
lens_2d = OrthographicLens()
lens_2d.setFilmSize(2, 2)
lens_2d.setNearFar(-1000, 1000)
new_window_camera_2d.node().setLens(lens_2d)
new_window_render_2d = NodePath('render2d of new window')
new_window_render_2d.setDepthTest(False)
new_window_render_2d.setDepthWrite(False)
new_window_camera_2d.reparentTo(new_window_render_2d)
new_window_2d_display_region.setCamera(new_window_camera_2d)"""
"""aspectRatio = base.getAspectRatio()
self.new_window_aspect2d = new_window_render_2d.attachNewNode(PGTop('Aspect2d of new window'))
self.new_window_aspect2d.setScale(1.0 / aspectRatio, 1.0, 1.0)"""
render.analyze()
示例9:
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getDefault [as 别名]
from core.modules.pPointLightNodeWrapper import PointLightNodeWrapper
from core.modules.pSpotLightNodeWrapper import SpotLightNodeWrapper
import wx
from math import tan
from gc import collect
# Local imports
from pPropertyGrid import PropertyGrid
from pSceneGraphTree import SceneGraphTree
from pTextureManager import TextureManager
from pViewport import *
from core.modules import *
# Get the default window origin
defWP = WindowProperties.getDefault()
if defWP.hasOrigin():
origin = defWP.getXOrigin(), defWP.getYOrigin()
else:
origin = (0, 0)
ID_ENABLE_GRID = 2
ID_SINGLE_VIEWPORT = 3
ID_4x4_GRID = 4
ID_2_HORIZONTAL = 5
ID_2_VERTICAL = 6
ID_NODEPATH = 7
ID_MODEL = 8
ID_TERRAIN = 9
ID_AMBIENT = 10
ID_DIRECTIONAL = 11