Calling MeshDrawer segment and link_segment Crashes Panda3D

Bug #1663900 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 and XP using Panda3D versions from 1.8.0 to 1.9.3, calling the segment() or link_segment() functions of MeshDrawer crashes Panda but offers the following fatal error:

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

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 segment and link_segment do not fatally crash.
        # At least on Windows 7 and XP it crashes with the following error -
        # :express(error): Attempt to cast pointer from ModelNode to Camera
        self.drawer.segment((0, 0, 10), (1, 10, 1), (0, 0, 1, 1), 1,
                            (1, 1, 0, 1))

        self.drawer.end()
        return task.cont

test = Test()
test.run()

Revision history for this message
rdb (rdb) wrote :

I think it expects you to pass base.cam instead of camera. Does that resolve the crash?

Revision history for this message
rdb (rdb) wrote :

The fix is to pass base.cam to the begin() call. I have, however, replaced the crash with an exception instead.

Changed in panda3d:
assignee: nobody → rdb (rdb)
status: New → Fix Committed
Revision history for this message
Jonathan Kelly (self.deus) wrote :

Yes indeed, using base.cam fixes the issue for me as well. I should have followed the example in the manual more closely it seems.

Also, sorry for the late reply, I missed the notification until just now.

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.