Ejemplo n.º 1
0
    def _prepare_scene(self, cpo_path, floor_path, rec_names):
        """Sets up the current scene."""
        def get_name(cpo):
            return cpo.getName()

        floor = load_cpo(floor_path)
        PSOStyler().apply(floor, "floor")
        floor.reparentTo(self.scene)

        cpo = load_cpo(cpo_path)
        cpo.reparentTo(self.scene)

        self.cache = self.scene.store_tree()
        self.floor = floor
        self.cpo = cpo

        self.scene.init_tree(tags=())
        pcpos = self.scene.descendants(type_=PSO)
        for pcpo in pcpos:
            pcpo.setCollideMask(BitMask32.allOn())
            pcpo.node().setDeactivationEnabled(False)

        cpos_rec = self._order_cpos(cpo.descendants(type_=PSO,
                                                    names=rec_names))

        return pcpos, cpos_rec
Ejemplo n.º 2
0
 def attach_physics(self):
     # Attach `self.scene` to the physics world.
     self.scene.init_tree(tags=("shape", ))
     bnodes = self.scene.descendants(type_=PSO)
     for bnode in bnodes:
         bnode.setCollideMask(BitMask32.allOn())
         bnode.node().setDeactivationEnabled(False)
     self.bbase.attach(bnodes)
Ejemplo n.º 3
0
 def attach_physics(self):
     # Attach `self.scene` to the physics world.
     self.scene.init_tree(tags=("shape",))
     bnodes = self.scene.descendants(type_=PSO)
     for bnode in bnodes:
         bnode.setCollideMask(BitMask32.allOn())
         bnode.node().setDeactivationEnabled(False)
     self.bbase.attach(bnodes)
Ejemplo n.º 4
0
 def attach_physics(self):
     # Attach `self.scene` to the physics world.
     try:
         exclude = zip(*self.compound_components)[0]
     except IndexError:
         exclude = []
     bnodes = [bnode for bnode in self.scene.descendants(type_=PSO)
               if bnode not in exclude]
     for bnode in bnodes:
         bnode.init_resources(tags=("shape",))
         bnode.setCollideMask(BitMask32.allOn())
         bnode.node().setDeactivationEnabled(False)
     self.bbase.attach(bnodes)
Ejemplo n.º 5
0
 def attach_physics(self):
     # Attach `self.scene` to the physics world.
     try:
         exclude = zip(*self.compound_components)[0]
     except IndexError:
         exclude = []
     bnodes = [
         bnode for bnode in self.scene.descendants(type_=PSO)
         if bnode not in exclude
     ]
     for bnode in bnodes:
         bnode.init_resources(tags=("shape", ))
         bnode.setCollideMask(BitMask32.allOn())
         bnode.node().setDeactivationEnabled(False)
     self.bbase.attach(bnodes)