Successive Calls to MeshDrawer.set_budget Create Dead GeomNodes

Bug #1663903 reported by Jonathan Kelly
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
Undecided
rdb

Bug Description

At least on Windows 7 using Panda3D versions from 1.9.1 to 1.9.3, each call to set_budget() of MeshDrawer causes it to abandon its original GeomNode and create a new one without removing the original from the drawer's NodePath. This means resetting the budget higher or lower as needed will quietly create dead GeomNodes that build up until explicitly removed.

Forum Topic: http://www.panda3d.org/forums/viewtopic.php?f=4&t=19307

Example Code:

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 setting budget does not increase number of geomnodes.
        # At least on Windows 7 it adds a new GeomNode with each call,
        # without deleting the old one.
        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()

Revision history for this message
rdb (rdb) wrote :

Thank you. This is now fixed; set_budget() reuses the existing GeomNode.

Changed in panda3d:
assignee: nobody → rdb (rdb)
status: New → Fix Committed
rdb (rdb)
Changed in panda3d:
milestone: none → 1.9.4
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.