I need to apply two textures to a actor’s face/head, the eye texture, and the mouth/muzzle texture, but im having a lot of trouble to make this
def loadMuzzle(self):
conkedtex = loader.loadTexture('ttr models/phase_3/maps/muzzleShortSurprised.jpg')
conkedeyetex = ('ttr models/phase_3/maps/eyesSurprised')
self.body.find('**/muzzle').setTexture(conkedtex, 1)
self.body.find('**/eyes').setTexture(conkedeyetex, 1)
self.body.find('**/eyes').setTransparency(TransparencyAttrib.MBinary, 1)
Happen within this
self.Pace = Sequence(
TWalk1, TWalk2,
Parallel(TWalkA, Tturn1, Tturn2, Walk1),
Wait(.01),
Turn1,
Parallel(TConked, Victory), #<------- in this parallel
Parallel(Ttaunt, Walk, Walk2),
Parallel(Ttaunt, Swing1),
Parallel(oof, GetHit1))
This is the full code:
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.loadModels();
self.sky = self.loader.loadModel('phase_3.5/models/props/TT_sky')
self.sky.reparentTo(self.render)
self.ttc.setTransparency(TransparencyAttrib.MBinary, 1)
self.oobe()
self.loadToon()
self.loadCog()
self.body.setPosHprScale((-16.30, 0, 0), (270, 0, 0), (1, 1, 1))
TWalk1 = self.body.posInterval(2.0, Point3(4, 0, 4))
TWalk2 = self.body.posInterval(2.0, Point3(40, 0, 4))
Tturn1 = self.body.hprInterval(4.0, Vec3(90, 0, 0))
Tturn2 = self.body.hprInterval(4.0, Vec3(-90, 0, 0))
Walk = self.Cog.actorInterval('normalwalk', duration=4, loop=1)
TWalkA = self.body.actorInterval('Walk', duration=4, loop=1)
TConked = self.body.actorInterval('conked', duration=2)
Ttaunt = self.body.actorInterval('Taunt', loop=1, duration=4.5)
Walk1 = self.Cog.posInterval(4.0, Point3(100, 0, 4))
Turn1 = self.Cog.hprInterval(.3, Vec3(80, 0, 0))
Walk2 = self.Cog.posInterval(4.0, Point3(45, 0, 4))
Swing1 = self.Cog.actorInterval('clubswing', startFrame=0, endFrame=120)
Victory = self.Cog.actorInterval('CogVictory', startFrame=0, endFrame=40)
oof = self.body.actorInterval('Slip')
GetHit1 = self.body.posInterval(.4, Point3(10, 0, 4))
self.Pace = Sequence(
TWalk1, TWalk2,
Parallel(TWalkA, Tturn1, Tturn2, Walk1),
Wait(.01),
Turn1,
Parallel(TConked, Victory),
Parallel(Ttaunt, Walk, Walk2),
Parallel(Ttaunt, Swing1),
Parallel(oof, GetHit1)
)
self.Pace.start()
self.music = None
self.accept("a", self.startMusic)
self.accept("q", self.stopMusic)
def loadModels(self):
self.ttc = loader.loadModel('phase_15/hood/toontown_central')
self.ttc.reparentTo(self.render)
def loadToon(self):
#Body
legs = Actor('ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000')
torso = Actor('ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000')
head = Actor('ttr models/phase_3/models/char/tt_a_chr_dgm_skirt_head_1000')
back = torso.find('**/def_joint_attachFlower')
botHead = head.find('**/head-front')
topHead = head.find('**/head')
self.body = Actor({'legs':legs, 'torso':torso, 'head':head},
{'legs':{'Static': 'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000','Idle': 'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_legs_neutral',
'Run':'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_legs_run','Taunt':'test/tt_a_chr_dgm_shorts_legs_taunt.bam',
'Angry': 'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_angry','Walk':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_walk',
'conked':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_legs_conked','Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_shorts_legs_slip-backward'},
'torso':{'Static': 'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000','Idle': 'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_torso_neutral',
'Run':'ttr models/phase_3/models/char/tt_a_chr_dgm_shorts_torso_run',
'Taunt':'test/tt_a_chr_dgm_shorts_torso_taunt.bam','Angry':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_angry',
'Walk':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_walk',
'conked':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_shorts_torso_conked',
'Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_shorts_torso_slip-backward'},
'head':{'Idle':'ttr models/phase_3/models/char/tt_a_chr_dgm_skirt_head_neutral',
'Run':'ttr models/phase_3/models/char/tt_a_chr_dgm_skirt_head_run','Static':'ttr models/phase_3/models/char/tt_a_chr_dgm_skirt_head_1000',
'Taunt':'test/tt_a_chr_dgm_skirt_head_taunt.bam','Angry':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_skirt_head_angry',
'Walk':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_skirt_head_walk',
'conked':'ttr models/phase_3.5/models/char/tt_a_chr_dgm_skirt_head_conked','Slip':'ttr models/phase_4/models/char/tt_a_chr_dgm_skirt_head_slip-backward'}})
self.body.attach('torso', 'legs', 'joint_hips')
self.body.attach('head', 'torso', 'def_head')
self.body.reparentTo(self.render)
self.body.loop('Static')
self.body.find('**/head-front').setColor(0, 0.8, 0.6)
self.body.find('**/head').setColor(0, 0.8, 0.6)
self.body.find('**/neck').setColor(0, 0.8, 0.6)
self.body.find('**/arms').setColor(0, 0.8, 0.6)
self.body.find('**/legs').setColor(0, 0.8, 0.6)
self.body.find('**/feet').setColor(0, 0.8, 0.6)
self.body.loop('Run')
# Shoes
Shoes = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_acc_sho_workBoots.jpg')
self.body.find('**/shoes').setTexture(Shoes, 1)
self.body.find('**/boots_long').hide()
self.body.find('**/boots_short').hide()
self.body.find('**/feet').hide()
# Hat
self.Hats = loader.loadModel('ttr models/phase_4/models/accessories/tt_m_chr_avt_acc_hat_golfHat')
self.Hats.reparentTo(self.body.find('**/head'))
self.Hats.setPosHprScale((0.0, -0.048714, 0.46431), (180.0, 323.130096, 0.0), (0.318405, 0.318405, 0.318405))
self.Hats.setColor(0.99, 0.99, 0.99)
# Glasses
self.Glasses = loader.loadModel('ttr models/phase_4/models/accessories/tt_m_chr_avt_acc_msk_squareRims')
self.Glasses.reparentTo(self.body.find('**/head-front'))
self.Glasses.setPosHprScale((0, .16996, .309818), (180, 3.814075, 0), (.265522, .220048, .277431))
self.Glasses.setColor(0.99, 0.99, 0.99)
#Backpack
self.Backpack = loader.loadModel('ttr models/phase_4/models/accessories/tt_m_chr_avt_acc_pac_gags')
self.Backpack.reparentTo(self.body.find('**/def_joint_attachFlower'))
self.Backpack.setPosHprScale((0.227545, -1.05, 0.053624), (180.0, 6.0, 0.0), (0.319532, 0.319532, 0.319532))
# Luvas/Gloves
self.Gloves = self.body.find('**/hands')
self.Gloves.setColor(0.99, 0.99, 0.99)
# Mangas/Sleeves
Sleeves = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shirtSleeve_bee.jpg')
self.body.find('**/sleeves').setTexture(Sleeves, 1)
# Camisas(camisetas)/Shirts
Shirt = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shirt_bee.jpg')
self.body.find('**/torso-top').setTexture(Shirt, 1)
# Shorts (its the same in my language)
Shorts = loader.loadTexture('ttr models/phase_4/maps/tt_t_chr_avt_shorts_playTime.jpg')
self.body.find('**/torso-bot').setTexture(Shorts, 1)
# Sombra do Toon/Toon Shadow
self.Shadow = loader.loadModel('ttr models/phase_3/models/props/drop_shadow.bam')
self.Shadow.reparentTo(self.body.find('**/joint_shadow'))
self.Shadow.setScale(.45)
self.Shadow.setColor(0, 0, 0, .5)
self.Shadow.setBin('fixed', 0, 1)
def loadCog(self):
self.Cog = Actor('ttr models/phase_3.5/models/char/suitA-mod', {'fingerwag': 'ttr models/phase_5/models/char/suitA-fingerwag',
'weirdwalk': 'ttr models/phase_5/models/char/suitA-awalk',
'normalwalk': 'ttr models/phase_4/models/char/suitA-walk',
'clubswing': 'ttr models/phase_5/models/char/suitA-golf-club-swing.bam',
'CogVictory': 'ttr models\phase_4\models\char/suitA-victory'})
self.Cog.reparentTo(self.render)
self.Cog.loop('normalwalk')
self.CogHead = loader.loadModel('ttr models/phase_4/models/char/suitA-heads.bam').find('**/bigcheese')
self.CogHead.reparentTo(self.Cog.find('**/joint_head'))
self.Cog.setPosHprScale((215.71, 37.24, 4), (180, 0, 0), (16, 16, 16))
self.Icon = loader.loadModel('ttr models/phase_3/models/gui/cog_icons').find('**/CorpIcon')
self.Icon.reparentTo(self.Cog.find('**/joint_attachMeter'))
self.Icon.setH(180)
self.Cog.setPosHprScale((102, 46, 4), (180, 0, 0), (1, 1, 1))
self.Shadow = loader.loadModel('ttr models/phase_3/models/props/drop_shadow.bam')
self.Shadow.reparentTo(self.Cog.find('**/joint_shadow'))
self.Shadow.setScale(.45)
self.Shadow.setColor(0, 0, 0, .5)
self.Shadow.setBin('fixed', 0, 1)
self.club = loader.loadModel('ttr models/phase_5/models/props/golf-club.bam')
self.club.reparentTo(self.Cog.find('**/joint_Lhold'))
def loadMuzzle(self):
conkedtex = loader.loadTexture('ttr models/phase_3/maps/muzzleShortSurprised.jpg')
conkedeyetex = ('ttr models/phase_3/maps/eyesSurprised')
self.body.find('**/muzzle').setTexture(conkedtex, 1)
self.body.find('**/eyes').setTexture(conkedeyetex, 1)
self.body.find('**/eyes').setTransparency(TransparencyAttrib.MBinary, 1)
def startMusic(self):
if self.music:
self.music.stop()
self.music.play()
else:
self.music = self.loader.loadMusic('phase_3/audio/bgm/create_a_toon.mid')
self.music.play()
def stopMusic(self):
self.music.stop()
app = MyApp()
app.run()
I also tried
intervalName = Func(loadMuzzzle)
intervalName = Func(loadMuzzle())
intervalName = Func(loadMuzzle, 0, 0)