def __init__(self, xml): base.camNode.setCameraMask(BitMask32.bit(0)) #only temporary while testing self.plight = PointLight('plight') bright = 2 self.plight.setColor(VBase4(bright, bright, bright, 1)) #self.plight.setAttenuation(Point3(0, 0, 0.5)) plnp = base.camera.attachNewNode(self.plight) #plnp.setPos(0, 0, 0) render.setLight(plnp) #base.disableMouse() self.reload(xml)
def __init__(self): DNANode.__init__(self, 'baseline') self.code = '' self.color = VBase4(1, 1, 1, 1) self.font = None self.flags = '' self.indent = 0.0 self.kern = 0.0 self.wiggle = 0.0 self.stumble = 0.0 self.stomp = 0.0 self.width = 0 self.height = 0
def enterDie(self, ts): if self.avatar: dieSound = base.audio3d.loadSfx( self.avatar.getToonAnimalNoise('exclaim')) base.audio3d.attachSoundToObject(dieSound, self.avatar) self.avatar.setTransparency(1) self.avatar.getGeomNode().setTransparency(1) SoundInterval(dieSound, node=self.avatar).start() self.track = Sequence( Parallel( LerpColorScaleInterval(self.avatar.getGeomNode(), colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1), duration=0.5), LerpColorScaleInterval(self.avatar.getNameTag(), colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1), duration=0.5), ActorInterval(self.avatar, 'fallb')), Func(self.fsm.request, 'dead')) self.track.start() del dieSound
def resetProperties(self): self.seaLevel = 0 self.center = 0 self.anchor = None self.overallSpeed = 0 self.uvSpeed = Vec2(0, 0) self.threshold = 0 self.radius = 0 self.uvScale = VBase2(0, 0) self.waveEnabled = 0 self.high = Vec4(0, 0, 0, 0) self.mid = VBase4(0, 0, 0, 0) self.low = Vec4(0, 0, 0, 0)
def exitInputChoice(self): if not self.controlKeyPressed: if self.controlKeyWarningIval: self.controlKeyWarningIval.finish() self.controlKeyWarningIval = None self.controlKeyWarningIval = Sequence( Func(self.controlKeyWarningLabel.show), self.controlKeyWarningLabel.colorScaleInterval( 10, VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Func(self.controlKeyWarningLabel.hide)) self.controlKeyWarningIval.start() if self.timer != None: self.timer.destroy() self.timer = None self.timerStartTime = None self.hideForceArrows() self.arrowRotateSound.stop() self.arrowUpSound.stop() self.arrowDownSound.stop() taskMgr.remove(self.uniqueName('aimtask')) return
def __init__(self, parent): self.parent = parent LoadFontFace("data/fonts/Delicious-Roman.otf") LoadFontFace("data/fonts/verdana.ttf") self.parent.rRegion.setActive(1) self.parent.rContext = self.parent.rRegion.getContext() #context.LoadDocument('assets/background.rml').Show() self.doc = self.parent.rContext.LoadDocument( 'data/rml/login_screen.rml') self.doc.Show() element = self.doc.GetElementById('log_in') element.AddEventListener('click', self.loginButPressed, True) element = self.doc.GetElementById('log_in_red') element.AddEventListener('click', self.loginButRedPressed, True) element = self.doc.GetElementById('log_in_blue') element.AddEventListener('click', self.loginButBluePressed, True) self.cuber = Actor('cuber', {'no': 'cuber-noway', 'yes': 'cuber-yay'}) self.cuber.reparentTo(render) self.cuber.setPos(-4, 20, -2) self.cuber.setColor(1, 0, 0) self.cuber.loop('no') self.cuber2 = Actor('cuber', {'no': 'cuber-noway', 'yes': 'cuber-yay'}) self.cuber2.reparentTo(render) self.cuber2.setPos(4, 20, -2) self.cuber2.setColor(0, 0, 1) self.cuber2.loop('yes') dlight1 = DirectionalLight("dlight1") dlight1.setColor(VBase4(0.7, 0.7, 0.7, 1.0)) self.dlnp1 = render.attachNewNode(dlight1) self.dlnp1.setHpr(0, -50, 0) render.setLight(self.dlnp1) alight = AmbientLight("alight") alight.setColor(VBase4(0.4, 0.4, 0.4, 1.0)) self.alnp = render.attachNewNode(alight) render.setLight(self.alnp)
def create_menu_button(self, device): button = DirectButton( command=self.switch_to_panel, extraArgs=[device], text=device.name, text_scale=0.05, text_align=TextNode.ALeft, text_fg=VBase4(0.0, 0.0, 0.0, 1.0), text_pos=Vec2(0.01, base.a2dBottom / 10.0), relief=1, pad=Vec2(0.01, 0.01), frameColor=VBase4(0.8, 0.8, 0.8, 1.0), frameSize=VBase4( 0.0, base.a2dLeft * -0.75 - 0.081, # 0.08=Scrollbar, 0.001=inaccuracy base.a2dBottom / 5.0, 0.0, ), parent=self.devices_frame.getCanvas(), ) self.buttons[device] = button
def __init__(self, _heightField): texture = loader.loadTexture("ground_tex.png") self.zScale = 45 self.terrain = GeoMipTerrain("BasicTerrain") self.terrain.setHeightfield(_heightField) # Dynamic settings? self.terrain.setBlockSize(16) self.terrain.setNear(20) self.terrain.setFar(100) self.terrain.setFocalPoint(base.camera) # Settings self.terrain.getRoot().setSz(self.zScale) self.terrain.getRoot().setTexture(texture) self.terrain.getRoot().reparentTo(render) self.terrain.generate() self.terrainSize = (self.terrain.heightfield().getReadXSize(), self.terrain.heightfield().getReadYSize()) print "Terrain Size:", self.terrainSize taskMgr.add(self.terrainTask, "TerrainTask") self.skydome = loader.loadModel("Skydome") self.skydome.setDepthTest(False) self.skydome.setAttrib(CullBinAttrib.make("skydomeBin", 1000)) self.skydome.reparentTo(camera) self.skydome.setScale(2) self.skydome.setPos(0, 0, -0.5) self.skydome.setCollideMask(BitMask32.allOff()) taskMgr.add(self.skydomeTask, "paperplanet_skydome") # Add some fancy fog self.fog = Fog("Fog Name") self.fog.setColor(0.4,0.2,0.3) self.fog.setExpDensity(0.015) render.setFog(self.fog) # Some Test light dlight = DirectionalLight("dlight") dlight.setColor(VBase4(0.8, 0.8, 0.5, 1)) dlnp = render.attachNewNode(dlight) dlnp.setHpr(0, -60, 0) render.setLight(dlnp) # Add basic blacksmith hut tmp = loader.loadModel("blacksmith_hut") tmp.reparentTo(render) tmp.setPos(164.054, 340.92, 11.3384)
def __init__(self): self.avatar = None self.active = True self.objectCode = None self.chatButton = NametagGlobals.noButton self.chatReversed = False self.font = None self.chatFont = None self.shadow = None self.marginManager = None self.visible3d = True self.chatType = NametagGlobals.CHAT self.chatBalloonType = NametagGlobals.CHAT_BALLOON self.nametagColor = NametagGlobals.NametagColors[ NametagGlobals.CCOtherPlayer] self.chatColor = NametagGlobals.ChatColors[ NametagGlobals.CCOtherPlayer] self.speedChatColor = VBase4(1, 1, 1, 1) self.wordWrap = 8 self.chatWordWrap = 10 self.text = '' self.chatPages = [] self.chatPageIndex = 0 self.chatTimeoutTask = None self.chatTimeoutTaskName = self.getUniqueName() + '-timeout' self.stompChatText = '' self.stompTask = None self.stompTaskName = self.getUniqueName() + '-stomp' self.icon = PandaNode('icon') self.nametag2d = Nametag2d() self.nametag3d = Nametag3d() self.nametags = set() self.add(self.nametag2d) self.add(self.nametag3d) # Add the tick task: self.tickTaskName = self.getUniqueName() + '-tick' self.tickTask = taskMgr.add(self.tick, self.tickTaskName, sort=45)
def __init__(self): # Initialize the ShowBase class from which we inherit, which will # create a window and set up everything we need for rendering into it. ShowBase.__init__(self) # Set clipping planes on lens. self.cam.node().getLens().setNear(10.0) self.cam.node().getLens().setFar(1000.0) # Show instructions in the corner of the window. self.title = addTitle("BobViz Demo") # Spherocylinder is a special sphere where there are two hemispheres, # one just barely below z, and one just barely above z self.spheroBase = loader.loadModel("models/sphere.egg") # The default shader for the spherocylinder should just be a simple one # This could be changed for other objects, but the vertex shader scales a # a sphere to a spherocylinder. spheroShader = Shader.load(Shader.SL_GLSL, vertex ="shaders/spherocylinder.vert", fragment="shaders/spherocylinder.frag") self.spheroBase.set_shader(spheroShader) # Create an ambient light. We could use other light sources to make sexier graphics, # but this is good enough for gov't work. alightnode = AmbientLight("ambient light") alightnode.setColor((1.0, 1.0, 1.0, 1)) alight = render.attachNewNode(alightnode) render.setLight(alight) # Set the default camera position. # Mouse control resets it to zero, so we need to calculate the # appropriate transform to put the camera back into place. # I put the camera along -y, pointing at the origin. # Default view is +x -> right, +y -> into screen, +z -> up self.disableMouse() self.camera.setPos(0, -50, 0) mat=Mat4(camera.getMat()) mat.invertInPlace() self.mouseInterfaceNode.setMat(mat) self.enableMouse() # Make the background default to white self.win.setClearColorActive(True) self.win.setClearColor(VBase4(1, 1, 1, 1)) self.spheroColor = (0.8,0.0, 0.0, 1.0) # Enable anti-aliasing render.setAntialias(AntialiasAttrib.MAuto)
def drawChatBalloon(self, model, modelWidth, modelHeight): if self.chatFont is None: # We can't draw this without a font. return # Prefix the nametag text: if hasattr(self.avatar, 'avatarType') and self.avatar.avatarType == CIGlobals.Suit and len(self.getText().split('\n')) == 3: # Just show the cog's name name, _, _ = self.getText().split('\n') else: name = self.getText() self.chatTextNode.setText(name + ': ' + self.actualChatText) # Set our priority in the margin system: self.setPriority(MarginGlobals.MP_normal) if self.textNodePath is not None: self.textNodePath.removeNode() self.textNodePath = None if self.arrow is not None: self.arrow.removeNode() self.arrow = None if self.isClickable(): foreground, background = self.chatColor[self.clickState] else: foreground, background = self.chatColor[PGButton.SInactive] if self.chatType == NametagGlobals.SPEEDCHAT: background = self.speedChatColor if background[3] > self.CHAT_BALLOON_ALPHA: background = VBase4( background[0], background[1], background[2], self.CHAT_BALLOON_ALPHA) self.chatBalloon = ChatBalloon( model, modelWidth, modelHeight, self.chatTextNode, foreground=foreground, background=background, reversed=self.chatReversed, button=self.chatButton[self.clickState], is2d = True) self.chatBalloon.reparentTo(self.contents) self.cTag.set_chatballoon_size(self.chatBalloon.width, self.chatBalloon.height) # Calculate the center of the TextNode: left, right, bottom, top = self.chatTextNode.getFrameActual() center = self.contents.getRelativePoint( self.chatBalloon.textNodePath, ((left+right) / 2.0, 0, (bottom+top) / 2.0)) # Translate the chat balloon along the inverse: self.chatBalloon.setPos(self.chatBalloon, -center)
def freeze(self): if self.isFrozen: return 0 self.clearFreezeTracks() self.avatar.animFSM.request('off') self.avatar.stop() self.freezeUpTrack = Parallel( SoundInterval(self.iceCubeForm, node=self.iceCube), LerpColorScaleInterval( self.iceCube, duration=0.5, colorScale=VBase4(0.76, 0.76, 1.0, 1.0), startColorScale=self.iceCube.getColorScale(), blendType='easeInOut'), LerpColorScaleInterval( self.avatar.getGeomNode(), duration=0.5, colorScale=VBase4(0.5, 0.5, 1.0, 1.0), startColorScale=base.localAvatar.getGeomNode().getColorScale(), blendType='easeOut')) self.freezeUpTrack.start() self.isFrozen = True return 1
def fireWater(self, origin, target): color = VBase4(0.75, 0.75, 1, 0.8) dScaleUp = 0.1 dHold = 0.3 dScaleDown = 0.1 horizScale = 0.1 vertScale = 0.1 sprayTrack = self.getSprayTrack(color, origin, target, dScaleUp, dHold, dScaleDown, horizScale, vertScale) duration = self.squirtSfx.length() if sprayTrack.getDuration() < duration: duration = sprayTrack.getDuration() soundTrack = SoundInterval(self.squirtSfx, node=self.waterPitcherModel, duration=duration) self.fireTrack = Parallel(sprayTrack, soundTrack) self.fireTrack.start()
def __init__(self, loader, doneEvent): StateData.__init__(self, doneEvent) self.loader = loader self.zoneId = None self.track = None self.interior = False self.firstPerson = FirstPerson() self.snowEffect = SnowEffect(self) self.lastBookPage = 2 self.useFirstPerson = config.GetBool('want-firstperson-battle') self.lampLights = [] self.lampLightColor = VBase4(255 / 255.0, 255 / 255.0, 218 / 255.0, 1.0) return
def onPropertiesUpdated(self): self.sanitizeProperties() rgba = self.properties['color'].split(',') if len(rgba) < 3: print "ERROR: please define a correct color for light. (example: r,g,b,a in float values)!" realcolor = VBase4( float(rgba[0]) / 255, float(rgba[1]) / 255, float(rgba[2]) / 255, 1.0) self.plnp.setY(-self.properties['distance']) self.plight.setColor(realcolor) self.plight.setAttenuation((self.properties['attenuation']))
def createPlane(self, frame=None, color=VBase4(1, 1, 1, 1)): """ Creates a Plane/Card with the Panda3d Cardmaker() class Keyword Arguments: frame {list} -- The coordinates [x1,y1,x2,y2] of the planes/cards edges (default: {[-1, -1, 1, 1]}) color {VBase4} -- The color of the planes/cards (default: {VBase4(1, 1, 1, 1)}) """ frame = frame or [-1, -1, 1, 1] card = CardMaker("plane") card.set_color(color) card.set_frame(frame[0], frame[1], frame[2], frame[3]) n = NodePath() self.plane = n.attach_new_node(card.generate()) self.plane.reparentTo(self.render) self.plane.setHpr(0, 270, 0)
def createLights(self, r, g, b, startColor=1, fade=0): self.deleteLights() self.amblight = AmbientLight("amblight") self.amblight.setColor(VBase4(r, g, b, 1)) self.ambNode = render.attachNewNode(self.amblight) render.setLight(self.ambNode) if fade: self.lightTrack = LerpFunc(self.setLightColor, fromData=startColor, toData=r, duration=2.5, blendType="easeInOut") self.lightTrack.start() self.skyTrack = LerpColorInterval(self.sky, color=VBase4(r + 0.4, g + 0.4, b + 0.4, 1.0), startColor=VBase4(startColor, startColor, startColor, 1.0), duration=1.5) self.skyTrack.start() sky = "tt" if r < 0.6: sky = "br" self.skySeq = Sequence(Wait(1.5), Func(self.createSky, sky)) self.skySeq.start()
def add_texcam(self, scene, x, y, z): # Create a buffer and a camera that renders into it. # Set the sort to render the buffer before the main scene. # Return a texture derived from the buffer to be applied to an object. t_buffer = base.win.makeTextureBuffer("My Buffer", 512, 512) t_buffer.setClearColorActive(True) t_buffer.setClearColor(VBase4(0, 0, 0, 1)) t_texture = t_buffer.getTexture() t_buffer.setSort(-100) t_camera = base.makeCamera(t_buffer) t_camera.reparentTo(scene) t_camera.set_pos(x, y, z) t_camera.look_at(0, 0, 0) return t_texture
def __exitCrane(self): if self.closeButton: self.closeButton.destroy() self.closeButton = DirectLabel( relief=None, text=TTLocalizer.CashbotCraneLeaving, pos=(1.05, 0, -0.88), text_pos=(0, 0), text_scale=0.06, text_fg=VBase4(1, 1, 1, 1)) self.__cleanupCraneAdvice() self.__cleanupMagnetAdvice() self.d_requestFree() return
def loadLights(self): # Set a simple light dlight = DirectionalLight('DirectLight') dlnp = render.attachNewNode(dlight) dlnp.setHpr(-30, 0, 0) render.setLight(dlnp) self.directLight = dlnp self.discoLights = [] p1 = PointLight("PointLight1") p1.setColor(VBase4(1, 0, 0, 1)) p1.setAttenuation((0.08, 0, 0.05)) p1np = render.attachNewNode(p1) p1np.setPos(0, -5, 0) render.setLight(p1np) self.discoLights.append(p1) p2 = PointLight("PointLight2") p2.setColor(VBase4(0, 1, 0, 1)) p2.setAttenuation((0.08, 0, 0.05)) p2np = render.attachNewNode(p2) p2np.setPos(5, -5, 0) render.setLight(p2np) self.discoLights.append(p2) p3 = PointLight("PointLight3") p3.setColor(VBase4(0, 0, 1, 1)) p3.setAttenuation((0.08, 0, 0.05)) p3np = render.attachNewNode(p3) p3np.setPos(-5, -5, 0) render.setLight(p3np) self.discoLights.append(p3) p4 = PointLight("PointLight4") p4.setColor(VBase4(0, 0, 1, 1)) p4.setAttenuation((0.08, 0, 0.05)) p4np = render.attachNewNode(p4) p4np.setPos(-5, -5, 5) render.setLight(p4np) self.discoLights.append(p4) p5 = PointLight("PointLight1") p5.setColor(VBase4(0, 0, 1, 1)) p5.setAttenuation((0.08, 0, 0.05)) p5np = render.attachNewNode(p5) p5np.setPos(0, -5, 5) render.setLight(p5np) self.discoLights.append(p5) p6 = PointLight("PointLight1") p6.setColor(VBase4(0, 0, 1, 1)) p6.setAttenuation((0.08, 0, 0.05)) p6np = render.attachNewNode(p6) p6np.setPos(5, -5, 5) render.setLight(p6np) self.discoLights.append(p6)
def load_water(self): """ Loads the islands psuedo infinite water plane """ # Create a material for the PBR shaders water_material = Material() water_material.set_base_color(VBase4(0, 0.7, 0.9, 1)) water_card_maker = CardMaker('water_card') water_card_maker.set_frame(-200, 200, -150, 150) self.water_path = self.render.attach_new_node( water_card_maker.generate()) self.water_path.set_material(water_material, 1) self.water_path.set_scale(500)
def add_vibration(offset, axis_name, index): slider_width = canvas_width / 2 label = DirectLabel( text=axis_name, **left_aligned_small_text, pos=(0.05, 0, offset), parent=panel_canvas, ) slider = DirectSlider( value=0.0, range=(0.0, 1.0), command=self.update_vibration, frameSize=VBase4( 0, slider_width, -0.1, 0, ), thumb_frameSize=VBase4(0.0, 0.04, -0.04, 0.04), frameColor=VBase4(0.3, 0.3, 0.3, 1), pos=(canvas_width - slider_width, 0, offset), parent=panel_canvas, ) return slider
def add_axis(offset, axis_name): slider_width = canvas_width / 2 label = DirectLabel( text=axis_name, **left_aligned_small_text, pos=(0.05, 0, offset), parent=panel_canvas, ) slider = DirectSlider( value=0.0, range=(-1.0, 1.0), state=DGG.DISABLED, frameSize=VBase4( 0, slider_width, -0.1, 0, ), thumb_frameSize=VBase4(0.0, 0.04, -0.04, 0.04), frameColor=VBase4(0.3, 0.3, 0.3, 1), pos=(canvas_width - slider_width, 0, offset), parent=panel_canvas, ) return slider
def applyClickState(self, clickState): if self.chatBalloon is not None: foreground, background = self.chatColor[clickState] if self.chatType == NametagGlobals.SPEEDCHAT: background = self.speedChatColor if background[3] > self.CHAT_BALLOON_ALPHA: background = VBase4(background[0], background[1], background[2], self.CHAT_BALLOON_ALPHA) self.chatBalloon.setForeground(foreground) self.chatBalloon.setBackground(background) self.chatBalloon.setButton(self.chatButton[clickState]) elif self.panel is not None: foreground, background = self.nametagColor[clickState] self.setForeground(foreground) self.setBackground(background)
def _addDefaultLighting(self): alight = AmbientLight('alight') alight.setColor(VBase4(0.2, 0.2, 0.2, 1)) alnp = self.scene.scene.attachNewNode(alight) self.scene.scene.setLight(alnp) for camera in self.cameras: #NOTE: Point light following the camera plight = PointLight('plight') plight.setColor(VBase4(1.0, 1.0, 1.0, 1)) plnp = camera.attachNewNode(plight) self.scene.scene.setLight(plnp) if self.shadowing: # Use a 512x512 resolution shadow map plight.setShadowCaster(True, 512, 512) # Enable the shader generator for the receiving nodes self.scene.scene.setShaderAuto() self.scene.scene.setAntialias(AntialiasAttrib.MAuto) if self.modelLightsInfo is not None: # Add model-related lights (e.g. lamps) for model in self.scene.scene.findAllMatches('**/+ModelNode'): modelId = model.getNetTag('model-id') for lightNp in self.modelLightsInfo.getLightsForModel(modelId): if self.shadowing: # Use a 512x512 resolution shadow map lightNp.node().setShadowCaster(True, 512, 512) lightNp.reparentTo(model) self.scene.scene.setLight(lightNp)
def load(self): self.setMinigameMusic(DistributedDodgeballGame.GameSong) self.setDescription(DistributedDodgeballGame.GameDesc) self.setWinnerPrize(200) self.setLoserPrize(0) self.createWorld() self.blueScoreLbl = self.getWinterDodgeballScoreText(VBase4(0, 0, 1, 1)) self.blueScoreLbl.reparentTo(base.a2dTopLeft) self.blueScoreLbl['align'] = TextNode.ALeft self.blueScoreLbl.setText('Blue: 0') self.blueScoreLbl.setZ(-0.17) self.blueScoreLbl.setX(0.05) self.blueScoreLbl.hide() self.redScoreLbl = self.getWinterDodgeballScoreText(VBase4(1, 0, 0, 1)) self.redScoreLbl.reparentTo(base.a2dTopLeft) self.redScoreLbl['align'] = TextNode.ALeft self.redScoreLbl.setText('Red: 0') self.redScoreLbl.setZ(-0.35) self.redScoreLbl.setX(0.05) self.redScoreLbl.hide() trans = DistributedDodgeballGame.InitCamTrans camera.setPos(trans[0]) camera.setHpr(trans[1]) DistributedToonFPSGame.load(self)
def __init__(self, mp): vdata = GeomVertexData('name_me', GeomVertexFormat.getV3c4(), Geom.UHStatic) vertex = GeomVertexWriter(vdata, 'vertex') color = GeomVertexWriter(vdata, 'color') primitive = GeomTristrips(Geom.UHStatic) film_size = base.cam.node().getLens().getFilmSize() x = film_size.getX() / 2.0 z = x * 256.0 / 240.0 vertex.addData3f(x, 90, z) vertex.addData3f(-x, 90, z) vertex.addData3f(x, 90, -z) vertex.addData3f(-x, 90, -z) color.addData4f(VBase4(*mp['backgroundcolor1'])) color.addData4f(VBase4(*mp['backgroundcolor1'])) color.addData4f(VBase4(*mp['backgroundcolor2'])) color.addData4f(VBase4(*mp['backgroundcolor2'])) primitive.addNextVertices(4) primitive.closePrimitive() geom = Geom(vdata) geom.addPrimitive(primitive) self.node = GeomNode('sky') self.node.addGeom(geom) base.camera.attachNewNode(self.node)
def __init__(self, filePath): """ Initializes the object. The filePath argument represents the model to load for the sky geometry. """ self.sky = loader.loadModel(filePath) mat = Material() #mat.setAmbient( VBase4( 1, 1, 1, 1 )) mat.setEmission(VBase4(1, 1, 1, 1)) self.sky.setMaterial(mat) self.sky.setDepthWrite(False) self.sky.setDepthTest(False) self.sky.setBin('background', 0) self.sky.setEffect(CompassEffect.make(render)) self.sky.setLightOff() self.sky.reparentTo(base.cam) self.sky.setShaderOff()
def loadAttack(self): self.pen = loader.loadModel('phase_5/models/props/pen.bam') self.pen.reparentTo(self.suit.find('**/joint_Rhold')) self.sprayParticle = ParticleLoader.loadParticleEffect('phase_5/etc/penSpill.ptf') self.spray = loader.loadModel('phase_3.5/models/props/spray.bam') self.spray.setColor(VBase4(0, 0, 0, 1)) self.splat = Actor('phase_3.5/models/props/splat-mod.bam', {'chan': 'phase_3.5/models/props/splat-chan.bam'}) self.splat.setColor(VBase4(0, 0, 0, 1)) self.sprayScaleIval = LerpScaleInterval(self.spray, duration=0.3, scale=(1, 20, 1), startScale=(1, 1, 1)) sphere = CollisionSphere(0, 0, 0, 0.5) sphere.setTangible(0) if hasattr(self.suit, 'uniqueName'): collName = self.suit.uniqueName('fountainPenCollNode') else: collName = 'fountainPenCollNode' collNode = CollisionNode(collName) collNode.addSolid(sphere) collNode.setCollideMask(CIGlobals.WallBitmask) self.wsnp = self.spray.attachNewNode(collNode) self.wsnp.setY(1)
def refresh_device_menu(self): self.devices_frame['canvasSize'] = VBase4( 0, base.a2dLeft*-0.75, base.a2dBottom / 5.0 * len(self.buttons), 0, ) self.devices_frame.setCanvasSize() sorted_buttons = sorted(self.buttons.items(), key=lambda i: i[0].name) for idx, (dev, button) in enumerate(sorted_buttons): button.set_pos( 0, 0, (base.a2dBottom / 5.0) * idx, )