[Bf-blender-cvs] [c8b3f13c9ed] blender2.8: Bring new IDP_MergeGroup() on par with other copying logic.

Bastien Montagne noreply at git.blender.org
Tue Aug 15 16:44:11 CEST 2017


Commit: c8b3f13c9eda2107a35e6117cc2f4d6816682a04
Author: Bastien Montagne
Date:   Tue Aug 15 16:42:20 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBc8b3f13c9eda2107a35e6117cc2f4d6816682a04

Bring new IDP_MergeGroup() on par with other copying logic.

We now have to support more complex copying types, which are controlled
by flags, so all copying logic will need to take those at some point (at
least, all potentially dealing with IDs).

===================================================================

M	source/blender/blenkernel/BKE_idprop.h
M	source/blender/blenkernel/intern/idprop.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 5d8cd02756d..055c530d255 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -91,6 +91,7 @@ void IDP_ReplaceGroupInGroup(struct IDProperty *dest, const struct IDProperty *s
 void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL();
 void IDP_ReplaceInGroup_ex(struct IDProperty *group, struct IDProperty *prop, struct IDProperty *prop_exist);
 void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) ATTR_NONNULL();
+void IDP_MergeGroup_ex(IDProperty *dest, const IDProperty *src, const bool do_overwrite, const int flag) ATTR_NONNULL();
 bool IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL();
 bool IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
                       struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 /* pnew */);
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 9796903afc4..b00a62a1a87 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -605,7 +605,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
  * If a property is missing in \a dest, add it.
  * Do it recursively.
  */
-void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite)
+void IDP_MergeGroup_ex(IDProperty *dest, const IDProperty *src, const bool do_overwrite, const int flag)
 {
 	IDProperty *prop;
 
@@ -618,12 +618,12 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw
 				IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, prop->name);
 
 				if (prop_exist != NULL) {
-					IDP_MergeGroup(prop_exist, prop, do_overwrite);
+					IDP_MergeGroup_ex(prop_exist, prop, do_overwrite, flag);
 					continue;
 				}
 			}
 
-			IDProperty *copy = IDP_CopyProperty(prop);
+			IDProperty *copy = IDP_CopyProperty_ex(prop, flag);
 			IDP_ReplaceInGroup(dest, copy);
 		}
 	}
@@ -632,12 +632,12 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw
 			IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, prop->name);
 			if (prop_exist != NULL) {
 				if (prop->type == IDP_GROUP) {
-					IDP_MergeGroup(prop_exist, prop, do_overwrite);
+					IDP_MergeGroup_ex(prop_exist, prop, do_overwrite, flag);
 					continue;
 				}
 			}
 			else {
-				IDProperty *copy = IDP_CopyProperty(prop);
+				IDProperty *copy = IDP_CopyProperty_ex(prop, flag);
 				dest->len++;
 				BLI_addtail(&dest->data.group, copy);
 			}
@@ -646,6 +646,15 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw
 }
 
 /**
+ * If a property is missing in \a dest, add it.
+ * Do it recursively.
+ */
+void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite)
+{
+	IDP_MergeGroup_ex(dest, src, do_overwrite, 0);
+}
+
+/**
  * This function has a sanity check to make sure ID properties with the same name don't
  * get added to the group.
  *




More information about the Bf-blender-cvs mailing list