[Bf-blender-cvs] [3d587efef28] master: LibOverride: Cleanup: Remove option to disable library overrides.

Bastien Montagne noreply at git.blender.org
Mon Jul 13 16:46:00 CEST 2020


Commit: 3d587efef2872a4466432679bad0c8bc6cc0a335
Author: Bastien Montagne
Date:   Mon Jul 13 16:44:41 2020 +0200
Branches: master
https://developer.blender.org/rB3d587efef2872a4466432679bad0c8bc6cc0a335

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.

===================================================================

M	source/blender/blenkernel/BKE_lib_override.h
M	source/blender/blenkernel/intern/lib_override.c
M	source/blender/blenkernel/intern/undo_system.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_access_compare_override.c
M	source/blender/python/intern/bpy_app.c
M	source/creator/creator_args.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h
index 411df66fe36..22ede6dfa2d 100644
--- a/source/blender/blenkernel/BKE_lib_override.h
+++ b/source/blender/blenkernel/BKE_lib_override.h
@@ -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,
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 457d096f983..009303b8c83 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -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)
 {
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index e155dedeef0..0809e8dda6d 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -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) {
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index d735c9d55fc..ba3d2d29603 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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);
         }
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ac41028089c..b81fea1848c 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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))));
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 419e25d5dca..ac78c711a1a 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -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: {
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 46001f27fef..8d498ab569b 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -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;
   }
 
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index a89c8c4667d..1b846fd898c 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -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;
   }
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 957d49eb04e..4ee936aff91 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -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,
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 4aabfb76acb..20a75ebe3b9 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -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 feature

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list