def attach_physics(self): styler = PSOStyler() for pso, blocktype in zip(self.curr_psos, self.curr_blocktypes): styler.apply(pso, self.stimtype, blocktype=blocktype, kappa=self.kappa) Viewer.attach_physics(self)
def __init__(self, options): Viewer.__init__(self) self.options = deepcopy(options) self.place_camera() self.create_lights() self.win.setClearColor((0.05, 0.05, 0.1, 1.0)) self.disableMouse() self.stimtype = None self._prop_cache = None
def goto_sso(self, i): if self._prop_cache: self._prop_cache = None self.stimtype = self.options['stimtype'][i] Viewer.goto_sso(self, i) self._store_props() self._apply_props() minb, maxb = self.sso.getTightBounds() height = max(3, maxb[2]) self.plights.setPos(0, 0, height * 2 / 3.) print "Showing sso '%s'" % self.sso.getName()
def goto_sso(self, i): if self._blocktype_cache: self._blocktype_cache = None self.stimtype = self.options['stimtype'][i] self.kappa = self.options['kappa'][i] self.color0 = self.options['color0'][i] self.color1 = self.options['color1'][i] Viewer.goto_sso(self, i) self._store_blocktype_props() self._apply_blocktype_props() minb, maxb = self.sso.getTightBounds() height = max(2, maxb[2]) self.plights.setPos(0, 0, height * 2 / 3.) logger.info("Showing sso '%s'", self.sso.getName())
def init_ssos(self): """ Initialize the ssos.""" # load the actual sso objects from disk and do the default # Viewer initialization ssos = load_ssos(self.options['stimulus']) Viewer.init_ssos(self, ssos) # initialize the floor sso floor_path = os.path.join(CPO_PATH, "floors", "round-wooden-floor.cpo") self.floor = load_ssos([floor_path])[0] gso, = self.floor.descendants(type_=GSO) PSOStyler().apply(self.floor, "floor") GSOStyler(self.loader).apply(gso, "floor") self.floor.reparentTo(self.scene) self.floor.init_tree(tags=("model", "shape")) # give it a little extra ambient light alight = pm.AmbientLight('alight2') alight.setColor((0.6, 0.6, 0.6, 1.0)) alnp = self.lights.attachNewNode(alight) self.floor.setLight(alnp)
def init_ssos(self): """ Initialize the ssos.""" # load the actual sso objects from disk and do the default # Viewer initialization ssos = load_ssos(self.options['stimulus']) random.shuffle(ssos) Viewer.init_ssos(self, ssos) # initialize the floor sso floor_path = "stimuli/round-wooden-floor.cpo" self.floor = load_ssos([floor_path])[0] gso, = self.floor.descendants(type_=GSO) PSOStyler().apply(self.floor, "floor") GSOStyler(self.loader).apply(gso, "floor") self.floor.reparentTo(self.scene) self.floor.init_tree(tags=("model", "shape")) # give it a little extra ambient light alight = pm.AmbientLight('alight2') alight.setColor((0.6, 0.6, 0.6, 1.0)) alnp = self.lights.attachNewNode(alight) self.floor.setLight(alnp)
def attach_physics(self): styler = PSOStyler() for pso in self.curr_psos: styler.apply(pso, self.stimtype) Viewer.attach_physics(self)