From 56eea2b9a5f8ff4c30a4571d795e84676989dd35 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Thu, 25 Sep 2003 01:24:29 +0000 Subject: [PATCH] value is passed in attribChanged --- direct/src/level/Entity.py | 8 ++++++-- direct/src/level/Level.py | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/direct/src/level/Entity.py b/direct/src/level/Entity.py index 2a4d8492af..ddb01b822e 100755 --- a/direct/src/level/Entity.py +++ b/direct/src/level/Entity.py @@ -10,12 +10,14 @@ class Entity(DirectObject): and can be edited with the LevelEditor.""" notify = DirectNotifyGlobal.directNotify.newCategory('Entity') + """ # these are values that can be changed in the level editor Attribs = ( # Name, PythonType, CallSetterOnInitialization ('name', str, 0), ('comment', str, 0), ) + """ def __init__(self, level=None, entId=None): self.initializeEntity(level, entId) @@ -84,9 +86,9 @@ class Entity(DirectObject): # set the attrib directly self.__dict__[attrib] = value # and call the notify func - self.attribChanged(attrib) + self.attribChanged(attrib, value) - def attribChanged(self, attrib): + def attribChanged(self, attrib, value): """This is called when a parameter is tweaked and no setter is called; i.e. the value is set directly on the object. Some Entities might want to completely reset every time anything @@ -95,8 +97,10 @@ class Entity(DirectObject): """ pass + """ def getAttribInfo(self): return self.attribs + """ if __debug__: def debugPrint(self, message): diff --git a/direct/src/level/Level.py b/direct/src/level/Level.py index 15075c7e3a..e8c1d3748b 100755 --- a/direct/src/level/Level.py +++ b/direct/src/level/Level.py @@ -81,7 +81,8 @@ class Level: entity.entId)) entity.destroy() del self.createdEntities - del self.entities + if hasattr(self, 'entities'): + del self.entities del self.entId2spec del self.spec @@ -141,6 +142,8 @@ class Level: # we used to do this in initializeEntity, but that did not # allow for additional initialization to be performed in # derived entity __init__ funcs + # note that now DistributedEntity's are responsible for calling + # this for themselves self.onEntityCreate(entId) return entity