[Bf-blender-cvs] [095a53bd884] master: Cleanup: Remove outliner edit mode context menu entries

Nathan Craddock noreply at git.blender.org
Thu Sep 10 17:02:45 CEST 2020


Commit: 095a53bd884b5157b8ac25eb660e6520151d0899
Author: Nathan Craddock
Date:   Thu Sep 10 08:56:46 2020 -0600
Branches: master
https://developer.blender.org/rB095a53bd884b5157b8ac25eb660e6520151d0899

Cleanup: Remove outliner edit mode context menu entries

The outliner context menu has options to enter and exit edit mode, but
they only show in edit mode, and they don't work. This removes the
broken entries and related code.

Part of T77408

Differential Revision: https://developer.blender.org/D8641

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

M	release/scripts/startup/bl_ui/space_outliner.py
M	source/blender/editors/space_outliner/outliner_edit.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_select.c
M	source/blender/editors/space_outliner/outliner_tools.c

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

diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index e0764bc990c..4497f37cfd2 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -275,7 +275,6 @@ class OUTLINER_MT_object(Menu):
 
         space = context.space_data
         obj = context.active_object
-        object_mode = 'OBJECT' if obj is None else obj.mode
 
         layout.operator("outliner.id_copy", text="Copy", icon='COPYDOWN')
         layout.operator("outliner.id_paste", text="Paste", icon='PASTEDOWN')
@@ -293,16 +292,6 @@ class OUTLINER_MT_object(Menu):
 
         layout.separator()
 
-        if object_mode in {'EDIT', 'POSE'}:
-            name = bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode].name
-            layout.operator("outliner.object_operation",
-                            text=iface_("%s Set", i18n_contexts.operator_default) % name).type = 'OBJECT_MODE_ENTER'
-            layout.operator("outliner.object_operation",
-                            text=iface_("%s Clear", i18n_contexts.operator_default) % name).type = 'OBJECT_MODE_EXIT'
-            del name
-
-            layout.separator()
-
         if not (space.display_mode == 'VIEW_LAYER' and not space.use_filter_collection):
             layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK'
             layout.separator()
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index ad7346a5651..7cd27ae3321 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -285,61 +285,6 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 
 /** \} */
 
-/* -------------------------------------------------------------------- */
-/** \name Object Mode Enter/Exit Utilities
- * \{ */
-
-static void item_object_mode_enter_exit(bContext *C, ReportList *reports, Object *ob, bool enter)
-{
-  ViewLayer *view_layer = CTX_data_view_layer(C);
-  Object *obact = OBACT(view_layer);
-
-  if ((ob->type != obact->type) || ID_IS_LINKED(ob->data)) {
-    return;
-  }
-  if (((ob->mode & obact->mode) != 0) == enter) {
-    return;
-  }
-
-  if (ob == obact) {
-    BKE_report(reports, RPT_WARNING, "Active object mode not changed");
-    return;
-  }
-
-  Base *base = BKE_view_layer_base_find(view_layer, ob);
-  if (base == NULL) {
-    return;
-  }
-  Scene *scene = CTX_data_scene(C);
-  outliner_object_mode_toggle(C, scene, view_layer, base);
-}
-
-void item_object_mode_enter_fn(bContext *C,
-                               ReportList *reports,
-                               Scene *UNUSED(scene),
-                               TreeElement *UNUSED(te),
-                               TreeStoreElem *UNUSED(tsep),
-                               TreeStoreElem *tselem,
-                               void *UNUSED(user_data))
-{
-  Object *ob = (Object *)tselem->id;
-  item_object_mode_enter_exit(C, reports, ob, true);
-}
-
-void item_object_mode_exit_fn(bContext *C,
-                              ReportList *reports,
-                              Scene *UNUSED(scene),
-                              TreeElement *UNUSED(te),
-                              TreeStoreElem *UNUSED(tsep),
-                              TreeStoreElem *tselem,
-                              void *UNUSED(user_data))
-{
-  Object *ob = (Object *)tselem->id;
-  item_object_mode_enter_exit(C, reports, ob, false);
-}
-
-/** \} */
-
 /* -------------------------------------------------------------------- */
 /** \name Rename Operator
  * \{ */
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index e02e6118152..88080218e7f 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -281,11 +281,6 @@ void outliner_item_select(struct bContext *C,
                           struct TreeElement *te,
                           const short select_flag);
 
-void outliner_object_mode_toggle(struct bContext *C,
-                                 Scene *scene,
-                                 ViewLayer *view_layer,
-                                 Base *base);
-
 bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x);
 bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x);
 bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index fe40d4cfd36..8c26f0fb07b 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -135,14 +135,6 @@ static void do_outliner_item_mode_toggle_generic(bContext *C, TreeViewContext *t
   }
 }
 
-/* For draw callback to run mode switching */
-void outliner_object_mode_toggle(bContext *UNUSED(C),
-                                 Scene *UNUSED(scene),
-                                 ViewLayer *UNUSED(view_layer),
-                                 Base *UNUSED(base))
-{
-}
-
 /* Toggle the item's interaction mode if supported */
 void outliner_item_mode_toggle(bContext *C,
                                TreeViewContext *tvc,
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 01b6e636ded..b6c5d860457 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1492,16 +1492,6 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
         C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn);
     str = "Rename Object";
   }
-  else if (event == OL_OP_OBJECT_MODE_ENTER) {
-    outliner_do_object_operation(
-        C, op->reports, scene, space_outliner, &space_outliner->tree, item_object_mode_enter_fn);
-    str = "Enter Current Mode";
-  }
-  else if (event == OL_OP_OBJECT_MODE_EXIT) {
-    outliner_do_object_operation(
-        C, op->reports, scene, space_outliner, &space_outliner->tree, item_object_mode_exit_fn);
-    str = "Exit Current Mode";
-  }
   else {
     BLI_assert(0);
     return OPERATOR_CANCELLED;



More information about the Bf-blender-cvs mailing list