Пример #1
0
 def generateAvatar(self):
     self.cleanupAvatar()
     for key in self.dataCache.keys():
         self.avatar.setData(key, self.dataCache[key])
     self.avatar.generate()
     self.avatar.getAvatar().setPosHprScale(-2, 0, 0, 200, 0, 0, 1, 1, 1)
     self.avatar.getAvatar().reparentTo(render)
     self.subject = self.avatar.getAvatar()
     self.subject.setName("Temp Toon")
     self.subject.loop('neutral')
     shirtColor = random.choice(AvatarAttributes().convertColorDictToTbl())
     bttColor = random.choice(AvatarAttributes().convertColorDictToTbl())
     self.subject.find("**/torso-top").setColor(shirtColor)
     self.subject.find("**/sleeves").setColor(shirtColor)
     self.subject.find('**/torso-bot').setColor(bttColor)
Пример #2
0
 def setColor(self):
     colorEarAnimals = {'dog', 'horse', 'monkey'}
     body = ['**/head-*', '**/neck', '**/arms', '**/legs', '**/feet', '**/head']
     if(self.data['Animal'] not in colorEarAnimals):
         body.append('**/*ears*')
     for part in range(len(body)):
         self.Avatar.findAllMatches(body[part]).setColor(self.data['Color'])
     self.Avatar.findAllMatches("**/hands").setColor(AvatarAttributes().getColor('white'))
Пример #3
0
 def setData(self, key, value):
     attr = AvatarAttributes()
     tables = {
         'Animal': attr.getAnimals(),
         'Gender': ['boy', 'girl'],
         'Color': attr.convertColorDictToTbl(),
         'Weight': attr.getWeights(),
         'Height': attr.getHeights(),
         'HeadType': attr.getHeadTypes(),
         'HeadLength': ['short', 'long']
     }
     if (key not in self.dataCache):
         return
     if (value == 'prev' or value == 'next'):
         table = tables[key]
         index = 0
         for i in xrange(len(table)):
             if (table[i] == self.dataCache[key]):
                 index = i
         if (value == 'prev'):
             if (index == 0):
                 self.dataCache[key] = table[(len(table) - 1)]
             else:
                 self.dataCache[key] = table[index - 1]
         else:
             if (index == (len(table) - 1)):
                 self.dataCache[key] = table[0]
             else:
                 self.dataCache[key] = table[index + 1]
     else:
         self.dataCache[key] = value
     self.generateAvatar()
Пример #4
0
 def setData(self, key, value):
     attr = AvatarAttributes()
     tables = {'Animal' : attr.getAnimals(), 
               'Gender' : ['boy', 'girl'],
               'Color' : attr.convertColorDictToTbl(),
               'Weight' : attr.getWeights(),
               'Height' : attr.getHeights(),
               'HeadType' : attr.getHeadTypes(),
               'HeadLength' : ['short', 'long']}
     if(key not in self.dataCache):
         return
     if(value == 'prev' or value == 'next'):
         table = tables[key]
         index = 0
         for i in xrange(len(table)):
             if(table[i] == self.dataCache[key]):
                 index = i
         if(value == 'prev'):
             if(index == 0):
                 self.dataCache[key] = table[(len(table) - 1)]
             else:
                 self.dataCache[key] = table[index - 1]
         else:
             if(index == (len(table) - 1)):
                 self.dataCache[key] = table[0]
             else:
                 self.dataCache[key] = table[index + 1]
     else:
         self.dataCache[key] = value
     self.generateAvatar()
Пример #5
0
 def generate(self):
     if (self.amount >= Globals.LARGE_BEAN_AMT):
         mdl = 'phase_5.5/models/estate/jellybeanJar.bam'
     else:
         mdl = 'phase_4/models/props/jellybean4.bam'
     self.entity = loader.loadModel(mdl)
     if (self.amount < Globals.LARGE_BEAN_AMT):
         self.entity.setColor(
             random.choice(AvatarAttributes().convertColorDictToTbl()))
         self.entity.setScale(3)
     self.entity.setName('ent_jellybean')
     self.entity.setPythonTag('Amount', self.amount)
     ItemEntity.__init__(self, self, addCollision=True)
Пример #6
0
    def randomizeData(self, gender=None):
        def setData(key, value):
            self.dataCache[key] = value

        attr = AvatarAttributes()
        setData('Animal', random.choice(attr.getAnimals()))
        if (gender == None):
            setData('Gender', random.choice(['boy', 'girl']))
        else:
            setData('Gender', gender)
        setData('Weight', random.choice(attr.getWeights()))
        setData('Height', random.choice(attr.getHeights()))
        setData('Color', random.choice(attr.convertColorDictToTbl()))
        setData('HeadType', random.choice(attr.getHeadTypes()))
        setData('HeadLength', random.choice(['short', 'long']))
        self.generateAvatar()
Пример #7
0
 def randomizeData(self, gender = None):
     def setData(key, value):
         self.dataCache[key] = value
     
     attr = AvatarAttributes()
     setData('Animal', random.choice(attr.getAnimals()))
     if(gender == None):
         setData('Gender', random.choice(['boy', 'girl']))
     else:
         setData('Gender', gender)
     setData('Weight', random.choice(attr.getWeights()))
     setData('Height', random.choice(attr.getHeights()))
     setData('Color', random.choice(attr.convertColorDictToTbl()))
     setData('HeadType', random.choice(attr.getHeadTypes()))
     setData('HeadLength', random.choice(['short', 'long']))
     self.generateAvatar()