mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
formatting
This commit is contained in:
parent
0574017d72
commit
fc7fc09140
@ -136,7 +136,7 @@ class SelectedNodePaths(DirectObject):
|
|||||||
"""
|
"""
|
||||||
return self.selectedDict.values()[:]
|
return self.selectedDict.values()[:]
|
||||||
|
|
||||||
def __getitem__(self,index):
|
def __getitem__(self, index):
|
||||||
return self.getSelectedAsList()[index]
|
return self.getSelectedAsList()[index]
|
||||||
|
|
||||||
def getSelectedDict(self, id):
|
def getSelectedDict(self, id):
|
||||||
@ -266,7 +266,7 @@ class DirectBoundingBox:
|
|||||||
# Get bounds
|
# Get bounds
|
||||||
self.min = Point3(0)
|
self.min = Point3(0)
|
||||||
self.max = Point3(0)
|
self.max = Point3(0)
|
||||||
self.nodePath.calcTightBounds(self.min,self.max)
|
self.nodePath.calcTightBounds(self.min, self.max)
|
||||||
# Calc center and radius
|
# Calc center and radius
|
||||||
self.center = Point3((self.min + self.max)/2.0)
|
self.center = Point3((self.min + self.max)/2.0)
|
||||||
self.radius = Vec3(self.max - self.min).length()
|
self.radius = Vec3(self.max - self.min).length()
|
||||||
@ -332,11 +332,11 @@ class DirectBoundingBox:
|
|||||||
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def setBoxColorScale(self,r,g,b,a):
|
def setBoxColorScale(self, r, g, b, a):
|
||||||
if (self.lines):
|
if (self.lines):
|
||||||
self.lines.reset()
|
self.lines.reset()
|
||||||
self.lines = None
|
self.lines = None
|
||||||
self.lines = self.createBBoxLines((r,g,b,a))
|
self.lines = self.createBBoxLines((r, g, b, a))
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def updateBBoxLines(self):
|
def updateBBoxLines(self):
|
||||||
@ -528,7 +528,7 @@ class SelectionQueue(CollisionHandlerQueue):
|
|||||||
self.setCurrentIndex(-1)
|
self.setCurrentIndex(-1)
|
||||||
self.setCurrentEntry(None)
|
self.setCurrentEntry(None)
|
||||||
# Pick out the closest object that isn't a widget
|
# Pick out the closest object that isn't a widget
|
||||||
for i in range(startIndex,self.getNumEntries()):
|
for i in range(startIndex, self.getNumEntries()):
|
||||||
entry = self.getEntry(i)
|
entry = self.getEntry(i)
|
||||||
nodePath = entry.getIntoNodePath()
|
nodePath = entry.getIntoNodePath()
|
||||||
if (skipFlags & SKIP_HIDDEN) and nodePath.isHidden():
|
if (skipFlags & SKIP_HIDDEN) and nodePath.isHidden():
|
||||||
@ -606,7 +606,7 @@ class SelectionRay(SelectionQueue):
|
|||||||
self.sortEntries()
|
self.sortEntries()
|
||||||
|
|
||||||
def pickGeom3D(self, targetNodePath = render,
|
def pickGeom3D(self, targetNodePath = render,
|
||||||
origin = Point3(0), dir = Vec3(0,0,-1),
|
origin = Point3(0), dir = Vec3(0, 0, -1),
|
||||||
skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
|
skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
|
||||||
self.collideWithGeom()
|
self.collideWithGeom()
|
||||||
self.pick3D(targetNodePath, origin, dir)
|
self.pick3D(targetNodePath, origin, dir)
|
||||||
@ -615,7 +615,7 @@ class SelectionRay(SelectionQueue):
|
|||||||
|
|
||||||
def pickBitMask3D(self, bitMask = BitMask32.allOff(),
|
def pickBitMask3D(self, bitMask = BitMask32.allOff(),
|
||||||
targetNodePath = render,
|
targetNodePath = render,
|
||||||
origin = Point3(0), dir = Vec3(0,0,-1),
|
origin = Point3(0), dir = Vec3(0, 0, -1),
|
||||||
skipFlags = SKIP_ALL):
|
skipFlags = SKIP_ALL):
|
||||||
self.collideWithBitMask(bitMask)
|
self.collideWithBitMask(bitMask)
|
||||||
self.pick3D(targetNodePath, origin, dir)
|
self.pick3D(targetNodePath, origin, dir)
|
||||||
|
@ -65,7 +65,7 @@ class DirectSession(DirectObject):
|
|||||||
self.activeParent = None
|
self.activeParent = None
|
||||||
|
|
||||||
self.selectedNPReadout = OnscreenText.OnscreenText(
|
self.selectedNPReadout = OnscreenText.OnscreenText(
|
||||||
pos = (-1.0, -0.9), bg=Vec4(1,1,1,1),
|
pos = (-1.0, -0.9), bg=Vec4(1, 1, 1, 1),
|
||||||
scale = 0.05, align = TextNode.ALeft,
|
scale = 0.05, align = TextNode.ALeft,
|
||||||
mayChange = 1, font = self.font)
|
mayChange = 1, font = self.font)
|
||||||
# Make sure readout is never lit or drawn in wireframe
|
# Make sure readout is never lit or drawn in wireframe
|
||||||
@ -73,7 +73,7 @@ class DirectSession(DirectObject):
|
|||||||
self.selectedNPReadout.reparentTo(hidden)
|
self.selectedNPReadout.reparentTo(hidden)
|
||||||
|
|
||||||
self.activeParentReadout = OnscreenText.OnscreenText(
|
self.activeParentReadout = OnscreenText.OnscreenText(
|
||||||
pos = (-1.0, -0.975), bg=Vec4(1,1,1,1),
|
pos = (-1.0, -0.975), bg=Vec4(1, 1, 1, 1),
|
||||||
scale = 0.05, align = TextNode.ALeft,
|
scale = 0.05, align = TextNode.ALeft,
|
||||||
mayChange = 1, font = self.font)
|
mayChange = 1, font = self.font)
|
||||||
# Make sure readout is never lit or drawn in wireframe
|
# Make sure readout is never lit or drawn in wireframe
|
||||||
@ -81,7 +81,7 @@ class DirectSession(DirectObject):
|
|||||||
self.activeParentReadout.reparentTo(hidden)
|
self.activeParentReadout.reparentTo(hidden)
|
||||||
|
|
||||||
self.directMessageReadout = OnscreenText.OnscreenText(
|
self.directMessageReadout = OnscreenText.OnscreenText(
|
||||||
pos = (-1.0, 0.9), bg=Vec4(1,1,1,1),
|
pos = (-1.0, 0.9), bg=Vec4(1, 1, 1, 1),
|
||||||
scale = 0.05, align = TextNode.ALeft,
|
scale = 0.05, align = TextNode.ALeft,
|
||||||
mayChange = 1, font = self.font)
|
mayChange = 1, font = self.font)
|
||||||
# Make sure readout is never lit or drawn in wireframe
|
# Make sure readout is never lit or drawn in wireframe
|
||||||
@ -303,7 +303,7 @@ class DirectSession(DirectObject):
|
|||||||
base.cam.reparentTo(self.oobeCamera)
|
base.cam.reparentTo(self.oobeCamera)
|
||||||
# Position a target point to lerp the oobe camera to
|
# Position a target point to lerp the oobe camera to
|
||||||
direct.cameraControl.camManipRef.setPos(
|
direct.cameraControl.camManipRef.setPos(
|
||||||
self.trueCamera, Vec3(-2,-20, 5))
|
self.trueCamera, Vec3(-2, -20, 5))
|
||||||
direct.cameraControl.camManipRef.lookAt(self.trueCamera)
|
direct.cameraControl.camManipRef.lookAt(self.trueCamera)
|
||||||
t = self.oobeCamera.lerpPosHpr(
|
t = self.oobeCamera.lerpPosHpr(
|
||||||
Point3(0), Vec3(0), 2.0,
|
Point3(0), Vec3(0), 2.0,
|
||||||
@ -447,7 +447,7 @@ class DirectSession(DirectObject):
|
|||||||
if self.clusterMode == 'client':
|
if self.clusterMode == 'client':
|
||||||
if input in ('v','b','l','p', 'r', 'shift-r', 's', 't',
|
if input in ('v','b','l','p', 'r', 'shift-r', 's', 't',
|
||||||
'shift-a', 'w'):
|
'shift-a', 'w'):
|
||||||
self.cluster('messenger.send("%s")' % input,0)
|
self.cluster('messenger.send("%s")' % input, 0)
|
||||||
|
|
||||||
def getModifiers(self, input, base):
|
def getModifiers(self, input, base):
|
||||||
modifiers = DIRECT_NO_MOD
|
modifiers = DIRECT_NO_MOD
|
||||||
@ -506,9 +506,9 @@ class DirectSession(DirectObject):
|
|||||||
def followSelectedNodePathTask(self, state):
|
def followSelectedNodePathTask(self, state):
|
||||||
mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
|
mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
|
||||||
decomposeMatrix(mCoa2Render,
|
decomposeMatrix(mCoa2Render,
|
||||||
self.scale,self.hpr,self.pos,
|
self.scale, self.hpr, self.pos,
|
||||||
CSDefault)
|
CSDefault)
|
||||||
self.widget.setPosHpr(self.pos,self.hpr)
|
self.widget.setPosHpr(self.pos, self.hpr)
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def deselect(self, nodePath):
|
def deselect(self, nodePath):
|
||||||
@ -577,7 +577,7 @@ class DirectSession(DirectObject):
|
|||||||
flashColor.setW(1)
|
flashColor.setW(1)
|
||||||
else:
|
else:
|
||||||
doneColor = None
|
doneColor = None
|
||||||
flashColor = VBase4(1,0,0,1)
|
flashColor = VBase4(1, 0, 0, 1)
|
||||||
# Temporarily set node path color
|
# Temporarily set node path color
|
||||||
nodePath.setColor(flashColor)
|
nodePath.setColor(flashColor)
|
||||||
# Clean up color in a few seconds
|
# Clean up color in a few seconds
|
||||||
@ -594,7 +594,7 @@ class DirectSession(DirectObject):
|
|||||||
# Real work is done in upon death function
|
# Real work is done in upon death function
|
||||||
return Task.done
|
return Task.done
|
||||||
|
|
||||||
def flashDone(self,state):
|
def flashDone(self, state):
|
||||||
# Return node Path to original state
|
# Return node Path to original state
|
||||||
if state.nodePath.isEmpty():
|
if state.nodePath.isEmpty():
|
||||||
# Node path doesn't exist anymore, bail
|
# Node path doesn't exist anymore, bail
|
||||||
@ -843,7 +843,7 @@ class DisplayRegionContext(DirectObject):
|
|||||||
self.setOrientation()
|
self.setOrientation()
|
||||||
self.camUpdate()
|
self.camUpdate()
|
||||||
|
|
||||||
def __getitem__(self,key):
|
def __getitem__(self, key):
|
||||||
return self.__dict__[key]
|
return self.__dict__[key]
|
||||||
|
|
||||||
def setOrientation(self):
|
def setOrientation(self):
|
||||||
@ -869,19 +869,19 @@ class DisplayRegionContext(DirectObject):
|
|||||||
else:
|
else:
|
||||||
return self.camLens.getVfov()
|
return self.camLens.getVfov()
|
||||||
|
|
||||||
def setHfov(self,hfov):
|
def setHfov(self, hfov):
|
||||||
if self.isSideways:
|
if self.isSideways:
|
||||||
self.camLens.setFov(self.camLens.getHfov(), hfov)
|
self.camLens.setFov(self.camLens.getHfov(), hfov)
|
||||||
else:
|
else:
|
||||||
self.camLens.setFov(hfov, self.camLens.getVfov())
|
self.camLens.setFov(hfov, self.camLens.getVfov())
|
||||||
|
|
||||||
def setVfov(self,vfov):
|
def setVfov(self, vfov):
|
||||||
if self.isSideways:
|
if self.isSideways:
|
||||||
self.camLens.setFov(vfov, self.camLens.getVfov())
|
self.camLens.setFov(vfov, self.camLens.getVfov())
|
||||||
else:
|
else:
|
||||||
self.camLens.setFov(self.camLens.getHfov(), vfov)
|
self.camLens.setFov(self.camLens.getHfov(), vfov)
|
||||||
|
|
||||||
def setFov(self,hfov,vfov):
|
def setFov(self, hfov, vfov):
|
||||||
if self.isSideways:
|
if self.isSideways:
|
||||||
self.camLens.setFov(vfov, hfov)
|
self.camLens.setFov(vfov, hfov)
|
||||||
else:
|
else:
|
||||||
@ -961,12 +961,12 @@ class DisplayRegionList(DirectObject):
|
|||||||
drc = DisplayRegionContext(cam)
|
drc = DisplayRegionContext(cam)
|
||||||
self.displayRegionList.append(drc)
|
self.displayRegionList.append(drc)
|
||||||
|
|
||||||
self.accept("DIRECT-mouse1",self.mouseUpdate)
|
self.accept("DIRECT-mouse1", self.mouseUpdate)
|
||||||
self.accept("DIRECT-mouse2",self.mouseUpdate)
|
self.accept("DIRECT-mouse2", self.mouseUpdate)
|
||||||
self.accept("DIRECT-mouse3",self.mouseUpdate)
|
self.accept("DIRECT-mouse3", self.mouseUpdate)
|
||||||
self.accept("DIRECT-mouse1Up",self.mouseUpdate)
|
self.accept("DIRECT-mouse1Up", self.mouseUpdate)
|
||||||
self.accept("DIRECT-mouse2Up",self.mouseUpdate)
|
self.accept("DIRECT-mouse2Up", self.mouseUpdate)
|
||||||
self.accept("DIRECT-mouse3Up",self.mouseUpdate)
|
self.accept("DIRECT-mouse3Up", self.mouseUpdate)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
return self.displayRegionList[index]
|
return self.displayRegionList[index]
|
||||||
|
@ -28,7 +28,7 @@ def getTkColorString(color):
|
|||||||
return "#" + r + g + b
|
return "#" + r + g + b
|
||||||
|
|
||||||
## Background Color ##
|
## Background Color ##
|
||||||
def lerpBackgroundColor(r,g,b,duration):
|
def lerpBackgroundColor(r, g, b, duration):
|
||||||
"""
|
"""
|
||||||
Function to lerp background color to a new value
|
Function to lerp background color to a new value
|
||||||
"""
|
"""
|
||||||
@ -43,14 +43,14 @@ def lerpBackgroundColor(r,g,b,duration):
|
|||||||
r = sf * state.ec[0] + (1 - sf) * state.sc[0]
|
r = sf * state.ec[0] + (1 - sf) * state.sc[0]
|
||||||
g = sf * state.ec[1] + (1 - sf) * state.sc[1]
|
g = sf * state.ec[1] + (1 - sf) * state.sc[1]
|
||||||
b = sf * state.ec[2] + (1 - sf) * state.sc[2]
|
b = sf * state.ec[2] + (1 - sf) * state.sc[2]
|
||||||
base.setBackgroundColor(r,g,b)
|
base.setBackgroundColor(r, g, b)
|
||||||
return Task.cont
|
return Task.cont
|
||||||
taskMgr.remove('lerpBackgroundColor')
|
taskMgr.remove('lerpBackgroundColor')
|
||||||
t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
|
t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
|
||||||
t.time = 0.0
|
t.time = 0.0
|
||||||
t.duration = duration
|
t.duration = duration
|
||||||
t.sc = base.getBackgroundColor()
|
t.sc = base.getBackgroundColor()
|
||||||
t.ec = VBase4(r,g,b,1)
|
t.ec = VBase4(r, g, b, 1)
|
||||||
|
|
||||||
# Set direct drawing style for an object
|
# Set direct drawing style for an object
|
||||||
# Never light object or draw in wireframe
|
# Never light object or draw in wireframe
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
class CartesianGridBase:
|
class CartesianGridBase:
|
||||||
def isValidZone(self, zoneId):
|
def isValidZone(self, zoneId):
|
||||||
def checkBounds(self=self,zoneId=zoneId):
|
def checkBounds(self=self, zoneId=zoneId):
|
||||||
if ((zoneId < self.startingZone) or
|
if ((zoneId < self.startingZone) or
|
||||||
(zoneId > self.startingZone + self.gridSize * self.gridSize - 1)):
|
(zoneId > self.startingZone + self.gridSize * self.gridSize - 1)):
|
||||||
return 0
|
return 0
|
||||||
@ -49,7 +49,7 @@ class CartesianGridBase:
|
|||||||
x = col * self.cellWidth - dx
|
x = col * self.cellWidth - dx
|
||||||
y = row * self.cellWidth - dx
|
y = row * self.cellWidth - dx
|
||||||
|
|
||||||
return (x,y,0)
|
return (x, y, 0)
|
||||||
|
|
||||||
def getZoneCellOriginCenter(self, zoneId):
|
def getZoneCellOriginCenter(self, zoneId):
|
||||||
# Variant of the getZoneCellOrigin. It
|
# Variant of the getZoneCellOrigin. It
|
||||||
@ -62,5 +62,5 @@ class CartesianGridBase:
|
|||||||
x = col * self.cellWidth - dx + center
|
x = col * self.cellWidth - dx + center
|
||||||
y = row * self.cellWidth - dx + center
|
y = row * self.cellWidth - dx + center
|
||||||
|
|
||||||
return (x,y,0)
|
return (x, y, 0)
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class ClientRepository(ClientRepositoryBase):
|
|||||||
# send the message
|
# send the message
|
||||||
self.send(datagram)
|
self.send(datagram)
|
||||||
|
|
||||||
def isLocalId(self,id):
|
def isLocalId(self, id):
|
||||||
return ((id >= self.DOIDbase) and (id < self.DOIDlast))
|
return ((id >= self.DOIDbase) and (id < self.DOIDlast))
|
||||||
|
|
||||||
def haveCreateAuthority(self):
|
def haveCreateAuthority(self):
|
||||||
|
@ -499,7 +499,7 @@ class ClientRepositoryBase(ConnectionRepository):
|
|||||||
return doDict
|
return doDict
|
||||||
|
|
||||||
|
|
||||||
def sendSetLocation(self,doId,parentId,zoneId):
|
def sendSetLocation(self, doId, parentId, zoneId):
|
||||||
datagram = PyDatagram()
|
datagram = PyDatagram()
|
||||||
datagram.addUint16(CLIENT_OBJECT_LOCATION)
|
datagram.addUint16(CLIENT_OBJECT_LOCATION)
|
||||||
datagram.addUint32(doId)
|
datagram.addUint32(doId)
|
||||||
|
@ -76,7 +76,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
|
|||||||
self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
|
self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
|
||||||
taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
|
taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
|
||||||
|
|
||||||
def stopProcessVisibility(self,clearAll=False):
|
def stopProcessVisibility(self, clearAll=False):
|
||||||
taskMgr.remove(self.taskName("processVisibility"))
|
taskMgr.remove(self.taskName("processVisibility"))
|
||||||
if self.gridVisContext is not None:
|
if self.gridVisContext is not None:
|
||||||
self.cr.removeInterest(self.gridVisContext)
|
self.cr.removeInterest(self.gridVisContext)
|
||||||
@ -97,7 +97,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
|
|||||||
y = pos[1] + dx
|
y = pos[1] + dx
|
||||||
col = x // self.cellWidth
|
col = x // self.cellWidth
|
||||||
row = y // self.cellWidth
|
row = y // self.cellWidth
|
||||||
assert self.notify.debug("processVisibility: %s: avatar pos: %s %s" % (self.doId, x,y))
|
assert self.notify.debug("processVisibility: %s: avatar pos: %s %s" % (self.doId, x, y))
|
||||||
if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
|
if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
|
||||||
assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
|
assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
|
||||||
# If we are viewingRadius away from this entire grid,
|
# If we are viewingRadius away from this entire grid,
|
||||||
@ -153,7 +153,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
|
|||||||
if (av.getParent().compareTo(self) == 0):
|
if (av.getParent().compareTo(self) == 0):
|
||||||
# only detach if object is directly parented
|
# only detach if object is directly parented
|
||||||
av.detachNode()
|
av.detachNode()
|
||||||
#av.b_setLocation(0,0)
|
#av.b_setLocation(0, 0)
|
||||||
|
|
||||||
|
|
||||||
def handleAvatarZoneChange(self, av, zoneId):
|
def handleAvatarZoneChange(self, av, zoneId):
|
||||||
@ -199,14 +199,14 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
|
|||||||
|
|
||||||
self.centerLines = LineNodePath(self.lines)
|
self.centerLines = LineNodePath(self.lines)
|
||||||
self.centerLines.lineNode.setName('centerLines')
|
self.centerLines.lineNode.setName('centerLines')
|
||||||
self.centerLines.setColor(VBase4(1,0,0,0))
|
self.centerLines.setColor(VBase4(1, 0, 0, 0))
|
||||||
self.centerLines.setThickness(3)
|
self.centerLines.setThickness(3)
|
||||||
|
|
||||||
# Load up grid parts to initialize grid object
|
# Load up grid parts to initialize grid object
|
||||||
# Polygon used to mark grid plane
|
# Polygon used to mark grid plane
|
||||||
# self.gridBack = loader.loadModel('models/misc/gridBack')
|
# self.gridBack = loader.loadModel('models/misc/gridBack')
|
||||||
# self.gridBack.reparentTo(self)
|
# self.gridBack.reparentTo(self)
|
||||||
# self.gridBack.setColor(0.2,0.2,0.2,0.5)
|
# self.gridBack.setColor(0.2, 0.2, 0.2, 0.5)
|
||||||
|
|
||||||
self.cellLabelParent = None
|
self.cellLabelParent = None
|
||||||
self.markerParent = None
|
self.markerParent = None
|
||||||
@ -275,7 +275,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
|
|||||||
(j * cw - dx) + (cw * 0.5), # y
|
(j * cw - dx) + (cw * 0.5), # y
|
||||||
3.0, # z
|
3.0, # z
|
||||||
# Lay them down flat
|
# Lay them down flat
|
||||||
0,-90,0, # hpr
|
0, -90, 0, # hpr
|
||||||
scale, scale, scale)
|
scale, scale, scale)
|
||||||
self.cellLabelParent.flattenLight()
|
self.cellLabelParent.flattenLight()
|
||||||
|
|
||||||
|
@ -117,15 +117,15 @@ class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
|
|||||||
self.sendUpdate("setXYH", [x, y, h])
|
self.sendUpdate("setXYH", [x, y, h])
|
||||||
|
|
||||||
def b_setXYZH(self, x, y, z, h):
|
def b_setXYZH(self, x, y, z, h):
|
||||||
self.setXYZH(x,y,z,h)
|
self.setXYZH(x, y, z, h)
|
||||||
self.d_setXYZH(x,y,z,h)
|
self.d_setXYZH(x, y, z, h)
|
||||||
def setXYZH(self, x, y, z, h):
|
def setXYZH(self, x, y, z, h):
|
||||||
self.setPos(x, y, z)
|
self.setPos(x, y, z)
|
||||||
self.setH(h)
|
self.setH(h)
|
||||||
def getXYZH(self):
|
def getXYZH(self):
|
||||||
pos = self.getPos()
|
pos = self.getPos()
|
||||||
h = self.getH()
|
h = self.getH()
|
||||||
return pos[0],pos[1],pos[2],h
|
return pos[0], pos[1], pos[2], h
|
||||||
|
|
||||||
def d_setXYZH(self, x, y, z, h):
|
def d_setXYZH(self, x, y, z, h):
|
||||||
self.sendUpdate("setXYZH", [x, y, z, h])
|
self.sendUpdate("setXYZH", [x, y, z, h])
|
||||||
|
@ -70,7 +70,7 @@ class DistributedObject(DistributedObjectBase):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
def status(self, indent=0):
|
def status(self, indent=0):
|
||||||
"""
|
"""
|
||||||
print out "doId(parentId,zoneId) className
|
print out "doId(parentId, zoneId) className
|
||||||
and conditionally show generated, disabled, neverDisable,
|
and conditionally show generated, disabled, neverDisable,
|
||||||
or cachable"
|
or cachable"
|
||||||
"""
|
"""
|
||||||
|
@ -51,7 +51,7 @@ class DistributedObjectAI(DistributedObjectBase):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
def status(self, indent=0):
|
def status(self, indent=0):
|
||||||
"""
|
"""
|
||||||
print out doId(parentId,zoneId) className
|
print out doId(parentId, zoneId) className
|
||||||
and conditionally show generated, disabled, neverDisable,
|
and conditionally show generated, disabled, neverDisable,
|
||||||
or cachable
|
or cachable
|
||||||
"""
|
"""
|
||||||
@ -369,7 +369,7 @@ class DistributedObjectAI(DistributedObjectBase):
|
|||||||
else:
|
else:
|
||||||
self.doId = doId
|
self.doId = doId
|
||||||
# Put the new DO in the dictionaries
|
# Put the new DO in the dictionaries
|
||||||
self.air.addDOToTables(self, location=(parentId,zoneId))
|
self.air.addDOToTables(self, location=(parentId, zoneId))
|
||||||
# Send a generate message
|
# Send a generate message
|
||||||
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
|
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class DistributedObjectBase(DirectObject):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
def status(self, indent=0):
|
def status(self, indent=0):
|
||||||
"""
|
"""
|
||||||
print out "doId(parentId,zoneId) className"
|
print out "doId(parentId, zoneId) className"
|
||||||
"""
|
"""
|
||||||
spaces=' '*(indent+2)
|
spaces=' '*(indent+2)
|
||||||
try:
|
try:
|
||||||
|
@ -44,7 +44,7 @@ class DistributedObjectOV(DistributedObjectBase):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
def status(self, indent=0):
|
def status(self, indent=0):
|
||||||
"""
|
"""
|
||||||
print out "doId(parentId,zoneId) className"
|
print out "doId(parentId, zoneId) className"
|
||||||
and conditionally show generated, disabled
|
and conditionally show generated, disabled
|
||||||
"""
|
"""
|
||||||
spaces=' '*(indent+2)
|
spaces=' '*(indent+2)
|
||||||
|
@ -51,7 +51,7 @@ class DistributedObjectUD(DistributedObjectBase):
|
|||||||
if __debug__:
|
if __debug__:
|
||||||
def status(self, indent=0):
|
def status(self, indent=0):
|
||||||
"""
|
"""
|
||||||
print out doId(parentId,zoneId) className
|
print out doId(parentId, zoneId) className
|
||||||
and conditionally show generated, disabled, neverDisable,
|
and conditionally show generated, disabled, neverDisable,
|
||||||
or cachable"
|
or cachable"
|
||||||
"""
|
"""
|
||||||
@ -315,7 +315,7 @@ class DistributedObjectUD(DistributedObjectBase):
|
|||||||
else:
|
else:
|
||||||
self.doId = doId
|
self.doId = doId
|
||||||
# Put the new DO in the dictionaries
|
# Put the new DO in the dictionaries
|
||||||
self.air.addDOToTables(self, location=(parentId,zoneId))
|
self.air.addDOToTables(self, location=(parentId, zoneId))
|
||||||
# Send a generate message
|
# Send a generate message
|
||||||
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
|
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
|
|||||||
self.setZ(z)
|
self.setZ(z)
|
||||||
|
|
||||||
def setSmPos(self, x, y, z, t):
|
def setSmPos(self, x, y, z, t):
|
||||||
self.setPos(x,y,z)
|
self.setPos(x, y, z)
|
||||||
|
|
||||||
def setSmHpr(self, h, p, r, t):
|
def setSmHpr(self, h, p, r, t):
|
||||||
self.setHpr(h,p,r)
|
self.setHpr(h, p, r)
|
||||||
|
|
||||||
def setSmXYH(self, x, y, h, t):
|
def setSmXYH(self, x, y, h, t):
|
||||||
self.setX(x)
|
self.setX(x)
|
||||||
@ -48,11 +48,11 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
|
|||||||
self.setH(h)
|
self.setH(h)
|
||||||
|
|
||||||
def setSmXYZH(self, x, y, z, h, t):
|
def setSmXYZH(self, x, y, z, h, t):
|
||||||
self.setPos(x,y,z)
|
self.setPos(x, y, z)
|
||||||
self.setH(h)
|
self.setH(h)
|
||||||
|
|
||||||
def setSmPosHpr(self, x, y, z, h, p, r, t):
|
def setSmPosHpr(self, x, y, z, h, p, r, t):
|
||||||
self.setPosHpr(x,y,z,h,p,r)
|
self.setPosHpr(x, y, z, h, p, r)
|
||||||
|
|
||||||
def clearSmoothing(self, bogus = None):
|
def clearSmoothing(self, bogus = None):
|
||||||
pass
|
pass
|
||||||
|
@ -306,7 +306,7 @@ class DoCollectionManager:
|
|||||||
if not ownerView:
|
if not ownerView:
|
||||||
if self.isValidLocationTuple(location):
|
if self.isValidLocationTuple(location):
|
||||||
self.storeObjectLocation(do.doId, location[0], location[1])
|
self.storeObjectLocation(do.doId, location[0], location[1])
|
||||||
##assert do.doId not in self.zoneId2doIds.get(location,{})
|
##assert do.doId not in self.zoneId2doIds.get(location, {})
|
||||||
##self.zoneId2doIds.setdefault(location, {})
|
##self.zoneId2doIds.setdefault(location, {})
|
||||||
##self.zoneId2doIds[location][do.doId]=do
|
##self.zoneId2doIds[location][do.doId]=do
|
||||||
|
|
||||||
@ -354,13 +354,13 @@ class DoCollectionManager:
|
|||||||
## #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
|
## #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
|
||||||
## oldLocation = (oldParentId, oldZoneId)
|
## oldLocation = (oldParentId, oldZoneId)
|
||||||
## newLocation = (newParentId, newZoneId)
|
## newLocation = (newParentId, newZoneId)
|
||||||
## # HACK: DistributedGuildMemberUD starts in -1,-1, which isnt ever put in the
|
## # HACK: DistributedGuildMemberUD starts in -1, -1, which isnt ever put in the
|
||||||
## # zoneId2doIds table
|
## # zoneId2doIds table
|
||||||
## if self.isValidLocationTuple(oldLocation):
|
## if self.isValidLocationTuple(oldLocation):
|
||||||
## assert self.notify.debugStateCall(self)
|
## assert self.notify.debugStateCall(self)
|
||||||
## assert oldLocation in self.zoneId2doIds
|
## assert oldLocation in self.zoneId2doIds
|
||||||
## assert do.doId in self.zoneId2doIds[oldLocation]
|
## assert do.doId in self.zoneId2doIds[oldLocation]
|
||||||
## assert do.doId not in self.zoneId2doIds.get(newLocation,{})
|
## assert do.doId not in self.zoneId2doIds.get(newLocation, {})
|
||||||
## # remove from old zone
|
## # remove from old zone
|
||||||
## del(self.zoneId2doIds[oldLocation][do.doId])
|
## del(self.zoneId2doIds[oldLocation][do.doId])
|
||||||
## if len(self.zoneId2doIds[oldLocation]) == 0:
|
## if len(self.zoneId2doIds[oldLocation]) == 0:
|
||||||
|
@ -57,7 +57,7 @@ class GridParent:
|
|||||||
self.grid = grid
|
self.grid = grid
|
||||||
# Reparent the gridNodes under this grid
|
# Reparent the gridNodes under this grid
|
||||||
self.cellOrigin.reparentTo(grid)
|
self.cellOrigin.reparentTo(grid)
|
||||||
self.cellOrigin.setPosHpr(0,0,0,0,0,0)
|
self.cellOrigin.setPosHpr(0, 0, 0, 0, 0, 0)
|
||||||
|
|
||||||
# Get grid cell origin
|
# Get grid cell origin
|
||||||
cellPos = self.grid.getZoneCellOrigin(zoneId)
|
cellPos = self.grid.getZoneCellOrigin(zoneId)
|
||||||
@ -74,6 +74,6 @@ class GridParent:
|
|||||||
self.av.reparentTo(self.cellOrigin)
|
self.av.reparentTo(self.cellOrigin)
|
||||||
|
|
||||||
#print "gridParent: reparent to %s" % self.av
|
#print "gridParent: reparent to %s" % self.av
|
||||||
#print "gridParent: pos = %s,%s" % (self.av.getPos(), self.av.getParent().getPos())
|
#print "gridParent: pos = %s, %s" % (self.av.getPos(), self.av.getParent().getPos())
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class ServerRepository:
|
|||||||
self.qcm = QueuedConnectionManager()
|
self.qcm = QueuedConnectionManager()
|
||||||
self.qcl = QueuedConnectionListener(self.qcm, 0)
|
self.qcl = QueuedConnectionListener(self.qcm, 0)
|
||||||
self.qcr = QueuedConnectionReader(self.qcm, 0)
|
self.qcr = QueuedConnectionReader(self.qcm, 0)
|
||||||
self.cw = ConnectionWriter(self.qcm,0)
|
self.cw = ConnectionWriter(self.qcm, 0)
|
||||||
self.tcpRendezvous = self.qcm.openTCPServerRendezvous(tcpPort, 10)
|
self.tcpRendezvous = self.qcm.openTCPServerRendezvous(tcpPort, 10)
|
||||||
print self.tcpRendezvous
|
print self.tcpRendezvous
|
||||||
self.qcl.addConnection(self.tcpRendezvous)
|
self.qcl.addConnection(self.tcpRendezvous)
|
||||||
@ -326,7 +326,7 @@ class ServerRepository:
|
|||||||
datagram.addUint16(CLIENT_SET_DOID_RANGE)
|
datagram.addUint16(CLIENT_SET_DOID_RANGE)
|
||||||
datagram.addUint32(id)
|
datagram.addUint32(id)
|
||||||
datagram.addUint32(self.DOIDrange)
|
datagram.addUint32(self.DOIDrange)
|
||||||
print "Sending DOID range: ",id,self.DOIDrange
|
print "Sending DOID range: ", id, self.DOIDrange
|
||||||
self.cw.send(datagram, connection)
|
self.cw.send(datagram, connection)
|
||||||
|
|
||||||
# a client disconnected from us, we need to update our data, also tell other clients to remove
|
# a client disconnected from us, we need to update our data, also tell other clients to remove
|
||||||
@ -370,7 +370,7 @@ class ServerRepository:
|
|||||||
datagram.addUint16(CLIENT_REQUEST_GENERATES)
|
datagram.addUint16(CLIENT_REQUEST_GENERATES)
|
||||||
datagram.addUint32(ZoneID)
|
datagram.addUint32(ZoneID)
|
||||||
self.sendToAll(datagram)
|
self.sendToAll(datagram)
|
||||||
print "SENDING REQUEST GENERATES (",ZoneID,") TO ALL"
|
print "SENDING REQUEST GENERATES (", ZoneID, ") TO ALL"
|
||||||
|
|
||||||
# client has moved zones, need to update them
|
# client has moved zones, need to update them
|
||||||
def handleRemoveZone(self, dgi, connection):
|
def handleRemoveZone(self, dgi, connection):
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
tl = Toplevel()
|
tl = Toplevel()
|
||||||
tl.title('Interval Controls')
|
tl.title('Interval Controls')
|
||||||
outerFrame = Frame(tl)
|
outerFrame = Frame(tl)
|
||||||
def entryScaleCommand(t,s=self):
|
def entryScaleCommand(t, s=self):
|
||||||
s.setT(t)
|
s.setT(t)
|
||||||
s.pause()
|
s.pause()
|
||||||
self.es = es = EntryScale.EntryScale(
|
self.es = es = EntryScale.EntryScale(
|
||||||
@ -84,7 +84,7 @@
|
|||||||
bf.pack(expand = 1, fill = X)
|
bf.pack(expand = 1, fill = X)
|
||||||
outerFrame.pack(expand = 1, fill = X)
|
outerFrame.pack(expand = 1, fill = X)
|
||||||
# Add function to update slider during setT calls
|
# Add function to update slider during setT calls
|
||||||
def update(t,es=es):
|
def update(t, es=es):
|
||||||
es.set(t, fCommand = 0)
|
es.set(t, fCommand = 0)
|
||||||
if not hasattr(self, "setTHooks"):
|
if not hasattr(self, "setTHooks"):
|
||||||
self.setTHooks = []
|
self.setTHooks = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user