def createNameTag(self): try: if(self.nameTag): self.nameTagPath.removeNode() except: pass self.nameTag = TextNode("NameTag") dept = self.dept.getGameDept() name = self.name if self.isSkeleton: name = "Skelecog" if(self.version == 1): self.nameTag.setText('%s\n%s\nLevel %s' % (name, dept, self.level)) else: self.nameTag.setText('%s\n%s\nLevel %s v%s.0' % (name, dept, self.level, self.version)) cogFont = Globals.getFont('vtRemingtonPortable.ttf') self.nameTag.setFont(cogFont) self.nameTagPath = render.attachNewNode(self.nameTag) self.nameTagPath.reparentTo(self.cog.find('**/joint_nameTag')) self.nameTagPath.setBillboardPointEye(0) head = self.head.getHead() jointPos = self.cog.find('**/joint_head').getPos(render) if(head != None): min, max = head.getTightBounds() size = max - min zPos = head.getPos(render).getZ() - size.getZ() pos = head.getPos(render).getZ() + size.getZ() + 2.4 else: pos = jointPos.getZ() + 2.4 self.nameTagPath.setZ(pos) self.nameTag.setAlign(TextNode.ACenter) self.nameTag.setCardColor(0.8, 0.8, 0.8, 0.5) self.nameTag.setCardAsMargin(0,0,0,-0.2) self.nameTag.setCardDecal(True) self.nameTag.setTextColor(0.2,0.2,0.2,1.0) self.nameTagPath.setScale(0.35)
def createNameTag(self): try: if (self.nameTag): self.nameTagPath.removeNode() except: pass self.nameTag = TextNode("NameTag") dept = self.dept.getGameDept() name = self.name if self.isSkeleton: name = "Skelecog" if (self.version == 1): self.nameTag.setText('%s\n%s\nLevel %s' % (name, dept, self.level)) else: self.nameTag.setText('%s\n%s\nLevel %s v%s.0' % (name, dept, self.level, self.version)) cogFont = Globals.getFont('vtRemingtonPortable.ttf') self.nameTag.setFont(cogFont) self.nameTagPath = render.attachNewNode(self.nameTag) self.nameTagPath.reparentTo(self.cog.find('**/joint_nameTag')) self.nameTagPath.setBillboardPointEye(0) head = self.head.getHead() jointPos = self.cog.find('**/joint_head').getPos(render) if (head != None): min, max = head.getTightBounds() size = max - min zPos = head.getPos(render).getZ() - size.getZ() pos = head.getPos(render).getZ() + size.getZ() + 2.4 else: pos = jointPos.getZ() + 2.4 self.nameTagPath.setZ(pos) self.nameTag.setAlign(TextNode.ACenter) self.nameTag.setCardColor(0.8, 0.8, 0.8, 0.5) self.nameTag.setCardAsMargin(0, 0, 0, -0.2) self.nameTag.setCardDecal(True) self.nameTag.setTextColor(0.2, 0.2, 0.2, 1.0) self.nameTagPath.setScale(0.35)
def setupHUD(self): gui1 = loader.loadModel('phase_3/models/gui/create_a_toon_gui.bam') gui2 = loader.loadModel('phase_3/models/gui/gui_toongen.bam') mickeyFont = loader.loadFont('MickeyFont.bam') self.guiElements = [ OnscreenImage(image = gui1.find("**/CrtATn_TopBar"), parent=render2d, pos=(0, 0, 0.9), scale=(0.85, 0.85, 1)), OnscreenText(text = "Make Your Toon", pos = (0, 0.85), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.2, 0.2, 0.2)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, 0.4), relief=None, command=self.setData, extraArgs=['Animal', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, 0.41), hpr=(0, 0, 180), command=self.setData, extraArgs=['Animal', 'next'], relief=None), OnscreenText(text = "Animal", pos = (0.325, 0.38), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, 0.1), relief=None, command=self.setData, extraArgs=['Weight', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, 0.11), hpr=(0, 0, 180), command=self.setData, extraArgs=['Weight', 'next'], relief=None), OnscreenText(text = "Body", pos = (0.325, 0.1), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.20), relief=None, command=self.setData, extraArgs=['Height', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.19), hpr=(0, 0, 180), command=self.setData, extraArgs=['Height', 'next'], relief=None), OnscreenText(text = "Height", pos = (0.325, -0.2), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.50), relief=None, command=self.setData, extraArgs=['HeadType', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.49), hpr=(0, 0, 180), command=self.setData, extraArgs=['HeadType', 'next'], relief=None), OnscreenText(text = "Head", pos = (0.325, -0.5), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.8), relief=None, command=self.setData, extraArgs=['Color', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.79), hpr=(0, 0, 180), command=self.setData, extraArgs=['Color', 'next'], relief=None), OnscreenText(text = "Length", pos = (0.328, -0.67), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.57, 0, -0.65), scale = 0.4, relief=None, command=self.setData, extraArgs=['HeadLength', 'short']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.11, 0, -0.64), scale = 0.4, hpr=(0, 0, 180), command=self.setData, extraArgs=['HeadLength', 'long'], relief=None), OnscreenText(text = "Color", pos = (0.325, -0.8), font = mickeyFont, fg = (1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui2.find("**/tt_t_gui_mat_girlUp"), gui2.find("**/tt_t_gui_mat_girlDown")), pos=(0.66, 0, 0.68), relief=None, command=self.randomizeData, extraArgs = ['girl'], scale=(0.55, 0.55, 0.55)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom = (gui2.find("**/tt_t_gui_mat_boyUp"), gui2.find("**/tt_t_gui_mat_boyDown")), pos=(0, 0, 0.68), command=self.randomizeData, extraArgs = ['boy'], relief=None, scale=(0.55, 0.55, 0.55)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui2.find("**/tt_t_gui_mat_okUp"), gui2.find("**/tt_t_gui_mat_okDown")), pos=(1, 0, -0.2), relief=None, command=self.done) ]
def setupHUD(self): gui1 = loader.loadModel('phase_3/models/gui/create_a_toon_gui.bam') gui2 = loader.loadModel('phase_3/models/gui/gui_toongen.bam') mickeyFont = loader.loadFont('MickeyFont.bam') self.guiElements = [ OnscreenImage(image=gui1.find("**/CrtATn_TopBar"), parent=render2d, pos=(0, 0, 0.9), scale=(0.85, 0.85, 1)), OnscreenText(text="Make Your Toon", pos=(0, 0.85), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.2, 0.2, 0.2)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, 0.4), relief=None, command=self.setData, extraArgs=['Animal', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, 0.41), hpr=(0, 0, 180), command=self.setData, extraArgs=['Animal', 'next'], relief=None), OnscreenText(text="Animal", pos=(0.325, 0.38), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, 0.1), relief=None, command=self.setData, extraArgs=['Weight', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, 0.11), hpr=(0, 0, 180), command=self.setData, extraArgs=['Weight', 'next'], relief=None), OnscreenText(text="Body", pos=(0.325, 0.1), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.20), relief=None, command=self.setData, extraArgs=['Height', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.19), hpr=(0, 0, 180), command=self.setData, extraArgs=['Height', 'next'], relief=None), OnscreenText(text="Height", pos=(0.325, -0.2), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.50), relief=None, command=self.setData, extraArgs=['HeadType', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.49), hpr=(0, 0, 180), command=self.setData, extraArgs=['HeadType', 'next'], relief=None), OnscreenText(text="Head", pos=(0.325, -0.5), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.66, 0, -0.8), relief=None, command=self.setData, extraArgs=['Color', 'prev']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0, 0, -0.79), hpr=(0, 0, 180), command=self.setData, extraArgs=['Color', 'next'], relief=None), OnscreenText(text="Length", pos=(0.328, -0.67), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.57, 0, -0.65), scale=0.4, relief=None, command=self.setData, extraArgs=['HeadLength', 'short']), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui1.find("**/CrtATn_R_Arrow_UP"), gui1.find("**/CrtATn_R_Arrow_DN"), gui1.find("**/CrtATn_R_Arrow_RLVR")), pos=(0.11, 0, -0.64), scale=0.4, hpr=(0, 0, 180), command=self.setData, extraArgs=['HeadLength', 'long'], relief=None), OnscreenText(text="Color", pos=(0.325, -0.8), font=mickeyFont, fg=(1, 0, 0, 1), scale=(0.08, 0.08, 0.08)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui2.find("**/tt_t_gui_mat_girlUp"), gui2.find("**/tt_t_gui_mat_girlDown")), pos=(0.66, 0, 0.68), relief=None, command=self.randomizeData, extraArgs=['girl'], scale=(0.55, 0.55, 0.55)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui2.find("**/tt_t_gui_mat_boyUp"), gui2.find("**/tt_t_gui_mat_boyDown")), pos=(0, 0, 0.68), command=self.randomizeData, extraArgs=['boy'], relief=None, scale=(0.55, 0.55, 0.55)), DirectButton(clickSound=Globals.getClickSound(), rolloverSound=Globals.getRlvrSound(), geom=(gui2.find("**/tt_t_gui_mat_okUp"), gui2.find("**/tt_t_gui_mat_okDown")), pos=(1, 0, -0.2), relief=None, command=self.done) ]
def load(self): gui = loader.loadModel('phase_3/models/gui/laff_o_meter.bam') hType = self.av.getData().get("Animal") if hType == 'dog': headModel = gui.find('**/doghead') elif hType == 'cat': headModel = gui.find('**/cathead') elif hType == 'mouse': headModel = gui.find('**/mousehead') elif hType == 'horse': headModel = gui.find('**/horsehead') elif hType == 'rabbit': headModel = gui.find('**/bunnyhead') elif hType == 'duck': headModel = gui.find('**/duckhead') elif hType == 'monkey': headModel = gui.find('**/monkeyhead') elif hType == 'bear': headModel = gui.find('**/bearhead') elif hType == 'pig': headModel = gui.find('**/pighead') self.color = self.av.getData().get('Color') self.container['image'] = headModel self.container['image_color'] = self.color self.resetFrameSize() self.setScale(0.1) self.frown = DirectFrame(parent=self.container, relief=None, image=gui.find('**/frown')) self.smile = DirectFrame(parent=self.container, relief=None, image=gui.find('**/smile')) self.eyes = DirectFrame(parent=self.container, relief=None, image=gui.find('**/eyes')) self.openSmile = DirectFrame(parent=self.container, relief=None, image=gui.find('**/open_smile')) self.tooth1 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_1')) self.tooth2 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_2')) self.tooth3 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_3')) self.tooth4 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_4')) self.tooth5 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_5')) self.tooth6 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_6')) self.maxLabel = DirectLabel(parent=self.eyes, relief=None, pos=(0.442, 0, 0.051), text='120', text_scale=0.4, text_font=Globals.getFont('ImpressBT.ttf')) self.hpLabel = DirectLabel(parent=self.eyes, relief=None, pos=(-0.398, 0, 0.051), text='120', text_scale=0.4, text_font=Globals.getFont('ImpressBT.ttf')) self.teeth = [ self.tooth6, self.tooth5, self.tooth4, self.tooth3, self.tooth2, self.tooth1 ] self.fractions = [0.0, 0.166666, 0.333333, 0.5, 0.666666, 0.833333] gui.removeNode()
def load(self): gui = loader.loadModel('phase_3/models/gui/laff_o_meter.bam') hType = self.av.getData().get("Animal") if hType == 'dog': headModel = gui.find('**/doghead') elif hType == 'cat': headModel = gui.find('**/cathead') elif hType == 'mouse': headModel = gui.find('**/mousehead') elif hType == 'horse': headModel = gui.find('**/horsehead') elif hType == 'rabbit': headModel = gui.find('**/bunnyhead') elif hType == 'duck': headModel = gui.find('**/duckhead') elif hType == 'monkey': headModel = gui.find('**/monkeyhead') elif hType == 'bear': headModel = gui.find('**/bearhead') elif hType == 'pig': headModel = gui.find('**/pighead') self.color = self.av.getData().get('Color') self.container['image'] = headModel self.container['image_color'] = self.color self.resetFrameSize() self.setScale(0.1) self.frown = DirectFrame(parent=self.container, relief=None, image=gui.find('**/frown')) self.smile = DirectFrame(parent=self.container, relief=None, image=gui.find('**/smile')) self.eyes = DirectFrame(parent=self.container, relief=None, image=gui.find('**/eyes')) self.openSmile = DirectFrame(parent=self.container, relief=None, image=gui.find('**/open_smile')) self.tooth1 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_1')) self.tooth2 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_2')) self.tooth3 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_3')) self.tooth4 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_4')) self.tooth5 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_5')) self.tooth6 = DirectFrame(parent=self.openSmile, relief=None, image=gui.find('**/tooth_6')) self.maxLabel = DirectLabel(parent=self.eyes, relief=None, pos=(0.442, 0, 0.051), text='120', text_scale=0.4, text_font=Globals.getFont('ImpressBT.ttf')) self.hpLabel = DirectLabel(parent=self.eyes, relief=None, pos=(-0.398, 0, 0.051), text='120', text_scale=0.4, text_font=Globals.getFont('ImpressBT.ttf')) self.teeth = [self.tooth6, self.tooth5, self.tooth4, self.tooth3, self.tooth2, self.tooth1] self.fractions = [0.0, 0.166666, 0.333333, 0.5, 0.666666, 0.833333] gui.removeNode()