Comment 2 for bug 1013419

Revision history for this message
Josh Enes (joshenes) wrote :

I can confirm that this bug still exists and that the provided patch fixes the bug.

I used the following code to expose the bug, which is fixed after applying the patch.
Pressing space toggles scaling the text using two different methods, using setTextScale, and using setScale on the NodePath.
Without the patch, only the NodePath scale works properly.

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        self.text = TextNode('my text node')
        self.text_np = NodePath(self.text)
        self.text_np.reparentTo(render2d)
        self.text.setText('hello world')
        self.accept('space', self.swap_scales)
        self.text_np.setScale(0.1)
        self.text.setTextScale(1.0)

    def swap_scales(self):
        np_scale = self.text_np.getScale()
        text_scale = self.text.getTextScale()
        self.text_np.setScale(text_scale)
        self.text.setTextScale(np_scale[0])
        self.text.forceUpdate()

Game().run()