MeshDrawer bugs?

I have been struggling with some (what look like) bugs with MeshDrawer’s functions in 1.9.3 and much older versions, on a couple of windows 7 machines. It seems odd I would be the first one to catch bugs this obvious so maybe I am doing something incorrectly.

Can anyone reproduce these?

Calling segment and link_segment gives the fatal error-

:express(error): Attempt to cast pointer from ModelNode to Camera

The distance parameter for explosion is inoperative. All particles seem to be drawn in the center regardless of the passed distance value.

Each time you call set_budget, MeshDrawer abandons its original GeomNode and creates a new one without removing the original from the drawer’s node/nodepath. If you only call set_budget once then all works well, but successive calls leave ghost geometry behind in whatever form MeshDrawer had left them before the budget change.

Test code:

from direct.showbase.ShowBase import ShowBase
from panda3d.core import MeshDrawer, NodePath

class Test(ShowBase):

    def __init__(self):
        self.drawer = MeshDrawer()
        self.drawer_node = self.drawer.get_root()
        self.drawer_node.set_pos(0, 100, 0)
        self.time = 0
        taskMgr.add(self.update_task, 'universe')

    def update_task(self, task):
        self.time += globalClock.get_dt()
        self.drawer.begin(camera, render)

        # test that explosion particles expand in all directions.
        self.drawer.explosion((0, 0, 0), (0, 0, 1, 1), 1,
                              (0, 1, 1, 1), 0, 5, self.time)

        # test that segment and link_segment do not fatally crash.
        self.drawer.segment((0, 0, 10), (1, 10, 1), (0, 0, 1, 1), 1,
                            (1, 1, 0, 1))

        # test that setting budget should not increase number of geomnodes.
        print '# of geoms- ', self.drawer_node.get_children().get_num_paths()

        return task.cont

test = Test()

I am now convinced these are legitimate bugs in MeshDrawer. I should post each of these three to the bug tracker as separate reports, right?

Yes, please do.

Okay, they are posted.

Please let me know if there is any additional information I can provide on these.

Thanks a lot! These issues are now fixed.

Thank you, rdb. I really appreciate it.

Without your countless fixes and years of dedication Panda3D would be a buggy mess!