DrawSolidPolygon() ..... Swig director method error

Discuss issues specific the Python port of Box2D
MrGecko
Posts: 1
Joined: Tue Jun 09, 2009 9:55 am

DrawSolidPolygon() ..... Swig director method error

Postby MrGecko » Mon May 30, 2011 10:36 am

Hi !
I'm using pyBox2D 2.0.2b2 and I get this error when I try to run the testbed examples:

Code: Select all

TypeError: "DrawSolidPolygon() takes exactly 4 arguments (3 given) Swig director method error Error detected when calling 'b2DebugDraw.DrawSolidPolygon'"


Is this related to my installation of box2D ?

Thanks :)

kne
Posts: 88
Joined: Mon Feb 18, 2008 12:30 am

Re: DrawSolidPolygon() ..... Swig director method error

Postby kne » Tue May 31, 2011 12:54 pm

Hi MrGecko,

I believe the problem is that I did not inform users properly about the upgrades I did for the old pybox2d 2.0.2b1 (I've really only been working on the 2.1 version and the pure Python port recently).

It was initially just a quick fix for the memory leak that I had found. But then I figured "what the heck", and gave it a few niceties such as removing the ugly getAsType(), and removing the redundant polygon vertex count from the parameter lists of b2DebugDraw -- which the bug you are running into now. I'll have to document these changes sometime, but my hope is that any remaining users will move to 2.1 soon.

TL;DR: Remove the vertex_count parameter, and it should work again.

kne

midnite_cowboy
Posts: 1
Joined: Fri Jul 01, 2011 4:07 pm

Re: DrawSolidPolygon() ..... Swig director method error

Postby midnite_cowboy » Fri Jul 01, 2011 4:14 pm

Hi,
Could you be more specific about which files must be fixed? I couldn't find the VertexCount parameter you mentioned.

Cheers

kne
Posts: 88
Joined: Mon Feb 18, 2008 12:30 am

Re: DrawSolidPolygon() ..... Swig director method error

Postby kne » Fri Jul 08, 2011 7:07 pm

midnite_cowboy,

Sorry for the late response --

As you can see in this diff, vertexCount parameters in the Draw*Polygon callbacks of b2DebugDraw have been removed. The same is also true for all other backends (pyglet, etc.). This means if you are using debug drawing you should change in either your debug drawing code or mine (e.g., pygame_main.py):

Code: Select all

    def DrawSolidPolygon(self, vertices, vertexCount, color):   

to

Code: Select all

    def DrawSolidPolygon(self, vertices, color):   

The same goes for DrawPolygon.

Romance1984
Posts: 26
Joined: Sat Jul 25, 2015 2:42 am

Re: DrawSolidPolygon() ..... Swig director method error

Postby Romance1984 » Wed Aug 19, 2015 1:34 am

The same is also true for all other backends.
เว็บคาสิโนออนไลน์


Return to “Python”



Who is online

Users browsing this forum: No registered users and 1 guest