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.
from direct.showbase.ShowBase import ShowBase from panda3d.core import MeshDrawer, NodePath class Test(ShowBase): def __init__(self): ShowBase.__init__(self) self.drawer = MeshDrawer() self.drawer_node = self.drawer.get_root() self.drawer_node.reparent_to(render) self.drawer_node.set_two_sided(True) self.drawer_node.set_pos(0, 100, 0) self.drawer.set_budget(512) 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. self.drawer.set_budget(512) print '# of geoms- ', self.drawer_node.get_children().get_num_paths() self.drawer.end() return task.cont test = Test() test.run()