mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Made childrenTag a dictionary which could have multiple items for filtering option
This commit is contained in:
parent
a8ae4fa3f1
commit
4c6b2a4698
@ -52,8 +52,8 @@ class TreeNode:
|
||||
self.menuVar.set(0)
|
||||
self._popupMenu = None
|
||||
self.fSortChildren = False # [gjeon] flag for sorting children or not
|
||||
self.fModeChildrenTag = 0 # [gjeon] 0: hide by given tag, 1: show by given tag
|
||||
self.childrenTag = None
|
||||
self.fModeChildrenTag = 0 # [gjeon] flag for using filter or not
|
||||
self.childrenTag = None # [gjeon] filter dictionary for
|
||||
|
||||
# [gjeon] to set fSortChildren
|
||||
def setFSortChildren(self, fSortChildren):
|
||||
@ -303,10 +303,14 @@ class TreeNode:
|
||||
self.kidKeys.append(key)
|
||||
|
||||
# [gjeon] to filter by given tag
|
||||
if self.childrenTag:
|
||||
#if not item.nodePath.hasTag('GameArea'):
|
||||
if self.fModeChildrenTag != item.nodePath.hasTag(self.childrenTag):
|
||||
self.kidKeys.remove(key)
|
||||
if self.fModeChildrenTag:
|
||||
if self.childrenTag:
|
||||
showThisItem = False
|
||||
for tagKey in self.childrenTag.keys():
|
||||
if item.nodePath.hasTag(tagKey):
|
||||
showThisItem = self.childrenTag[tagKey]
|
||||
if not showThisItem:
|
||||
self.kidKeys.remove(key)
|
||||
|
||||
# Remove unused children
|
||||
for key in self.children.keys():
|
||||
@ -429,9 +433,14 @@ class TreeNode:
|
||||
# Is it this node
|
||||
if searchKey == self.item.GetKey():
|
||||
# [gjeon] to filter by given tag
|
||||
if self.childrenTag:
|
||||
if self.fModeChildrenTag != self.item.nodePath.hasTag(self.childrenTag):
|
||||
return None
|
||||
if self.fModeChildrenTag:
|
||||
if self.childrenTag:
|
||||
showThisItem = False
|
||||
for tagKey in self.childrenTag.keys():
|
||||
if item.nodePath.hasTag(tagKey):
|
||||
showThisItem = self.childrenTag[tagKey]
|
||||
if not showThisItem:
|
||||
return None
|
||||
return self
|
||||
# Nope, check the children
|
||||
sublist = self.item._GetSubList()
|
||||
|
Loading…
x
Reference in New Issue
Block a user