def __chooseFriend(self, friendId, friendName): """ selects a friend for loading for the preview toon I can get my avatar's dna using base.localAvatar.style. I can get the dna of all my friends using base.cr.identifyFriend(avId), but I cannot get the dna of the other avatars of my account (family) using the above. For my family avatars we make a request to the database by using : base.cr.getAvatarDetails(familyAvatar, self.__handleFamilyAvatar, "DistributedToon") """ messenger.send('wakeup') if self.checkFamily(friendId): if friendId == base.localAvatar.doId: self.createPreviewToon(base.localAvatar.style) else: # The request to the database takes too long, so we cache off the value # everytime a new family avatar is clicked. Check this list before making a new database request. if self.doId2Dna.has_key(friendId): self.createPreviewToon(self.doId2Dna[friendId]) else: familyAvatar = DistributedToon.DistributedToon(base.cr) familyAvatar.doId = friendId # The doId is required for getAvatarDetails to work # getAvatarDetails puts a DelayDelete on the avatar, and this # is not a real DO, so bypass the 'generated' check familyAvatar.forceAllowDelayDelete() base.cr.getAvatarDetails(familyAvatar, self.__handleFamilyAvatar, "DistributedToon") else: friend = base.cr.identifyFriend(friendId) if friend: self.createPreviewToon(friend.style)
def __init__(self, cr, name, dnaName): try: self.DistributedCCharBase_initialized return except: self.DistributedCCharBase_initialized = 1 DistributedChar.DistributedChar.__init__(self, cr) if dnaName == 'riggy': dna = ToonDNA.ToonDNA() toon = DistributedToon.DistributedToon(cr) toon.setDNA(dna) toon.setName(name) else: dna = CharDNA.CharDNA() dna.newChar(dnaName) self.setDNA(dna) self.setName(name) self.setTransparency(TransparencyAttrib.MDual, 1) fadeIn = self.colorScaleInterval(0.5, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut') fadeIn.start() self.diffPath = None self.transitionToCostume = 0 self.__initCollisions() self.setBlend(frameBlend=config.GetBool('interpolate-animations', True)) return
def enterQuery(self): self.dataText['text'] = TTLocalizer.AvatarDetailPanelLookup % self.avName self.bCancel.show() self.avatar = base.cr.doId2do.get(self.avId) if self.avatar != None and not self.avatar.ghostMode: self.createdAvatar = 0 else: self.avatar = DistributedToon.DistributedToon(base.cr) self.createdAvatar = 1 self.avatar.doId = self.avId self.avatar.forceAllowDelayDelete() base.cr.getAvatarDetails(self.avatar, self.__handleAvatarDetails, 'DistributedToon')
def __chooseFriend(self, friendId, friendName): messenger.send('wakeup') if self.checkFamily(friendId): if friendId == base.localAvatar.doId: self.createPreviewToon(base.localAvatar.style) elif friendId in self.doId2Dna: self.createPreviewToon(self.doId2Dna[friendId]) else: familyAvatar = DistributedToon.DistributedToon(base.cr) familyAvatar.doId = friendId familyAvatar.forceAllowDelayDelete() base.cr.getAvatarDetails(familyAvatar, self.__handleFamilyAvatar, 'DistributedToon') else: friend = base.cr.identifyFriend(friendId) if friend: self.createPreviewToon(friend.style)
def __loadFriend(self): if self.allowGetDetails == 0: CatalogScreen.notify.warning('smashing requests') if self.frienddoId and self.allowGetDetails: if self.giftAvatar: if hasattr(self.giftAvatar, 'doId'): self.giftAvatar.disable() self.giftAvatar.delete() self.giftAvatar = None self.giftAvatar = DistributedToon.DistributedToon(base.cr) self.giftAvatar.doId = self.frienddoId self.giftAvatar.forceAllowDelayDelete() self.giftAvatar.generate() base.cr.getAvatarDetails(self.giftAvatar, self.__handleAvatarDetails, 'DistributedToon') self.gotAvatar = 0 self.allowGetDetails = 0 self.scrollList['state'] = DGG.DISABLED return
def createHolder(self): toon = DistributedToon.DistributedToon(base.cr, bFake=True) toon.forceAllowDelayDelete() return toon
def createHolder(self): toon = DistributedToon.DistributedToon(base.cr, bFake = True) # getAvatarDetails puts a DelayDelete on the avatar, and this # is not a real DO, so bypass the 'generated' check toon.forceAllowDelayDelete() return toon