mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
changed names of Ref generators
This commit is contained in:
parent
2b45840e6e
commit
384c789535
@ -39,7 +39,6 @@ class Indirection:
|
|||||||
TODO: store string components that are duplicates of strings in the actual system so that
|
TODO: store string components that are duplicates of strings in the actual system so that
|
||||||
Python will keep one copy and reduce memory usage
|
Python will keep one copy and reduce memory usage
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, evalStr=None, dictKey=NoDictKey):
|
def __init__(self, evalStr=None, dictKey=NoDictKey):
|
||||||
# if this is a dictionary lookup, pass dictKey instead of evalStr
|
# if this is a dictionary lookup, pass dictKey instead of evalStr
|
||||||
self.evalStr = evalStr
|
self.evalStr = evalStr
|
||||||
@ -196,7 +195,7 @@ class ObjectRef:
|
|||||||
return None
|
return None
|
||||||
return container
|
return container
|
||||||
|
|
||||||
def getContainer(self):
|
def getContainerGen(self):
|
||||||
# try to get a handle on the container by eval'ing and looking things
|
# try to get a handle on the container by eval'ing and looking things
|
||||||
# up in dictionaries, depending on the type of each indirection
|
# up in dictionaries, depending on the type of each indirection
|
||||||
#import pdb;pdb.set_trace()
|
#import pdb;pdb.set_trace()
|
||||||
@ -225,7 +224,7 @@ class ObjectRef:
|
|||||||
# TODO: check that this is still the object we originally pointed to
|
# TODO: check that this is still the object we originally pointed to
|
||||||
yield self._getContainerByEval(evalStr, curObj=curObj)
|
yield self._getContainerByEval(evalStr, curObj=curObj)
|
||||||
|
|
||||||
def getNameGen(self):
|
def getEvalStrGen(self):
|
||||||
str = ''
|
str = ''
|
||||||
prevIndirection = None
|
prevIndirection = None
|
||||||
curIndirection = None
|
curIndirection = None
|
||||||
@ -253,7 +252,7 @@ class ObjectRef:
|
|||||||
yield str
|
yield str
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
for result in self.getNameGen():
|
for result in self.getEvalStrGen():
|
||||||
pass
|
pass
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -357,9 +356,9 @@ class FindContainers(Job):
|
|||||||
# if this container is new, or the objRef repr is shorter than what we already have,
|
# if this container is new, or the objRef repr is shorter than what we already have,
|
||||||
# put it in the table
|
# put it in the table
|
||||||
if contId in self._id2ref:
|
if contId in self._id2ref:
|
||||||
for existingRepr in self._id2ref[contId].getNameGen():
|
for existingRepr in self._id2ref[contId].getEvalStrGen():
|
||||||
yield None
|
yield None
|
||||||
for newRepr in objRef.getNameGen():
|
for newRepr in objRef.getEvalStrGen():
|
||||||
yield None
|
yield None
|
||||||
if contId not in self._id2ref or len(newRepr) < len(existingRepr):
|
if contId not in self._id2ref or len(newRepr) < len(existingRepr):
|
||||||
if contId in self._id2ref:
|
if contId in self._id2ref:
|
||||||
@ -454,10 +453,10 @@ class FindContainers(Job):
|
|||||||
curObjRef = containerRef
|
curObjRef = containerRef
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for curObj in curObjRef.getContainer():
|
for curObj in curObjRef.getContainerGen():
|
||||||
yield None
|
yield None
|
||||||
except:
|
except:
|
||||||
self.notify.debug('lost current container, ref.getContainer() failed')
|
self.notify.debug('lost current container, ref.getContainerGen() failed')
|
||||||
# that container is gone, try again
|
# that container is gone, try again
|
||||||
curObjRef = None
|
curObjRef = None
|
||||||
continue
|
continue
|
||||||
@ -759,7 +758,7 @@ class PruneObjectRefs(Job):
|
|||||||
for id in ids:
|
for id in ids:
|
||||||
yield None
|
yield None
|
||||||
try:
|
try:
|
||||||
for container in _id2baseStartRef[id].getContainer():
|
for container in _id2baseStartRef[id].getContainerGen():
|
||||||
yield None
|
yield None
|
||||||
except:
|
except:
|
||||||
# reference is invalid, remove it
|
# reference is invalid, remove it
|
||||||
@ -769,7 +768,7 @@ class PruneObjectRefs(Job):
|
|||||||
for id in ids:
|
for id in ids:
|
||||||
yield None
|
yield None
|
||||||
try:
|
try:
|
||||||
for container in _id2discoveredStartRef[id].getContainer():
|
for container in _id2discoveredStartRef[id].getContainerGen():
|
||||||
yield None
|
yield None
|
||||||
except:
|
except:
|
||||||
# reference is invalid, remove it
|
# reference is invalid, remove it
|
||||||
@ -858,13 +857,13 @@ class ContainerLeakDetector(Job):
|
|||||||
|
|
||||||
def getContainerByIdGen(self, id):
|
def getContainerByIdGen(self, id):
|
||||||
# return a generator to look up a container
|
# return a generator to look up a container
|
||||||
return self._id2ref[id].getContainer()
|
return self._id2ref[id].getContainerGen()
|
||||||
def getContainerById(self, id):
|
def getContainerById(self, id):
|
||||||
for result in self._id2ref[id].getContainer():
|
for result in self._id2ref[id].getContainerGen():
|
||||||
pass
|
pass
|
||||||
return result
|
return result
|
||||||
def getContainerNameByIdGen(self, id):
|
def getContainerNameByIdGen(self, id):
|
||||||
return self._id2ref[id].getNameGen()
|
return self._id2ref[id].getEvalStrGen()
|
||||||
def getContainerNameById(self, id):
|
def getContainerNameById(self, id):
|
||||||
if id in self._id2ref:
|
if id in self._id2ref:
|
||||||
return repr(self._id2ref[id])
|
return repr(self._id2ref[id])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user