*** empty log message ***
This commit is contained in:
parent
fb787d8e34
commit
1b2a1e605e
|
|
@ -62,6 +62,8 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
self.controlMappings = {}
|
||||
self.controlOffsets = {}
|
||||
self.taggedObjects = {}
|
||||
self.controlPriorities = {}
|
||||
self.sortedControlMappings = []
|
||||
|
||||
for serverConfig in configList:
|
||||
server = DisplayConnection(
|
||||
|
|
@ -131,16 +133,14 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
|
||||
|
||||
def controlObjectTask(self, task):
|
||||
for object in self.controlMappings:
|
||||
for pair in self.sortedControlMappings:
|
||||
object = pair[1]
|
||||
name = self.controlMappings[object][0]
|
||||
serverList = self.controlMappings[object][1]
|
||||
#print object
|
||||
if (self.objectMappings.has_key(object)):
|
||||
self.moveObject(self.objectMappings[object],name,serverList,
|
||||
self.controlOffsets[object], self.objectHasColor[object])
|
||||
|
||||
self.sendNamedMovementDone()
|
||||
#print "running control object"
|
||||
return Task.cont
|
||||
|
||||
def sendNamedMovementDone(self, serverList = None):
|
||||
|
|
@ -151,6 +151,16 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
for server in serverList:
|
||||
self.serverList[server].sendNamedMovementDone()
|
||||
|
||||
|
||||
|
||||
def redoSortedPriorities(self):
|
||||
|
||||
self.sortedControlMappings = []
|
||||
for key in self.controlMappings:
|
||||
self.sortedControlMappings.append([self.controlPriorities[key],
|
||||
key])
|
||||
|
||||
self.sortedControlMappings.sort()
|
||||
|
||||
def moveObject(self, nodePath, object, serverList, offset, hasColor = True):
|
||||
self.notify.debug('moving object '+object)
|
||||
|
|
@ -206,7 +216,7 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
|
||||
|
||||
def addControlMapping(self,objectName,controlledName, serverList = None,
|
||||
offset = None):
|
||||
offset = None, priority = 0):
|
||||
if (not self.controlMappings.has_key(objectName)):
|
||||
if (serverList == None):
|
||||
serverList = range(len(self.serverList))
|
||||
|
|
@ -215,6 +225,7 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
|
||||
self.controlMappings[objectName] = [controlledName,serverList]
|
||||
self.controlOffsets[objectName] = offset
|
||||
self.controlPriorities[objectName] = priority
|
||||
else:
|
||||
oldList = self.controlMappings[objectName]
|
||||
mergedList = []
|
||||
|
|
@ -223,7 +234,8 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
for item in serverList:
|
||||
if (item not in mergedList):
|
||||
mergedList.append(item)
|
||||
|
||||
|
||||
self.redoSortedPriorities()
|
||||
#self.notify.debug('attempt to add duplicate controlled object: '+name)
|
||||
|
||||
def setControlMappingOffset(self,objectName,offset):
|
||||
|
|
@ -235,6 +247,7 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
|
||||
if (serverList == None):
|
||||
self.controlMappings.pop(name)
|
||||
self.controlPriorities.pop(name)
|
||||
else:
|
||||
list = self.controlMappings[key][1]
|
||||
newList = []
|
||||
|
|
@ -244,8 +257,10 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
self.controlMappings[key][1] = newList
|
||||
if (len(newList) == 0):
|
||||
self.controlMappings.pop(name)
|
||||
|
||||
|
||||
self.controlPriorities.pop(name)
|
||||
self.redoSortedPriorities()
|
||||
|
||||
|
||||
def getNodePathFindCmd(self, nodePath):
|
||||
import string
|
||||
pathString = `nodePath`
|
||||
|
|
@ -363,7 +378,6 @@ class ClusterClient(DirectObject.DirectObject):
|
|||
""" Update cameraJig position to reflect latest position """
|
||||
|
||||
(name,x, y, z, h, p, r, sx, sy, sz,red,g,b,a, hidden) = data
|
||||
# dgi)
|
||||
#print "name"
|
||||
#if (name == "camNode"):
|
||||
# print x,y,z,h,p,r, sx, sy, sz,red,g,b,a, hidden
|
||||
|
|
|
|||
|
|
@ -58,8 +58,10 @@ class ClusterServer(DirectObject.DirectObject):
|
|||
self.objectMappings = {}
|
||||
self.objectHasColor = {}
|
||||
self.controlMappings = {}
|
||||
self.controlPriorities = {}
|
||||
self.controlOffsets = {}
|
||||
self.messageQueue = []
|
||||
self.sortedControlMappings = []
|
||||
|
||||
# These must be passed in as bootstrap arguments and stored in
|
||||
# the __builtins__ namespace
|
||||
|
|
@ -98,7 +100,8 @@ class ClusterServer(DirectObject.DirectObject):
|
|||
return Task.cont
|
||||
|
||||
|
||||
def addNamedObjectMapping(self,object,name,hasColor = True):
|
||||
def addNamedObjectMapping(self,object,name,hasColor = True,
|
||||
priority = 0):
|
||||
if (not self.objectMappings.has_key(name)):
|
||||
self.objectMappings[name] = object
|
||||
self.objectHasColor[name] = hasColor
|
||||
|
|
@ -110,14 +113,25 @@ class ClusterServer(DirectObject.DirectObject):
|
|||
self.objectMappings.pop(name)
|
||||
|
||||
|
||||
def redoSortedPriorities(self):
|
||||
|
||||
self.sortedControlMappings = []
|
||||
for key in self.objectMappings:
|
||||
self.sortedControlMappings.append([self.controlPriorities[key],
|
||||
key])
|
||||
|
||||
self.sortedControlMappings.sort()
|
||||
|
||||
|
||||
def addControlMapping(self,objectName,controlledName, offset = None):
|
||||
def addControlMapping(self,objectName,controlledName, offset = None,
|
||||
priority = 0):
|
||||
if (not self.controlMappings.has_key(objectName)):
|
||||
self.controlMappings[objectName] = controlledName
|
||||
if (offset == None):
|
||||
offset = Vec3(0,0,0)
|
||||
self.controlOffsets[objectName] = offset
|
||||
self.controlPriorities[objectName] = priority
|
||||
self.redoSortedPriorities()
|
||||
else:
|
||||
self.notify.debug('attempt to add duplicate controlled object: '+name)
|
||||
|
||||
|
|
@ -129,6 +143,8 @@ class ClusterServer(DirectObject.DirectObject):
|
|||
def removeControlMapping(self,name):
|
||||
if (self.controlMappings.has_key(name)):
|
||||
self.controlMappings.pop(name)
|
||||
self.controlPriorities.pop(name)
|
||||
self.redoSortedPriorities()
|
||||
|
||||
|
||||
def startControlObjectTask(self):
|
||||
|
|
@ -137,8 +153,9 @@ class ClusterServer(DirectObject.DirectObject):
|
|||
|
||||
def controlObjectTask(self, task):
|
||||
#print "running control object task"
|
||||
for object in self.controlMappings:
|
||||
name = self.controlMappings[object]
|
||||
for pair in self.sortedControlPriorities:
|
||||
object = pair[1]
|
||||
name = self.controlMappings[object]
|
||||
if (self.objectMappings.has_key(object)):
|
||||
self.moveObject(self.objectMappings[object],name,self.controlOffsets[object],
|
||||
self.objectHasColor[object])
|
||||
|
|
|
|||
Loading…
Reference in New Issue