Toon: Some progress on gender

Work on removal of gender
This commit is contained in:
DarthNihilus1 2023-11-13 14:57:00 -05:00
parent a5ecbb8b1e
commit 8bc02ddc8d
5 changed files with 732 additions and 1410 deletions

View File

@ -19,13 +19,13 @@ class BodyShop(StateData.StateData):
self.legChoice = 0
self.headChoice = 0
self.speciesChoice = 0
self.eyelashesChoice = 0
return
def enter(self, toon, shopsVisited = []):
base.disableMouse()
self.toon = toon
self.dna = self.toon.getStyle()
gender = self.toon.style.getGender()
self.speciesStart = self.getSpeciesStart()
self.speciesChoice = self.speciesStart
self.headStart = 0
@ -34,17 +34,16 @@ class BodyShop(StateData.StateData):
self.torsoChoice = ToonDNA.toonTorsoTypes.index(self.dna.torso) % 3
self.legStart = 0
self.legChoice = ToonDNA.toonLegTypes.index(self.dna.legs)
self.eyelashesStart = 0
self.eyelashesChoice = 0
if CLOTHESSHOP in shopsVisited:
self.clothesPicked = 1
else:
self.clothesPicked = 0
self.clothesPicked = 1
if gender == 'm' or ToonDNA.GirlBottoms[self.dna.botTex][1] == ToonDNA.SHORTS:
torsoStyle = 's'
torsoPool = ToonDNA.toonTorsoTypes[:3]
else:
torsoStyle = 'd'
torsoPool = ToonDNA.toonTorsoTypes[3:6]
torsoStyle = 'd'
torsoPool = ToonDNA.toonTorsoTypes[3:6]
self.__swapSpecies(0)
self.__swapHead(0)
self.__swapTorso(0)
@ -179,60 +178,39 @@ class BodyShop(StateData.StateData):
self.ignore('MAT-newToonCreated')
def __swapTorso(self, offset):
gender = self.toon.style.getGender()
if not self.clothesPicked:
length = len(ToonDNA.toonTorsoTypes[6:])
torsoOffset = 6
elif gender == 'm':
length = len(ToonDNA.toonTorsoTypes[:3])
length = len(ToonDNA.toonTorsoTypes[3:6])
if self.toon.style.torso[1] == 'd':
torsoOffset = 3
else:
torsoOffset = 0
if self.dna.armColor not in ToonDNA.defaultBoyColorList:
self.dna.armColor = ToonDNA.defaultBoyColorList[0]
if self.dna.legColor not in ToonDNA.defaultBoyColorList:
self.dna.legColor = ToonDNA.defaultBoyColorList[0]
if self.dna.headColor not in ToonDNA.defaultBoyColorList:
self.dna.headColor = ToonDNA.defaultBoyColorList[0]
if self.toon.style.topTex not in ToonDNA.MakeAToonBoyShirts:
randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
self.toon.style.topTex = shirtTex
self.toon.style.topTexColor = shirtColor
self.toon.style.sleeveTex = sleeveTex
self.toon.style.sleeveTexColor = sleeveColor
if self.toon.style.botTex not in ToonDNA.MakeAToonBoyBottoms:
botTex, botTexColor = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON)
if self.dna.armColor not in ToonDNA.defaultColorList:
self.dna.armColor = ToonDNA.defaultColorList[0]
if self.dna.legColor not in ToonDNA.defaultColorList:
self.dna.legColor = ToonDNA.defaultColorList[0]
if self.dna.headColor not in ToonDNA.defaultColorList:
self.dna.headColor = ToonDNA.defaultColorList[0]
if self.toon.style.topTex not in ToonDNA.MakeAToonShirts:
randomShirt = ToonDNA.getRandomTop(ToonDNA.MAKE_A_TOON)
shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
self.toon.style.topTex = shirtTex
self.toon.style.topTexColor = shirtColor
self.toon.style.sleeveTex = sleeveTex
self.toon.style.sleeveTexColor = sleeveColor
if self.toon.style.botTex not in ToonDNA.MakeAToonBottoms:
if self.toon.style.torso[1] == 'd':
botTex, botTexColor = ToonDNA.getRandomBottom(ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SKIRT)
self.toon.style.botTex = botTex
self.toon.style.botTexColor = botTexColor
else:
length = len(ToonDNA.toonTorsoTypes[3:6])
if self.toon.style.torso[1] == 'd':
torsoOffset = 3
else:
botTex, botTexColor = ToonDNA.getRandomBottom(ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SHORTS)
self.toon.style.botTex = botTex
self.toon.style.botTexColor = botTexColor
torsoOffset = 0
if self.dna.armColor not in ToonDNA.defaultGirlColorList:
self.dna.armColor = ToonDNA.defaultGirlColorList[0]
if self.dna.legColor not in ToonDNA.defaultGirlColorList:
self.dna.legColor = ToonDNA.defaultGirlColorList[0]
if self.dna.headColor not in ToonDNA.defaultGirlColorList:
self.dna.headColor = ToonDNA.defaultGirlColorList[0]
if self.toon.style.topTex not in ToonDNA.MakeAToonGirlShirts:
randomShirt = ToonDNA.getRandomTop(gender, ToonDNA.MAKE_A_TOON)
shirtTex, shirtColor, sleeveTex, sleeveColor = randomShirt
self.toon.style.topTex = shirtTex
self.toon.style.topTexColor = shirtColor
self.toon.style.sleeveTex = sleeveTex
self.toon.style.sleeveTexColor = sleeveColor
if self.toon.style.botTex not in ToonDNA.MakeAToonGirlBottoms:
if self.toon.style.torso[1] == 'd':
botTex, botTexColor = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SKIRT)
self.toon.style.botTex = botTex
self.toon.style.botTexColor = botTexColor
torsoOffset = 3
else:
botTex, botTexColor = ToonDNA.getRandomBottom(gender, ToonDNA.MAKE_A_TOON, girlBottomType=ToonDNA.SHORTS)
self.toon.style.botTex = botTex
self.toon.style.botTexColor = botTexColor
torsoOffset = 0
self.torsoChoice = (self.torsoChoice + offset) % length
self.__updateScrollButtons(self.torsoChoice, length, self.torsoStart, self.torsoLButton, self.torsoRButton)
torso = ToonDNA.toonTorsoTypes[torsoOffset + self.torsoChoice]
@ -280,6 +258,20 @@ class BodyShop(StateData.StateData):
self.toon.swapToonColor(self.dna)
self.restrictHeadType(newHead)
def __swapEyelashes(self, offset):
length = len([0,1])
self.eyelashesChoice = (self.eyelashesChoice + offset ) % length
self.__updateScrollButtons(self.eyelashesChoice, length, self.eyelashesStart,
self.eyelashesLButton, self.eyelashesRButton)
self.eyelashes = [0, 1][self.eyelashesChoice]
self.__updateEyelashes()
def __updateEyelashes(self):
return
#WIP
#TODO figure out what toggles eyelashes and use the model head based on if they want eyelashes or not
self.__updateScrollButtons(self.eyelashesChoice, len([0, 1]), self.eyelashesStart,
self.eyelashesLButton, self.eyelashesRButton)
def __updateScrollButtons(self, choice, length, start, lButton, rButton):
if choice == (start - 1) % length:
rButton['state'] = DGG.DISABLED

View File

@ -1,118 +0,0 @@
from panda3d.core import *
from direct.fsm import StateData
from direct.gui.DirectGui import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from toontown.toon import ToonDNA
from toontown.toon import Toon
from .MakeAToonGlobals import *
from direct.directnotify import DirectNotifyGlobal
import random
class GenderShop(StateData.StateData):
notify = DirectNotifyGlobal.directNotify.newCategory('GenderShop')
def __init__(self, makeAToon, doneEvent):
StateData.StateData.__init__(self, doneEvent)
self.shopsVisited = []
self.toon = None
self.gender = 'm'
self.makeAToon = makeAToon
return
def enter(self):
base.disableMouse()
self.accept('next', self.__handleForward)
return None
def showButtons(self):
return None
def exit(self):
self.ignore('next')
def load(self):
gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
guiBoyUp = gui.find('**/tt_t_gui_mat_boyUp')
guiBoyDown = gui.find('**/tt_t_gui_mat_boyDown')
guiGirlUp = gui.find('**/tt_t_gui_mat_girlUp')
guiGirlDown = gui.find('**/tt_t_gui_mat_girlDown')
self.boyButton = DirectButton(relief=None, image=(guiBoyUp,
guiBoyDown,
guiBoyUp,
guiBoyDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.4, 0, -0.8), command=self.createRandomBoy, text=('',
TTLocalizer.GenderShopBoyButtonText,
TTLocalizer.GenderShopBoyButtonText,
''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, 0.19), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
self.boyButton.hide()
self.girlButton = DirectButton(relief=None, image=(guiGirlUp,
guiGirlDown,
guiGirlUp,
guiGirlDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(0.4, 0, -0.8), command=self.createRandomGirl, text=('',
TTLocalizer.GenderShopGirlButtonText,
TTLocalizer.GenderShopGirlButtonText,
''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, 0.19), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
self.girlButton.hide()
gui.removeNode()
del gui
self.toon = None
return
def unload(self):
self.boyButton.destroy()
self.girlButton.destroy()
del self.boyButton
del self.girlButton
if self.toon:
self.toon.delete()
self.makeAToon = None
return
def setGender(self, choice):
self.__setGender(choice)
def __setGender(self, choice):
self.gender = 'm'
if self.toon:
self.gender = self.toon.style.gender
messenger.send(self.doneEvent)
def hideButtons(self):
self.boyButton.hide()
self.girlButton.hide()
def showButtons(self):
self.boyButton.show()
self.girlButton.show()
def createRandomBoy(self):
self._createRandomToon('m')
def createRandomGirl(self):
self._createRandomToon('f')
def _createRandomToon(self, gender):
if self.toon:
self.toon.stopBlink()
self.toon.stopLookAroundNow()
self.toon.delete()
self.dna = ToonDNA.ToonDNA()
self.dna.newToonRandom(gender=gender, stage=1)
self.toon = Toon.Toon()
self.toon.setDNA(self.dna)
self.toon.useLOD(1000)
self.toon.setNameVisible(0)
self.toon.startBlink()
self.toon.startLookAround()
self.toon.reparentTo(render)
self.toon.setPos(self.makeAToon.toonPosition)
self.toon.setHpr(self.makeAToon.toonHpr)
self.toon.setScale(self.makeAToon.toonScale)
self.toon.loop('neutral')
self.makeAToon.setNextButtonState(DGG.NORMAL)
self.makeAToon.setToon(self.toon)
messenger.send('MAT-newToonCreated')
def __handleForward(self):
self.doneStatus = 'next'
messenger.send(self.doneEvent)

View File

@ -18,7 +18,6 @@ from .MakeAToonGlobals import *
from direct.interval.IntervalGlobal import *
from direct.directnotify import DirectNotifyGlobal
from toontown.toontowngui import TTDialog
from . import GenderShop
from . import BodyShop
from . import ColorShop
from . import MakeClothesGUI
@ -53,24 +52,22 @@ class MakeAToon(StateData.StateData):
self.namelessPotAv = av
self.nameList.append(av.name)
self.fsm = ClassicFSM.ClassicFSM('MakeAToon', [State.State('Init', self.enterInit, self.exitInit, ['GenderShop', 'NameShop']),
State.State('GenderShop', self.enterGenderShop, self.exitGenderShop, ['BodyShop']),
State.State('BodyShop', self.enterBodyShop, self.exitBodyShop, ['GenderShop', 'ColorShop']),
self.fsm = ClassicFSM.ClassicFSM('MakeAToon', [State.State('Init', self.enterInit, self.exitInit, ['BodyShop', 'NameShop']),
State.State('BodyShop', self.enterBodyShop, self.exitBodyShop, ['ColorShop']),
State.State('ColorShop', self.enterColorShop, self.exitColorShop, ['BodyShop', 'ClothesShop']),
State.State('ClothesShop', self.enterClothesShop, self.exitClothesShop, ['ColorShop', 'NameShop']),
State.State('NameShop', self.enterNameShop, self.exitNameShop, ['ClothesShop']),
State.State('Done', self.enterDone, self.exitDone, [])], 'Init', 'Done')
self.parentFSM = parentFSM
self.parentFSM.getStateNamed('createAvatar').addChild(self.fsm)
self.gs = GenderShop.GenderShop(self, 'GenderShop-done')
self.bs = BodyShop.BodyShop('BodyShop-done')
self.cos = ColorShop.ColorShop('ColorShop-done')
self.cls = MakeClothesGUI.MakeClothesGUI('ClothesShop-done')
self.ns = NameShop.NameShop(self, 'NameShop-done', avList, index, self.isPaid)
self.shop = GENDERSHOP
self.shop = BODYSHOP
self.shopsVisited = []
if self.warp:
self.shopsVisited = [GENDERSHOP,
self.shopsVisited = [
BODYSHOP,
COLORSHOP,
CLOTHESSHOP]
@ -113,7 +110,7 @@ class MakeAToon(StateData.StateData):
self.guiLastButton.hide()
self.fsm.request('NameShop')
else:
self.fsm.request('GenderShop')
self.fsm.request('BodyShop')
def exit(self):
base.camLens.setFov(ToontownGlobals.DefaultCameraFov)
@ -246,7 +243,6 @@ class MakeAToon(StateData.StateData):
self.toon.setNameVisible(0)
self.toon.startBlink()
self.toon.startLookAround()
self.gs.load()
self.bs.load()
self.cos.load()
self.cls.load()
@ -268,12 +264,10 @@ class MakeAToon(StateData.StateData):
if self.toon:
self.toon.stopBlink()
self.toon.stopLookAroundNow()
self.gs.unload()
self.bs.unload()
self.cos.unload()
self.cls.unload()
self.ns.unload()
del self.gs
del self.bs
del self.cos
del self.cls
@ -377,9 +371,7 @@ class MakeAToon(StateData.StateData):
def goToNextShop(self):
self.progressing = 1
if self.shop == GENDERSHOP:
self.fsm.request('BodyShop')
elif self.shop == BODYSHOP:
if self.shop == BODYSHOP:
self.fsm.request('ColorShop')
elif self.shop == COLORSHOP:
self.fsm.request('ClothesShop')
@ -388,9 +380,7 @@ class MakeAToon(StateData.StateData):
def goToLastShop(self):
self.progressing = 0
if self.shop == BODYSHOP:
self.fsm.request('GenderShop')
elif self.shop == COLORSHOP:
if self.shop == COLORSHOP:
self.fsm.request('BodyShop')
elif self.shop == CLOTHESSHOP:
self.fsm.request('ColorShop')
@ -408,38 +398,9 @@ class MakeAToon(StateData.StateData):
def exitInit(self):
pass
def enterGenderShop(self):
base.cr.centralLogger.writeClientEvent('MAT - enteringGenderShop')
self.shop = GENDERSHOP
if GENDERSHOP not in self.shopsVisited:
self.shopsVisited.append(GENDERSHOP)
self.genderWalls.reparentTo(self.squishJoint)
self.genderProps.reparentTo(self.propJoint)
self.roomSquishActor.pose('squish', 0)
self.guiNextButton['state'] = DGG.DISABLED
else:
self.dropRoom(self.genderWalls, self.genderProps)
self.guiTopBar['text'] = TTLocalizer.CreateYourToonTitle
self.guiTopBar['text_fg'] = (1, 0.92, 0.2, 1)
self.guiTopBar['text_scale'] = TTLocalizer.MATenterGenderShop
base.transitions.fadeIn()
self.accept('GenderShop-done', self.__handleGenderShopDone)
self.gs.enter()
self.guiNextButton.show()
self.gs.showButtons()
self.rotateLeftButton.hide()
self.rotateRightButton.hide()
def exitGenderShop(self):
self.squishRoom(self.genderWalls)
self.squishProp(self.genderProps)
self.gs.exit()
self.ignore('GenderShop-done')
def __handleGenderShopDone(self):
self.guiNextButton.hide()
self.gs.hideButtons()
self.goToNextShop()
def bodyShopOpening(self):
self.bs.showButtons()

View File

@ -925,11 +925,11 @@ class Toon(Avatar.Avatar, ToonHead):
def generateToonClothes(self, fromNet = 0):
swappedTorso = 0
if self.hasLOD():
if self.style.getGender() == 'f' and fromNet == 0:
if fromNet == 0:
try:
bottomPair = ToonDNA.GirlBottoms[self.style.botTex]
bottomPair = ToonDNA.Bottoms[self.style.botTex]
except:
bottomPair = ToonDNA.GirlBottoms[0]
bottomPair = ToonDNA.Bottoms[0]
if len(self.style.torso) < 2:
self.sendLogSuspiciousEvent('nakedToonDNA %s was requested' % self.style.torso)
@ -972,25 +972,19 @@ class Toon(Avatar.Avatar, ToonHead):
except:
sleeveColor = ToonDNA.ClothesColors[0]
if self.style.getGender() == 'm':
try:
texName = ToonDNA.BoyShorts[self.style.botTex]
except:
texName = ToonDNA.BoyShorts[0]
else:
try:
texName = ToonDNA.GirlBottoms[self.style.botTex][0]
except:
texName = ToonDNA.GirlBottoms[0][0]
try:
texName = ToonDNA.Bottoms[self.style.botTex][0]
except:
texName = ToonDNA.Bottoms[0][0]
bottomTex = loader.loadTexture(texName, okMissing=True)
if bottomTex is None:
self.sendLogSuspiciousEvent('failed to load texture %s' % texName)
if self.style.getGender() == 'm':
bottomTex = loader.loadTexture(ToonDNA.BoyShorts[0])
else:
bottomTex = loader.loadTexture(ToonDNA.GirlBottoms[0][0])
bottomTex = loader.loadTexture(ToonDNA.Bottoms[0][0])
bottomTex.setMinfilter(Texture.FTLinearMipmapLinear)
bottomTex.setMagfilter(Texture.FTLinear)
try:

File diff suppressed because it is too large Load Diff