mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
formatting
This commit is contained in:
parent
de052535d4
commit
0dd3363dd1
@ -160,7 +160,7 @@ class ClusterClient(DirectObject.DirectObject):
|
||||
server.sendCommandString(commandString)
|
||||
if fLocally:
|
||||
# Execute locally
|
||||
exec( commandString, __builtins__ )
|
||||
exec(commandString, __builtins__)
|
||||
|
||||
def exit(self):
|
||||
# Execute remotely
|
||||
@ -208,7 +208,7 @@ class ClusterClientSync(ClusterClient):
|
||||
ClusterClient.moveCamera(self,xyz,hpr)
|
||||
self.waitForSwap=1
|
||||
|
||||
|
||||
|
||||
class DisplayConnection:
|
||||
def __init__(self,qcm,serverName,port,msgHandler):
|
||||
self.msgHandler = msgHandler
|
||||
@ -276,19 +276,19 @@ class DisplayConnection:
|
||||
|
||||
# the following should only be called by a synchronized cluster manger
|
||||
def sendSwapNow(self):
|
||||
ClusterClient.notify.debug(
|
||||
ClusterClient.notify.debug(
|
||||
"display connect send swap now, packet %d" %
|
||||
self.msgHandler.packetNumber)
|
||||
datagram = self.msgHandler.makeSwapNowDatagram()
|
||||
self.cw.send(datagram, self.tcpConn)
|
||||
|
||||
|
||||
def sendCommandString(self, commandString):
|
||||
ClusterClient.notify.debug("send command string: %s" % commandString)
|
||||
datagram = self.msgHandler.makeCommandStringDatagram(commandString)
|
||||
self.cw.send(datagram, self.tcpConn)
|
||||
|
||||
def sendExit(self):
|
||||
ClusterClient.notify.debug(
|
||||
ClusterClient.notify.debug(
|
||||
"display connect send exit, packet %d" %
|
||||
self.msgHandler.packetNumber)
|
||||
datagram = self.msgHandler.makeExitDatagram()
|
||||
@ -389,8 +389,8 @@ def createClusterClient():
|
||||
return ClusterClientSync(displayConfigs, base.clusterSyncFlag)
|
||||
else:
|
||||
return ClusterClient(displayConfigs, base.clusterSyncFlag)
|
||||
|
||||
|
||||
|
||||
|
||||
class DummyClusterClient(DirectObject.DirectObject):
|
||||
""" Dummy class to handle command strings when not in cluster mode """
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DummyClusterClient")
|
||||
@ -400,6 +400,6 @@ class DummyClusterClient(DirectObject.DirectObject):
|
||||
def __call__(self, commandString, fLocally = 1, serverList = None):
|
||||
if fLocally:
|
||||
# Execute locally
|
||||
exec( commandString, __builtins__ )
|
||||
exec(commandString, __builtins__)
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ class ClusterServer(DirectObject.DirectObject):
|
||||
""" Handle arbitrary command string from client """
|
||||
command = self.msgHandler.parseCommandStringDatagram(dgi)
|
||||
try:
|
||||
exec( command, __builtins__ )
|
||||
exec(command, __builtins__)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -23,13 +23,13 @@ class DirectDeviceManager(VrpnClient, DirectObject):
|
||||
else:
|
||||
# Check config file, if that fails, use default
|
||||
self.server = myBase.config.GetString('vrpn-server', 'spacedyne')
|
||||
|
||||
|
||||
# Create a vrpn client
|
||||
VrpnClient.__init__(self, self.server)
|
||||
|
||||
|
||||
def createButtons(self, device):
|
||||
return DirectButtons(self, device)
|
||||
|
||||
|
||||
def createAnalogs(self, device):
|
||||
return DirectAnalogs(self, device)
|
||||
|
||||
@ -53,27 +53,27 @@ class DirectButtons(ButtonNode, DirectObject):
|
||||
ButtonNode.__init__(self, vrpnClient, device)
|
||||
# Attach node to data graph
|
||||
self.nodePath = myBase.dataRoot.attachNewNode(self)
|
||||
|
||||
|
||||
def __getitem__(self, index):
|
||||
if (index < 0) or (index >= self.getNumButtons()):
|
||||
raise IndexError
|
||||
return self.getButtonState(index)
|
||||
|
||||
|
||||
def __len__(self):
|
||||
return self.getNumButtons()
|
||||
|
||||
|
||||
def enable(self):
|
||||
self.nodePath.reparentTo(myBase.dataRoot)
|
||||
|
||||
|
||||
def disable(self):
|
||||
self.nodePath.reparentTo(myBase.dataUnused)
|
||||
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def getNodePath(self):
|
||||
return self.nodePath
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
str = self.name + ': '
|
||||
for val in self:
|
||||
@ -102,21 +102,21 @@ class DirectAnalogs(AnalogNode, DirectObject):
|
||||
ANALOG_CENTER)
|
||||
self.analogRange = self.analogMax - self.analogMin
|
||||
|
||||
|
||||
|
||||
def __getitem__(self, index):
|
||||
if (index < 0) or (index >= self.getNumControls()):
|
||||
raise IndexError
|
||||
return self.getControlState(index)
|
||||
|
||||
|
||||
def __len__(self):
|
||||
return self.getNumControls()
|
||||
|
||||
|
||||
def enable(self):
|
||||
self.nodePath.reparentTo(myBase.dataRoot)
|
||||
|
||||
|
||||
def disable(self):
|
||||
self.nodePath.reparentTo(myBase.dataUnused)
|
||||
|
||||
|
||||
def normalizeWithoutCentering(self, val, minVal = -1, maxVal = 1):
|
||||
#
|
||||
# This is the old code that doesn't incorporate the centering fix
|
||||
@ -129,7 +129,7 @@ class DirectAnalogs(AnalogNode, DirectObject):
|
||||
# Zero out values in deadband
|
||||
val = sign * max(abs(val) - self.analogDeadband, 0.0)
|
||||
# Clamp value between analog range min and max and scale about center
|
||||
val = min( max( val, self.analogMin ), self.analogMax )
|
||||
val = min(max(val, self.analogMin), self.analogMax)
|
||||
# Normalize values to given minVal and maxVal range
|
||||
return (((maxVal - minVal) *
|
||||
((val - self.analogMin) / float(self.analogRange))) + minVal)
|
||||
@ -157,7 +157,7 @@ class DirectAnalogs(AnalogNode, DirectObject):
|
||||
float(aMin - (center - deadband)))
|
||||
# Normalize values to given minVal and maxVal range
|
||||
return (((maxVal - minVal) * ((percentVal + 1)/2.0)) + minVal)
|
||||
|
||||
|
||||
def normalizeChannel(self, chan, minVal = -1, maxVal = 1, sf = 1.0):
|
||||
try:
|
||||
return self.normalize(self[chan], minVal, maxVal, sfx)
|
||||
@ -166,10 +166,10 @@ class DirectAnalogs(AnalogNode, DirectObject):
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def getNodePath(self):
|
||||
return self.nodePath
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
str = self.name + ': '
|
||||
for val in self:
|
||||
@ -187,19 +187,19 @@ class DirectTracker(TrackerNode, DirectObject):
|
||||
TrackerNode.__init__(self, vrpnClient, device)
|
||||
# Attach node to data graph
|
||||
self.nodePath = myBase.dataRoot.attachNewNode(self)
|
||||
|
||||
|
||||
def enable(self):
|
||||
self.nodePath.reparentTo(myBase.dataRoot)
|
||||
|
||||
|
||||
def disable(self):
|
||||
self.nodePath.reparentTo(myBase.dataUnused)
|
||||
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def getNodePath(self):
|
||||
return self.nodePath
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return self.name
|
||||
|
||||
@ -214,29 +214,29 @@ class DirectDials(DialNode, DirectObject):
|
||||
DialNode.__init__(self, vrpnClient, device)
|
||||
# Attach node to data graph
|
||||
self.nodePath = myBase.dataRoot.attachNewNode(self)
|
||||
|
||||
|
||||
def __getitem__(self, index):
|
||||
"""
|
||||
if (index < 0) or (index >= self.getNumDials()):
|
||||
raise IndexError
|
||||
"""
|
||||
return self.readDial(index)
|
||||
|
||||
|
||||
def __len__(self):
|
||||
return self.getNumDials()
|
||||
|
||||
|
||||
def enable(self):
|
||||
self.nodePath.reparentTo(myBase.dataRoot)
|
||||
|
||||
|
||||
def disable(self):
|
||||
self.nodePath.reparentTo(myBase.dataUnused)
|
||||
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def getNodePath(self):
|
||||
return self.nodePath
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
str = self.name + ': '
|
||||
for i in range(self.getNumDials()):
|
||||
@ -260,19 +260,19 @@ class DirectTimecodeReader(AnalogNode, DirectObject):
|
||||
AnalogNode.__init__(self, vrpnClient, device)
|
||||
# Attach node to data graph
|
||||
self.nodePath = myBase.dataRoot.attachNewNode(self)
|
||||
|
||||
|
||||
def enable(self):
|
||||
self.nodePath.reparentTo(myBase.dataRoot)
|
||||
|
||||
|
||||
def disable(self):
|
||||
self.nodePath.reparentTo(myBase.dataUnused)
|
||||
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
|
||||
def getNodePath(self):
|
||||
return self.nodePath
|
||||
|
||||
|
||||
def getTime(self):
|
||||
# Assume only one card, use channel 0
|
||||
timeBits = int(self.getControlState(0))
|
||||
@ -290,7 +290,7 @@ class DirectTimecodeReader(AnalogNode, DirectObject):
|
||||
(self.frames / 30.0))
|
||||
return (self.hours, self.minutes, self.seconds, self.frames,
|
||||
self.totalSeconds)
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
str = ('%s: %d:%d:%d:%d' % ((self.name,) + self.getTime()[:-1]))
|
||||
return str
|
||||
|
@ -249,7 +249,7 @@ class DirectCameraControl(PandaObject):
|
||||
self.camManipRef.setPos(self.coaMarkerPos)
|
||||
self.camManipRef.setHpr(direct.camera, ZERO_POINT)
|
||||
else:
|
||||
wrt = direct.camera.getTransform( self.camManipRef )
|
||||
wrt = direct.camera.getTransform(self.camManipRef)
|
||||
self.camManipRef.setHpr(self.camManipRef,
|
||||
(-1 * deltaX * 180.0),
|
||||
(deltaY * 180.0),
|
||||
@ -270,7 +270,7 @@ class DirectCameraControl(PandaObject):
|
||||
t.coaCenter = getScreenXY(self.coaMarker)
|
||||
t.lastAngle = getCrankAngle(t.coaCenter)
|
||||
# Store the camera/manipRef offset transform
|
||||
t.wrt = direct.camera.getTransform( self.camManipRef )
|
||||
t.wrt = direct.camera.getTransform(self.camManipRef)
|
||||
taskMgr.add(t, 'manipulateCamera')
|
||||
|
||||
def mouseRollTask(self, state):
|
||||
@ -288,7 +288,7 @@ class DirectCameraControl(PandaObject):
|
||||
def lockCOA(self):
|
||||
self.fLockCOA = 1
|
||||
direct.message('COA Lock On')
|
||||
|
||||
|
||||
def unlockCOA(self):
|
||||
self.fLockCOA = 0
|
||||
direct.message('COA Lock Off')
|
||||
@ -382,7 +382,7 @@ class DirectCameraControl(PandaObject):
|
||||
|
||||
def updateCoaMarkerSize(self, coaDist = None):
|
||||
if not coaDist:
|
||||
coaDist = Vec3(self.coaMarker.getPos( direct.camera )).length()
|
||||
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
||||
# KEH: use current display region for fov
|
||||
# sf = COA_MARKER_SF * coaDist * math.tan(deg2Rad(direct.dr.fovV))
|
||||
sf = COA_MARKER_SF * coaDist * math.tan(deg2Rad(direct.drList.getCurrentDr().fovV))
|
||||
@ -454,7 +454,7 @@ class DirectCameraControl(PandaObject):
|
||||
|
||||
def centerCam(self):
|
||||
self.centerCamIn(1.0)
|
||||
|
||||
|
||||
def centerCamNow(self):
|
||||
self.centerCamIn(0.)
|
||||
|
||||
@ -463,7 +463,7 @@ class DirectCameraControl(PandaObject):
|
||||
# Record undo point
|
||||
direct.pushUndo([direct.camera])
|
||||
# Determine marker location
|
||||
markerToCam = self.coaMarker.getPos( direct.camera )
|
||||
markerToCam = self.coaMarker.getPos(direct.camera)
|
||||
dist = Vec3(markerToCam - ZERO_POINT).length()
|
||||
scaledCenterVec = Y_AXIS * dist
|
||||
delta = markerToCam - scaledCenterVec
|
||||
@ -491,7 +491,7 @@ class DirectCameraControl(PandaObject):
|
||||
blendType = 'easeInOut',
|
||||
task = 'manipulateCamera')
|
||||
t.uponDeath = self.updateCoaMarkerSizeOnDeath
|
||||
|
||||
|
||||
def spawnMoveToView(self, view):
|
||||
# Kill any existing tasks
|
||||
taskMgr.remove('manipulateCamera')
|
||||
@ -525,7 +525,7 @@ class DirectCameraControl(PandaObject):
|
||||
self.camManipRef.setPosHpr(self.coaMarker, ZERO_VEC,
|
||||
hprOffset)
|
||||
# Scale center vec by current distance to target
|
||||
offsetDistance = Vec3(direct.camera.getPos(self.camManipRef) -
|
||||
offsetDistance = Vec3(direct.camera.getPos(self.camManipRef) -
|
||||
ZERO_POINT).length()
|
||||
scaledCenterVec = Y_AXIS * (-1.0 * offsetDistance)
|
||||
# Now put the camManipRef at that point
|
||||
@ -541,15 +541,15 @@ class DirectCameraControl(PandaObject):
|
||||
blendType = 'easeInOut',
|
||||
task = 'manipulateCamera')
|
||||
t.uponDeath = self.updateCoaMarkerSizeOnDeath
|
||||
|
||||
|
||||
|
||||
|
||||
def swingCamAboutWidget(self, degrees, t):
|
||||
# Remove existing camera manipulation task
|
||||
taskMgr.remove('manipulateCamera')
|
||||
|
||||
# Record undo point
|
||||
direct.pushUndo([direct.camera])
|
||||
|
||||
|
||||
# Coincident with widget
|
||||
self.camManipRef.setPos(self.coaMarker, ZERO_POINT)
|
||||
# But aligned with render space
|
||||
@ -582,16 +582,16 @@ class DirectCameraControl(PandaObject):
|
||||
# At what distance does the object fill 30% of the screen?
|
||||
# Assuming radius of 1 on widget
|
||||
camY = direct.dr.near * (2.0 * maxScale)/(0.3 * maxDim)
|
||||
|
||||
|
||||
# What is the vector through the center of the screen?
|
||||
centerVec = Y_AXIS * camY
|
||||
|
||||
|
||||
# Where is the node relative to the viewpoint
|
||||
vWidget2Camera = direct.widget.getPos(direct.camera)
|
||||
|
||||
|
||||
# How far do you move the camera to be this distance from the node?
|
||||
deltaMove = vWidget2Camera - centerVec
|
||||
|
||||
|
||||
# Move a target there
|
||||
self.camManipRef.setPos(direct.camera, deltaMove)
|
||||
|
||||
@ -603,7 +603,7 @@ class DirectCameraControl(PandaObject):
|
||||
task = 'manipulateCamera')
|
||||
# Upon death, reparent Cam to parent
|
||||
fitTask.parent = parent
|
||||
fitTask.uponDeath = self.reparentCam
|
||||
fitTask.uponDeath = self.reparentCam
|
||||
|
||||
def moveToFit(self):
|
||||
# How bit is the active widget?
|
||||
@ -627,7 +627,7 @@ class DirectCameraControl(PandaObject):
|
||||
# Spawn a task to move the widget
|
||||
t = direct.widget.lerpPos(Point3(centerVec),
|
||||
CAM_MOVE_DURATION,
|
||||
other = direct.camera,
|
||||
other = direct.camera,
|
||||
blendType = 'easeInOut',
|
||||
task = 'moveToFitTask')
|
||||
t.uponDeath = lambda state: taskMgr.remove('stickToWidget')
|
||||
|
@ -17,7 +17,7 @@ class LineNodePath(NodePath):
|
||||
# Attach a geomNode to the parent and set self to be
|
||||
# the resulting node path
|
||||
self.lineNode = GeomNode("lineNode")
|
||||
self.assign(parent.attachNewNode( self.lineNode ))
|
||||
self.assign(parent.attachNewNode(self.lineNode))
|
||||
if name:
|
||||
self.setName(name)
|
||||
|
||||
@ -27,26 +27,26 @@ class LineNodePath(NodePath):
|
||||
ls.setThickness(thickness)
|
||||
ls.setColor(colorVec)
|
||||
|
||||
def moveTo( self, *_args ):
|
||||
apply( self.lineSegs.moveTo, _args )
|
||||
def moveTo(self, *_args):
|
||||
apply(self.lineSegs.moveTo, _args)
|
||||
|
||||
def drawTo( self, *_args ):
|
||||
apply( self.lineSegs.drawTo, _args )
|
||||
def drawTo(self, *_args):
|
||||
apply(self.lineSegs.drawTo, _args)
|
||||
|
||||
def create( self, frameAccurate = 0 ):
|
||||
def create(self, frameAccurate = 0):
|
||||
self.lineSegs.create( self.lineNode, frameAccurate )
|
||||
|
||||
def reset( self ):
|
||||
def reset(self):
|
||||
self.lineSegs.reset()
|
||||
self.lineNode.removeAllGeoms()
|
||||
|
||||
def isEmpty( self ):
|
||||
def isEmpty(self):
|
||||
return self.lineSegs.isEmpty()
|
||||
|
||||
def setThickness( self, thickness ):
|
||||
self.lineSegs.setThickness( thickness )
|
||||
def setThickness(self, thickness):
|
||||
self.lineSegs.setThickness(thickness)
|
||||
|
||||
def setColor( self, *_args ):
|
||||
def setColor(self, *_args):
|
||||
apply( self.lineSegs.setColor, _args )
|
||||
|
||||
def setVertex( self, *_args):
|
||||
@ -66,7 +66,7 @@ class LineNodePath(NodePath):
|
||||
|
||||
def getVertexColor( self ):
|
||||
return self.lineSegs.getVertexColor()
|
||||
|
||||
|
||||
def drawArrow(self, sv, ev, arrowAngle, arrowLength):
|
||||
"""
|
||||
Do the work of moving the cursor around to draw an arrow from
|
||||
@ -193,12 +193,12 @@ def qSlerp(startQuat, endQuat, t):
|
||||
destQuat = Quat.identQuat()
|
||||
# Calc dot product
|
||||
cosOmega = (startQ.getI() * endQuat.getI() +
|
||||
startQ.getJ() * endQuat.getJ() +
|
||||
startQ.getJ() * endQuat.getJ() +
|
||||
startQ.getK() * endQuat.getK() +
|
||||
startQ.getR() * endQuat.getR())
|
||||
# If the above dot product is negative, it would be better to
|
||||
# go between the negative of the initial and the final, so that
|
||||
# we take the shorter path.
|
||||
# we take the shorter path.
|
||||
if ( cosOmega < 0.0 ):
|
||||
cosOmega *= -1
|
||||
startQ.setI(-1 * startQ.getI())
|
||||
@ -214,7 +214,7 @@ def qSlerp(startQuat, endQuat, t):
|
||||
startScale = math.sin((1.0 - t) * omega)/sinOmega
|
||||
endScale = math.sin(t * omega)/sinOmega
|
||||
else:
|
||||
# ends very close
|
||||
# ends very close
|
||||
startScale = 1.0 - t
|
||||
endScale = t
|
||||
destQuat.setI(startScale * startQ.getI() +
|
||||
|
@ -49,7 +49,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.config = config
|
||||
# Setup wantVerifyPdb as soon as reasonable:
|
||||
Verify.wantVerifyPdb = self.config.GetBool('want-verify-pdb', 0)
|
||||
|
||||
|
||||
self.printEnvDebugInfo()
|
||||
|
||||
if self.config.GetBool('use-vfs', 1):
|
||||
@ -78,11 +78,11 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
# using 'sleep' once per frame to limit CPU usage.
|
||||
self.sleepCycle = 0.0
|
||||
|
||||
|
||||
# Fill this in with a function to invoke when the user "exits"
|
||||
# the program by closing the main window.
|
||||
self.exitFunc = None
|
||||
|
||||
|
||||
Task.TaskManager.taskTimerVerbose = self.config.GetBool('task-timer-verbose', 0)
|
||||
Task.TaskManager.extendedExceptions = self.config.GetBool('extended-exceptions', 0)
|
||||
Task.TaskManager.pStatsTasks = self.config.GetBool('pstats-tasks', 0)
|
||||
@ -145,7 +145,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.setupRender()
|
||||
self.setupRender2d()
|
||||
self.setupRender2dp()
|
||||
self.setupDataGraph()
|
||||
self.setupDataGraph()
|
||||
|
||||
# This is a placeholder for a CollisionTraverser. If someone
|
||||
# stores a CollisionTraverser pointer here, we'll traverse it
|
||||
@ -366,7 +366,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
"""
|
||||
if pipe == None:
|
||||
pipe = self.pipe
|
||||
|
||||
|
||||
if pipe == None:
|
||||
self.makeDefaultPipe()
|
||||
pipe = self.pipe
|
||||
@ -421,7 +421,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
# Set up a 3-d camera for the window by default.
|
||||
self.makeCamera(win, scene = scene, aspectRatio = aspectRatio)
|
||||
|
||||
|
||||
return win
|
||||
|
||||
def closeWindow(self, win):
|
||||
@ -469,7 +469,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# This is intended to be called only once, at application
|
||||
# startup. It is normally called automatically unless
|
||||
# window-type is configured to 'none'.
|
||||
|
||||
|
||||
self.openMainWindow()
|
||||
|
||||
# Give the window a chance to truly open.
|
||||
@ -504,7 +504,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
if self.win != None:
|
||||
return self.win.isValid()
|
||||
return 0
|
||||
|
||||
|
||||
def openMainWindow(self):
|
||||
"""
|
||||
Creates the initial, main window for the application, and sets
|
||||
@ -535,7 +535,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.win = oldWin
|
||||
self.winList.append(oldWin)
|
||||
success = 0
|
||||
|
||||
|
||||
if self.win != None:
|
||||
if isinstance(self.win, GraphicsWindow):
|
||||
self.setupMouse(self.win)
|
||||
@ -588,7 +588,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.frameRateMeter.clearWindow()
|
||||
self.frameRateMeter = None
|
||||
|
||||
|
||||
|
||||
def setupRender(self):
|
||||
"""
|
||||
Creates the render scene graph, the primary scene graph for
|
||||
@ -601,7 +601,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.render.node().setAttrib(RescaleNormalAttrib.makeDefault());
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
self.render.setTwoSided(0)
|
||||
self.backfaceCullingEnabled = 1
|
||||
self.textureEnabled = 1
|
||||
@ -628,7 +628,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# occasionally want to put 3-d geometry under render2d, and
|
||||
# it's simplest (and seems to be easier on graphics drivers)
|
||||
# if the 2-d scene has been cleared first.
|
||||
|
||||
|
||||
dt = DepthTestAttrib.make(DepthTestAttrib.MNone)
|
||||
dw = DepthWriteAttrib.make(DepthWriteAttrib.MOff)
|
||||
#lt = LightTransition.allOff()
|
||||
@ -675,7 +675,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# occasionally want to put 3-d geometry under render2d, and
|
||||
# it's simplest (and seems to be easier on graphics drivers)
|
||||
# if the 2-d scene has been cleared first.
|
||||
|
||||
|
||||
dt = DepthTestAttrib.make(DepthTestAttrib.MNone)
|
||||
dw = DepthWriteAttrib.make(DepthWriteAttrib.MOff)
|
||||
#lt = LightTransition.allOff()
|
||||
@ -685,14 +685,14 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
self.render2dp.setMaterialOff(1)
|
||||
self.render2dp.setTwoSided(1)
|
||||
|
||||
|
||||
# The normal 2-d DisplayRegion has an aspect ratio that
|
||||
# matches the window, but its coordinate system is square.
|
||||
# This means anything we parent to render2d gets stretched.
|
||||
# For things where that makes a difference, we set up
|
||||
# aspect2d, which scales things back to the right aspect
|
||||
# ratio.
|
||||
|
||||
|
||||
aspectRatio = self.getAspectRatio()
|
||||
self.aspect2dp = self.render2dp.attachNewNode(PGTop("aspect2dp"))
|
||||
# Temporary test for old panda.
|
||||
@ -710,7 +710,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# Returns the actual aspect ratio of the indicated (or main
|
||||
# window), or the default aspect ratio if there is not yet a
|
||||
# main window.
|
||||
|
||||
|
||||
if self.aspectRatio:
|
||||
return self.aspectRatio
|
||||
|
||||
@ -753,7 +753,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
camNode = Camera(camName)
|
||||
lens = PerspectiveLens()
|
||||
lens.setAspectRatio(aspectRatio)
|
||||
|
||||
|
||||
camNode.setLens(lens)
|
||||
|
||||
# self.camera is the parent node of all cameras: a node that
|
||||
@ -761,7 +761,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
if self.camera == None:
|
||||
self.camera = self.render.attachNewNode('camera')
|
||||
__builtins__["camera"] = self.camera
|
||||
|
||||
|
||||
cam = self.camera.attachNewNode(camNode)
|
||||
dr.setCamera(cam)
|
||||
|
||||
@ -801,7 +801,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# not as clear how useful it is.
|
||||
if self.camera2d == None:
|
||||
self.camera2d = self.render2d.attachNewNode('camera2d')
|
||||
|
||||
|
||||
camera2d = self.camera2d.attachNewNode(cam2dNode)
|
||||
dr.setCamera(camera2d)
|
||||
|
||||
@ -834,7 +834,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# not as clear how useful it is.
|
||||
if self.camera2dp == None:
|
||||
self.camera2dp = self.render2dp.attachNewNode('camera2dp')
|
||||
|
||||
|
||||
camera2dp = self.camera2dp.attachNewNode(cam2dNode)
|
||||
dr.setCamera(camera2dp)
|
||||
|
||||
@ -858,7 +858,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
using the indicated window. If the mouse has already been set
|
||||
up for a different window, those structures are deleted first.
|
||||
"""
|
||||
|
||||
|
||||
if self.buttonThrowers != None:
|
||||
for bt in self.buttonThrowers:
|
||||
mw = bt.getParent()
|
||||
@ -866,14 +866,14 @@ class ShowBase(DirectObject.DirectObject):
|
||||
bt.removeNode()
|
||||
mw.removeNode()
|
||||
mk.removeNode()
|
||||
|
||||
|
||||
# For each mouse/keyboard device, we create
|
||||
# - MouseAndKeyboard
|
||||
# - MouseWatcher
|
||||
# - ButtonThrower
|
||||
# The ButtonThrowers are stored in a list, self.buttonThrowers.
|
||||
# Given a ButtonThrower, one can access the MouseWatcher and
|
||||
# MouseAndKeyboard using getParent.
|
||||
# MouseAndKeyboard using getParent.
|
||||
#
|
||||
# The MouseAndKeyboard generates mouse events and mouse
|
||||
# button/keyboard events; the MouseWatcher passes them through
|
||||
@ -969,7 +969,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
32.0 / self.win.getHeight() / aspectRatio,
|
||||
1.0, 32.0 / self.win.getHeight())
|
||||
#self.mouseWatcherNode.setGeometry(mouseViz)
|
||||
|
||||
|
||||
def getAlt(self):
|
||||
return self.mouseWatcherNode.getModifierButtons().isDown(
|
||||
KeyboardButton.alt())
|
||||
@ -1079,7 +1079,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
# enable/disableAllAudio allow a programmable global override-off for current audio settings.
|
||||
# they're meant to be called when app loses audio focus (switched out), so we can turn off sound
|
||||
# without affecting internal sfxActive/musicActive sound settings, so things
|
||||
# without affecting internal sfxActive/musicActive sound settings, so things
|
||||
# come back ok when the app is switched back to
|
||||
|
||||
def disableAllAudio(self):
|
||||
@ -1130,7 +1130,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# along with their velocities. At the beginning of the frame
|
||||
# really means after the command prompt, which allows the user
|
||||
# to interactively query these deltas meaningfully.
|
||||
|
||||
|
||||
if self.cTrav:
|
||||
self.cTrav.resetPrevTransform(self.render)
|
||||
return Task.cont
|
||||
@ -1182,7 +1182,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
if self.recorder:
|
||||
self.recorder.playFrame()
|
||||
|
||||
|
||||
if self.mainWinMinimized:
|
||||
# If the main window is minimized, slow down the app a bit
|
||||
# by sleeping here in igLoop so we don't use all available
|
||||
@ -1270,7 +1270,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
if win:
|
||||
win.setClearColor(color)
|
||||
|
||||
|
||||
def toggleBackface(self):
|
||||
if self.backfaceCullingEnabled:
|
||||
self.backfaceCullingOff()
|
||||
@ -1425,14 +1425,14 @@ class ShowBase(DirectObject.DirectObject):
|
||||
if self.oobeCullFrustum != None:
|
||||
# First, disable OOBE cull mode.
|
||||
self.oobeCull()
|
||||
|
||||
|
||||
if self.oobeVis:
|
||||
self.oobeVis.reparentTo(self.hidden)
|
||||
|
||||
# Restore the mouse interface node.
|
||||
#self.mouseInterface.reparentTo(self.mouseWatcher)
|
||||
self.oobeTrackball.reparentTo(self.dataUnused)
|
||||
|
||||
|
||||
self.cam.reparentTo(self.camera)
|
||||
self.camNode.setLens(self.camLens)
|
||||
self.oobeCamera.reparentTo(self.hidden)
|
||||
@ -1462,7 +1462,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
# Don't change the camera lens--keep it with the original lens.
|
||||
#self.camNode.setLens(self.oobeLens)
|
||||
|
||||
|
||||
if self.oobeVis:
|
||||
self.oobeVis.reparentTo(self.camera)
|
||||
self.oobeMode = 1
|
||||
@ -1525,7 +1525,7 @@ class ShowBase(DirectObject.DirectObject):
|
||||
if filename.empty():
|
||||
# The screenshot attempt failed for some reason.
|
||||
return 0
|
||||
|
||||
|
||||
# Announce to anybody that a screenshot has been taken
|
||||
messenger.send('screenshot', [filename])
|
||||
return 1
|
||||
|
@ -78,7 +78,7 @@ operator == (const CPPIdentifier &other) const {
|
||||
if (_names.size() != other._names.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < (int)_names.size(); i++) {
|
||||
for (int i = 0; i < (int)_names.size(); ++i) {
|
||||
if (_names[i] != other._names[i]) {
|
||||
return false;
|
||||
}
|
||||
@ -107,7 +107,7 @@ operator < (const CPPIdentifier &other) const {
|
||||
if (_names.size() != other._names.size()) {
|
||||
return _names.size() < other._names.size();
|
||||
}
|
||||
for (int i = 0; i < (int)_names.size(); i++) {
|
||||
for (int i = 0; i < (int)_names.size(); ++i) {
|
||||
if (_names[i] != other._names[i]) {
|
||||
return _names[i] < other._names[i];
|
||||
}
|
||||
@ -492,7 +492,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPIdentifier *rep = new CPPIdentifier(*this);
|
||||
|
||||
bool anything_changed = false;
|
||||
for (int i = 0; i < (int)rep->_names.size(); i++) {
|
||||
for (int i = 0; i < (int)rep->_names.size(); ++i) {
|
||||
if (_names[i].has_templ()) {
|
||||
rep->_names[i].set_templ
|
||||
(_names[i].get_templ()->substitute_decl(subst, current_scope, global_scope));
|
||||
|
@ -156,7 +156,7 @@ output(ostream &out) const {
|
||||
out << "(";
|
||||
if (_num_parameters > 0) {
|
||||
out << "$1";
|
||||
for (int i = 1; i < _num_parameters; i++) {
|
||||
for (int i = 1; i < _num_parameters; ++i) {
|
||||
out << ", $" << i + 1;
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ save_expansion(const string &exp, const vector_string ¶meter_names) {
|
||||
|
||||
// Is this identifier one of our parameters?
|
||||
int pnum = -1;
|
||||
for (int i = 0; pnum == -1 && i < (int)parameter_names.size(); i++) {
|
||||
for (int i = 0; pnum == -1 && i < (int)parameter_names.size(); ++i) {
|
||||
if (parameter_names[i] == ident) {
|
||||
pnum = i;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ is_equivalent(const CPPParameterList &other) const {
|
||||
if (_parameters.size() != other._parameters.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (!_parameters[i]->_type->is_equivalent(*other._parameters[i]->_type)) {
|
||||
return false;
|
||||
}
|
||||
@ -67,7 +67,7 @@ operator == (const CPPParameterList &other) const {
|
||||
if (_parameters.size() != other._parameters.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (*_parameters[i] != *other._parameters[i]) {
|
||||
return false;
|
||||
}
|
||||
@ -98,7 +98,7 @@ operator < (const CPPParameterList &other) const {
|
||||
if (_parameters.size() != other._parameters.size()) {
|
||||
return _parameters.size() < other._parameters.size();
|
||||
}
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (*_parameters[i] != *other._parameters[i]) {
|
||||
return *_parameters[i] < *other._parameters[i];
|
||||
}
|
||||
@ -114,7 +114,7 @@ operator < (const CPPParameterList &other) const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPParameterList::
|
||||
is_tbd() const {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (_parameters[i]->_type->is_tbd()) {
|
||||
return true;
|
||||
}
|
||||
@ -132,7 +132,7 @@ is_tbd() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPParameterList::
|
||||
is_parameter_expr() const {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (_parameters[i]->_type->is_parameter_expr()) {
|
||||
return true;
|
||||
}
|
||||
@ -150,7 +150,7 @@ is_parameter_expr() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPParameterList::
|
||||
is_fully_specified() const {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (!_parameters[i]->is_fully_specified()) {
|
||||
return false;
|
||||
}
|
||||
@ -169,7 +169,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPParameterList *rep = new CPPParameterList;
|
||||
bool any_changed = false;
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
CPPInstance *inst =
|
||||
_parameters[i]->substitute_decl(subst, current_scope, global_scope)
|
||||
->as_instance();
|
||||
@ -197,7 +197,7 @@ CPPParameterList *CPPParameterList::
|
||||
resolve_type(CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPParameterList *rep = new CPPParameterList;
|
||||
bool any_changed = false;
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
CPPInstance *inst = _parameters[i];
|
||||
CPPType *new_type = inst->_type;
|
||||
if (new_type->is_tbd()) {
|
||||
@ -232,7 +232,7 @@ void CPPParameterList::
|
||||
output(ostream &out, CPPScope *scope, bool parameter_names,
|
||||
int num_default_parameters) const {
|
||||
if (!_parameters.empty()) {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (i != 0) {
|
||||
out << ", ";
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
bool unchanged =
|
||||
(rep->_ident == _ident && rep->_scope == _scope);
|
||||
|
||||
for (int i = 0; i < (int)_derivation.size(); i++) {
|
||||
for (int i = 0; i < (int)_derivation.size(); ++i) {
|
||||
rep->_derivation[i]._base =
|
||||
_derivation[i]._base->substitute_decl(subst, current_scope, global_scope)->as_type();
|
||||
if (rep->_derivation[i]._base != _derivation[i]._base) {
|
||||
|
@ -117,7 +117,7 @@ build_subst_decl(const CPPTemplateParameterList &formal_params,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPTemplateParameterList::
|
||||
is_fully_specified() const {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (!_parameters[i]->is_fully_specified()) {
|
||||
return false;
|
||||
}
|
||||
@ -134,7 +134,7 @@ is_fully_specified() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPTemplateParameterList::
|
||||
is_tbd() const {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
CPPType *type = _parameters[i]->as_type();
|
||||
if (type != (CPPType *)NULL &&
|
||||
(type->is_tbd() || type->as_class_template_parameter() != NULL)) {
|
||||
@ -158,7 +158,7 @@ operator == (const CPPTemplateParameterList &other) const {
|
||||
if (_parameters.size() != other._parameters.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (*_parameters[i] != *other._parameters[i]) {
|
||||
return false;
|
||||
}
|
||||
@ -186,7 +186,7 @@ operator < (const CPPTemplateParameterList &other) const {
|
||||
if (_parameters.size() != other._parameters.size()) {
|
||||
return _parameters.size() < other._parameters.size();
|
||||
}
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)_parameters.size(); ++i) {
|
||||
if (*_parameters[i] != *other._parameters[i]) {
|
||||
return *_parameters[i] < *other._parameters[i];
|
||||
}
|
||||
@ -205,7 +205,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPTemplateParameterList *rep = new CPPTemplateParameterList(*this);
|
||||
|
||||
bool anything_changed = false;
|
||||
for (int i = 0; i < (int)rep->_parameters.size(); i++) {
|
||||
for (int i = 0; i < (int)rep->_parameters.size(); ++i) {
|
||||
rep->_parameters[i] =
|
||||
_parameters[i]->substitute_decl(subst, current_scope, global_scope);
|
||||
if (rep->_parameters[i] != _parameters[i]) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ostream &
|
||||
indent(ostream &out, int indent_level) {
|
||||
for (int i = 0; i < indent_level; i++) {
|
||||
for (int i = 0; i < indent_level; ++i) {
|
||||
out << ' ';
|
||||
}
|
||||
return out;
|
||||
|
@ -161,7 +161,7 @@ ConfigTable::Symbol& Config<GetConfig>::GetAll(const ConfigString sym,
|
||||
ConfigVariableList var(sym, "DConfig", ConfigFlags::F_dconfig);
|
||||
|
||||
int num_values = var.get_num_values();
|
||||
for (int i = 0; i < num_values; i++) {
|
||||
for (int i = 0; i < num_values; ++i) {
|
||||
string value = var.get_string_value(i);
|
||||
s.push_back(SymbolEnt(SymbolEnt::ConfigFile, value));
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ void DSearchPath::
|
||||
write(ostream &out, int indent_level) const {
|
||||
Directories::const_iterator di;
|
||||
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||
for (int i = 0; i < indent_level; i++) {
|
||||
for (int i = 0; i < indent_level; ++i) {
|
||||
out << ' ';
|
||||
}
|
||||
out << (*di) << "\n";
|
||||
|
@ -115,7 +115,7 @@ pad_bytes(size_t size) {
|
||||
|
||||
while (size > 0) {
|
||||
_data.push_back('\0');
|
||||
size--;
|
||||
--size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ append_data(const void *data, size_t size) {
|
||||
// _data.reserve(_data.size() + size);
|
||||
|
||||
const uchar *source = (const uchar *)data;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
_data.v().push_back(source[i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user