mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Remove unnecessary "pass" statements from DistributedCamera code
This commit is contained in:
parent
e0dea2b342
commit
378030e9b9
@ -24,7 +24,6 @@ class Fixture(NodePath, FSM):
|
|||||||
self.scaleIval = None
|
self.scaleIval = None
|
||||||
self.recordingInProgress = False
|
self.recordingInProgress = False
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
pass
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Fixture(%d, \'%s\', %s, %s, %s)' % (self.id, self.state, self.getPos(), self.getHpr(), self.getFov())
|
return 'Fixture(%d, \'%s\', %s, %s, %s)' % (self.id, self.state, self.getPos(), self.getHpr(), self.getFov())
|
||||||
@ -34,7 +33,6 @@ class Fixture(NodePath, FSM):
|
|||||||
|
|
||||||
def setId(self, id):
|
def setId(self, id):
|
||||||
self.id = id
|
self.id = id
|
||||||
pass
|
|
||||||
|
|
||||||
def setFov(self, fov):
|
def setFov(self, fov):
|
||||||
"""
|
"""
|
||||||
@ -42,15 +40,12 @@ class Fixture(NodePath, FSM):
|
|||||||
"""
|
"""
|
||||||
if fov != VBase2(0):
|
if fov != VBase2(0):
|
||||||
self.lens.setFov(fov)
|
self.lens.setFov(fov)
|
||||||
pass
|
|
||||||
self.setupFrustum()
|
self.setupFrustum()
|
||||||
pass
|
|
||||||
|
|
||||||
def adjustFov(self, x, y):
|
def adjustFov(self, x, y):
|
||||||
fov = self.lens.getFov()
|
fov = self.lens.getFov()
|
||||||
self.lens.setFov(fov[0]+x, fov[1]+y)
|
self.lens.setFov(fov[0]+x, fov[1]+y)
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
pass
|
|
||||||
|
|
||||||
def getFov(self):
|
def getFov(self):
|
||||||
return self.lens.getFov()
|
return self.lens.getFov()
|
||||||
@ -59,40 +54,30 @@ class Fixture(NodePath, FSM):
|
|||||||
oldFrustum = self.find('frustum')
|
oldFrustum = self.find('frustum')
|
||||||
if oldFrustum:
|
if oldFrustum:
|
||||||
oldFrustum.detachNode()
|
oldFrustum.detachNode()
|
||||||
pass
|
|
||||||
|
|
||||||
self.attachNewNode(GeomNode('frustum')).node().addGeom(self.lens.makeGeometry())
|
self.attachNewNode(GeomNode('frustum')).node().addGeom(self.lens.makeGeometry())
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def setRecordingInProgress(self, inProgress):
|
def setRecordingInProgress(self, inProgress):
|
||||||
self.recordingInProgress = inProgress
|
self.recordingInProgress = inProgress
|
||||||
if self.recordingInProgress and \
|
if self.recordingInProgress and \
|
||||||
base.config.GetInt('camera-id', -1) >= 0:
|
base.config.GetInt('camera-id', -1) >= 0:
|
||||||
self.hide()
|
self.hide()
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
self.show()
|
self.show()
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
if base.config.GetBool('aware-of-cameras',0) and \
|
if base.config.GetBool('aware-of-cameras',0) and \
|
||||||
not self.recordingInProgress:
|
not self.recordingInProgress:
|
||||||
NodePath.show(self)
|
NodePath.show(self)
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def getScaleIval(self):
|
def getScaleIval(self):
|
||||||
if not self.scaleIval:
|
if not self.scaleIval:
|
||||||
self.scaleIval = Sequence(LerpScaleInterval(self.getChild(0), 0.25, 2, startScale = 1, blendType = 'easeInOut'),
|
self.scaleIval = Sequence(LerpScaleInterval(self.getChild(0), 0.25, 2, startScale = 1, blendType = 'easeInOut'),
|
||||||
LerpScaleInterval(self.getChild(0), 0.25, 1, startScale = 2, blendType = 'easeInOut'))
|
LerpScaleInterval(self.getChild(0), 0.25, 1, startScale = 2, blendType = 'easeInOut'))
|
||||||
pass
|
|
||||||
return self.scaleIval
|
return self.scaleIval
|
||||||
|
|
||||||
def setState(self, state):
|
def setState(self, state):
|
||||||
self.request(state)
|
self.request(state)
|
||||||
pass
|
|
||||||
|
|
||||||
def defaultFilter(self, request, args):
|
def defaultFilter(self, request, args):
|
||||||
if request == self.getCurrentOrNextState():
|
if request == self.getCurrentOrNextState():
|
||||||
@ -101,7 +86,6 @@ class Fixture(NodePath, FSM):
|
|||||||
|
|
||||||
def exitOff(self):
|
def exitOff(self):
|
||||||
self.accept('recordingInProgress', self.setRecordingInProgress)
|
self.accept('recordingInProgress', self.setRecordingInProgress)
|
||||||
pass
|
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.ignore('recordingInProgress')
|
self.ignore('recordingInProgress')
|
||||||
@ -109,10 +93,8 @@ class Fixture(NodePath, FSM):
|
|||||||
if self.scaleIval:
|
if self.scaleIval:
|
||||||
self.scaleIval.finish()
|
self.scaleIval.finish()
|
||||||
self.scaleIval = None
|
self.scaleIval = None
|
||||||
pass
|
|
||||||
|
|
||||||
self.hide()
|
self.hide()
|
||||||
pass
|
|
||||||
|
|
||||||
def enterStandby(self):
|
def enterStandby(self):
|
||||||
self.show()
|
self.show()
|
||||||
@ -122,37 +104,27 @@ class Fixture(NodePath, FSM):
|
|||||||
else:
|
else:
|
||||||
self.setColorScale(3,3,0,1)
|
self.setColorScale(3,3,0,1)
|
||||||
self.getScaleIval().finish()
|
self.getScaleIval().finish()
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def enterBlinking(self):
|
def enterBlinking(self):
|
||||||
self.show()
|
self.show()
|
||||||
self.setColorScale(0,3,0,1)
|
self.setColorScale(0,3,0,1)
|
||||||
self.getScaleIval().loop()
|
self.getScaleIval().loop()
|
||||||
pass
|
|
||||||
|
|
||||||
def exitBlinking(self):
|
def exitBlinking(self):
|
||||||
if self.scaleIval:
|
if self.scaleIval:
|
||||||
self.scaleIval.finish()
|
self.scaleIval.finish()
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def enterRecording(self):
|
def enterRecording(self):
|
||||||
if base.config.GetInt('camera-id', -1) == self.id:
|
if base.config.GetInt('camera-id', -1) == self.id:
|
||||||
self.demand('Using')
|
self.demand('Using')
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
self.show()
|
self.show()
|
||||||
self.setColorScale(3,0,0,1)
|
self.setColorScale(3,0,0,1)
|
||||||
self.getScaleIval().loop()
|
self.getScaleIval().loop()
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def exitRecording(self):
|
def exitRecording(self):
|
||||||
if self.scaleIval:
|
if self.scaleIval:
|
||||||
self.scaleIval.finish()
|
self.scaleIval.finish()
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def enterUsing(self, args = []):
|
def enterUsing(self, args = []):
|
||||||
localAvatar.b_setGameState('Camera')
|
localAvatar.b_setGameState('Camera')
|
||||||
@ -178,8 +150,6 @@ class Fixture(NodePath, FSM):
|
|||||||
lodNodes = render.findAllMatches('**/+LODNode')
|
lodNodes = render.findAllMatches('**/+LODNode')
|
||||||
for i in xrange(0,lodNodes.getNumPaths()):
|
for i in xrange(0,lodNodes.getNumPaths()):
|
||||||
lodNodes[i].node().forceSwitch(lodNodes[i].node().getHighestSwitch())
|
lodNodes[i].node().forceSwitch(lodNodes[i].node().getHighestSwitch())
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def exitUsing(self):
|
def exitUsing(self):
|
||||||
@ -199,9 +169,6 @@ class Fixture(NodePath, FSM):
|
|||||||
if self.dirty:
|
if self.dirty:
|
||||||
messenger.send('refresh-fixture', [self.id, self.pack()])
|
messenger.send('refresh-fixture', [self.id, self.pack()])
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
pass
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class DistributedCamera(DistributedObject):
|
class DistributedCamera(DistributedObject):
|
||||||
@ -211,8 +178,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
self.fixtures = {}
|
self.fixtures = {}
|
||||||
self.cameraId = base.config.GetInt('camera-id',0)
|
self.cameraId = base.config.GetInt('camera-id',0)
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
return self.fixtures.get(index)
|
return self.fixtures.get(index)
|
||||||
|
|
||||||
@ -236,7 +201,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
for fixture in self.fixtures.itervalues():
|
for fixture in self.fixtures.itervalues():
|
||||||
fixture.cleanup()
|
fixture.cleanup()
|
||||||
fixture.detachNode()
|
fixture.detachNode()
|
||||||
pass
|
|
||||||
self.fixtures = {}
|
self.fixtures = {}
|
||||||
|
|
||||||
DistributedObject.disable(self)
|
DistributedObject.disable(self)
|
||||||
@ -250,13 +214,9 @@ class DistributedCamera(DistributedObject):
|
|||||||
self.parent = render
|
self.parent = render
|
||||||
else:
|
else:
|
||||||
self.parent = self.cr.getDo(doId)
|
self.parent = self.cr.getDo(doId)
|
||||||
pass
|
|
||||||
|
|
||||||
for fix in self.fixtures.itervalues():
|
for fix in self.fixtures.itervalues():
|
||||||
fix.reparentTo(self.parent)
|
fix.reparentTo(self.parent)
|
||||||
pass
|
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def getCamParent(self):
|
def getCamParent(self):
|
||||||
return self.parent
|
return self.parent
|
||||||
@ -266,7 +226,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
fixture = self.fixtures.pop(x)
|
fixture = self.fixtures.pop(x)
|
||||||
fixture.cleanup()
|
fixture.cleanup()
|
||||||
fixture.detachNode()
|
fixture.detachNode()
|
||||||
pass
|
|
||||||
|
|
||||||
recordingInProgress = False
|
recordingInProgress = False
|
||||||
for x,fixture in enumerate(fixtures):
|
for x,fixture in enumerate(fixtures):
|
||||||
@ -277,7 +236,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
|
|
||||||
if x not in self.fixtures:
|
if x not in self.fixtures:
|
||||||
self.fixtures[x] = Fixture(x, self.parent, Point3(0), hpr = Point3(0), fov = VBase2(0))
|
self.fixtures[x] = Fixture(x, self.parent, Point3(0), hpr = Point3(0), fov = VBase2(0))
|
||||||
pass
|
|
||||||
|
|
||||||
fix = self.fixtures.get(x)
|
fix = self.fixtures.get(x)
|
||||||
fix.setId(x)
|
fix.setId(x)
|
||||||
@ -285,7 +243,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
fix.setState(state)
|
fix.setState(state)
|
||||||
fix.setFov(fov)
|
fix.setFov(fov)
|
||||||
recordingInProgress |= state == 'Recording'
|
recordingInProgress |= state == 'Recording'
|
||||||
pass
|
|
||||||
|
|
||||||
messenger.send('recordingInProgress', [recordingInProgress])
|
messenger.send('recordingInProgress', [recordingInProgress])
|
||||||
|
|
||||||
@ -294,8 +251,6 @@ class DistributedCamera(DistributedObject):
|
|||||||
if fixture:
|
if fixture:
|
||||||
fixture.request('Using', [True])
|
fixture.request('Using', [True])
|
||||||
self.accept('escape', self.stopTesting, [index])
|
self.accept('escape', self.stopTesting, [index])
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def stopTesting(self, index):
|
def stopTesting(self, index):
|
||||||
fixture = self.fixtures.get(index)
|
fixture = self.fixtures.get(index)
|
||||||
@ -303,5 +258,3 @@ class DistributedCamera(DistributedObject):
|
|||||||
self.ignore('escape')
|
self.ignore('escape')
|
||||||
fixture.request('Standby')
|
fixture.request('Standby')
|
||||||
localAvatar.b_setGameState('LandRoam')
|
localAvatar.b_setGameState('LandRoam')
|
||||||
pass
|
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ class DistributedCameraAI(DistributedObjectAI):
|
|||||||
DistributedObjectAI.__init__(self, air)
|
DistributedObjectAI.__init__(self, air)
|
||||||
self.parent = 0
|
self.parent = 0
|
||||||
self.fixtures = []
|
self.fixtures = []
|
||||||
pass
|
|
||||||
|
|
||||||
def getCamParent(self):
|
def getCamParent(self):
|
||||||
return self.parent
|
return self.parent
|
||||||
|
@ -7,7 +7,6 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
self.parent = 0
|
self.parent = 0
|
||||||
self.fixtures = []
|
self.fixtures = []
|
||||||
self.accept('refresh-fixture', self.refreshFixture)
|
self.accept('refresh-fixture', self.refreshFixture)
|
||||||
pass
|
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
self.ignore('escape')
|
self.ignore('escape')
|
||||||
@ -19,17 +18,14 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
|
|
||||||
def setCamParent(self, doId):
|
def setCamParent(self, doId):
|
||||||
self.parent = doId
|
self.parent = doId
|
||||||
pass
|
|
||||||
|
|
||||||
def setFixtures(self, fixtures):
|
def setFixtures(self, fixtures):
|
||||||
self.fixtures = fixtures
|
self.fixtures = fixtures
|
||||||
pass
|
|
||||||
|
|
||||||
def storeToFile(self, name):
|
def storeToFile(self, name):
|
||||||
f = file('cameras-%s.txt' % name, 'w')
|
f = file('cameras-%s.txt' % name, 'w')
|
||||||
f.writelines(self.getObject().pack())
|
f.writelines(self.getObject().pack())
|
||||||
f.close()
|
f.close()
|
||||||
pass
|
|
||||||
|
|
||||||
def unpackFixture(self, data):
|
def unpackFixture(self, data):
|
||||||
data = data.strip().replace('Camera','')
|
data = data.strip().replace('Camera','')
|
||||||
@ -45,9 +41,7 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
hpr[0],hpr[1],hpr[2],
|
hpr[0],hpr[1],hpr[2],
|
||||||
fov[0],fov[1],
|
fov[0],fov[1],
|
||||||
'Standby'])
|
'Standby'])
|
||||||
pass
|
|
||||||
f.close()
|
f.close()
|
||||||
pass
|
|
||||||
|
|
||||||
def refreshFixture(self, id, data):
|
def refreshFixture(self, id, data):
|
||||||
pos,hpr,fov = self.unpackFixture(data)
|
pos,hpr,fov = self.unpackFixture(data)
|
||||||
@ -59,24 +53,20 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
|
|
||||||
# distributed only
|
# distributed only
|
||||||
self.d_setFixtures(self.fixtures)
|
self.d_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
|
|
||||||
def b_setFixtures(self, fixtures):
|
def b_setFixtures(self, fixtures):
|
||||||
self.getObject().setFixtures(fixtures)
|
self.getObject().setFixtures(fixtures)
|
||||||
self.setFixtures(fixtures)
|
self.setFixtures(fixtures)
|
||||||
self.d_setFixtures(fixtures)
|
self.d_setFixtures(fixtures)
|
||||||
pass
|
|
||||||
|
|
||||||
def d_setFixtures(self, fixtures):
|
def d_setFixtures(self, fixtures):
|
||||||
self.sendUpdate('setFixtures', [fixtures])
|
self.sendUpdate('setFixtures', [fixtures])
|
||||||
pass
|
|
||||||
|
|
||||||
def addFixture(self, fixture, index = None):
|
def addFixture(self, fixture, index = None):
|
||||||
if index is not None:
|
if index is not None:
|
||||||
self.fixtures.insert(index, fixture)
|
self.fixtures.insert(index, fixture)
|
||||||
else:
|
else:
|
||||||
self.fixtures.append(fixture)
|
self.fixtures.append(fixture)
|
||||||
pass
|
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
return self.fixtures.index(fixture)
|
return self.fixtures.index(fixture)
|
||||||
|
|
||||||
@ -85,25 +75,20 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
fixture = self.fixtures[index]
|
fixture = self.fixtures[index]
|
||||||
fixture[6] = 'Blinking'
|
fixture[6] = 'Blinking'
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
pass
|
|
||||||
|
|
||||||
def standbyFixture(self, index):
|
def standbyFixture(self, index):
|
||||||
if index < len(self.fixtures):
|
if index < len(self.fixtures):
|
||||||
fixture = self.fixtures[index]
|
fixture = self.fixtures[index]
|
||||||
fixture[6] = 'Standby'
|
fixture[6] = 'Standby'
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
|
|
||||||
def testFixture(self, index):
|
def testFixture(self, index):
|
||||||
if index < len(self.fixtures):
|
if index < len(self.fixtures):
|
||||||
self.getObject().testFixture(index)
|
self.getObject().testFixture(index)
|
||||||
pass
|
|
||||||
|
|
||||||
def removeFixture(self, index):
|
def removeFixture(self, index):
|
||||||
self.fixtures.pop(index)
|
self.fixtures.pop(index)
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
|
|
||||||
def saveFixture(self, index = None):
|
def saveFixture(self, index = None):
|
||||||
"""
|
"""
|
||||||
@ -116,20 +101,15 @@ class DistributedCameraOV(DistributedObjectOV):
|
|||||||
hpr[0], hpr[1], hpr[2],
|
hpr[0], hpr[1], hpr[2],
|
||||||
'Standby'],
|
'Standby'],
|
||||||
index)
|
index)
|
||||||
pass
|
|
||||||
|
|
||||||
def startRecording(self):
|
def startRecording(self):
|
||||||
self.accept('escape', self.stopRecording)
|
self.accept('escape', self.stopRecording)
|
||||||
for fixture in self.fixtures:
|
for fixture in self.fixtures:
|
||||||
fixture[6] = 'Recording'
|
fixture[6] = 'Recording'
|
||||||
pass
|
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
|
|
||||||
def stopRecording(self):
|
def stopRecording(self):
|
||||||
self.ignore('escape')
|
self.ignore('escape')
|
||||||
for fixture in self.fixtures:
|
for fixture in self.fixtures:
|
||||||
fixture[6] = 'Standby'
|
fixture[6] = 'Standby'
|
||||||
pass
|
|
||||||
self.b_setFixtures(self.fixtures)
|
self.b_setFixtures(self.fixtures)
|
||||||
pass
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user