Beispiel #1
0
 def __PrepareAvatar(self, scene, point = None, rotation = None):
     if scene is None:
         raise ValueError('None type passed as scene to paperDoll::__PrepareAvatar!')
     oldAnimation = None
     sceneTypesDifferent = getattr(self.scene, '__typename__', None) != getattr(scene, '__typename__', None)
     if self.avatar:
         oldAnimation = self.avatar.animationUpdater
         if self.scene:
             self.factory.RemoveAvatarFromScene(self.avatar, self.scene)
         if sceneTypesDifferent:
             PD.AbortAllLod(self.avatar)
             del self.avatar
     if type(scene) in (trinity.Tr2InteriorScene, trinity.WodBakingScene) and type(self.scene) is not type(scene):
         self.avatar = trinity.Tr2IntSkinnedObject()
         self.doll.avatarType = 'interior'
     self.factory.AddAvatarToScene(self.avatar, scene)
     if point:
         self.avatar.translation = point
     if rotation:
         self.avatar.rotation = rotation
         self.avatar.animationUpdater = oldAnimation
     if getattr(self.avatar.animationUpdater, 'network', None):
         if self.doll.gender == PD.GENDER.MALE and self.avatar.animationUpdater.network.GetAnimationSetCount() > 1:
             self.avatar.animationUpdater.network.SetAnimationSetIndex(1)
         else:
             self.avatar.animationUpdater.network.SetAnimationSetIndex(0)
Beispiel #2
0
 def ConvertToInterior(triObject, resPath):
     returnObject = trinity.Tr2IntSkinnedObject()
     returnObject.visualModel = triObject.visualModel
     returnObject.animationUpdater = triObject.animationUpdater
     returnObject.lowDetailModel = triObject.lowDetailModel
     returnObject.mediumDetailModel = triObject.mediumDetailModel
     returnObject.highDetailModel = triObject.highDetailModel
     return returnObject
Beispiel #3
0
    def __CreateNudeAvatar(self, doll):
        if doll.gender == PD.GENDER.FEMALE:
            genderPath = self.femalePath
        else:
            genderPath = self.malePath
        self._gender = doll.gender
        avatar = trinity.Tr2IntSkinnedObject()
        avatar.visualModel = self.factory.CreateVisualModel(doll.gender)
        avatar.name = 'TattooBakingAvatar'
        bodyParts = []
        for nudePartModularPath in PD.DEFAULT_NUDE_PARTS:
            bodyPartTuple = None
            if PD.DOLL_PARTS.HEAD in nudePartModularPath:
                headMods = doll.buildDataManager.GetModifiersByCategory(
                    PD.DOLL_PARTS.HEAD)
                if headMods:
                    headMod = doll.buildDataManager.GetModifiersByCategory(
                        PD.DOLL_PARTS.HEAD)[0]
                    if headMod.redfile:
                        bodyPartTuple = (headMod.name,
                                         blue.resMan.LoadObject(
                                             headMod.redfile))
            if not bodyPartTuple:
                mod = self.factory.CollectBuildData(self._gender,
                                                    nudePartModularPath)
                bodyPartTuple = (mod.name, blue.resMan.LoadObject(mod.redfile))
            bodyParts.append(bodyPartTuple)

        PD.BeFrameNice()
        for bodyPartTuple in bodyParts:
            modname, bodyPart = bodyPartTuple
            if bodyPart:
                for mesh in bodyPart.meshes:
                    mesh.name = modname
                    if len(mesh.opaqueAreas) > 0:
                        areasCount = mesh.GetAreasCount()
                        for i in xrange(areasCount):
                            areas = mesh.GetAreas(i)
                            if areas and areas != mesh.opaqueAreas:
                                del areas[:]

                        avatar.visualModel.meshes.append(mesh)

        self.__avatar = avatar
        self.__DoBlendShapes(doll)
        if doll.gender == PD.GENDER.FEMALE:
            bindPose = self.femaleBindPose
        else:
            bindPose = self.maleBindPose
        avatar.animationUpdater = bindPose
        clip = bindPose.grannyRes.GetAnimationName(0)
        bindPose.PlayAnimationEx(clip, 0, 0, 0)
        avatar.ResetAnimationBindings()
        bindPose.EndAnimation()