diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-29 19:14:27 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-29 19:23:25 +0300 |
commit | 20ae4f928cecf78d5275c1226db87cb1ab22db50 (patch) | |
tree | dea89f4b8fa754c3b3a10f636b94b690ef604341 /source/blender/editors/object/object_relations.c | |
parent | bde39e51100b89aa21d1cb99ab17000c977a19b6 (diff) |
Make basic object & bones transformations overridable.
You can now override loc/rot/scale of objects and posebones.
Also added a basic operator to make an override of active linked object,
but this is very limited/wip/testing feature (you have to manually override
object and its armature, and relink to proper local overrides
yourself...). Final 'make proxy killer' will be much more automated of
course.
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 7e59b606f3c..5de113b30a0 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -77,6 +77,7 @@ #include "BKE_lattice.h" #include "BKE_layer.h" #include "BKE_library.h" +#include "BKE_library_override.h" #include "BKE_library_query.h" #include "BKE_library_remap.h" #include "BKE_main.h" @@ -2325,6 +2326,43 @@ void OBJECT_OT_make_local(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); } +static int make_override_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Main *bmain = CTX_data_main(C); + Object *locobj, *refobj = CTX_data_active_object(C); + + locobj = (Object *)BKE_override_static_create_from(bmain, &refobj->id); + + WM_event_add_notifier(C, NC_WINDOW, NULL); + + return OPERATOR_FINISHED; +} + +static int make_override_poll(bContext *C) +{ + Object *obact = CTX_data_active_object(C); + + /* Object must be directly linked to be overridable. */ + return (ED_operator_objectmode(C) && obact && obact->id.lib != NULL && obact->id.tag & LIB_TAG_EXTERN); +} + +void OBJECT_OT_make_override(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Make Override"; + ot->description = "Make local override of this library linked data-block"; + ot->idname = "OBJECT_OT_make_override"; + + /* api callbacks */ + ot->exec = make_override_exec; + ot->poll = make_override_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ +} + enum { MAKE_SINGLE_USER_ALL = 1, MAKE_SINGLE_USER_SELECTED = 2, |