def generate(self): if not self.isLose: animDict = self.getAnimations() self.actor = Actor(self.suit, animDict) else: self.actor = Actor( self.suit, { 'lose': loader.loadModel('phase_4/models/char/suit%s-lose.bam' % (self.suitType)) }) self.shadow = ShadowCaster(self.actor) self.shadow.initializeDropShadow() self.actor.setScale(self.scale)
def generate(self): head = loader.loadModel('phase_3/models/char/%s-heads-%s.bam' % (self.data['Animal'], self.data['HeadType'])) torso = loader.loadModel('phase_3/models/char/%s-torso-%s.bam' % (self.data['Weight'], self.data['Gender'])) legs = loader.loadModel('phase_3/models/char/%s-legs.bam' % (self.data['Height'])) if(self.data['HeadLength'] == 'short'): self.removeOtherParts(head.findAllMatches('**/*long*'), None) else: self.removeOtherParts(head.findAllMatches('**/*short*'), None) muzzleParts = head.findAllMatches('**/*muzzle*') if(self.data['Animal'] != 'dog'): for partNum in range(0, muzzleParts.getNumPaths()): part = muzzleParts.getPath(partNum) if not 'neutral' in part.getName(): part.hide() self.removeOtherParts(legs.findAllMatches('**/boots*') + legs.findAllMatches('**/shoes'), None) torsoAnims = self.generateAnims(torso=True) legsAnims = self.generateAnims(legs=True) self.Avatar = Actor({'head' : head, 'torso' : torso, 'legs' : legs}, {'torso' : torsoAnims, 'legs' : legsAnims}) self.Avatar.attach('head', 'torso', 'def_head') self.Avatar.attach('torso', 'legs', 'joint_hips') if(self.data['Gender'] == 'girl'): femaleEyes = loader.loadTexture('phase_3/maps/eyesFemale.jpg', 'phase_3/maps/eyesFemale_a.rgb') try: self.Avatar.find('**/eyes').setTexture(femaleEyes, 1) except: pass try: self.Avatar.find('**/eyes-%s' % (self.data['HeadLength'])).setTexture(femaleEyes, 1) except: pass # Reseat pupils of old head models pupils = head.findAllMatches('**/*pupil*') for pupil in pupils: pupil.setY(0.02) self.setColor() shadow = ShadowCaster(self.Avatar) shadow.initializeDropShadow() self.Avatar.setPythonTag("AvatarInstance", self)