Poodletooth-iLand/toontown/dna/DNASignBaseline.py

30 lines
962 B
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from panda3d.core import BamFile, NodePath, StringStream, decompressString
import DNANode
class DNASignBaseline(DNANode.DNANode):
COMPONENT_CODE = 6
def __init__(self):
DNANode.DNANode.__init__(self, '')
self.data = ''
def makeFromDGI(self, dgi):
DNANode.DNANode.makeFromDGI(self, dgi)
self.data = dgi.getString()
if len(self.data):
self.data = decompressString(self.data)
def traverse(self, nodePath, dnaStorage):
node = nodePath.attachNewNode('baseline', 0)
node.setPosHpr(self.pos, self.hpr)
node.setPos(node, 0, -0.1, 0)
if self.data:
bf = BamFile()
ss = StringStream()
ss.setData(self.data)
bf.openRead(ss)
signText = NodePath(bf.readNode())
signText.reparentTo(node)
node.flattenStrong()
for child in self.children:
child.traverse(nodePath, dnaStorage)