def generateBodyPart(toon, bodyPart, partType, partPhase, pantType): partAnimations = {} mdlPath = BASE_MODEL % (partPhase, partType, pantType, bodyPart, str(CIGlobals.getModelDetail(toon.avatarType))) if '_-' in mdlPath: mdlPath = mdlPath.replace('_-', '-') if '__' in mdlPath: mdlPath = mdlPath.replace('__', '_') toon.loadModel(mdlPath, bodyPart) for animName in ANIMATIONS: animationData = ANIMATIONS[animName] animPath = None if len(animationData) == 2: animPhase = animationData[0] animFile = animationData[1] animPath = BASE_MODEL % (animPhase, partType, pantType, bodyPart, animFile) if '_-' in animPath: animPath = animPath.replace('_-', '-') if '__' in animPath: animPath = animPath.replace('__', '_') partAnimations[animName] = animPath toon.loadAnims(partAnimations, bodyPart) return
def generateTorso(self): torsotype = self.getTorso() self.loadModel('phase_3/models/char/tt_a_chr_' + torsotype + '_torso_' + str(CIGlobals.getModelDetail(self.avatarType)) + '.bam', 'torso') self.loadAnims({'neutral': 'phase_3/models/char/tt_a_chr_' + torsotype + '_torso_neutral.bam', 'run': 'phase_3/models/char/tt_a_chr_' + torsotype + '_torso_run.bam', 'walk': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_walk.bam', 'pie': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_pie-throw.bam', 'fallb': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_slip-backward.bam', 'fallf': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_slip-forward.bam', 'lose': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_lose.bam', 'win': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_victory-dance.bam', 'squirt': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_water-gun.bam', 'zend': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_jump-zend.bam', 'tele': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_teleport.bam', 'book': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_book.bam', 'leap': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_leap_zhang.bam', 'jump': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_jump-zhang.bam', 'happy': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_jump.bam', 'shrug': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_shrug.bam', 'hdance': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_happy-dance.bam', 'wave': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_wave.bam', 'scemcee': 'phase_4/models/char/tt_a_chr_dgm_shorts_torso_scientistEmcee.bam', 'scwork': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_scientistWork.bam', 'scgame': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_scientistGame.bam', 'scjealous': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_scientistJealous.bam', 'swim': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_swim.bam', 'toss': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_toss.bam', 'cringe': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_cringe.bam', 'conked': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_conked.bam', 'catchneutral': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_gameneutral.bam', 'catchrun': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_gamerun.bam', 'hold-bottle': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_hold-bottle.bam', 'push-button': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_press-button.bam', 'happy-dance': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_happy-dance.bam', 'juggle': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_juggle.bam', 'shout': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_shout.bam', 'dneutral': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_sad-neutral.bam', 'dwalk': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_losewalk.bam', 'smooch': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_smooch.bam', 'conked': 'phase_3.5/models/char/tt_a_chr_' + torsotype + '_torso_conked.bam', 'sound': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_shout.bam', 'sprinkle-dust': 'phase_5/models/char/tt_a_chr_' + torsotype + '_torso_sprinkle-dust.bam', 'start-sit': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_intoSit.bam', 'sit': 'phase_4/models/char/tt_a_chr_' + torsotype + '_torso_sit.bam'}, 'torso')
def generateFromFile(self, jsonfile, slot): infoFile = open(jsonfile) jsonInfo = json.load(infoFile) if not jsonInfo["toon" + str(slot)]["head"] == "dog": h = loader.loadModel("phase_3/models/char/" + jsonInfo["toon" + str(slot)]["head"] + "-heads-" + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + ".bam") else: h = loader.loadModel("phase_3/models/char/tt_a_chr_" + jsonInfo["toon" + str(slot)]["headtype"] + "_head_" + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + ".bam") if jsonInfo["toon" + str(slot)]["headtype"] == "1": try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo["toon" + str(slot)]["headtype"] == "2": try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo["toon" + str(slot)]["headtype"] == "3": try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo["toon" + str(slot)]["headtype"] == "4": try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass try: if jsonInfo["toon" + str(slot)]["head"] == 'monkey': pass else: h.find('**/ears-long').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) h.find('**/ears-short').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) except: pass try: h.find('**/head-front-short').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) h.find('**/head-front-long').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) h.find('**/head-short').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) h.find('**/head-long').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) except: pass try: h.find('**/head-front').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) h.find('**/head').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) except: pass try: if jsonInfo["toon" + str(slot)]["head"] == 'dog' or jsonInfo["toon" + str(slot)]["head"] == 'monkey': pass else: h.find('**/ears').setColor(jsonInfo["toon" + str(slot)]["headcolor"][0], jsonInfo["toon" + str(slot)]["headcolor"][1], jsonInfo["toon" + str(slot)]["headcolor"][2], jsonInfo["toon" + str(slot)]["headcolor"][3]) except: pass if jsonInfo["toon" + str(slot)]["gender"] == "girl": print jsonInfo["toon" + str(slot)]["head"] lashes = loader.loadModel("phase_3/models/char/" + jsonInfo["toon" + str(slot)]["head"] + "-lashes.bam") lashes.reparentTo(h) if jsonInfo["toon" + str(slot)]["headtype"] == "1" or jsonInfo["toon" + str(slot)]["headtype"] == "dgm_skirt" or jsonInfo["toon" + str(slot)]["headtype"] == "dgm_shorts" or jsonInfo["toon" + str(slot)]["headtype"] == "dgs_shorts": lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo["toon" + str(slot)]["headtype"] == "2" or jsonInfo["toon" + str(slot)]["headtype"] == "dgl_shorts": lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() elif jsonInfo["toon" + str(slot)]["headtype"] == "3" or jsonInfo["toon" + str(slot)]["headtype"] == "dgm_skirt" or jsonInfo["toon" + str(slot)]["headtype"] == "dgm_shorts" or jsonInfo["toon" + str(slot)]["headtype"] == "dgs_shorts": lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo["toon" + str(slot)]["headtype"] == "4" or jsonInfo["toon" + str(slot)]["headtype"] == "dgl_shorts": lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return h
def generateHead(self, gender, head, headType, forGui=0): def stashMuzzles(length, stashNeutral=0): if stashNeutral: if length == 'short': self.findAllMatches('**/muzzle-long-neutral').hide() elif length == 'long': self.findAllMatches('**/muzzle-short-neutral').hide() else: if length == 'short': if self.find('**/muzzle-long-neutral').isHidden(): self.find('**/muzzle-long-neutral').show() else: if length == 'long': if self.find('**/muzzle-short-neutral').isHidden(): self.find('**/muzzle-short-neutral').show() self.findAllMatches('**/muzzle-' + length + '-s*').hide() self.findAllMatches('**/muzzle-' + length + '-laugh').hide() self.findAllMatches('**/muzzle-' + length + '-angry').hide() def stashParts(length): for part in self.findAllMatches('**/*' + length + '*'): part.hide() self.gender = gender self.animal = head self.head = headType _modelDetail = str(CIGlobals.getModelDetail(CIGlobals.Toon)) if head != 'dog': self.loadModel( 'phase_3/models/char/%s-heads-%s.bam' % (head, _modelDetail), 'head') else: self.loadModel( 'phase_3/models/char/tt_a_chr_%s_head_%s.bam' % (headType, _modelDetail), 'head') partAnimations = {} for animName in ToonGlobals.ANIMATIONS: animationData = list(ToonGlobals.ANIMATIONS[animName]) animPath = None if len(animationData) == 2: animPhase = animationData[0] animFile = animationData[1] animPath = ToonGlobals.BASE_MODEL % (animPhase, headType, '', 'head', animFile) if '_-' in animPath: animPath = animPath.replace('_-', '-') if '__' in animPath: animPath = animPath.replace('__', '_') partAnimations[animName] = animPath self.loadAnims(partAnimations, 'head') _pupilL = self.findAllMatches('**/def_left_pupil') _pupilR = self.findAllMatches('**/def_right_pupil') if headType == '1': stashParts('long') stashMuzzles('long', stashNeutral=0) stashMuzzles('short', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_short') _pupilR = self.findAllMatches('**/joint_pupilR_short') else: if headType == '2': if head == 'mouse': stashParts('short') stashMuzzles('short', stashNeutral=1) stashMuzzles('long', stashNeutral=0) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') else: stashParts('long') stashMuzzles('short', stashNeutral=0) stashMuzzles('long', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_short') _pupilR = self.findAllMatches('**/joint_pupilR_short') if head == 'rabbit': self.findAllMatches('**/head-long').show() self.findAllMatches('**/head-front-long').show() self.findAllMatches('**/head-front-short').hide() self.findAllMatches('**/head-short').hide() else: if headType == '3': stashParts('short') stashMuzzles('long', stashNeutral=0) stashMuzzles('short', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') if head == 'rabbit': self.findAllMatches('**/head-long').hide() self.findAllMatches('**/head-front-long').hide() self.findAllMatches('**/head-front-short').show() self.findAllMatches('**/head-short').show() else: if headType == '4': stashParts('short') stashMuzzles('short', stashNeutral=0) stashMuzzles('long', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') self.pupils.append(_pupilL) self.pupils.append(_pupilR) if forGui: self.guiFix() if self.gender == 'girl': self.setupEyelashes() return
def generate(self, gender, head, headtype): if not head == "dog": h = loader.loadModel("phase_3/models/char/" + head + "-heads-" + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + ".bam") else: h = Actor("phase_3/models/char/tt_a_chr_" + headtype + "_head_" + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + ".bam", {"neutral": "phase_3/models/char/tt_a_chr_" + headtype + "_head_neutral.bam", "run": "phase_3/models/char/tt_a_chr_" + headtype + "_head_run.bam", "walk": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_walk.bam", "pie": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_pie-throw.bam", "fallb": "phase_4/models/char/tt_a_chr_" + headtype + "_head_slip-backward.bam", "fallf": "phase_4/models/char/tt_a_chr_" + headtype + "_head_slip-forward.bam", "lose": "phase_5/models/char/tt_a_chr_" + headtype + "_head_lose.bam", "win": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_victory-dance.bam", "squirt": "phase_5/models/char/tt_a_chr_" + headtype + "_head_water-gun.bam", "zend": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_jump-zend.bam", "tele": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_teleport.bam", "book": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_book.bam", "leap": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_leap_zhang.bam", "jump": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_jump-zhang.bam", "happy": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_jump.bam", "shrug": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_shrug.bam", "hdance": "phase_5/models/char/tt_a_chr_" + headtype + "_head_happy-dance.bam", "wave": "phase_3.5/models/char/tt_a_chr_" + headtype + "_head_wave.bam"}) if headtype == "1": try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == "2": try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == "3": try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == "4": try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass if gender == "girl": lashes = loader.loadModel("phase_3/models/char/" + head + "-lashes.bam") lashes.reparentTo(h) if headtype == "1" or headtype == "dgm_skirt" or headtype == "dgm_shorts" or headtype == "dgs_shorts": lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif headtype == "2" or headtype == "dgl_shorts": lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() elif headtype == "3" or headtype == "dgm_skirt" or headtype == "dgm_shorts" or headtype == "dgs_shorts": lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif headtype == "4" or headtype == "dgl_shorts": lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return tuple((h, lashes)) else: return h
def generateHead(self, gender, head, headtype, forGui = 0): def stashMuzzles(length, stashNeutral = 0): if stashNeutral: if length == 'short': self.findAllMatches('**/muzzle-long-neutral').hide() elif length == 'long': self.findAllMatches('**/muzzle-short-neutral').hide() elif length == 'short': if self.find('**/muzzle-long-neutral').isHidden(): self.find('**/muzzle-long-neutral').show() elif length == 'long': if self.find('**/muzzle-short-neutral').isHidden(): self.find('**/muzzle-short-neutral').show() self.findAllMatches('**/muzzle-' + length + '-s*').hide() self.findAllMatches('**/muzzle-' + length + '-laugh').hide() self.findAllMatches('**/muzzle-' + length + '-angry').hide() def stashParts(length): for part in self.findAllMatches('**/*' + length + '*'): part.hide() self.gender = gender self.animal = head self.head = headtype _modelDetail = str(CIGlobals.getModelDetail(CIGlobals.Toon)) if head != 'dog': self.loadModel('phase_3/models/char/%s-heads-%s.bam' % (head, _modelDetail), 'head') else: self.loadModel('phase_3/models/char/tt_a_chr_%s_head_%s.bam' % (headtype, _modelDetail), 'head') self.loadAnims({'neutral': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_neutral.bam', 'run': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_run.bam', 'walk': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_walk.bam', 'pie': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_pie-throw.bam', 'fallb': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-backward.bam', 'fallf': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-forward.bam', 'lose': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_lose.bam', 'win': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_victory-dance.bam', 'squirt': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_water-gun.bam', 'zend': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zend.bam', 'tele': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_teleport.bam', 'book': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_book.bam', 'leap': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_leap_zhang.bam', 'jump': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zhang.bam', 'happy': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump.bam', 'shrug': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_shrug.bam', 'hdance': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_happy-dance.bam', 'wave': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_wave.bam', 'swim': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_swim.bam', 'toss': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_toss.bam', 'cringe': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_cringe.bam', 'conked': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_conked.bam', 'catchneutral': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_gameneutral.bam', 'catchrun': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_gamerun.bam', 'hold-bottle': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_hold-bottle.bam', 'push-button': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_press-button.bam', 'happy-dance': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_happy-dance.bam', 'juggle': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_juggle.bam', 'shout': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_shout.bam', 'dneutral': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_sad-neutral.bam', 'dwalk': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_losewalk.bam', 'smooch': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_smooch.bam', 'conked': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_conked.bam', 'sound': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_shout.bam', 'sprinkle-dust': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_sprinkle-dust.bam', 'start-sit': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_intoSit.bam', 'sit': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_sit.bam'}, 'head') _pupilL = self.findAllMatches('**/def_left_pupil') _pupilR = self.findAllMatches('**/def_right_pupil') if headtype == '1': stashParts('long') stashMuzzles('long', stashNeutral=0) stashMuzzles('short', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_short') _pupilR = self.findAllMatches('**/joint_pupilR_short') elif headtype == '2': if head == 'mouse': stashParts('short') stashMuzzles('short', stashNeutral=1) stashMuzzles('long', stashNeutral=0) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') else: stashParts('long') stashMuzzles('short', stashNeutral=0) stashMuzzles('long', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_short') _pupilR = self.findAllMatches('**/joint_pupilR_short') if head == 'rabbit': self.findAllMatches('**/head-long').show() self.findAllMatches('**/head-front-long').show() self.findAllMatches('**/head-front-short').hide() self.findAllMatches('**/head-short').hide() elif headtype == '3': stashParts('short') stashMuzzles('long', stashNeutral=0) stashMuzzles('short', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') if head == 'rabbit': self.findAllMatches('**/head-long').hide() self.findAllMatches('**/head-front-long').hide() self.findAllMatches('**/head-front-short').show() self.findAllMatches('**/head-short').show() elif headtype == '4': stashParts('short') stashMuzzles('short', stashNeutral=0) stashMuzzles('long', stashNeutral=1) _pupilL = self.findAllMatches('**/joint_pupilL_long') _pupilR = self.findAllMatches('**/joint_pupilR_long') self.pupils.append(_pupilL) self.pupils.append(_pupilR) if forGui: self.guiFix() if self.gender == 'girl': self.setupEyelashes()
def generate(self, gender, head, headtype): if not head == 'dog': h = loader.loadModel( 'phase_3/models/char/' + head + '-heads-' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') else: h = Actor( 'phase_3/models/char/tt_a_chr_' + headtype + '_head_' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam', { 'neutral': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_neutral.bam', 'run': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_run.bam', 'walk': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_walk.bam', 'pie': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_pie-throw.bam', 'fallb': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-backward.bam', 'fallf': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-forward.bam', 'lose': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_lose.bam', 'win': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_victory-dance.bam', 'squirt': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_water-gun.bam', 'zend': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zend.bam', 'tele': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_teleport.bam', 'book': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_book.bam', 'leap': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_leap_zhang.bam', 'jump': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zhang.bam', 'happy': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump.bam', 'shrug': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_shrug.bam', 'hdance': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_happy-dance.bam', 'wave': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_wave.bam' }) if headtype == '1': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if headtype == '2': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if headtype == '3': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if headtype == '4': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass if gender == 'girl': lashes = loader.loadModel('phase_3/models/char/' + head + '-lashes.bam') lashes.reparentTo(h) if headtype == '1' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() else: if headtype == '2' or headtype == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() else: if headtype == '3' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() else: if headtype == '4' or headtype == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return tuple((h, lashes)) return h
def generateFromFile(self, jsonfile, slot): infoFile = open(jsonfile) jsonInfo = json.load(infoFile) if not jsonInfo['toon' + str(slot)]['head'] == 'dog': h = loader.loadModel( 'phase_3/models/char/' + jsonInfo['toon' + str(slot)]['head'] + '-heads-' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') else: h = loader.loadModel( 'phase_3/models/char/tt_a_chr_' + jsonInfo['toon' + str(slot)]['headtype'] + '_head_' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') if jsonInfo['toon' + str(slot)]['headtype'] == '1': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if jsonInfo['toon' + str(slot)]['headtype'] == '2': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if jsonInfo['toon' + str(slot)]['headtype'] == '3': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass else: if jsonInfo['toon' + str(slot)]['headtype'] == '4': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass try: if jsonInfo['toon' + str(slot)]['head'] == 'monkey': pass else: h.find('**/ears-long').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/ears-short').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: h.find('**/head-front-short').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-front-long').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-short').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-long').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: h.find('**/head-front').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: if jsonInfo['toon' + str(slot)]['head'] == 'dog' or jsonInfo[ 'toon' + str(slot)]['head'] == 'monkey': pass else: h.find('**/ears').setColor( jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass if jsonInfo['toon' + str(slot)]['gender'] == 'girl': print jsonInfo['toon' + str(slot)]['head'] lashes = loader.loadModel('phase_3/models/char/' + jsonInfo['toon' + str(slot)]['head'] + '-lashes.bam') lashes.reparentTo(h) if jsonInfo['toon' + str(slot)]['headtype'] == '1' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgm_skirt' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgm_shorts' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '2' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '3' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgm_skirt' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgm_shorts' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '4' or jsonInfo[ 'toon' + str(slot)]['headtype'] == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return h
def generate(self, gender, head, headtype): if not head == 'dog': h = loader.loadModel('phase_3/models/char/' + head + '-heads-' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') else: h = Actor('phase_3/models/char/tt_a_chr_' + headtype + '_head_' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam', {'neutral': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_neutral.bam', 'run': 'phase_3/models/char/tt_a_chr_' + headtype + '_head_run.bam', 'walk': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_walk.bam', 'pie': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_pie-throw.bam', 'fallb': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-backward.bam', 'fallf': 'phase_4/models/char/tt_a_chr_' + headtype + '_head_slip-forward.bam', 'lose': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_lose.bam', 'win': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_victory-dance.bam', 'squirt': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_water-gun.bam', 'zend': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zend.bam', 'tele': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_teleport.bam', 'book': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_book.bam', 'leap': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_leap_zhang.bam', 'jump': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump-zhang.bam', 'happy': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_jump.bam', 'shrug': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_shrug.bam', 'hdance': 'phase_5/models/char/tt_a_chr_' + headtype + '_head_happy-dance.bam', 'wave': 'phase_3.5/models/char/tt_a_chr_' + headtype + '_head_wave.bam'}) if headtype == '1': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == '2': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == '3': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif headtype == '4': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass if gender == 'girl': lashes = loader.loadModel('phase_3/models/char/' + head + '-lashes.bam') lashes.reparentTo(h) if headtype == '1' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif headtype == '2' or headtype == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() elif headtype == '3' or headtype == 'dgm_skirt' or headtype == 'dgm_shorts' or headtype == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif headtype == '4' or headtype == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return tuple((h, lashes)) else: return h
def generateFromFile(self, jsonfile, slot): infoFile = open(jsonfile) jsonInfo = json.load(infoFile) if not jsonInfo['toon' + str(slot)]['head'] == 'dog': h = loader.loadModel('phase_3/models/char/' + jsonInfo['toon' + str(slot)]['head'] + '-heads-' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') else: h = loader.loadModel('phase_3/models/char/tt_a_chr_' + jsonInfo['toon' + str(slot)]['headtype'] + '_head_' + str(CIGlobals.getModelDetail(CIGlobals.Toon)) + '.bam') if jsonInfo['toon' + str(slot)]['headtype'] == '1': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo['toon' + str(slot)]['headtype'] == '2': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-long-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo['toon' + str(slot)]['headtype'] == '3': try: h.find('**/eyes-long').hide() except: pass try: h.find('**/ears-long').hide() except: pass try: h.find('**/head-long').hide() except: pass try: h.find('**/joint_pupilR_long').hide() h.find('**/joint_pupilL_long').hide() except: pass try: h.find('**/head-front-long').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass elif jsonInfo['toon' + str(slot)]['headtype'] == '4': try: h.find('**/eyes-short').hide() except: pass try: h.find('**/ears-short').hide() except: pass try: h.find('**/head-short').hide() except: pass try: h.find('**/joint_pupilR_short').hide() h.find('**/joint_pupilL_short').hide() except: pass try: h.find('**/head-front-short').hide() except: pass try: h.find('**/muzzle-long-laugh').hide() except: pass try: h.find('**/muzzle-long-angry').hide() except: pass try: h.find('**/muzzle-long-smile').hide() except: pass try: h.find('**/muzzle-long-sad').hide() except: pass try: h.find('**/muzzle-long-surprise').hide() except: pass try: h.find('**/muzzle-short-neutral').hide() except: pass try: h.find('**/muzzle-short-laugh').hide() except: pass try: h.find('**/muzzle-short-angry').hide() except: pass try: h.find('**/muzzle-short-smile').hide() except: pass try: h.find('**/muzzle-short-sad').hide() except: pass try: h.find('**/muzzle-short-surprise').hide() except: pass try: if jsonInfo['toon' + str(slot)]['head'] == 'monkey': pass else: h.find('**/ears-long').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/ears-short').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: h.find('**/head-front-short').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-front-long').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-short').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head-long').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: h.find('**/head-front').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) h.find('**/head').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass try: if jsonInfo['toon' + str(slot)]['head'] == 'dog' or jsonInfo['toon' + str(slot)]['head'] == 'monkey': pass else: h.find('**/ears').setColor(jsonInfo['toon' + str(slot)]['headcolor'][0], jsonInfo['toon' + str(slot)]['headcolor'][1], jsonInfo['toon' + str(slot)]['headcolor'][2], jsonInfo['toon' + str(slot)]['headcolor'][3]) except: pass if jsonInfo['toon' + str(slot)]['gender'] == 'girl': print jsonInfo['toon' + str(slot)]['head'] lashes = loader.loadModel('phase_3/models/char/' + jsonInfo['toon' + str(slot)]['head'] + '-lashes.bam') lashes.reparentTo(h) if jsonInfo['toon' + str(slot)]['headtype'] == '1' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgm_skirt' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgm_shorts' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '2' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '3' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgm_skirt' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgm_shorts' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgs_shorts': lashes.find('**/open-long').hide() lashes.find('**/closed-long').hide() lashes.find('**/closed-short').hide() elif jsonInfo['toon' + str(slot)]['headtype'] == '4' or jsonInfo['toon' + str(slot)]['headtype'] == 'dgl_shorts': lashes.find('**/open-short').hide() lashes.find('**/closed-short').hide() lashes.find('**/closed-long').hide() return h