Thanks Campbell, it worked pretty well. (committed in rev. 29016) In Blender 2.49 we had an interesting (strange) behaviour. All Logics that used a pointer (mesh, material, scene, ...) was increasing user counting when created. However none of them is doing lib_address_us in readfile.c. Therefore the user count increase didn't affect anything.
Now at least is more consistent (user count is always the same before and after you save the file/reopen it). What also means you can delete the blocks even if they are being used in Logic (it would be nice to have a warning for that). Regards, Dalai (ps.: sound is the only datablock increasing user counting when created from Logic. It's been handled correctly in readfile.c (using _us) but it needs some adjustments. I did a pre-commit today (29021) but the counting still looks strange.) 2010/5/26 Campbell Barton <[email protected]>: > On Wed, May 26, 2010 at 5:31 PM, Dalai Felinto <[email protected]> wrote: >> I gave it more thought and I think I have solution. I can manually >> increase/decrease the usercount in a set function of the rna property. >> It sounds hacky for me and I'm still not even sure it will work (I >> haven't tried rna setfuncs for pointers). >> >> I think a more elegant solution would be to use (fictional name) >> PROP_POINTER_LINK and have it handled internally. I don't know about >> the internals though. >> >> Regards, >> Dalai >> >> 2010/5/25 Dalai Felinto <[email protected]>: >>> Hello there, >>> quick question: Is there a way to have a PROP_POINTER property that >>> doesn't increase the id user count when "selected"? >>> >>> Explanation: >>> Some times (e.g. BGE Logic TouchSensor) we want to point to a >>> datablock but don't want to affect its user counting (i.e. stop this >>> block from being deleted). >>> >>> In 2.49 (maybe by design or by bug) we are not increasing user >>> counting for those in readfile.c (there we are using newlibadr instead >>> of newlibadr_us). This will give you different usercounting for a >>> datablock after you re-open it, what is strange. So I was wondering if >>> is there a way (or it's an acceptable design) to have a Rna Prop >>> linking to a datablock but without changing it id counting. >>> >>> Regards, >>> Dalai >>> > > At the moment the types themselves define if they get user counts or not. > This doesnt work when they have user counts in some places and not others. > > IIRC Text doesnt have user counts, but Meshes do for eg. > > I had to add set functions in 2 places because of this, just make sure > to add some comment that the only reason they are there is to avoid > user-counts. > > had a look into making the user count work per property and its not > all that easy (though possible ofcourse) > > -- > - Campbell > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
