|
|
@@ -24,7 +24,6 @@ class Fixture(NodePath, FSM):
|
|
|
self.scaleIval = None
|
|
|
self.recordingInProgress = False
|
|
|
self.dirty = False
|
|
|
- pass
|
|
|
|
|
|
def __str__(self):
|
|
|
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):
|
|
|
self.id = id
|
|
|
- pass
|
|
|
|
|
|
def setFov(self, fov):
|
|
|
"""
|
|
|
@@ -42,15 +40,12 @@ class Fixture(NodePath, FSM):
|
|
|
"""
|
|
|
if fov != VBase2(0):
|
|
|
self.lens.setFov(fov)
|
|
|
- pass
|
|
|
self.setupFrustum()
|
|
|
- pass
|
|
|
|
|
|
def adjustFov(self, x, y):
|
|
|
fov = self.lens.getFov()
|
|
|
self.lens.setFov(fov[0]+x, fov[1]+y)
|
|
|
self.dirty = True
|
|
|
- pass
|
|
|
|
|
|
def getFov(self):
|
|
|
return self.lens.getFov()
|
|
|
@@ -59,40 +54,30 @@ class Fixture(NodePath, FSM):
|
|
|
oldFrustum = self.find('frustum')
|
|
|
if oldFrustum:
|
|
|
oldFrustum.detachNode()
|
|
|
- pass
|
|
|
|
|
|
self.attachNewNode(GeomNode('frustum')).node().addGeom(self.lens.makeGeometry())
|
|
|
- pass
|
|
|
-
|
|
|
|
|
|
def setRecordingInProgress(self, inProgress):
|
|
|
self.recordingInProgress = inProgress
|
|
|
if self.recordingInProgress and \
|
|
|
base.config.GetInt('camera-id', -1) >= 0:
|
|
|
self.hide()
|
|
|
- pass
|
|
|
else:
|
|
|
self.show()
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def show(self):
|
|
|
if base.config.GetBool('aware-of-cameras',0) and \
|
|
|
not self.recordingInProgress:
|
|
|
NodePath.show(self)
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def getScaleIval(self):
|
|
|
if not self.scaleIval:
|
|
|
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'))
|
|
|
- pass
|
|
|
return self.scaleIval
|
|
|
|
|
|
def setState(self, state):
|
|
|
self.request(state)
|
|
|
- pass
|
|
|
|
|
|
def defaultFilter(self, request, args):
|
|
|
if request == self.getCurrentOrNextState():
|
|
|
@@ -101,7 +86,6 @@ class Fixture(NodePath, FSM):
|
|
|
|
|
|
def exitOff(self):
|
|
|
self.accept('recordingInProgress', self.setRecordingInProgress)
|
|
|
- pass
|
|
|
|
|
|
def enterOff(self):
|
|
|
self.ignore('recordingInProgress')
|
|
|
@@ -109,10 +93,8 @@ class Fixture(NodePath, FSM):
|
|
|
if self.scaleIval:
|
|
|
self.scaleIval.finish()
|
|
|
self.scaleIval = None
|
|
|
- pass
|
|
|
|
|
|
self.hide()
|
|
|
- pass
|
|
|
|
|
|
def enterStandby(self):
|
|
|
self.show()
|
|
|
@@ -122,37 +104,27 @@ class Fixture(NodePath, FSM):
|
|
|
else:
|
|
|
self.setColorScale(3,3,0,1)
|
|
|
self.getScaleIval().finish()
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def enterBlinking(self):
|
|
|
self.show()
|
|
|
self.setColorScale(0,3,0,1)
|
|
|
self.getScaleIval().loop()
|
|
|
- pass
|
|
|
|
|
|
def exitBlinking(self):
|
|
|
if self.scaleIval:
|
|
|
self.scaleIval.finish()
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def enterRecording(self):
|
|
|
if base.config.GetInt('camera-id', -1) == self.id:
|
|
|
self.demand('Using')
|
|
|
- pass
|
|
|
else:
|
|
|
self.show()
|
|
|
self.setColorScale(3,0,0,1)
|
|
|
self.getScaleIval().loop()
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def exitRecording(self):
|
|
|
if self.scaleIval:
|
|
|
self.scaleIval.finish()
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def enterUsing(self, args = []):
|
|
|
localAvatar.b_setGameState('Camera')
|
|
|
@@ -178,8 +150,6 @@ class Fixture(NodePath, FSM):
|
|
|
lodNodes = render.findAllMatches('**/+LODNode')
|
|
|
for i in xrange(0,lodNodes.getNumPaths()):
|
|
|
lodNodes[i].node().forceSwitch(lodNodes[i].node().getHighestSwitch())
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
|
|
|
def exitUsing(self):
|
|
|
@@ -199,9 +169,6 @@ class Fixture(NodePath, FSM):
|
|
|
if self.dirty:
|
|
|
messenger.send('refresh-fixture', [self.id, self.pack()])
|
|
|
self.dirty = False
|
|
|
- pass
|
|
|
-
|
|
|
- pass
|
|
|
|
|
|
|
|
|
class DistributedCamera(DistributedObject):
|
|
|
@@ -211,8 +178,6 @@ class DistributedCamera(DistributedObject):
|
|
|
self.fixtures = {}
|
|
|
self.cameraId = base.config.GetInt('camera-id',0)
|
|
|
|
|
|
- pass
|
|
|
-
|
|
|
def __getitem__(self, index):
|
|
|
return self.fixtures.get(index)
|
|
|
|
|
|
@@ -236,7 +201,6 @@ class DistributedCamera(DistributedObject):
|
|
|
for fixture in self.fixtures.itervalues():
|
|
|
fixture.cleanup()
|
|
|
fixture.detachNode()
|
|
|
- pass
|
|
|
self.fixtures = {}
|
|
|
|
|
|
DistributedObject.disable(self)
|
|
|
@@ -250,13 +214,9 @@ class DistributedCamera(DistributedObject):
|
|
|
self.parent = render
|
|
|
else:
|
|
|
self.parent = self.cr.getDo(doId)
|
|
|
- pass
|
|
|
|
|
|
for fix in self.fixtures.itervalues():
|
|
|
fix.reparentTo(self.parent)
|
|
|
- pass
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def getCamParent(self):
|
|
|
return self.parent
|
|
|
@@ -266,7 +226,6 @@ class DistributedCamera(DistributedObject):
|
|
|
fixture = self.fixtures.pop(x)
|
|
|
fixture.cleanup()
|
|
|
fixture.detachNode()
|
|
|
- pass
|
|
|
|
|
|
recordingInProgress = False
|
|
|
for x,fixture in enumerate(fixtures):
|
|
|
@@ -277,7 +236,6 @@ class DistributedCamera(DistributedObject):
|
|
|
|
|
|
if x not in self.fixtures:
|
|
|
self.fixtures[x] = Fixture(x, self.parent, Point3(0), hpr = Point3(0), fov = VBase2(0))
|
|
|
- pass
|
|
|
|
|
|
fix = self.fixtures.get(x)
|
|
|
fix.setId(x)
|
|
|
@@ -285,7 +243,6 @@ class DistributedCamera(DistributedObject):
|
|
|
fix.setState(state)
|
|
|
fix.setFov(fov)
|
|
|
recordingInProgress |= state == 'Recording'
|
|
|
- pass
|
|
|
|
|
|
messenger.send('recordingInProgress', [recordingInProgress])
|
|
|
|
|
|
@@ -294,8 +251,6 @@ class DistributedCamera(DistributedObject):
|
|
|
if fixture:
|
|
|
fixture.request('Using', [True])
|
|
|
self.accept('escape', self.stopTesting, [index])
|
|
|
- pass
|
|
|
- pass
|
|
|
|
|
|
def stopTesting(self, index):
|
|
|
fixture = self.fixtures.get(index)
|
|
|
@@ -303,5 +258,3 @@ class DistributedCamera(DistributedObject):
|
|
|
self.ignore('escape')
|
|
|
fixture.request('Standby')
|
|
|
localAvatar.b_setGameState('LandRoam')
|
|
|
- pass
|
|
|
-
|