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>2013-12-12 17:28:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-12-12 17:35:12 +0400
commit2195dd32cc7b2f4bf26c7d216cbaba32f82184da (patch)
tree254311c95553d563bcc78f031cd384c0fba69d74 /source/blender/blenkernel/intern/idprop.c
parent8a7f2b24c1aa3a76637a1ae3b01a2f074755803c (diff)
Fix T37595: Switching modal transform broke with trackball rotation.
Id properties may have different sized "values" array depending on the transform operator
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 785069cd150..0596c5109dd 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -506,6 +506,34 @@ void IDP_SyncGroupValues(IDProperty *dest, const IDProperty *src)
}
}
+void IDP_SyncGroupTypes(IDProperty *dst, const IDProperty *src, const bool do_arraylen)
+{
+ IDProperty *prop_dst, *prop_dst_next;
+ const IDProperty *prop_src;
+
+ for (prop_dst = dst->data.group.first; prop_dst; prop_dst = prop_dst_next) {
+ prop_dst_next = prop_dst->next;
+ if ((prop_src = IDP_GetPropertyFromGroup((IDProperty *)src, prop_dst->name))) {
+ /* check of we should replace? */
+ if ((prop_dst->type != prop_src->type || prop_dst->subtype != prop_src->subtype) ||
+ (do_arraylen && ELEM(prop_dst->type, IDP_ARRAY, IDP_IDPARRAY) && (prop_src->len != prop_dst->len)))
+ {
+ IDP_FreeFromGroup(dst, prop_dst);
+ prop_dst = IDP_CopyProperty(prop_src);
+
+ dst->len++;
+ BLI_insertlinkbefore(&dst->data.group, prop_dst_next, prop_dst);
+ }
+ else if (prop_dst->type == IDP_GROUP) {
+ IDP_SyncGroupTypes(prop_dst, prop_src, do_arraylen);
+ }
+ }
+ else {
+ IDP_FreeFromGroup(dst, prop_dst);
+ }
+ }
+}
+
/**
* Replaces all properties with the same name in a destination group from a source group.
*/