diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-16 19:57:24 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-16 20:01:04 +0300 |
commit | 527c9af48f08f280182b248ea9b4af51f75ab8ca (patch) | |
tree | aa3d7b74c445e420c172ddabe08c16d0729c3a62 | |
parent | 5ed702dc9cbd94d592b1997e6bd35d5b6e7a639f (diff) |
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...
-rw-r--r-- | source/blender/editors/object/object_relations.c | 18 |
1 files changed, 17 insertions, 1 deletions
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 */ |