FANDOM


ToonMedClothingDisplay_v2_pub1.py

'''
author: Dyna/[REDACTED]
date started: 2017_11_04_November
simplified 2019_03_07_March for public release
Python programming

purpose: 
This program was made to show shirts and shorts on Toontown's 3D clothing models.
This should make it easy to make pictures similar to the following:
http://toontownrewritten.wikia.com/wiki/File:Extraordinaire_Jacket.png
http://toontownrewritten.wikia.com/wiki/File:Extraordinaire_Jacket_Back.png
http://toontownrewritten.wikia.com/wiki/File:Extraordinaire_Shorts.png
http://toontownrewritten.wikia.com/wiki/File:Extraordinaire_Shorts_Back.png
It should be a little less creepy than mannequins at the mall.
Man, I'm glad they cut the heads off so those mannequins don't come to life.

tutorials:
https://www.reddit.com/r/Toontown/comments/54mpfh/toontown_toon_model_export_with_clothes/
http://xdar1d.tumblr.com/post/83997644958/panda3d-dog-tutorial-pype
http://www.afterhoursprogramming.com/tutorial/Python/Comments/
https://www.youtube.com/watch?v=XcAeDddqAdo
Panda3D Tutorial Ep. 4: Actors
Sam's Gaming
Published on Oct 14, 2016


Settings for the Placer Panel
Relative Y:
7.50

Relative H:
180
0
'''

from direct.actor.Actor import Actor
from pandac.PandaModules import *
from direct.task import Task
import math
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3
from pandac.PandaModules import *

import direct.directbase.DirectStart
from panda3d.core import CollisionTraverser,CollisionNode
from panda3d.core import CollisionHandlerQueue,CollisionRay
from panda3d.core import Filename,AmbientLight,DirectionalLight
from panda3d.core import PandaNode,NodePath,Camera,TextNode
from panda3d.core import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.showbase.DirectObject import DirectObject
import direct.directbase.DirectStart
from panda3d.core import ColorAttrib

ToonMedClothingDisplay = Actor(

{
#Torso
#To change the size of the Torso, here are the sizes you can choose from:
#Small = "dgs", Medium = "dgm", Long/Tall: "dgl"
#Replace "dgl" with what size you want.
#If you want a boy toon, replace "skirt" with "shorts".
"torso":"phase_3/models/char/tt_a_chr_dgm_shorts_torso_1000.bam",

#Legs
#To change the size of the legs, repeat the same thing as before:
#Short = "dgs", Medium = "dgm", Tall = "dgl"
#Replace "dgm" with what size you want
#If you want a girl toon, you don't need to change the "shorts" to "skirt", it's the same thing.
"legs":"phase_3/models/char/tt_a_chr_dgm_shorts_legs_1000.bam",

},

#Animations

#Make sure the torso size, and legs are the same as the Actor (Dog)

{

#"head":{"neutral":"phase_3/models/char/tt_a_chr_dgm_skirt_head_neutral.bam"},
"torso":{"neutral":"phase_3/models/char/tt_a_chr_dgm_shorts_torso_run.bam"},
"legs":{"neutral":"phase_3/models/char/tt_a_chr_dgm_shorts_legs_run.bam"}})

#Attach the parts
#ToonMedClothingDisplay.attach("head", "torso", "def_head")
ToonMedClothingDisplay.attach("torso", "legs", "joint_hips")

#Loop Animation
#ToonMedClothingDisplay.loop('neutral')

#Render
#ToonMedClothingDisplay.setAlphaScale(.1)

ToonMedClothingDisplay.reparentTo(render)


#Find Parts
feet = ToonMedClothingDisplay.find('**/feet') #add .removeNode() if you want shoes, if not keep it like it is
legs = ToonMedClothingDisplay.find('**/legs')
neck = ToonMedClothingDisplay.find('**/neck')
arms = ToonMedClothingDisplay.find('**/arms')
head = ToonMedClothingDisplay.find('**/head')
backhead = ToonMedClothingDisplay.find('**/head-front')

#Set Glove Color
hands = ToonMedClothingDisplay.find('**/hands').setColor(1, 1, 1, 1)


#Load Clothing Textures
ToonMedClothingDisplay.shirt = loader.loadTexture ("phase_4/maps/tt_t_chr_shirt_scientistC.jpg")
ToonMedClothingDisplay.sleeves = loader.loadTexture ("phase_4/maps/tt_t_chr_shirtSleeve_scientist.jpg")
ToonMedClothingDisplay.shorts = loader.loadTexture ("phase_4/maps/tt_t_chr_shorts_scientistA.jpg")

#ttrold/2017_10_17_October/phase_4/maps/tt_t_chr_avt_shirt_sellbotCrusher.jpg
#ttrold/2017_10_17_October/phase_4/maps/tt_t_chr_avt_shirtSleeve_sellbotCrusher.jpg
#ttrold/2017_10_17_October/phase_4/maps/tt_t_chr_avt_shorts_sellbotCrusher.jpg
#ttrold/2017_10_17_October/phase_4/maps/tt_t_chr_avt_skirt_sellbotCrusher.jpg

#ttrold/2014_06_05_June/phase_4/maps/tt_t_chr_avt_shirt_sora.jpg
#ttrold/2014_06_05_June/phase_4/maps/tt_t_chr_avt_shirtSleeve_sora.jpg
#ttrold/2014_06_05_June/phase_4/maps/tt_t_chr_avt_shorts_sora.jpg


#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shirtSleeve_scientist.jpg

#Outfit Male scientistDD DogCat 180.png
#Fissionton
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shirt_scientistD.jpg
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shorts_scientistD.jpg

#Outfit Male scientistAB Monkey 180.png
#Surlee
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shirt_scientistA.jpg
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shorts_scientistB.jpg

#Outfit Male scientistCA Horse 180.png
#Prepostera
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shirt_scientistC.jpg
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shorts_scientistA.jpg

#Outfit Male scientistBC Duck 180.png
#Dimm
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shirt_scientistB.jpg
#ttrold/2018_04_02_April/phase_4/maps/tt_t_chr_shorts_scientistC.jpg


#ttr_t_chr_avt_shirt_bronzeCroc.jpg
#ttr_t_chr_avt_shirt_bronzeDeer.jpg
#ttr_t_chr_avt_shirtSleeve_bronze.jpg
#ttr_t_chr_avt_shirt_goldCroc.jpg
#ttr_t_chr_avt_shirt_goldDeer.jpg
#ttr_t_chr_avt_shirtSleeve_gold.jpg
#ttr_t_chr_avt_shirt_silverCroc.jpg
#ttr_t_chr_avt_shirt_silverDeer.jpg
#ttr_t_chr_avt_shirtSleeve_silver.jpg



#winter_14_2.jpg
#desat_shirt_5.jpg
#desat_sleeve_5.jpg
#CowboyShirt4.jpg
#CowboySleeve4.jpg

#Set Clothing Textures
shirt = ToonMedClothingDisplay.find('**/torso-top').setTexture(ToonMedClothingDisplay.shirt, 1)
sleeves = ToonMedClothingDisplay.find('**/sleeves').setTexture(ToonMedClothingDisplay.sleeves, 1)
shorts = ToonMedClothingDisplay.find('**/torso-bot').setTexture(ToonMedClothingDisplay.shorts, 1)

#If you'd like to change colors for clothing if you use different clothes use something like this for example:
#Set Clothing Color
#shirt = ToonMedClothingDisplay.find('**/torso-top').setColor(0.460938, 0.378906, 0.824219, 1.0)
#sleeves = ToonMedClothingDisplay.find('**/sleeves').setColor(0.460938, 0.378906, 0.824219, 1.0)
# shorts = ToonMedClothingDisplay.find('**/torso-bot').setColor(0.863281, 0.40625, 0.417969, 1.0)

#Set Transparency
ToonMedClothingDisplay.setTransparency(TransparencyAttrib.MAlpha)
#ToonMedClothingDisplay.setColorScale(1.0, 1.0, 1.0, 0.5)
ToonMedClothingDisplay.setColorScale(1.0, 1.0, 1.0, 1.0)

#Remove limbs/shoes/boots
ToonMedClothingDisplay.find('**/feet').removeNode()
ToonMedClothingDisplay.find('**/legs').removeNode()
ToonMedClothingDisplay.find('**/shoes').removeNode()
ToonMedClothingDisplay.find('**/boots_short').removeNode()
ToonMedClothingDisplay.find('**/boots_long').removeNode()

ToonMedClothingDisplay.find('**/hands').removeNode()
ToonMedClothingDisplay.find('**/arms').removeNode()
ToonMedClothingDisplay.find('**/neck').removeNode()


#Remove Shoes/Boots (If you want shoes, remember to remove the #'s:

#shoes = loader.loadTexture ("phase_4/maps/tt_t_chr_avt_acc_sho_converseStyleBlack.jpg")
#ToonMedClothingDisplay.find('**/boots_long').removeNode()
#ToonMedClothingDisplay.find('**/shoes').removeNode()
#ToonMedClothingDisplay.find('**/boots_short')
#ToonMedClothingDisplay.find('**/boots_short').setTexture(shoes, 1)

#Toon Color

#Here's the toon colors:
#White (1.0, 1.0, 1.0, 1.0)
#Peach (0.96875, 0.691406, 0.699219, 1.0)
#Bright Red (0.933594, 0.265625, 0.28125, 1.0)
#Red (0.863281, 0.40625, 0.417969, 1.0)
#Maroon (0.710938, 0.234375, 0.4375, 1.0)
#Sienna (0.570312, 0.449219, 0.164062, 1.0)
#Brown (0.640625, 0.355469, 0.269531, 1.0)
#Tan (0.996094, 0.695312, 0.511719, 1.0)
#Coral (0.832031, 0.5, 0.296875, 1.0)
#Orange (0.992188, 0.480469, 0.167969, 1.0)
#Yellow (0.996094, 0.898438, 0.320312, 1.0)
#Cream (0.996094, 0.957031, 0.597656, 1.0)
#Citrine (0.855469, 0.933594, 0.492188, 1.0)
#Lime Green (0.550781, 0.824219, 0.324219, 1.0)
#Sea Green (0.242188, 0.742188, 0.515625, 1.0)
#Green (0.304688, 0.96875, 0.402344, 1.0)
#Light Blue (0.433594, 0.90625, 0.835938, 1.0)
#Aqua (0.347656, 0.820312, 0.953125, 1.0)
#Blue (0.191406, 0.5625, 0.773438, 1.0)
#Periwinkle (0.558594, 0.589844, 0.875, 1.0)
#Royal Blue (0.285156, 0.328125, 0.726562, 1.0)
#Slate Blue (0.460938, 0.378906, 0.824219, 1.0)
#Purple (0.546875, 0.28125, 0.75, 1.0)
#Lavender (0.726562, 0.472656, 0.859375, 1.0)
#Pink (0.898438, 0.617188, 0.90625, 1.0)
#Gray (0.7, 0.7, 0.8, 1.0)
#Black (0.3, 0.3, 0.35, 1.0)

#Toon Colors
#arms.setColor(0.285156, 0.328125, 0.726562, 1.0)
#legs.setColor(0.285156, 0.328125, 0.726562, 1.)
#neck.setColor(0.285156, 0.328125, 0.726562, 1.0)
#backhead.setColor(0.285156, 0.328125, 0.726562, 1.0)
#head.setColor(0.285156, 0.328125, 0.726562, 1.0)
#feet.setColor(0.285156, 0.328125, 0.726562, 1.0) #remove this if you want shoes


ToonMedClothingDisplay.place()

#ToonMedClothingDisplay.setPlayRate(0.001, 'neutral')
#ToonMedClothingDisplay.pose('neutral', -0)

print ToonMedClothingDisplay.getNumFrames('neutral')

#Camera
base.cam.setZ(2.75)

base.disableMouse()
base.useDrive()
base.useTrackball()


#shadow = loader.loadModel("phase_3/models/props/drop_shadow.bam")
#shadow.reparentTo(render)
#shadow.reparentTo(ToonMedClothingDisplay.find('**/joint_shadow'))
#shadow.setSx(0.5)
#shadow.setSy(0.5)

run()


Output

Community content is available under CC-BY-SA unless otherwise noted.