I’m in need of skilled C++ forum guys support again.
Now I’m putting my hands over the PGBbutton component to use it in my project but I’m experiencing strange occurrences just form the beginning using this simple python code:
import direct.directbase.DirectStart
from pandac.PandaModules import *
#----
class mybutton(PGButton):
def __init__(self, name="Button", parent=aspect2d, label=""):
PGButton.__init__(self, name)
if not label: label=name
self.setup(label)
self.NP=parent.attachNewNode(self)
#----
if __name__ == '__main__':
b=mybutton(name="Yello!", parent=None)
tpGg1=TextGraphic()
tb=b.getFrame()
tpGg1.setFrame(tb)
tpGg1.setModel(b.NP)
#
tpMgr = TextPropertiesManager.getGlobalPtr()
tpMgr.setGraphic("gr1", tpGg1)
#
text=TextNode('tnode')
tn=base.aspect2d.attachNewNode(text)
text.setText("\5gr1\5\2")
tn.setScale(.06)
#
run()
The PGbutton part goes fine until I pretend to wrap it into a TextNode, after that the button text label disappear. To investigate the problem I found a good idea to watch into the core TextNode.cxx to understand the ::set_text() mechanics but…there is no method, just an override of TextEncdoder component and no method there too, therefore I’m lost.
So could somebody address me where the heck is it?