diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-19 17:42:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-19 19:38:19 +0300 |
commit | fbf4c11960db62a27876e1d791d3293071e26c76 (patch) | |
tree | 8b51aa88f16ba18884b3d9120636f66052474a8e /source/blender/editors/space_outliner | |
parent | e6fe207a52b1d3f46f02c3d01973ae501c97ba49 (diff) |
Make Static Override optional/hidden by default.
That feature will not be ready (or at least, not tested enough) to be
officially part of 2.80 beta. So we disable it by default, hidding it
behind a startup option (`--enable-static-override`), and a python
app var (`bpy.app.use_static_override`).
That way, people who really want to play with it can do it easily, while
not exposing/enabling non-production-ready feature by default.
Note that underlying override code remains active, i.e. files we do have
overridden data-blocks will be loaded correctly according to static override.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 2f84340e34e..b66622536e9 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -1076,8 +1076,8 @@ typedef enum eOutlinerIdOpTypes { static const EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""}, {OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""}, - {OUTLINER_IDOP_STATIC_OVERRIDE, "STATIC_OVERRIDE", - 0, "Add Static Override", "Add a local static override of this data-block"}, + {OUTLINER_IDOP_STATIC_OVERRIDE, "STATIC_OVERRIDE", 0, "Add Static Override", + "Add a local static override of this data-block"}, {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, {OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"}, {OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users", @@ -1090,6 +1090,29 @@ static const EnumPropertyItem prop_id_op_types[] = { {0, NULL, 0, NULL, NULL} }; +static const EnumPropertyItem *outliner_id_operation_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + if (BKE_override_static_is_enabled()) { + *r_free = false; + return prop_id_op_types; + } + + EnumPropertyItem *items = NULL; + int totitem = 0; + + for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) { + if (it->value == OUTLINER_IDOP_STATIC_OVERRIDE) { + continue; + } + RNA_enum_item_add(&items, &totitem, it); + } + RNA_enum_item_end(&items, &totitem); + *r_free = true; + + return items; +} + static int outliner_id_operation_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1163,9 +1186,11 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) } case OUTLINER_IDOP_STATIC_OVERRIDE: { - /* make local */ - outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL); - ED_undo_push(C, "Overridden Data"); + if (BKE_override_static_is_enabled()) { + /* make local */ + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL); + ED_undo_push(C, "Overridden Data"); + } break; } case OUTLINER_IDOP_SINGLE: @@ -1270,6 +1295,7 @@ void OUTLINER_OT_id_operation(wmOperatorType *ot) ot->flag = 0; ot->prop = RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", ""); + RNA_def_enum_funcs(ot->prop, outliner_id_operation_itemf); } /* **************************************** */ |