[Bf-committers] help with readfile.c::do_version

Dalai Felinto dfelinto at gmail.com
Mon May 10 10:03:14 CEST 2010


Hello there,
as mentioned in last dev meeting I changed a few Game Sensors to use a
datablock pointer instead of a string.
e.g. the Collision Sensor struct used to have a string with the name
of the material to trigger the collision, but now it will have a
struct Material *ma; instead.

Therefore I need a nice do_version to convert the char[] to *Material.
In order to accomplish that I'm using BLI_findstring() . It works
fine, however it gives me the new pointer for the image datablock, not
the one stored in the file. That means that when we get in
lib_link_object() the pointer will try to be converted into itself,
what will not work since the new pointer will not be in the list of
the old pointers.

The workaround I found for it is totally hacky. I created a function
called oldlibadr() that gives me the old pointer once I provide it
with the new one. It's the opposite of newlibadr() used in
lib_link_object(). You can see the patch for readfile.c here -
http://www.pasteall.org/13020/diff

Looking forward for directions on that.

Thanks,
Dalai


More information about the Bf-committers mailing list