Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-10-22 23:47:03 +0300
committerHans Goudey <h.goudey@me.com>2020-10-22 23:47:03 +0300
commit7863ded680e423f8fd5f1d2a0216e0914eee2a78 (patch)
treeae1f0646a150581c8554d3f75f5ed6f9f9256ee0 /source
parentd453bbbd26d98a816bd52da502132a52cc6825c8 (diff)
parent3d916c0a966c96fa394d219be4029ca27d68d198 (diff)
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c103
1 files changed, 54 insertions, 49 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 09ccb950c18..3045529747d 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1947,60 +1947,65 @@ static void outliner_draw_mode_column_toggle(uiBlock *block,
TreeStoreElem *tselem,
const bool lock_object_modes)
{
- const int active_mode = tvc->obact->mode;
- bool draw_active_icon = true;
+ if (tselem->type != 0 || te->idcode != ID_OB) {
+ return;
+ }
- if (tselem->type == 0 && te->idcode == ID_OB) {
- Object *ob = (Object *)tselem->id;
+ Object *ob = (Object *)tselem->id;
+ Object *ob_active = tvc->obact;
- /* When not locking object modes, objects can remain in non-object modes. For modes that do not
- * allow multi-object editing, these other objects should still show be viewed as not in the
- * mode. Otherwise multiple objects show the same mode icon in the outliner even though only
- * one object is actually editable in the mode. */
- if (!lock_object_modes && ob != tvc->obact && !(tvc->ob_edit || tvc->ob_pose)) {
- draw_active_icon = false;
- }
+ /* Not all objects support particle systems. */
+ if (ob_active->mode == OB_MODE_PARTICLE_EDIT && !psys_get_current(ob)) {
+ return;
+ }
- if (ob->type == tvc->obact->type) {
- int icon;
- const char *tip;
+ /* Only for objects with the same type. */
+ if (ob->type != ob_active->type) {
+ return;
+ }
- if (draw_active_icon && ob->mode == tvc->obact->mode) {
- icon = UI_icon_from_object_mode(active_mode);
- tip = TIP_("Remove from the current mode");
- }
- else {
- /* Not all objects support particle systems */
- if (active_mode == OB_MODE_PARTICLE_EDIT && !psys_get_current(ob)) {
- return;
- }
- icon = ICON_DOT;
- tip = TIP_(
- "Change the object in the current mode\n"
- "* Ctrl to add to the current mode");
- }
+ bool draw_active_icon = ob->mode == ob_active->mode;
- uiBut *but = uiDefIconBut(block,
- UI_BTYPE_ICON_TOGGLE,
- 0,
- icon,
- 0,
- te->ys,
- UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- tip);
- UI_but_func_set(but, outliner_mode_toggle_fn, tselem, NULL);
- UI_but_flag_enable(but, UI_BUT_DRAG_LOCK);
-
- if (ID_IS_LINKED(&ob->id)) {
- UI_but_disable(but, TIP_("Can't edit external library data"));
- }
- }
+ /* When not locking object modes, objects can remain in non-object modes. For modes that do not
+ * allow multi-object editing, these other objects should still show be viewed as not in the
+ * mode. Otherwise multiple objects show the same mode icon in the outliner even though only
+ * one object is actually editable in the mode. */
+ if (!lock_object_modes && ob != ob_active && !(tvc->ob_edit || tvc->ob_pose)) {
+ draw_active_icon = false;
+ }
+
+ int icon;
+ const char *tip;
+ if (draw_active_icon) {
+ icon = UI_icon_from_object_mode(ob_active->mode);
+ tip = TIP_("Remove from the current mode");
+ }
+ else {
+ icon = ICON_DOT;
+ tip = TIP_(
+ "Change the object in the current mode\n"
+ "* Ctrl to add to the current mode");
+ }
+
+ uiBut *but = uiDefIconBut(block,
+ UI_BTYPE_ICON_TOGGLE,
+ 0,
+ icon,
+ 0,
+ te->ys,
+ UI_UNIT_X,
+ UI_UNIT_Y,
+ NULL,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ tip);
+ UI_but_func_set(but, outliner_mode_toggle_fn, tselem, NULL);
+ UI_but_flag_enable(but, UI_BUT_DRAG_LOCK);
+
+ if (ID_IS_LINKED(&ob->id)) {
+ UI_but_disable(but, TIP_("Can't edit external library data"));
}
}