forked from bartvdbraak/blender
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
This commit is contained in:
parent
2110af20f5
commit
095a53bd88
@ -275,7 +275,6 @@ class OUTLINER_MT_object(Menu):
|
|||||||
|
|
||||||
space = context.space_data
|
space = context.space_data
|
||||||
obj = context.active_object
|
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_copy", text="Copy", icon='COPYDOWN')
|
||||||
layout.operator("outliner.id_paste", text="Paste", icon='PASTEDOWN')
|
layout.operator("outliner.id_paste", text="Paste", icon='PASTEDOWN')
|
||||||
@ -293,16 +292,6 @@ class OUTLINER_MT_object(Menu):
|
|||||||
|
|
||||||
layout.separator()
|
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):
|
if not (space.display_mode == 'VIEW_LAYER' and not space.use_filter_collection):
|
||||||
layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK'
|
layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK'
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
@ -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
|
/** \name Rename Operator
|
||||||
* \{ */
|
* \{ */
|
||||||
|
@ -281,11 +281,6 @@ void outliner_item_select(struct bContext *C,
|
|||||||
struct TreeElement *te,
|
struct TreeElement *te,
|
||||||
const short select_flag);
|
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_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_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]);
|
bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]);
|
||||||
|
@ -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 */
|
/* Toggle the item's interaction mode if supported */
|
||||||
void outliner_item_mode_toggle(bContext *C,
|
void outliner_item_mode_toggle(bContext *C,
|
||||||
TreeViewContext *tvc,
|
TreeViewContext *tvc,
|
||||||
|
@ -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);
|
C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn);
|
||||||
str = "Rename Object";
|
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 {
|
else {
|
||||||
BLI_assert(0);
|
BLI_assert(0);
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
Loading…
Reference in New Issue
Block a user