ソースを参照

showCS, hideCS

David Rose 24 年 前
コミット
793dfb2fe4
1 ファイル変更25 行追加10 行削除
  1. 25 10
      direct/src/extensions/NodePath-extensions.py

+ 25 - 10
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()