forked from bartvdbraak/blender
Fix inability to toggle pose-mode without sync-selection
- There was no way to select some kinds of data without activating them. - Pose mode could not be activated at all. No change to behavior with sync-selection enabled.
This commit is contained in:
parent
8c6c46469c
commit
78ad368d12
@ -267,7 +267,8 @@ void outliner_object_mode_toggle(struct bContext *C,
|
|||||||
|
|
||||||
void outliner_element_activate(struct SpaceOutliner *soops, struct TreeStoreElem *tselem);
|
void outliner_element_activate(struct SpaceOutliner *soops, struct TreeStoreElem *tselem);
|
||||||
|
|
||||||
bool outliner_item_is_co_within_close_toggle(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);
|
||||||
|
|
||||||
/* outliner_edit.c ---------------------------------------------- */
|
/* outliner_edit.c ---------------------------------------------- */
|
||||||
typedef void (*outliner_operation_cb)(struct bContext *C,
|
typedef void (*outliner_operation_cb)(struct bContext *C,
|
||||||
|
@ -1115,8 +1115,10 @@ static void do_outliner_item_activate_tree_element(bContext *C,
|
|||||||
TreeElement *te,
|
TreeElement *te,
|
||||||
TreeStoreElem *tselem,
|
TreeStoreElem *tselem,
|
||||||
const bool extend,
|
const bool extend,
|
||||||
const bool recursive)
|
const bool recursive,
|
||||||
|
const bool is_over_name_icons)
|
||||||
{
|
{
|
||||||
|
bool do_activate_data = soops->flag & SO_SYNC_SELECT || is_over_name_icons;
|
||||||
/* Always makes active object, except for some specific types. */
|
/* Always makes active object, except for some specific types. */
|
||||||
if (ELEM(tselem->type,
|
if (ELEM(tselem->type,
|
||||||
TSE_SEQUENCE,
|
TSE_SEQUENCE,
|
||||||
@ -1133,7 +1135,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
|
|||||||
else if (tselem->type == TSE_POSE_BASE) {
|
else if (tselem->type == TSE_POSE_BASE) {
|
||||||
/* Support pose mode toggle, keeping the active object as is. */
|
/* Support pose mode toggle, keeping the active object as is. */
|
||||||
}
|
}
|
||||||
else if (soops->flag & SO_SYNC_SELECT) {
|
else if (do_activate_data) {
|
||||||
/* Only activate when synced selection is enabled */
|
/* Only activate when synced selection is enabled */
|
||||||
tree_element_set_active_object(C,
|
tree_element_set_active_object(C,
|
||||||
scene,
|
scene,
|
||||||
@ -1149,8 +1151,10 @@ static void do_outliner_item_activate_tree_element(bContext *C,
|
|||||||
outliner_element_activate(soops, tselem);
|
outliner_element_activate(soops, tselem);
|
||||||
|
|
||||||
if (tselem->type == 0) { // the lib blocks
|
if (tselem->type == 0) { // the lib blocks
|
||||||
/* editmode? */
|
if (do_activate_data == false) {
|
||||||
if (te->idcode == ID_SCE) {
|
/* Only select in outliner. */
|
||||||
|
}
|
||||||
|
else if (te->idcode == ID_SCE) {
|
||||||
if (scene != (Scene *)tselem->id) {
|
if (scene != (Scene *)tselem->id) {
|
||||||
WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), (Scene *)tselem->id);
|
WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), (Scene *)tselem->id);
|
||||||
}
|
}
|
||||||
@ -1212,7 +1216,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
|
|||||||
tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false);
|
tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (soops->flag & SO_SYNC_SELECT) {
|
else if (do_activate_data) {
|
||||||
tree_element_type_active(C,
|
tree_element_type_active(C,
|
||||||
scene,
|
scene,
|
||||||
view_layer,
|
view_layer,
|
||||||
@ -1332,7 +1336,7 @@ void outliner_item_do_activate_from_tree_element(
|
|||||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||||
|
|
||||||
do_outliner_item_activate_tree_element(
|
do_outliner_item_activate_tree_element(
|
||||||
C, scene, view_layer, soops, te, tselem, extend, recursive);
|
C, scene, view_layer, soops, te, tselem, extend, recursive, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1390,9 +1394,18 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
|
|||||||
do_outliner_range_select(C, soops, activate_te, extend);
|
do_outliner_range_select(C, soops, activate_te, extend);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const bool is_over_name_icons = outliner_item_is_co_over_name_icons(activate_te,
|
||||||
|
view_mval[0]);
|
||||||
outliner_item_select(soops, activate_te, extend, extend);
|
outliner_item_select(soops, activate_te, extend, extend);
|
||||||
do_outliner_item_activate_tree_element(
|
do_outliner_item_activate_tree_element(C,
|
||||||
C, scene, view_layer, soops, activate_te, activate_tselem, extend, false);
|
scene,
|
||||||
|
view_layer,
|
||||||
|
soops,
|
||||||
|
activate_te,
|
||||||
|
activate_tselem,
|
||||||
|
extend,
|
||||||
|
false,
|
||||||
|
is_over_name_icons);
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -1505,17 +1518,6 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
|
|||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find if x coordinate is over an icon or name */
|
|
||||||
static bool outliner_item_is_co_over_name_icons(TreeElement *te, float view_co_x)
|
|
||||||
{
|
|
||||||
/* Special case: count area left of Scene Collection as empty space */
|
|
||||||
bool outside_left = (TREESTORE(te)->type == TSE_VIEW_COLLECTION_BASE) ?
|
|
||||||
(view_co_x > te->xs + UI_UNIT_X) :
|
|
||||||
(view_co_x > te->xs);
|
|
||||||
|
|
||||||
return outside_left && (view_co_x < te->xend);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int outliner_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
static int outliner_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||||
{
|
{
|
||||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||||
|
@ -361,8 +361,19 @@ bool outliner_is_element_visible(const TreeElement *te)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find if x coordinate is over an icon or name */
|
||||||
|
bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x)
|
||||||
|
{
|
||||||
|
/* Special case: count area left of Scene Collection as empty space */
|
||||||
|
bool outside_left = (TREESTORE(te)->type == TSE_VIEW_COLLECTION_BASE) ?
|
||||||
|
(view_co_x > te->xs + UI_UNIT_X) :
|
||||||
|
(view_co_x > te->xs);
|
||||||
|
|
||||||
|
return outside_left && (view_co_x < te->xend);
|
||||||
|
}
|
||||||
|
|
||||||
/* Find if x coordinate is over element disclosure toggle */
|
/* Find if x coordinate is over element disclosure toggle */
|
||||||
bool outliner_item_is_co_within_close_toggle(TreeElement *te, float view_co_x)
|
bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x)
|
||||||
{
|
{
|
||||||
return (view_co_x > te->xs) && (view_co_x < te->xs + UI_UNIT_X);
|
return (view_co_x > te->xs) && (view_co_x < te->xs + UI_UNIT_X);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user