Ah, iirc the "correct" way to do this would be to handle this in the appropriate lib_link_*** function (lib_link_sensors, or whatever it is). You could check if the old pointer is NULL, and if so check if there is a name in the name field, then look up the id block.
Joe On Mon, May 10, 2010 at 10:03 AM, Dalai Felinto <dfeli...@gmail.com> wrote: > 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 > _______________________________________________ > Bf-committers mailing list > Bf-committers@blender.org > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers