Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-15 21:43:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-15 21:43:54 +0300
commitc5bcbad779a4709db914851560b66bcd94f3fcc0 (patch)
treee9e660853cf1150c75ee450dee38f081ca7a348b /source/blender/blenkernel/intern/idprop.c
parent50cd69d8d944fd5a7865e93a651b84d4b7e353a3 (diff)
Proxy ID property syncing
This means pose bones on proxy poses can have their own values as long as the name and type matches that of the library pose bone. without this the only way to add new values on a pose bone proxy is to protect in the lib, reload the proxy blend and save.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 07a717cc419..37aee8fb4aa 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -385,6 +385,49 @@ IDProperty *IDP_CopyGroup(IDProperty *prop)
return newp;
}
+/* use for syncing proxies.
+ * When values name and types match, copy the values, else ignore */
+void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
+{
+ IDProperty *loop, *prop;
+ for (prop=src->data.group.first; prop; prop=prop->next) {
+ for (loop=dest->data.group.first; loop; loop=loop->next) {
+ if (BSTR_EQ(loop->name, prop->name)) {
+ int copy_done= 0;
+
+ if(prop->type==loop->type) {
+
+ switch (prop->type) {
+ case IDP_INT:
+ case IDP_FLOAT:
+ case IDP_DOUBLE:
+ loop->data= prop->data;
+ copy_done= 1;
+ break;
+ case IDP_GROUP:
+ IDP_SyncGroupValues(loop, prop);
+ copy_done= 1;
+ break;
+ default:
+ {
+ IDProperty *tmp= loop;
+ IDProperty *copy= IDP_CopyProperty(prop);
+
+ BLI_insertlinkafter(&dest->data.group, loop, copy);
+ BLI_remlink(&dest->data.group, tmp);
+ loop = copy;
+
+ IDP_FreeProperty(tmp);
+ MEM_freeN(tmp);
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+}
+
/*
replaces all properties with the same name in a destination group from a source group.
*/