diff --git a/direct/src/extensions/NodePath-extensions.py b/direct/src/extensions/NodePath-extensions.py index 8ff37821e5..e13cb8b4ae 100644 --- a/direct/src/extensions/NodePath-extensions.py +++ b/direct/src/extensions/NodePath-extensions.py @@ -821,14 +821,29 @@ def setAlphaScale(self, alpha): self.setColorScale(1, 1, 1, alpha) - - - - - - - - - + def showCS(self, mask = None): + """showCS(self, mask) + Shows the collision solids at or below this node. If mask is + not None, it is a BitMask32 object (e.g. WallBitmask, + CameraBitmask) that indicates which particular collision + solids should be made visible; otherwise, all of them will be. + """ + npc = self.findAllMatches('**/+CollisionNode') + for p in range(0, npc.getNumPaths()): + np = npc[p] + if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()): + np.show() + def hideCS(self, mask = None): + """hideCS(self, mask) + Hides the collision solids at or below this node. If mask is + not None, it is a BitMask32 object (e.g. WallBitmask, + CameraBitmask) that indicates which particular collision + solids should be hidden; otherwise, all of them will be. + """ + npc = self.findAllMatches('**/+CollisionNode') + for p in range(0, npc.getNumPaths()): + np = npc[p] + if (mask == None or (np.node().getIntoCollideMask() & mask).getWord()): + np.hide()