Skip to content

Instantly share code, notes, and snippets.

@AskAlice
Created September 27, 2016 00:24
Show Gist options
  • Save AskAlice/d49456ebfd260622a63f7aa94d6ec421 to your computer and use it in GitHub Desktop.
Save AskAlice/d49456ebfd260622a63f7aa94d6ec421 to your computer and use it in GitHub Desktop.
#Tutorial made by Mayday Parade (xDar1D)
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
dog = Actor(
#Dog Actor
#Head (Don’t change skirt to head even if it’s a boy, only applies to dog toons)
{“head”:”phase/models/char/tt_a_chr_dgm_skirt_head_1000.bam”,
#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/models/char/tt_a_chr_dgl_skirt_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/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)
{“torso”:{“neutral”:”phase/models/char/tt_a_chr_dgl_skirt_torso_neutral.bam”},
“legs”:{“neutral”:“phase/models/char/tt_a_chr_dgm_shorts_legs_neutral.bam”}})
#Attach the parts
dog.attach(“head”, “torso”, “def_head”)
dog.attach(“torso”, “legs”, “joint_hips”)
#Loop Animation
dog.loop(‘neutral’, ‘torso’)
dog.loop(‘neutral’, ‘legs’)
#Render
dog.reparentTo(render)
#Eyelashes (If you want a girl dog add this entire code), if you want a boy dog remove it
eyelashes = loader.loadModel (‘phase/models/char/dog-lashes.bam’)
eyes = dog.find(‘**/eyes’)
eyelashes.find(‘**/closed-long’).removeNode()
eyelashes.find(‘**/closed-short’).removeNode()
eyelashes.find(‘**/open-long’)
eyelashes.find(‘**/open-short’).removeNode()
eyelashes.reparentTo(eyes)
#Find Parts
feet = dog.find(‘**/feet’) #add .removeNode() if you want shoes, if not keep it like it is
legs = dog.find(‘**/legs’)
neck = dog.find(‘**/neck’)
arms = dog.find(‘**/arms’)
head = dog.find(‘**/head’)
backhead = dog.find(‘**/head-front’)
#Set Glove Color
hands = dog.find(‘**/hands’).setColor(1, 1, 1, 1)
#Load Clothing Textures
dog.shirt = loader.loadTexture (“phase/maps/shirt_Cat7_02.jpg”)
dog.sleeves = loader.loadTexture (“phase/maps/shirt_sleeveCat7_02.jpg”)
dog.shorts = loader.loadTexture (“phase/maps/desat_skirt_7.jpg”)
#Set Clothing Textures
shirt = dog.find(‘**/torso-top’).setTexture(dog.shirt, 1)
sleeves = dog.find(‘**/sleeves’).setTexture(dog.sleeves, 1)
shorts = dog.find(‘**/torso-bot’).setTexture(dog.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 = dog.find(‘**/torso-top’).setColor(0.863281, 0.40625, 0.417969, 1.0)
# sleeves = dog.find(‘**/sleeves’).setColor(0.863281, 0.40625, 0.417969, 1.0)
# shorts = dog.find(‘**/torso-bot’).setColor(0.863281, 0.40625, 0.417969, 1.0)
#Remove Shoes/Boots (If you want shoes, do (remember to remove the #):
#shoes = loader.loadTexture (“phase/maps/tt_t_chr_avt_acc_sho_winterBootsBeige.jpg”)
#dog.find(‘**/boots_long’)
#dog.find(‘**/shoes’).removeNode()
#dog.find(‘**/boots_short’).removeNode()
#dog.find(‘**/boots_long’).setTexture(shoes, 1)
#If you add the shoes, remove the feet so go back up and put “.removeNode()” after the feet so it will be:
#feet = dog.find(‘**/feet’).removeNode()
#keep this if you want no shoes
dog.find(‘**/boots_short’).removeNode()
dog.find(‘**/shoes’).removeNode()
dog.find(‘**/boots_long’).removeNode()
#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.710938, 0.234375, 0.4375, 1.0)
legs.setColor(0.710938, 0.234375, 0.4375, 1.0)
neck.setColor(0.710938, 0.234375, 0.4375, 1.0)
backhead.setColor(0.710938, 0.234375, 0.4375, 1.0)
head.setColor(0.710938, 0.234375, 0.4375, 1.0)
feet.setColor(0.710938, 0.234375, 0.4375, 1.0) #<—- remove that if you want shoes
#Camera
base.disableMouse()
base.useDrive()
base.useTrackball()
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment