Finalize/enable new static override for linked groups.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 1 Feb 2018 13:08:18 +0000 (14:08 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 1 Feb 2018 13:08:18 +0000 (14:08 +0100)
Behavior is expected to be simillar to 'make proxy' on linked groups, it
basically allows you to select which object in the group will be to
'root' override (usually, the armature), checks which other objects
needs to be overridden as well, overrides the group itself too, and
instantiates the group and the root overridden object.

It seems to be working, though handling of armature deformation is kind
of totally broken in blender2.8 currently (modifiers...). ;)

source/blender/editors/object/object_relations.c

index 589b54cd3c0fb1b0fe4deea8bb9c8f41c3cd28f4..43d29b6f931d00236026502d99d68ac4c281fb6b 100644 (file)
@@ -2411,7 +2411,6 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
        bool success = false;
 
        if (!ID_IS_LINKED(obact) && obact->dup_group != NULL && ID_IS_LINKED(obact->dup_group)) {
-#if 0  /* Not working yet! */
                Base *base = BLI_findlink(&obact->dup_group->view_layer->object_bases, RNA_enum_get(op->ptr, "object"));
                Object *obgroup = obact;
                obact = base->object;
@@ -2424,7 +2423,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
 
                FOREACH_GROUP_OBJECT(obgroup->dup_group, ob)
                {
-                       make_override_tag_object(obact, ob);
+                       make_override_static_tag_object(obact, ob);
                }
                FOREACH_GROUP_OBJECT_END;
 
@@ -2435,7 +2434,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
                ViewLayer *view_layer = CTX_data_view_layer(C);
                Object *new_obact = (Object *)obact->id.newid;
                if (new_obact != NULL && (base = BKE_view_layer_base_find(view_layer, new_obact)) == NULL) {
-                       BKE_collection_object_add_from(scene, obact, new_obact);
+                       BKE_collection_object_add_from(scene, obgroup, new_obact);
                        base = BKE_view_layer_base_find(view_layer, new_obact);
                        BKE_view_layer_base_select(view_layer, base);
                }
@@ -2453,9 +2452,6 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
                /* Cleanup. */
                BKE_main_id_clear_newpoins(bmain);
                BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, false);
-#else
-               UNUSED_VARS(op);
-#endif
        }
        /* Else, poll func ensures us that ID_IS_LINKED(obact) is true. */
        else if (obact->type == OB_ARMATURE) {
@@ -2512,8 +2508,8 @@ void OBJECT_OT_make_override_static(wmOperatorType *ot)
 
        /* properties */
        PropertyRNA *prop;
-       prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object",
-                           "Name of lib-linked/grouped object to make a proxy for");
+       prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Override Object",
+                           "Name of lib-linked/group object to make an override from");
        RNA_def_enum_funcs(prop, proxy_group_object_itemf);
        RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
        ot->prop = prop;