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