Fix: Asset shelf missing deactivation if new item hidden
When a new item is active, other items are only deactivated in the `set_state_active` method. This doesn't run if the new item is not displayed by the shelf for whatever reason (e.g. catalog filters). To fix this, just set the item inactive. This may be redundant with the deactivation in `set_state_active`, or it might not be, depending on whether the active item is visible. Pull Request: https://projects.blender.org/blender/blender/pulls/121589
This commit is contained in:
@@ -86,11 +86,15 @@ void AbstractViewItem::deactivate()
|
||||
|
||||
void AbstractViewItem::change_state_delayed()
|
||||
{
|
||||
const std::optional<bool> should_be_active = this->should_be_active();
|
||||
if (should_be_active.has_value() && *should_be_active) {
|
||||
/* Don't call #activate() here, since this reflects an external state change and therefore
|
||||
* shouldn't call #on_activate(). */
|
||||
set_state_active();
|
||||
if (const std::optional<bool> should_be_active = this->should_be_active()) {
|
||||
if (*should_be_active) {
|
||||
/* Don't call #activate() here, since this reflects an external state change and therefore
|
||||
* shouldn't call #on_activate(). */
|
||||
set_state_active();
|
||||
}
|
||||
else {
|
||||
is_active_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user