def generateName(self): v4 = self.getState() v56 = NametagGlobals.getNameFg(self.group.getColorCode(), v4) v54 = NametagGlobals.getNameBg(self.group.getColorCode(), v4) self.name_frame = Vec4(*self.group.getNameFrame()) self.name_frame[0] -= NametagGlobals._card_pad[0] self.name_frame[1] += NametagGlobals._card_pad[1] self.name_frame[2] -= NametagGlobals._card_pad[2] self.name_frame[3] += NametagGlobals._card_pad[3] self.field_396 = 1 v47 = None if v54[3] != 0.0: card = CardMaker('nametag') card.setFrame(self.name_frame) card.setColor(v54) if NametagGlobals._nametag_card: card.setSourceGeometry(NametagGlobals._nametag_card.node(), NametagGlobals._nametag_card_frame) self.np_372 = self.np_top.attachNewNode(card.generate()) self.np_372.setTransparency(1) v47 = self.np_372.find('**/+GeomNode') label86 = False if self.is_3d: if self.group.name_icon: self.group.name_icon.instanceTo(self.np_top) if v47: self.np_360 = self.group.copyNameTo(v47) self.np_360.setDepthWrite(0) self.np_360.setY( -0.01) # Panda3D 1.10 hack to prevent z-fighting. v47.node().setEffect(DecalEffect.make()) else: label86 = True else: label86 = True if label86: self.np_360 = self.group.copyNameTo(self.np_top) if self.has_draw_order: bin = config.GetString('nametag-fixed-bin', 'fixed') self.name_icon.setBin(bin, self.draw_order + 1) self.np_360.setBin(bin, self.draw_order + 2) self.np_360.setColor(v56) if v56[3] != 1.0: self.np_360.setTransparency(1)
def generateName(self): v4 = self.getState() v84 = NametagGlobals.getNameFg(self.group.getColorCode(), v4) v75 = NametagGlobals.getNameBg(self.group.getColorCode(), v4) v75[3] = max(v75[3], NametagGlobals._min_2d_alpha) v75[3] = min(v75[3], NametagGlobals._max_2d_alpha) v67 = NametagGlobals._card_pad[3] + self.group.name_frame[3] v68 = self.group.name_frame[2] - NametagGlobals._card_pad[2] wordwrap = self.group.getNameWordwrap() v17 = self.cell_width / wordwrap * 2.0 v66 = 0.333 * (1.0 / v17) - (v68 + v67) * 0.5 v18 = min(1.0 / v17 - v67, v66) v69 = Mat4(v17, 0, 0, 0, 0, v17, 0, 0, 0, 0, v17, 0, 0, 0, v18 * v17, 1.0) a3 = v69 if v75[3] != 0.0: card = CardMaker('nametag') card.setFrame( self.group.name_frame[0] - NametagGlobals._card_pad[0], self.group.name_frame[1] + NametagGlobals._card_pad[1], v68, v67) card.setColor(v75) if NametagGlobals._nametag_card: card.setSourceGeometry(NametagGlobals._nametag_card.node(), NametagGlobals._nametag_card_frame) self.attached_np = self.np.attachNewNode(card.generate()) self.attached_np.setMat(v69) if v75[3] != 1.0: self.attached_np.setTransparency(1) if self.has_draw_order: bin = config.GetString('nametag-fixed-bin', 'fixed') self.attached_np.setBin(bin, self.draw_order) self.copied_np = self.group.copyNameTo(self.np) self.copied_np.setMat(a3) if self.has_draw_order: bin = config.GetString('nametag-fixed-bin', 'fixed') self.copied_np.setBin(bin, self.draw_order) self.copied_np.setColor(v84) if v84[3] != 1.0: self.copied_np.setTransparency(1) reducer = SceneGraphReducer() reducer.applyAttribs(self.copied_np.node()) reducer.applyAttribs(self.attached_np.node()) if NametagGlobals._arrow_model: self.arrow = NametagGlobals._arrow_model.copyTo(self.np) if self.has_draw_order: bin = config.GetString('nametag-fixed-bin', 'fixed') self.arrow.setBin(bin, self.draw_order) self.trans_vec = a3.xformPoint(Point3(0, 0, v68 - 1.0)) color = NametagGlobals.getArrowColor(self.group.getColorCode()) self.arrow.setColor(color) if color[3] != 1.0: self.arrow.setTransparency(1) self.rotateArrow() elif self.arrow: self.arrow.removeNode() v69 = self.np.getNetTransform().getMat() v69 = a3 * v69 v77 = v69.xformPoint( Point3(self.group.name_frame[0] - NametagGlobals._card_pad[0], 0, v68)) v80 = v69.xformPoint( Point3(self.group.name_frame[1] + NametagGlobals._card_pad[1], 0, v67)) frame = Vec4(v77[0], v80[0], v77[2], v80[2]) self.setRegion(frame, 0)