one-liner fix for id property duplication bug

This commit is contained in:
Joseph Eagar 2008-10-06 10:24:32 +00:00
parent ba720030be
commit 16f199bda3

@ -220,6 +220,10 @@ IDProperty *IDP_CopyGroup(IDProperty *prop)
return newp;
}
/*
replaces a property with the same name in a group, or adds
it if the propery doesn't exist.
*/
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
@ -231,7 +235,6 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
MEM_freeN(loop);
return;
}
}
@ -349,6 +352,7 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
if (create_if_needed) {
id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
id->properties->type = IDP_GROUP;
strcpy(id->name, "top_level_group");
}
return id->properties;
}
@ -424,7 +428,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
return prop;
}
/*NOTE: this will free all child properties of list arrays and groups!
/*NOTE: this will free all child properties including list arrays and groups!
Also, note that this does NOT unlink anything! Plus it doesn't free
the actual IDProperty struct either.*/
void IDP_FreeProperty(IDProperty *prop)
@ -442,7 +446,8 @@ void IDP_FreeProperty(IDProperty *prop)
}
}
/*Unlinks any IDProperty<->ID linkage that might be going on.*/
/*Unlinks any IDProperty<->ID linkage that might be going on.
note: currently unused.*/
void IDP_UnlinkProperty(IDProperty *prop)
{
switch (prop->type) {