예제 #1
0
 def Spawn(self, scene, **kwargs):
     """
     Spawns a new character into a scene.
     If 'point' is supplied, the doll will spawn at that point in world coordinates.
     If 'gender' is supplied, must be either GENDER.FEMALE or GENDER.MALE, defaults to GENDER.FEMALE
     Other arguments should be kept in args.
     """
     gender = pdDef.GENDER.FEMALE
     if 'gender' in kwargs:
         gender = kwargs['gender']
     if self.doll is None:
         self.doll = pdImpl.Doll(PaperDollCharacter.__DEFAULT_NAME,
                                 gender=gender)
     else:
         gender = self.doll.gender
     spawnLod = kwargs.get('spawnLod', False)
     usePrepass = kwargs.get('usePrepass', False)
     self.doll.SetUsePrepass(usePrepass)
     if 'lod' in kwargs and not spawnLod:
         self.doll.overrideLod = kwargs['lod']
     if self.visualModel is None:
         self.visualModel = self.factory.CreateVisualModel(gender=gender)
     self.__PrepareAvatar(scene,
                          point=kwargs.get('point'),
                          rotation=kwargs.get('rotation'))
     self.scene = scene
     self.avatar.visualModel = self.visualModel
     if spawnLod:
         networkToLoad = const.FEMALE_MORPHEME_PATH if gender == pdDef.GENDER.FEMALE else const.MALE_MORPHEME_PATH
         pdLod.SetupLODFromPaperdoll(self.avatar, self.doll, self.factory,
                                     networkToLoad)
     elif kwargs.get('updateDoll', True):
         self.doll.Update(self.factory, self.avatar)
예제 #2
0
def CreateRandomDollNoClothes(gender, bloodline, doll=None, noRandomize=False):
    from eve.client.script.ui.login.charcreation.eveDollRandomizer import EveDollRandomizer
    ml = pdDM.ModifierLoader()
    blue.synchro.Yield()
    randomizer = EveDollRandomizer(ml)
    randomizer.isNewCharacter = True
    if gender is not None:
        randomizer.gender = gender
    if bloodline is not None:
        randomizer.bloodline = bloodline
    randomizer.SetSculptingLimits()
    options = randomizer.ListOptions(None)
    if doll is not None:
        randomizer.RemoveAllOptionsByCategory(doll, options)
    else:
        import eve.client.script.paperDoll.paperDollImpl as pdImp
        doll = pdImp.Doll('randomized', gender=gender)
    for x in [pdDef.DOLL_PARTS.HEAD, pdDef.BODY_CATEGORIES.SKIN]:
        randomizer.AddCategoryForWhitelistRandomization(x)

    resourceDict = randomizer.GetResources()
    randomizer.AddRandomizedResourcesToDoll(doll, resourceDict)
    if not noRandomize:
        blendshapes = randomizer.GetBlendshapeOptions()
        del blendshapes[pdDef.DOLL_EXTRA_PARTS.BODYSHAPES]
        randomizer.AddRandomizedResourcesToDoll(doll, blendshapes)
    return doll
예제 #3
0
    def LoadFromRes(self, resPath):
        """
        Loads the doll from the given resPath and applies it to its avatar if it has one.
        """
        self.doll = pdImpl.Doll(PaperDollCharacter.__DEFAULT_NAME)
        while not self.factory.IsLoaded:
            pdCf.Yield()

        self.doll.Load(resPath, self.factory)
        if self.avatar:
            self.doll.Update(self.factory, self.avatar)
예제 #4
0
 def GetDoll(self, randomizeBlendshapes=True, doll=None):
     resourceDict = self.GetResources()
     if randomizeBlendshapes:
         blendshapeOptions = self.GetBlendshapeOptions()
     if doll is not None:
         self.RemoveAllOptionsByCategory(doll, resourceDict)
         if randomizeBlendshapes:
             self.RemoveAllOptionsByCategory(doll, blendshapeOptions)
     else:
         import eve.client.script.paperDoll.paperDollImpl as pdImp
         doll = pdImp.Doll('randomized', gender=self.GetGender())
     self.AddRandomizedResourcesToDoll(doll, resourceDict)
     if randomizeBlendshapes:
         self.AddRandomizedResourcesToDoll(doll, blendshapeOptions)
     return doll
 def GetDoll(self, randomizeBlendshapes=True, doll=None):
     """
     Returns a doll that is randomized except for constraints that have already been set.
     For instance, if gender is set manually on this instance, that value is used instead of randomizing.
     
     
     THIS METHOD SHOULDN'T BE IN COMMON SINCE IT WILL BREAK SHIT ON THE SERVER
     """
     resourceDict = self.GetResources()
     if randomizeBlendshapes:
         blendshapeOptions = self.GetBlendshapeOptions()
     if doll is not None:
         self.RemoveAllOptionsByCategory(doll, resourceDict)
         if randomizeBlendshapes:
             self.RemoveAllOptionsByCategory(doll, blendshapeOptions)
     else:
         import eve.client.script.paperDoll.paperDollImpl as pdImp
         doll = pdImp.Doll('randomized', gender=self.GetGender())
     self.AddRandomizedResourcesToDoll(doll, resourceDict)
     if randomizeBlendshapes:
         self.AddRandomizedResourcesToDoll(doll, blendshapeOptions)
     return doll
예제 #6
0
 def LoadDollFromDNA(self,
                     dollDNA,
                     dollName=None,
                     lodEnabled=True,
                     compressionSettings=None):
     """
     Loads a doll from the given dna and then applies it to its avatar if it has one.
     """
     name = dollName if dollName is not None else PaperDollCharacter.__DEFAULT_NAME
     self.doll = pdImpl.Doll(name)
     self.doll.LoadDNA(dollDNA, self.factory)
     if compressionSettings:
         self.doll.compressionSettings = compressionSettings
     if self.avatar:
         gender = pdDef.GENDER.MALE if self.doll.gender else pdDef.GENDER.FEMALE
         networkToLoad = const.FEMALE_MORPHEME_PATH if gender == pdDef.GENDER.FEMALE else const.MALE_MORPHEME_PATH
         if lodEnabled:
             uthread.worker('^PaperDollCharacter::LoadFromDNA',
                            pdLod.SetupLODFromPaperdoll, self.avatar,
                            self.doll, self.factory, networkToLoad)
         else:
             uthread.worker('^PaperDollCharacter::LoadFromDNA',
                            self.doll.Update, self.factory, self.avatar)
def CreateRandomDollNoClothes(gender, bloodline, doll=None, noRandomize=False):
    """
        WHY IS THIS FUNCTION IN COMMON?
    
        Uses the core paperDoll randomizer to make a random doll
        based on EVE constraints. Only randomizes head, skintone
        and facial sculpting, does not randomize clothes.
        Per game design, new characters should have stubble hairstyles
        and eyebrows on by default.
        Also does not randomize body sculpting.
    """
    from eve.client.script.ui.login.charcreation.eveDollRandomizer import EveDollRandomizer
    ml = pdDM.ModifierLoader()
    blue.synchro.Yield()
    randomizer = EveDollRandomizer(ml)
    randomizer.isNewCharacter = True
    if gender is not None:
        randomizer.gender = gender
    if bloodline is not None:
        randomizer.bloodline = bloodline
    randomizer.SetSculptingLimits()
    options = randomizer.ListOptions(None)
    if doll is not None:
        randomizer.RemoveAllOptionsByCategory(doll, options)
    else:
        import eve.client.script.paperDoll.paperDollImpl as pdImp
        doll = pdImp.Doll('randomized', gender=gender)
    for x in [pdDef.DOLL_PARTS.HEAD, pdDef.BODY_CATEGORIES.SKIN]:
        randomizer.AddCategoryForWhitelistRandomization(x)

    resourceDict = randomizer.GetResources()
    randomizer.AddRandomizedResourcesToDoll(doll, resourceDict)
    if not noRandomize:
        blendshapes = randomizer.GetBlendshapeOptions()
        del blendshapes[pdDef.DOLL_EXTRA_PARTS.BODYSHAPES]
        randomizer.AddRandomizedResourcesToDoll(doll, blendshapes)
    return doll