LibOverride: Cleanup: Remove option to disable library overrides.

Code is mature enough now to not need this anymore, people who do not
want to use liboverrides can just not create them.
This commit is contained in:
Bastien Montagne 2020-07-13 16:44:41 +02:00
parent 5c8dd2a703
commit 3d587efef2
Notes: blender-bot 2023-02-14 11:00:17 +01:00
Referenced by commit 14eaa9ed63, LibOverride: fix for removing `use_override_library` in rB3d587efef2872.
10 changed files with 11 additions and 82 deletions

View File

@ -51,9 +51,6 @@ struct Main;
struct PointerRNA;
struct PropertyRNA;
void BKE_lib_override_library_enable(const bool do_enable);
bool BKE_lib_override_library_is_enabled(void);
struct IDOverrideLibrary *BKE_lib_override_library_init(struct ID *local_id,
struct ID *reference_id);
void BKE_lib_override_library_copy(struct ID *dst_id,

View File

@ -66,20 +66,6 @@ static void lib_override_library_property_clear(IDOverrideLibraryProperty *op);
static void lib_override_library_property_operation_clear(
IDOverrideLibraryPropertyOperation *opop);
/* Temp, for until library override is ready and tested enough to go 'public',
* we hide it by default in UI and such. */
static bool _lib_override_library_enabled = true;
void BKE_lib_override_library_enable(const bool do_enable)
{
_lib_override_library_enabled = do_enable;
}
bool BKE_lib_override_library_is_enabled()
{
return _lib_override_library_enabled;
}
/** Initialize empty overriding of \a reference_id by \a local_id. */
IDOverrideLibrary *BKE_lib_override_library_init(ID *local_id, ID *reference_id)
{

View File

@ -507,9 +507,7 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack,
/* Might not be final place for this to be called - probably only want to call it from some
* undo handlers, not all of them? */
if (BKE_lib_override_library_is_enabled()) {
BKE_lib_override_library_main_operations_create(G_MAIN, false);
}
BKE_lib_override_library_main_operations_create(G_MAIN, false);
/* Remove all undos after (also when 'ustack->step_active == NULL'). */
while (ustack->steps.last != ustack->step_active) {

View File

@ -559,7 +559,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
case UI_ID_LOCAL:
if (id) {
Main *bmain = CTX_data_main(C);
if (BKE_lib_override_library_is_enabled() && CTX_wm_window(C)->eventstate->shift) {
if (CTX_wm_window(C)->eventstate->shift) {
if (ID_IS_OVERRIDABLE_LIBRARY(id)) {
/* Only remap that specific ID usage to overriding local data-block. */
ID *override_id = BKE_lib_override_library_create_from_id(bmain, id, false);
@ -931,10 +931,8 @@ static void template_ID(const bContext *C,
0,
0,
0,
BKE_lib_override_library_is_enabled() ?
TIP_("Direct linked library data-block, click to make local, "
"Shift + Click to create a library override") :
TIP_("Direct linked library data-block, click to make local"));
TIP_("Direct linked library data-block, click to make local, "
"Shift + Click to create a library override"));
if (disabled) {
UI_but_flag_enable(but, UI_BUT_DISABLED);
}

View File

@ -2523,7 +2523,7 @@ static bool make_override_library_poll(bContext *C)
Object *obact = CTX_data_active_object(C);
/* Object must be directly linked to be overridable. */
return (BKE_lib_override_library_is_enabled() && ED_operator_objectmode(C) && obact != NULL &&
return (ED_operator_objectmode(C) && obact != NULL &&
((ID_IS_LINKED(obact) && obact->id.tag & LIB_TAG_EXTERN) ||
(!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
ID_IS_LINKED(obact->instance_collection))));

View File

@ -1563,7 +1563,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
switch (enum_value) {
case OUTLINER_IDOP_OVERRIDE_LIBRARY:
return BKE_lib_override_library_is_enabled();
return true;
case OUTLINER_IDOP_SINGLE:
if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
return true;
@ -1677,12 +1677,10 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
break;
}
case OUTLINER_IDOP_OVERRIDE_LIBRARY: {
if (BKE_lib_override_library_is_enabled()) {
/* make local */
outliner_do_libdata_operation(
C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL);
ED_undo_push(C, "Overridden Data");
}
/* make local */
outliner_do_libdata_operation(
C, op->reports, scene, soops, &soops->tree, id_override_library_cb, NULL);
ED_undo_push(C, "Overridden Data");
break;
}
case OUTLINER_IDOP_SINGLE: {

View File

@ -518,7 +518,7 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
{
if (!BKE_lib_override_library_is_enabled() || !ID_IS_OVERRIDABLE_LIBRARY(id)) {
if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
return NULL;
}

View File

@ -1177,10 +1177,6 @@ eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr,
{
uint override_status = 0;
if (!BKE_lib_override_library_is_enabled()) {
return override_status;
}
if (!ptr || !prop || !ptr->owner_id || !ID_IS_OVERRIDE_LIBRARY(ptr->owner_id)) {
return override_status;
}

View File

@ -50,7 +50,6 @@
#include "BKE_appdir.h"
#include "BKE_blender_version.h"
#include "BKE_global.h"
#include "BKE_lib_override.h"
#include "DNA_ID.h"
@ -392,29 +391,6 @@ static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void
return PyC_UnicodeFromByte(G.autoexec_fail);
}
PyDoc_STRVAR(bpy_app_use_override_library_doc,
"Boolean, whether library override is exposed in UI or not.");
static PyObject *bpy_app_use_override_library_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
return PyBool_FromLong((long)BKE_lib_override_library_is_enabled());
}
static int bpy_app_use_override_library_set(PyObject *UNUSED(self),
PyObject *value,
void *UNUSED(closure))
{
const int param = PyC_Long_AsBool(value);
if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy.app.use_override_library must be a boolean");
return -1;
}
BKE_lib_override_library_enable((const bool)param);
return 0;
}
static PyGetSetDef bpy_app_getsets[] = {
{"debug", bpy_app_debug_get, bpy_app_debug_set, bpy_app_debug_doc, (void *)G_DEBUG},
{"debug_ffmpeg",
@ -485,11 +461,6 @@ static PyGetSetDef bpy_app_getsets[] = {
(void *)G_DEBUG_GPU_MEM},
{"debug_io", bpy_app_debug_get, bpy_app_debug_set, bpy_app_debug_doc, (void *)G_DEBUG_IO},
{"use_override_library",
bpy_app_use_override_library_get,
bpy_app_use_override_library_set,
bpy_app_use_override_library_doc,
NULL},
{"use_event_simulate",
bpy_app_global_flag_get,
bpy_app_global_flag_set__only_disable,

View File

@ -51,7 +51,6 @@
# include "BKE_global.h"
# include "BKE_image.h"
# include "BKE_lib_id.h"
# include "BKE_lib_override.h"
# include "BKE_main.h"
# include "BKE_report.h"
# include "BKE_scene.h"
@ -619,7 +618,6 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
printf("Misc Options:\n");
BLI_argsPrintArgDoc(ba, "--app-template");
BLI_argsPrintArgDoc(ba, "--factory-startup");
BLI_argsPrintArgDoc(ba, "--disable-library-override");
BLI_argsPrintArgDoc(ba, "--enable-event-simulate");
printf("\n");
BLI_argsPrintArgDoc(ba, "--env-system-datafiles");
@ -1121,17 +1119,6 @@ static int arg_handle_factory_startup_set(int UNUSED(argc),
return 0;
}
static const char arg_handle_disable_override_library_doc[] =
"\n\t"
"Disable Library Override features in the UI.";
static int arg_handle_disable_override_library(int UNUSED(argc),
const char **UNUSED(argv),
void *UNUSED(data))
{
BKE_lib_override_library_enable(false);
return 0;
}
static const char arg_handle_enable_event_simulate_doc[] =
"\n\t"
"Enable event simulation testing feature 'bpy.types.Window.event_simulate'.";
@ -2225,8 +2212,6 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_argsAdd(ba, 1, NULL, "--app-template", CB(arg_handle_app_template), NULL);
BLI_argsAdd(ba, 1, NULL, "--factory-startup", CB(arg_handle_factory_startup_set), NULL);
BLI_argsAdd(
ba, 1, NULL, "--disable-library-override", CB(arg_handle_disable_override_library), NULL);
BLI_argsAdd(ba, 1, NULL, "--enable-event-simulate", CB(arg_handle_enable_event_simulate), NULL);
/* TODO, add user env vars? */