Переглянути джерело

*** empty log message ***

Mark Mine 24 роки тому
батько
коміт
e4852a0ab5
2 змінених файлів з 24 додано та 9 видалено
  1. 11 8
      direct/src/cluster/ClusterClient.py
  2. 13 1
      direct/src/showbase/Loader.py

+ 11 - 8
direct/src/cluster/ClusterClient.py

@@ -46,14 +46,6 @@ class ClusterClient(DirectObject.DirectObject):
             base.camera.getHpr(render))
         return Task.cont
         
-    def cmd(self, commandString, fLocally = 1):
-        # Execute remotely
-        for server in self.serverList:
-            server.sendCommandString(commandString)
-        if fLocally:
-            # Execute locally
-            exec( commandString, globals() )
-
     def getNodePathFindCmd(self, nodePath):
         import string
         pathString = `nodePath`
@@ -71,6 +63,17 @@ class ClusterClient(DirectObject.DirectObject):
     def deselectNodePath(self, nodePath):
         self.cmd(self.getNodePathFindCmd(nodePath) + '.deselect()', 0)
 
+    def loadModel(self, nodePath):
+        pass
+
+    def cmd(self, commandString, fLocally = 1):
+        # Execute remotely
+        for server in self.serverList:
+            server.sendCommandString(commandString)
+        if fLocally:
+            # Execute locally
+            exec( commandString, globals() )
+
     def exit(self):
         # Execute remotely
         for server in self.serverList:

+ 13 - 1
direct/src/showbase/Loader.py

@@ -15,6 +15,7 @@ class Loader:
 
     notify = directNotify.newCategory("Loader")
     #notify.setDebug(1)
+    modelCount = 0
     
     # special methods
     def __init__(self, base):
@@ -24,7 +25,7 @@ class Loader:
         self.loader = PandaLoader()
         
     # model loading funcs
-    def loadModel(self, modelPath):
+    def loadModel(self, modelPath, fMakeNodeNamesUnique = 0):
         """loadModel(self, string)
         Attempt to load a model from given file path, return
         a nodepath to the model if successful or None otherwise."""
@@ -37,6 +38,8 @@ class Loader:
                 nodePath = NodePath(node)
             else:
                 nodePath = self.base.hidden.attachNewNode(node)
+            if fMakeNodeNamesUnique:
+                self.makeNodeNamesUnique(nodePath, 0)
         else:
             nodePath = None
         return nodePath
@@ -204,3 +207,12 @@ class Loader:
         sound = base.sfxManager.getSound(soundPath)
         return sound
 
+    def makeNodeNamesUnique(self, nodePath, nodeCount):
+        if nodeCount == 0:
+            Loader.modelCount += 1
+        nodePath.setName(nodePath.getName() +
+                         ('_%d_%d' % (Loader.modelCount, nodeCount)))
+        for i in range(nodePath.getNumChildren()):
+            nodeCount += 1
+            self.makeNodeNamesUnique(nodePath.getChild(i), nodeCount)
+