GSoC/GCI Archive
Google Code-in 2012 Copyleft Games Group

PySoy: Improve Box.material

completed by: Darrel

mentors: Amaury Medeiros, Arc Riley, Tony Young, David Czech, Mayank Singh

Right now, if you create put a soy.bodies.Box in a scene, you get pages full of "CRITICAL **: soy_materials_material_render: assertion `self != NULL' failed" because Box.material hasn't been set to anything yet. This reflects very poorly on us.

First, when a material isn't supplied at box creation time, a generic 'null material' global instance of soy.materials.Material (created in libsoy's init) should be used such that the box.material can never be NULL. This will fix those critical errors flooding the terminal.

Second, in PySoy's bindings, tp_new should optionally accept a material and pass this to a Box constructor which uses it instead of ref/unref'ing the global generic 'null material' before setting it via a property.

Third, if PySoy's Box.material property is deleted (eg, del(cube.material)) then it should revert to the global 'null material'.

This task should take under 100 lines of code between Box.gs (libsoy) and Box.c (pysoy), demonstrate it working by updating pysoy/examples/TwoCubes.py or a similar example using Box.

While working on this task you should join and remain in #PySoy on Freenode to get help, feedback, and guidance from mentors and other developers. Code updates which may affect your work are also announced here as they happen.

When you've done, commit your work and post the resulting changeset url to this task.