[Bf-blender-cvs] [527c9af48f0] blender2.8: Static overrides: reduce the amount of instantiated objects when overriding a group.

Bastien Montagne noreply at git.blender.org
Wed May 16 19:01:10 CEST 2018


Commit: 527c9af48f08f280182b248ea9b4af51f75ab8ca
Author: Bastien Montagne
Date:   Wed May 16 18:57:24 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB527c9af48f08f280182b248ea9b4af51f75ab8ca

Static overrides: reduce the amount of instantiated objects when overriding a group.

For now, do not override/instantiate objects used as boneshapes.

Note that this is a rather poor/dirty hack, it seems Spring char groups
still have a lot of other (unused???) shape objects.

Ideally lib groups should be designed more cleanly for the new Static
Override system, putting only really usable objects into 'main' group,
and placing the others in sub-groups, helpers groups, or so...

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

M	source/blender/editors/object/object_relations.c

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

diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ee1ef490274..dd919aedabb 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -2311,6 +2311,19 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
 		}
 		FOREACH_GROUP_OBJECT_END;
 
+		/* Then, we make static override of the whole set of objects in the group. */
+		FOREACH_GROUP_OBJECT_BEGIN(group, ob)
+		{
+			if (ob->type == OB_ARMATURE && ob->pose != NULL) {
+				for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan != NULL; pchan = pchan->next) {
+					if (pchan->custom != NULL) {
+						pchan->custom->id.tag &= ~ LIB_TAG_DOIT;
+					}
+				}
+			}
+		}
+		FOREACH_GROUP_OBJECT_END;
+
 		success = BKE_override_static_create_from_tag(bmain);
 
 		/* Intantiate our newly overridden objects in scene, if not yet done. */
@@ -2319,7 +2332,10 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
 		Group *new_group = (Group *)group->id.newid;
 		FOREACH_GROUP_OBJECT_BEGIN(new_group, new_ob)
 		{
-			if (new_ob != NULL && (base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL) {
+			if (new_ob != NULL &&
+			    new_ob->id.override_static != NULL &&
+			    (base = BKE_view_layer_base_find(view_layer, new_ob)) == NULL)
+			{
 				BKE_collection_object_add_from(scene, obgroup, new_ob);
 				DEG_id_tag_update_ex(bmain, &new_ob->id, OB_RECALC_OB | DEG_TAG_BASE_FLAGS_UPDATE);
 				/* parent to 'group' empty */



More information about the Bf-blender-cvs mailing list