Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 1,941 Lines • ▼ Show 20 Lines | |||||
| /* Draw icons for adding and removing objects from the current interation mode. */ | /* Draw icons for adding and removing objects from the current interation mode. */ | ||||
| static void outliner_draw_mode_column_toggle(uiBlock *block, | static void outliner_draw_mode_column_toggle(uiBlock *block, | ||||
| TreeViewContext *tvc, | TreeViewContext *tvc, | ||||
| TreeElement *te, | TreeElement *te, | ||||
| TreeStoreElem *tselem, | TreeStoreElem *tselem, | ||||
| const bool lock_object_modes) | const bool lock_object_modes) | ||||
| { | { | ||||
| const int active_mode = tvc->obact->mode; | if (tselem->type != 0 || te->idcode != ID_OB) { | ||||
| bool draw_active_icon = true; | return; | ||||
| } | |||||
| if (tselem->type == 0 && te->idcode == ID_OB) { | |||||
| Object *ob = (Object *)tselem->id; | Object *ob = (Object *)tselem->id; | ||||
| Object *ob_active = tvc->obact; | |||||
| /* Not all objects support particle systems. */ | |||||
| if (ob_active->mode == OB_MODE_PARTICLE_EDIT && !psys_get_current(ob)) { | |||||
| return; | |||||
| } | |||||
natecraddock: Perhaps add the missing `.` I forgot if that's okay to include with this cleanup | |||||
| /* Only for objects with the same type. */ | |||||
| if (ob->type != ob_active->type) { | |||||
| return; | |||||
| } | |||||
| bool draw_active_icon = ob->mode == ob_active->mode; | |||||
| /* When not locking object modes, objects can remain in non-object modes. For modes that do not | /* 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 | * 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 | * mode. Otherwise multiple objects show the same mode icon in the outliner even though only | ||||
| * one object is actually editable in the mode. */ | * one object is actually editable in the mode. */ | ||||
| if (!lock_object_modes && ob != tvc->obact && !(tvc->ob_edit || tvc->ob_pose)) { | if (!lock_object_modes && ob != ob_active && !(tvc->ob_edit || tvc->ob_pose)) { | ||||
| draw_active_icon = false; | draw_active_icon = false; | ||||
| } | } | ||||
| if (ob->type == tvc->obact->type) { | |||||
| int icon; | int icon; | ||||
| const char *tip; | const char *tip; | ||||
| if (draw_active_icon) { | |||||
| if (draw_active_icon && ob->mode == tvc->obact->mode) { | icon = UI_icon_from_object_mode(ob_active->mode); | ||||
| icon = UI_icon_from_object_mode(active_mode); | |||||
| tip = TIP_("Remove from the current mode"); | tip = TIP_("Remove from the current mode"); | ||||
| } | } | ||||
| else { | else { | ||||
| /* Not all objects support particle systems */ | |||||
| if (active_mode == OB_MODE_PARTICLE_EDIT && !psys_get_current(ob)) { | |||||
| return; | |||||
| } | |||||
| icon = ICON_DOT; | icon = ICON_DOT; | ||||
| tip = TIP_( | tip = TIP_( | ||||
| "Change the object in the current mode\n" | "Change the object in the current mode\n" | ||||
| "* Ctrl to add to the current mode"); | "* Ctrl to add to the current mode"); | ||||
| } | } | ||||
| uiBut *but = uiDefIconBut(block, | uiBut *but = uiDefIconBut(block, | ||||
| UI_BTYPE_ICON_TOGGLE, | UI_BTYPE_ICON_TOGGLE, | ||||
| 0, | 0, | ||||
| icon, | icon, | ||||
| 0, | 0, | ||||
| te->ys, | te->ys, | ||||
| UI_UNIT_X, | UI_UNIT_X, | ||||
| UI_UNIT_Y, | UI_UNIT_Y, | ||||
| NULL, | NULL, | ||||
| 0.0, | 0.0, | ||||
| 0.0, | 0.0, | ||||
| 0.0, | 0.0, | ||||
| 0.0, | 0.0, | ||||
| tip); | tip); | ||||
| UI_but_func_set(but, outliner_mode_toggle_fn, tselem, NULL); | UI_but_func_set(but, outliner_mode_toggle_fn, tselem, NULL); | ||||
| UI_but_flag_enable(but, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(but, UI_BUT_DRAG_LOCK); | ||||
| if (ID_IS_LINKED(&ob->id)) { | if (ID_IS_LINKED(&ob->id)) { | ||||
| UI_but_disable(but, TIP_("Can't edit external library data")); | UI_but_disable(but, TIP_("Can't edit external library data")); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } | |||||
| static void outliner_draw_mode_column(const bContext *C, | static void outliner_draw_mode_column(const bContext *C, | ||||
| uiBlock *block, | uiBlock *block, | ||||
| TreeViewContext *tvc, | TreeViewContext *tvc, | ||||
| SpaceOutliner *space_outliner, | SpaceOutliner *space_outliner, | ||||
| ListBase *tree) | ListBase *tree) | ||||
| { | { | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| ▲ Show 20 Lines • Show All 1,659 Lines • Show Last 20 Lines | |||||
Perhaps add the missing . I forgot if that's okay to include with this cleanup