class beastGlobals(DirectObject): def __init__(self, base): DirectObject.__init__(self) self.base = base ''' Setup point2d NodePath ''' self.point2d = NodePath(PGTop('point2d')) self.point2d.node().setMouseWatcher(self.base.mouseWatcherNode) self.point2d.setDepthTest(False) self.point2d.setDepthWrite(False) self.point2d.setMaterialOff(True) self.point2d.setTwoSided(True) self.p2dTopLeft = self.point2d.attachNewNode('p2dTopLeft') self.p2dTopRight = self.point2d.attachNewNode('p2dTopRight') self.p2dTopCenter = self.point2d.attachNewNode('p2dTopCenter') self.p2dCenterLeft = self.point2d.attachNewNode('p2dCenterLeft') self.p2dCenterRight = self.point2d.attachNewNode('p2dCenterRight') self.p2dBottomLeft = self.point2d.attachNewNode('p2dBottomLeft') self.p2dBottomRight = self.point2d.attachNewNode('p2dBottomRight') self.p2dBottomCenter = self.point2d.attachNewNode('p2dBottomCenter') self.beastPointSize = ConfigVariableDouble('beast-point-size', 1.0).getValue() self.beastPointSizeAuto = ConfigVariableBool('beast-point-size-auto', False).getValue() self.beastRenderCache = ConfigVariableBool('beast-render-cache', True).getValue() self.beastRenderDebug = ConfigVariableBool('beast-render-debug', False).getValue() self.setPointSize(self.beastPointSize, update = False) self.setPointSizeAuto(self.beastPointSizeAuto, update = False) self.accept('window-event', self.windowEvent) self.originalResolution = (float(self.base.win.getXSize()), float(self.base.win.getYSize()))
def __init__(self, name, dynamic=False): NodePath.__init__(self, PGTop(name)) DirectObject.__init__(self) self.setPythonTag('SpriteCollection', self) global SpriteCollectionCounter SpriteCollectionCounter += 1 self.__id = int(SpriteCollectionCounter) self.node().setMouseWatcher(base.mouseWatcherNode) self.setDepthTest(False) self.setDepthWrite(False) self.setMaterialOff(True) self.setTwoSided(True) self.__lastRender = globalClock.getFrameCount() self.buffer = None self.__dynamic = dynamic self.__beastRenderCache = ConfigVariableBool('beast-render-cache', True).getValue() self.__beastForceNewFrame = ConfigVariableBool('beast-force-new-frame', True).getValue() self.__beastDebug = ConfigVariableBool('beast-debug', False).getValue() if self.__dynamic == False and self.__beastRenderCache == True: self.fakeRender2d = NodePath('fakeRender2d-%s-%s' % (self.__id, self.getName())) self.reparentTo(self.fakeRender2d) self._setupTextureBuffer() self.accept('beastCollectionUpdate', self._update) base.taskMgr.add(self._update, 'updateTask-%s-%s' % (self.__id, self.getName()), sort=-1000) else: self.reparentTo(render2d)
def __init__(self, pg_world: PGWorld): if pg_world.win is None: return self.aspect2d_np = NodePath(PGTop("aspect2d")) self.aspect2d_np.show(self.CAM_MASK) self.para_vis_np = {} # make_buffer_func, make_camera_func = pg_world.win.makeTextureBuffer, pg_world.makeCamera # don't delete the space in word, it is used to set a proper position for i, np_name in enumerate( ["Steering", " Throttle", " Brake", " Speed"]): text = TextNode(np_name) text.setText(np_name) text.setSlant(0.1) textNodePath = self.aspect2d_np.attachNewNode(text) textNodePath.setScale(0.052) text.setFrameColor(0, 0, 0, 1) text.setTextColor(0, 0, 0, 1) text.setFrameAsMargin(-self.GAP, self.PARA_VIS_LENGTH, 0, 0) text.setAlign(TextNode.ARight) textNodePath.setPos(-1.125111, 0, 0.9 - i * 0.08) if i != 0: cm = CardMaker(np_name) cm.setFrame(0, self.PARA_VIS_LENGTH - 0.21, -self.PARA_VIS_HEIGHT / 2 + 0.1, self.PARA_VIS_HEIGHT / 2) cm.setHasNormals(True) card = textNodePath.attachNewNode(cm.generate()) card.setPos(0.21, 0, 0.22) self.para_vis_np[np_name.lstrip()] = card else: # left name = "Left" cm = CardMaker(name) cm.setFrame(0, (self.PARA_VIS_LENGTH - 0.4) / 2, -self.PARA_VIS_HEIGHT / 2 + 0.1, self.PARA_VIS_HEIGHT / 2) cm.setHasNormals(True) card = textNodePath.attachNewNode(cm.generate()) card.setPos(0.2 + self.PARA_VIS_LENGTH / 2, 0, 0.22) self.para_vis_np[name] = card # right name = "Right" cm = CardMaker(np_name) cm.setFrame(-(self.PARA_VIS_LENGTH - 0.1) / 2, 0, -self.PARA_VIS_HEIGHT / 2 + 0.1, self.PARA_VIS_HEIGHT / 2) cm.setHasNormals(True) card = textNodePath.attachNewNode(cm.generate()) card.setPos(0.2 + self.PARA_VIS_LENGTH / 2, 0, 0.22) self.para_vis_np[name] = card super(VehiclePanel, self).__init__(self.BUFFER_W, self.BUFFER_H, Vec3(-0.9, -1.01, 0.78), self.BKG_COLOR, pg_world=pg_world, parent_node=self.aspect2d_np) self.add_to_display(pg_world, [2 / 3, 1, self.display_bottom, self.display_top])
def setupPoint2d(self): fakeRender2d = NodePath('render2d') fakeRender2d.setDepthTest(False) fakeRender2d.setDepthWrite(False) fakeRender2d.setMaterialOff(True) fakeRender2d.setTwoSided(True) self.point2d = beastNodePath(PGTop('point2d')) self.point2d.reparentTo(fakeRender2d) self.point2d.node().setMouseWatcher(self.base.mouseWatcherNode) self.p2dTopLeft = self.point2d.attachNewNode('p2dTopLeft') self.p2dTopRight = self.point2d.attachNewNode('p2dTopRight') self.p2dTopCenter = self.point2d.attachNewNode('p2dTopCenter') self.p2dCenterLeft = self.point2d.attachNewNode('p2dCenterLeft') self.p2dCenterRight = self.point2d.attachNewNode('p2dCenterRight') self.p2dBottomLeft = self.point2d.attachNewNode('p2dBottomLeft') self.p2dBottomRight = self.point2d.attachNewNode('p2dBottomRight') self.p2dBottomCenter = self.point2d.attachNewNode('p2dBottomCenter')
def newWindow(self): self.wp = WindowProperties() self.wp.setSize(700, 500) self.wp.setRawMice(True) print(self.wp.getMouseMode()) win2mouseWatcher = MouseWatcher() ar = 1 self.win2 = base.openWindow(props=self.wp, aspectRatio=ar) self.window2render2d = NodePath('window2render2d') self.window2render2d.setDepthTest(0) self.window2render2d.setDepthWrite(0) self.window2camera2d = base.makeCamera2d(self.win2) self.window2camera2d.reparentTo(self.window2render2d) # Parent gui to this self.window2aspect2d = self.window2render2d.attachNewNode( PGTop('window2aspect2d')) self.window2aspect2d.setScale(1.0 / ar, 1.0, 1.0) name = self.win2.getInputDeviceName(0) mk = base.dataRoot.attachNewNode(MouseAndKeyboard(self.win2, 0, name)) mw = mk.attachNewNode(MouseWatcher(name)) self.window2aspect2d.node().setMouseWatcher(mw.node())
from panda3d.core import VirtualFileSystem, Notify, ClockObject, PandaSystem from panda3d.core import ConfigPageManager, ConfigVariableManager from panda3d.core import NodePath, PGTop from . import DConfig as config __dev__ = config.GetBool('want-dev', __debug__) vfs = VirtualFileSystem.getGlobalPtr() ostream = Notify.out() globalClock = ClockObject.getGlobalClock() cpMgr = ConfigPageManager.getGlobalPtr() cvMgr = ConfigVariableManager.getGlobalPtr() pandaSystem = PandaSystem.getGlobalPtr() # This is defined here so GUI elements can be instantiated before ShowBase. aspect2d = NodePath(PGTop("aspect2d")) # Set direct notify categories now that we have config directNotify.setDconfigLevels() def run(): assert ShowBase.notify.warning( "run() is deprecated, use base.run() instead") base.run() def inspect(anObject): # Don't use a regular import, to prevent ModuleFinder from picking # it up as a dependency when building a .p3d package. import importlib
def __init__(self, base: wd.World, window_title: str = "WRS Robot Planning and Control System", cam_pos: np.ndarray = np.array([2.0, 0, 2.0]), lookat_pos: np.ndarray = np.array([0, 0, 0.25]), up: np.ndarray = np.array([0, 0, 1]), fov: int = 40, w: int = 1920, h: int = 1080, lens_type: str = "perspective"): self._base = base # setup render scene self.render = NodePath("extra_win_render") # setup render 2d self.render2d = NodePath("extra_win_render2d") self.render2d.setDepthTest(0) self.render2d.setDepthWrite(0) self.win = base.openWindow( props=WindowProperties(base.win.getProperties()), makeCamera=False, scene=self.render, requireWindow=True, ) # set window background to white base.setBackgroundColor(r=1, g=1, b=1, win=self.win) # set window title and window's dimension self.set_win_props( title=window_title, size=(w, h), ) # set len for the camera and set the camera for the new window lens = PerspectiveLens() lens.setFov(fov) lens.setNearFar(0.001, 5000.0) if lens_type == "orthographic": lens = OrthographicLens() lens.setFilmSize(1, 1) # make aspect ratio looks same as base window aspect_ratio = base.getAspectRatio() lens.setAspectRatio(aspect_ratio) self.cam = base.makeCamera( self.win, scene=self.render, ) # can also be found in base.camList self.cam.reparentTo(self.render) self.cam.setPos(Point3(cam_pos[0], cam_pos[1], cam_pos[2])) self.cam.lookAt(Point3(lookat_pos[0], lookat_pos[1], lookat_pos[2]), Vec3(up[0], up[1], up[2])) self.cam.node().setLens(lens) # use same len as sys # set up cartoon effect self._separation = 1 self.filter = flt.Filter(self.win, self.cam) self.filter.setCartoonInk(separation=self._separation) # camera in camera 2d self.cam2d = base.makeCamera2d(self.win, ) self.cam2d.reparentTo(self.render2d) # attach GPTop to the render2d to make sure the DirectGui can be used self.aspect2d = self.render2d.attachNewNode(PGTop("aspect2d")) # self.aspect2d.setScale(1.0 / aspect_ratio, 1.0, 1.0) # setup mouse for the new window # name of mouse watcher is to adapt to the name in the input manager self.mouse_thrower = base.setupMouse(self.win, fMultiWin=True) self.mouseWatcher = self.mouse_thrower.getParent() self.mouseWatcherNode = self.mouseWatcher.node() self.aspect2d.node().setMouseWatcher(self.mouseWatcherNode) # self.mouseWatcherNode.addRegion(PGMouseWatcherBackground()) # setup input manager self.inputmgr = im.InputManager(self, lookatpos=lookat_pos) # copy attributes and functions from base ## change the bound function to a function, and bind to `self` to become a unbound function self._interaction_update = functools.partial( base._interaction_update.__func__, self) self.p3dh = base.p3dh base.taskMgr.add(self._interaction_update, "interaction_extra_window", appendTask=True)
#: See :meth:`panda3d.core.ConfigVariableManager.getGlobalPtr()`. cvMgr = ConfigVariableManager.getGlobalPtr() #: See :meth:`panda3d.core.PandaSystem.getGlobalPtr()`. pandaSystem = PandaSystem.getGlobalPtr() #: The root of the 2-D scene graph. The coordinate system of this node runs #: from -1 to 1, with the X axis running from left to right and the Z axis from #: bottom to top. render2d = NodePath("render2d") #: The root of the 2-D scene graph used for GUI rendering. Unlike render2d, #: which may result in elements being stretched in windows that do not have a #: square aspect ratio, this node is scaled automatically to ensure that nodes #: parented to it do not appear stretched. aspect2d = render2d.attachNewNode(PGTop("aspect2d")) #: A dummy scene graph that is not being rendered by anything. hidden = NodePath("hidden") # Set direct notify categories now that we have config directNotify.setDconfigLevels() def run(): """Deprecated alias for :meth:`base.run() <.ShowBase.run>`.""" assert ShowBase.notify.warning( "run() is deprecated, use base.run() instead") base.run()
def __init__(self): self.bspLoader = Py_CL_BSPLoader() self.bspLoader.setGlobalPtr(self.bspLoader) if metadata.USE_RENDER_PIPELINE: from rpcore import RenderPipeline self.pipeline = RenderPipeline() self.pipeline.create(self) else: ShowBase.__init__(self) self.loader.destroy() self.loader = CogInvasionLoader(self) __builtin__.loader = self.loader self.graphicsEngine.setDefaultLoader(self.loader.loader) self.cam.node().getDisplayRegion(0).setClearDepthActive(1) from panda3d.core import RenderAttribRegistry from panda3d.core import ShaderAttrib, TransparencyAttrib from libpandabsp import BSPMaterialAttrib attribRegistry = RenderAttribRegistry.getGlobalPtr() attribRegistry.setSlotSort(BSPMaterialAttrib.getClassSlot(), 0) attribRegistry.setSlotSort(ShaderAttrib.getClassSlot(), 1) attribRegistry.setSlotSort(TransparencyAttrib.getClassSlot(), 2) gsg = self.win.getGsg() # Let's print out the Graphics information. self.notify.info( 'Graphics Information:\n\tVendor: {0}\n\tRenderer: {1}\n\tVersion: {2}\n\tSupports Cube Maps: {3}\n\tSupports 3D Textures: {4}\n\tSupports Compute Shaders: {5}' .format(gsg.getDriverVendor(), gsg.getDriverRenderer(), gsg.getDriverVersion(), str(gsg.getSupportsCubeMap()), str(gsg.getSupports3dTexture()), str(gsg.getSupportsComputeShaders()))) # Enable shader generation on all of the main scenes if gsg.getSupportsBasicShaders() and gsg.getSupportsGlsl(): render.setShaderAuto() render2d.setShaderAuto() render2dp.setShaderAuto() else: # I don't know how this could be possible self.notify.error("GLSL shaders unsupported by graphics driver.") return # Let's disable fog on Intel graphics if gsg.getDriverVendor() == "Intel": metadata.NO_FOG = 1 self.notify.info('Applied Intel-specific graphical fix.') self.win.disableClears() self.camNode.setCameraMask(CIGlobals.MainCameraBitmask) from direct.distributed.ClockDelta import globalClockDelta __builtin__.globalClockDelta = globalClockDelta # Any ComputeNodes should be parented to this node, not render. # We isolate ComputeNodes to avoid traversing the same ComputeNodes # when doing multi-pass rendering. self.computeRoot = NodePath('computeRoot') self.computeCam = self.makeCamera(base.win) self.computeCam.node().setCullBounds(OmniBoundingVolume()) self.computeCam.node().setFinal(True) self.computeCam.reparentTo(self.computeRoot) # Initialized in initStuff() self.shaderGenerator = None render.hide() self.camLens.setNearFar(0.5, 10000) self.physicsWorld = BulletWorld() # Panda units are in feet, so the gravity is 32 feet per second, # not 9.8 meters per second. self.physicsWorld.setGravity(Vec3(0, 0, -32.1740)) self.physicsWorld.setGroupCollisionFlag(7, 1, True) self.physicsWorld.setGroupCollisionFlag(7, 2, True) self.physicsWorld.setGroupCollisionFlag(7, 3, False) self.physicsWorld.setGroupCollisionFlag(7, 4, False) self.physicsWorld.setGroupCollisionFlag(7, 8, True) self.taskMgr.add(self.__physicsUpdate, "physicsUpdate", sort=30) debugNode = BulletDebugNode('Debug') self.debugNP = render.attachNewNode(debugNode) self.physicsWorld.setDebugNode(self.debugNP.node()) self.physicsDbgFlag = False self.setPhysicsDebug(self.config.GetBool('physics-debug', False)) #self.shadowCaster = ShadowCaster(Vec3(163, -67, 0)) #self.shadowCaster.enable() self.bspLoader.setGamma(2.2) self.bspLoader.setWin(self.win) self.bspLoader.setCamera(self.camera) self.bspLoader.setRender(self.render) self.bspLoader.setMaterialsFile("phase_14/etc/materials.txt") #self.bspLoader.setTextureContentsFile("phase_14/etc/texturecontents.txt") self.bspLoader.setWantVisibility(True) self.bspLoader.setVisualizeLeafs(False) self.bspLoader.setWantLightmaps(True) #self.bspLoader.setShadowCamPos(Point3(-15, 5, 40)) #self.bspLoader.setShadowResolution(60 * 2, 1024 * 1) self.bspLoader.setPhysicsWorld(self.physicsWorld) self.bspLevel = None self.materialData = {} self.skyBox = None self.skyBoxUtil = None #self.nmMgr = RNNavMeshManager.get_global_ptr() #self.nmMgr.set_root_node_path(self.render) #self.nmMgr.get_reference_node_path().reparentTo(self.render) #self.nmMgr.start_default_update() #self.nmMgr.get_reference_node_path_debug().reparentTo(self.render) self.navMeshNp = None # Setup 3d audio run before igLoop so 3d positioning doesn't lag behind base.audio3d = Audio3DManager(base.sfxManagerList[0], camera, render) base.audio3d.setDropOffFactor(0.15) base.audio3d.setDopplerFactor(0.15) # Setup collision handlers base.cTrav = CollisionTraverser() base.lifter = CollisionHandlerFloor() base.pusher = CollisionHandlerPusher() base.queue = CollisionHandlerQueue() base.lightingCfg = None self.cl_attackMgr = None #self.accept('/', self.projectShadows) # Let's setup the user input storage system uis = UserInputStorage() self.inputStore = uis self.userInputStorage = uis __builtin__.inputStore = uis __builtin__.userInputStorage = uis self.credits2d = self.render2d.attachNewNode(PGTop("credits2d")) self.credits2d.setScale(1.0 / self.getAspectRatio(), 1.0, 1.0) self.wakeWaterHeight = -30.0 self.bloomToggle = False self.hdrToggle = False self.fxaaToggle = CIGlobals.getSettingsMgr().getSetting( "aa").getValue() == "FXAA" self.aoToggle = False self.music = None self.currSongName = None render.show(CIGlobals.ShadowCameraBitmask) self.avatars = [] wrm = WaterReflectionManager() self.waterReflectionMgr = wrm __builtin__.waterReflectionMgr = wrm # Let's setup our margins base.marginManager = MarginManager() base.margins = aspect2d.attachNewNode( base.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1) base.leftCells = [ base.marginManager.addCell(0.1, -0.6, base.a2dTopLeft), base.marginManager.addCell(0.1, -1.0, base.a2dTopLeft), base.marginManager.addCell(0.1, -1.4, base.a2dTopLeft) ] base.bottomCells = [ base.marginManager.addCell(0.4, 0.1, base.a2dBottomCenter), base.marginManager.addCell(-0.4, 0.1, base.a2dBottomCenter), base.marginManager.addCell(-1.0, 0.1, base.a2dBottomCenter), base.marginManager.addCell(1.0, 0.1, base.a2dBottomCenter) ] base.rightCells = [ base.marginManager.addCell(-0.1, -0.6, base.a2dTopRight), base.marginManager.addCell(-0.1, -1.0, base.a2dTopRight), base.marginManager.addCell(-0.1, -1.4, base.a2dTopRight) ] base.mouseWatcherNode.setEnterPattern('mouse-enter-%r') base.mouseWatcherNode.setLeavePattern('mouse-leave-%r') base.mouseWatcherNode.setButtonDownPattern('button-down-%r') base.mouseWatcherNode.setButtonUpPattern('button-up-%r') cbm = CullBinManager.getGlobalPtr() cbm.addBin('ground', CullBinManager.BTUnsorted, 18) # The portal uses the shadow bin by default, # but we still want to see it with real shadows. cbm.addBin('portal', CullBinManager.BTBackToFront, 19) if not metadata.USE_REAL_SHADOWS: cbm.addBin('shadow', CullBinManager.BTBackToFront, 19) else: cbm.addBin('shadow', CullBinManager.BTFixed, -100) cbm.addBin('gui-popup', CullBinManager.BTUnsorted, 60) cbm.addBin('gsg-popup', CullBinManager.BTFixed, 70) self.setBackgroundColor(CIGlobals.DefaultBackgroundColor) self.disableMouse() self.enableParticles() base.camLens.setNearFar(CIGlobals.DefaultCameraNear, CIGlobals.DefaultCameraFar) base.transitions = CITransitions(loader) base.transitions.IrisModelName = "phase_3/models/misc/iris.bam" base.transitions.FadeModelName = "phase_3/models/misc/fade.bam" self.accept(self.inputStore.TakeScreenshot, ScreenshotHandler.takeScreenshot) #self.accept('u', render.setShaderOff) #self.accept('i', render.setShaderOff, [1]) #self.accept('o', render.setShaderOff, [2]) # Disabled oobe culling #self.accept('o', self.oobeCull) #self.accept('c', self.reportCam) self.taskMgr.add(self.__updateShadersAndPostProcess, 'CIBase.updateShadersAndPostProcess', 47) self.taskMgr.add(self.__update3DAudio, 'CIBase.update3DAudio', 59)
def windowMaker(base, label): # find an open slot, if none, return false windict = dict() grid = None for i in range(grid_size[0]): for j in range(grid_size[1]): if occupied[i][j] == False: grid = (i, j) occupied[i][j] = True break else: continue break if not grid: return False windict['grid'] = grid position = grid_to_screen_pos(*grid) #open window newwin = base.openWindow(name=label) newwin.setWindowEvent(label + "-event") listener.accept(newwin.getWindowEvent(), windowEvent) windict['win'] = newwin #format window wp = WindowProperties() wp.setOrigin(*position) wp.setSize(*ws) newwin.requestProperties(wp) #make 3d-mousewatcher display region displayRegion = newwin.getDisplayRegion(0) displayRegion.setDimensions(.3, 1, 0, 1) mkNode = MouseAndKeyboard(newwin, 0, label + "_keyboard_mouse") mk = base.dataRoot.attachNewNode(mkNode) windict['mk'] = mk modis = ModifierButtons() modis.addButton(ButtonHandle('shift')) modis.addButton(ButtonHandle('control')) mwNode = MouseWatcher(label) mwNode.setModifierButtons(modis) mwNode.setDisplayRegion(displayRegion) mw = mk.attachNewNode(mwNode) windict['mw'] = mw bt = ButtonThrower(label + "_button_thrower") bt.setModifierButtons(modis) windict['bt'] = bt bt.setPrefix(label + "_") mw.attachNewNode(bt) #listen for default button events for button in buttons: listener.accept(bt.prefix + button, buttons[button]) #format render display region render_dr = newwin.getDisplayRegion(1) windict['render_dr'] = render_dr render_dr.setDimensions(.3, 1, 0, 1) #create a display region for Gui Elements gui_dr = newwin.makeDisplayRegion(0, .3, .3, 1) # gui_dr.setSort(20) mwNodegui = MouseWatcher(label + "gui") mwNodegui.setDisplayRegion(gui_dr) mwgui = mk.attachNewNode(mwNodegui) #create a 2d render/aspect for gui rendergui = NodePath('render2d') rendergui.setDepthWrite(0) rendergui.setMaterialOff(1) rendergui.setTwoSided(1) #set up aspect2d aspectgui = rendergui.attachNewNode(PGTop('aspectgui')) aspectgui.node().setMouseWatcher(mwgui.node()) #set up camera camNodegui = Camera("camNode2d") cameragui = rendergui.attachNewNode(camNodegui) cameragui.setPos(0, 0, 0) cameragui.setDepthTest(False) cameragui.setDepthWrite(False) lens = OrthographicLens() lens.setFilmSize(2, 2) lens.setNearFar(-1000, 1000) cameragui.node().setLens(lens) gui_dr.setCamera(cameragui) #make frame for gui frame = DirectFrame(frameSize=(-1, 1, -1, 1), frameColor=(.5, .5, .5, 1), relief='ridge') frame.reparentTo(aspectgui) frame.setTransparency(0) windict['gui_frame'] = frame #create Gui elements guibuttons = dict() # guibuttons['Create'] = label+"_mode_create" guibuttons['Preview'] = label + "_preview" # createButton(base, frame, .7, "Create", label+"_mode_create") createButton(base, frame, .7, "Preview", label + "_preview") windict['guibuttons'] = guibuttons #create a display region for math data preview preview_dr = newwin.makeDisplayRegion(0, .3, 0, .3) windict['preview_dr'] = preview_dr # preview_label = label+"_preview" # preview_mwNode = MouseWatcher(preview_label) # preview_mwNode.setDisplayRegion(preview_dr) # preview_mw = mk.attachNewNode(preview_mwNode) # preview_bt = ButtonThrower(preview_label+"_button_thrower") # preview_bt.setPrefix(preview_label+"_") # preview_mw.attachNewNode(preview_bt) # preview_dr.setSort(30) win_to_windict[newwin] = windict return windict