Outliner: Move mode toggling to left column

Add a column of icons in the left gutter of the outliner for controlling
the interaction modes of objects. When an object is in a mode other than
object mode, the mode icon will draw to the left of that object. Any
other objects that are valid to be added or swapped into the mode are
drawn with a dot to the left of the object.

Clicking the dot to the left of an object will swap that object with the
current active object in the interaction mode. For edit and pose modes,
ctrl clicking the dot will add that object to the current mode.

Clicking the mode icon next to the active object removes it and all
other objects from the current mode.

The behavior is nearly identical to the previous edit/pose mode toggling
by selecting the mesh and armature datablocks, with additional support
for all interaction modes.

Currently two undo steps are pushed to prevent an assert.

Part of T77408

Manifest Task: https://developer.blender.org/T68498

Differential Revision: https://developer.blender.org/D8641
This commit is contained in:
2020-09-10 08:35:58 -06:00
parent 0649e63716
commit 2110af20f5
11 changed files with 280 additions and 165 deletions

View File

@@ -2294,6 +2294,36 @@ int UI_idcode_icon_get(const int idcode)
}
}
int UI_mode_icon_get(const int mode)
{
switch (mode) {
case OB_MODE_OBJECT:
return ICON_OBJECT_DATAMODE;
case OB_MODE_EDIT:
case OB_MODE_EDIT_GPENCIL:
return ICON_EDITMODE_HLT;
case OB_MODE_SCULPT:
case OB_MODE_SCULPT_GPENCIL:
return ICON_SCULPTMODE_HLT;
case OB_MODE_VERTEX_PAINT:
case OB_MODE_VERTEX_GPENCIL:
return ICON_VPAINT_HLT;
case OB_MODE_WEIGHT_PAINT:
case OB_MODE_WEIGHT_GPENCIL:
return ICON_WPAINT_HLT;
case OB_MODE_TEXTURE_PAINT:
return ICON_TPAINT_HLT;
case OB_MODE_PARTICLE_EDIT:
return ICON_PARTICLEMODE;
case OB_MODE_POSE:
return ICON_POSE_HLT;
case OB_MODE_PAINT_GPENCIL:
return ICON_GREASEPENCIL;
default:
return ICON_NONE;
}
}
/* draws icon with dpi scale factor */
void UI_icon_draw(float x, float y, int icon_id)
{