Browse Source

*** empty log message ***

Jesse Schell 25 years ago
parent
commit
47e1a235ac

+ 2 - 0
direct/src/distributed/ClientRepository.py

@@ -152,6 +152,7 @@ class ClientRepository(DirectObject.DirectObject):
             # Assign it an Id
             # Assign it an Id
             distObj.doId = doId
             distObj.doId = doId
             # Update the required fields
             # Update the required fields
+            distObj.generateInit()  # Only called when constructed
 	    distObj.generate()
 	    distObj.generate()
             distObj.updateRequiredFields(cdc, di)
             distObj.updateRequiredFields(cdc, di)
             # Put the new do in both dictionaries
             # Put the new do in both dictionaries
@@ -190,6 +191,7 @@ class ClientRepository(DirectObject.DirectObject):
             self.doId2do[doId] = distObj
             self.doId2do[doId] = distObj
             self.doId2cdc[doId] = cdc
             self.doId2cdc[doId] = cdc
             # Update the required fields
             # Update the required fields
+            distObj.generateInit()  # Only called when constructed
 	    distObj.generate()
 	    distObj.generate()
             distObj.updateRequiredOtherFields(cdc, di)
             distObj.updateRequiredOtherFields(cdc, di)
             # Put the new do in both dictionaries
             # Put the new do in both dictionaries

+ 6 - 0
direct/src/distributed/DistributedObject.py

@@ -49,6 +49,12 @@ class DistributedObject(PandaObject):
         Inheritors should redefine this to take appropriate action on generate
         Inheritors should redefine this to take appropriate action on generate
         """
         """
         pass
         pass
+
+    def generateInit(self):
+        """generateInit(self)
+        This method is called when the DistributedObject is first introduced
+        to the world... Not when it is pulled from the cache.
+        """
     
     
     def getDoId(self):
     def getDoId(self):
         """getDoId(self)
         """getDoId(self)

+ 42 - 1
direct/src/interval/FunctionInterval.py

@@ -44,9 +44,33 @@ class EventInterval(FunctionInterval):
         # Create function interval
         # Create function interval
 	FunctionInterval.__init__(self, sendFunc, name = event)
 	FunctionInterval.__init__(self, sendFunc, name = event)
 
 
+### FunctionInterval subclass for accepting hooks ###
+class AcceptInterval(FunctionInterval):
+    # Initialization
+    def __init__(self, dirObj, event, function, name):
+        """__init__(dirObj, event, function, name)
+        """
+        def acceptFunc(dirObj = dirObj, event = event, function = function):
+            print "accepting..."
+            dirObj.accept(event, function)
+        # Create function interval
+	FunctionInterval.__init__(self, acceptFunc, name = name)
+
+### FunctionInterval subclass for throwing events ###
+class IgnoreInterval(FunctionInterval):
+    # Initialization
+    def __init__(self, dirObj, event, name):
+        """__init__(dirObj, event, name)
+        """
+        def ignoreFunc(dirObj = dirObj, event = event):
+            print "ignoring..."
+            dirObj.ignore(event)
+        # Create function interval
+	FunctionInterval.__init__(self, ignoreFunc, name = name)
+
 ### Function Interval subclass for adjusting scene graph hierarchy ###
 ### Function Interval subclass for adjusting scene graph hierarchy ###
 class ParentInterval(FunctionInterval):
 class ParentInterval(FunctionInterval):
-    # PosInterval counter
+    # ParentInterval counter
     parentIntervalNum = 1
     parentIntervalNum = 1
     # Initialization
     # Initialization
     def __init__(self, nodePath, parent, name = None):
     def __init__(self, nodePath, parent, name = None):
@@ -61,6 +85,23 @@ class ParentInterval(FunctionInterval):
         # Create function interval
         # Create function interval
 	FunctionInterval.__init__(self, reparentFunc, name = name)
 	FunctionInterval.__init__(self, reparentFunc, name = name)
 
 
+### Function Interval subclass for adjusting scene graph hierarchy ###
+class WrtParentInterval(FunctionInterval):
+    # WrtParentInterval counter
+    wrtParentIntervalNum = 1
+    # Initialization
+    def __init__(self, nodePath, parent, name = None):
+        """__init__(nodePath, parent, name)
+        """
+        def wrtReparentFunc(nodePath = nodePath, parent = parent):
+            nodePath.wrtReparentTo(parent)
+        # Determine name
+	if (name == None):
+	    name = 'WrtParentInterval-%d' % WrtParentInterval.wrtParentIntervalNum
+	    WrtParentInterval.wrtParentIntervalNum += 1
+        # Create function interval
+	FunctionInterval.__init__(self, wrtReparentFunc, name = name)
+
 ### Function Interval subclasses for instantaneous pose changes ###
 ### Function Interval subclasses for instantaneous pose changes ###
 class PosInterval(FunctionInterval):
 class PosInterval(FunctionInterval):
     # PosInterval counter
     # PosInterval counter