Commit: 1cf39ca00225477fd6198f8463ce4565672ef289
Author: Nathan Craddock
Date:   Tue Aug 18 15:50:15 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB1cf39ca00225477fd6198f8463ce4565672ef289

Cleanup: Remove broken context menu mode toggle code

The outliner context menu had an operator to enter/exit modes, but it
only showed when the objects were in modes. Additionally, I'm not
certain how much it was used since it has been broken for a long time
and no one has reported it.

Entering modes through the context menu could be a nice feature, but I
think it would be an easier problem to solve after a context menu
refactor.

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

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 0826a65ec62..034e6567aa1 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -297,16 +297,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 cd2fcd8e2cf..9fe29268603 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -284,61 +284,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 89771f9f76e..ffb8e5001a7 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -283,11 +283,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 382b7ad94b5..7249fbb5a28 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -131,8 +131,6 @@ static void do_outliner_item_editmode_toggle(bContext *C, 
Scene *scene, Base *ba
   }
   else {
     ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, 
EM_NO_CONTEXT);
-    /* TODO (Nathan): Why does this crash on undo? */
-    // ED_object_base_activate(C, base);
   }
   if (ok) {
     ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : 
BA_DESELECT);
@@ -188,18 +186,6 @@ static void do_outliner_item_mode_toggle_generic(bContext 
*C, TreeViewContext *t
   ED_outliner_select_sync_from_object_tag(C);
 }
 
-/* For draw callback to run mode switching */
-void outliner_object_mode_toggle(bContext *C, Scene *scene, ViewLayer 
*view_layer, Base *base)
-{
-  Object *obact = OBACT(view_layer);
-  if (obact->mode & OB_MODE_EDIT) {
-    do_outliner_item_editmode_toggle(C, scene, base);
-  }
-  else if (obact->mode & OB_MODE_POSE) {
-    do_outliner_item_posemode_toggle(C, scene, base);
-  }
-}
-
 /* Toggle the item's interaction mode if supported */
 void outliner_item_mode_toggle(bContext *C, TreeViewContext *tvc, TreeElement 
*te)
 {
diff --git a/source/blender/editors/space_outliner/outliner_tools.c 
b/source/blender/editors/space_outliner/outliner_tools.c
index 4a13535438e..9053db01628 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1340,8 +1340,6 @@ enum {
   OL_OP_TOGSEL,
   OL_OP_TOGREN,
   OL_OP_RENAME,
-  OL_OP_OBJECT_MODE_ENTER,
-  OL_OP_OBJECT_MODE_EXIT,
 };
 
 static const EnumPropertyItem prop_object_op_types[] = {
@@ -1354,8 +1352,6 @@ static const EnumPropertyItem prop_object_op_types[] = {
      "Remap Users",
      "Make all users of selected data-blocks to use instead a new chosen one"},
     {OL_OP_RENAME, "RENAME", 0, "Rename", ""},
-    {OL_OP_OBJECT_MODE_ENTER, "OBJECT_MODE_ENTER", 0, "Enter Mode", ""},
-    {OL_OP_OBJECT_MODE_EXIT, "OBJECT_MODE_EXIT", 0, "Exit Mode", ""},
     {0, NULL, 0, NULL, NULL},
 };
 
@@ -1425,16 +1421,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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to