Commit: e0d6c13a443eb86678b8b4f60279a5390ecfe632
Author: Nathan Craddock
Date: Sat Aug 15 20:25:20 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBe0d6c13a443eb86678b8b4f60279a5390ecfe632
Outliner: Fix ID operation menu
Use the active item to determine the type of action to take.
===================================================================
M source/blender/editors/space_outliner/outliner_tools.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_tools.c
b/source/blender/editors/space_outliner/outliner_tools.c
index 5a0847c1b8d..e65f3e2d0a8 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -204,6 +204,11 @@ static void set_operation_types(SpaceOutliner
*space_outliner,
}
}
+static TreeElement *get_target_element(SpaceOutliner *space_outliner)
+{
+ return outliner_find_element_with_flag(&space_outliner->tree, TSE_ACTIVE);
+}
+
static void unlink_action_fn(bContext *C,
ReportList *UNUSED(reports),
Scene *UNUSED(scene),
@@ -1729,18 +1734,20 @@ static int outliner_id_operation_exec(bContext *C,
wmOperator *op)
Scene *scene = CTX_data_scene(C);
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
- eOutlinerIdOpTypes event;
/* check for invalid states */
if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
- set_operation_types(
- space_outliner, &space_outliner->tree, &scenelevel, &objectlevel,
&idlevel, &datalevel);
+ TreeElement *te = get_target_element(space_outliner);
+ if (!te) {
+ return OPERATOR_CANCELLED;
+ }
- event = RNA_enum_get(op->ptr, "type");
+ get_element_operation_type(te, &scenelevel, &objectlevel, &idlevel,
&datalevel);
+ eOutlinerIdOpTypes event = RNA_enum_get(op->ptr, "type");
switch (event) {
case OUTLINER_IDOP_UNLINK: {
/* unlink datablock from its parent */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs