mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
default values not allowed as parent tokens
This commit is contained in:
parent
417ecf5bcb
commit
6c46fccb42
@ -1,6 +1,7 @@
|
|||||||
"""ParentMgr module: contains the ParentMgr class"""
|
"""ParentMgr module: contains the ParentMgr class"""
|
||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
from direct.showbase.PythonUtil import isDefaultValue
|
||||||
|
|
||||||
class ParentMgr:
|
class ParentMgr:
|
||||||
# This is now used on the AI as well.
|
# This is now used on the AI as well.
|
||||||
@ -24,7 +25,7 @@ class ParentMgr:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('ParentMgr')
|
notify = DirectNotifyGlobal.directNotify.newCategory('ParentMgr')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.token2nodepath = {}
|
self.token2nodepath = {}
|
||||||
# these are nodepaths that have requested to be parented to
|
# these are nodepaths that have requested to be parented to
|
||||||
@ -64,6 +65,8 @@ class ParentMgr:
|
|||||||
(repr(child), parentToken))
|
(repr(child), parentToken))
|
||||||
child.wrtReparentTo(self.token2nodepath[parentToken])
|
child.wrtReparentTo(self.token2nodepath[parentToken])
|
||||||
else:
|
else:
|
||||||
|
if isDefaultValue(parentToken):
|
||||||
|
self.notify.error('child %s requested reparent to default-value token: %s' % (repr(child), parentToken))
|
||||||
self.notify.debug(
|
self.notify.debug(
|
||||||
"child %s requested reparent to parent '%s' that is not (yet) registered" %
|
"child %s requested reparent to parent '%s' that is not (yet) registered" %
|
||||||
(repr(child), parentToken))
|
(repr(child), parentToken))
|
||||||
@ -83,6 +86,9 @@ class ParentMgr:
|
|||||||
"registerParent: token '%s' already registered, referencing %s" %
|
"registerParent: token '%s' already registered, referencing %s" %
|
||||||
(token, repr(self.token2nodepath[token])))
|
(token, repr(self.token2nodepath[token])))
|
||||||
|
|
||||||
|
if isDefaultValue(token):
|
||||||
|
self.notify.error('parent token (for %s) cannot be a default value (%s)' % (repr(parent), token))
|
||||||
|
|
||||||
self.notify.debug("registering %s as '%s'" % (repr(parent), token))
|
self.notify.debug("registering %s as '%s'" % (repr(parent), token))
|
||||||
self.token2nodepath[token] = parent
|
self.token2nodepath[token] = parent
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user