[Bf-committers] Group freeing bug
Campbell Barton
cbarton at metavr.com
Sun Mar 19 18:38:44 CET 2006
Hey Ton, group freeing dosent check that the objects are still in a
group when it removes the object from a group.
This causes a bug in oops unlink and Python group module. where objects
are flagged as in a group and drawn green.
Heres a change that fixes it. does more listbase loops then Id like, but
its probably the best that can be done with the current datastructure.
objects keeping a count of how many groups use them could be good.
if (ob.group_users==0) :)
Was...
_________________________________________________
void free_group(Group *group)
{
/* don't free group itself */
GroupObject *go;
while(group->gobject.first) {
go= group->gobject.first;
BLI_remlink(&group->gobject, go);
free_group_object(go);
}
}
Added a check for objects group status.
_________________________________________________
void free_group(Group *group)
{
/* don't free group itself */
GroupObject *go;
Base *base;
while(group->gobject.first) {
go= group->gobject.first;
BLI_remlink(&group->gobject, go);
free_group_object(go);
/* check to see if the group flag needs to be changed.*/
if (!find_group(go->ob)) {
go->ob->flag &= ~OB_FROMGROUP;
base= object_in_scene(go->ob, G.scene);
if (base) base->flag &= ~OB_FROMGROUP;
}
}
}
_________________________________________________
Does this look okay?
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-committers
mailing list