Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 1,929 Lines • ▼ Show 20 Lines | static void outliner_mode_toggle_fn(bContext *C, void *tselem_poin, void *UNUSED(arg2)) | ||||
| TreeViewContext tvc; | TreeViewContext tvc; | ||||
| outliner_viewcontext_init(C, &tvc); | outliner_viewcontext_init(C, &tvc); | ||||
| TreeElement *te = outliner_find_tree_element(&space_outliner->tree, tselem); | TreeElement *te = outliner_find_tree_element(&space_outliner->tree, tselem); | ||||
| if (!te) { | if (!te) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Check that the the item is actually an object. */ | |||||
Severin: There should be some kind of sanity check here, before just assuming this is an object. | |||||
| BLI_assert(tselem->id != NULL && GS(tselem->id->name) == ID_OB); | |||||
| Object *ob = (Object *)tselem->id; | |||||
| const bool object_data_shared = (ob->data == tvc.obact->data); | |||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| const bool do_extend = win->eventstate->ctrl != 0; | const bool do_extend = win->eventstate->ctrl != 0 && !object_data_shared; | ||||
| outliner_item_mode_toggle(C, &tvc, te, do_extend); | outliner_item_mode_toggle(C, &tvc, te, do_extend); | ||||
| } | } | ||||
| /* 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, | ||||
| Show All 21 Lines | static void outliner_draw_mode_column_toggle(uiBlock *block, | ||||
| /* 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 != ob_active && !(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; | ||||
| } | } | ||||
| const bool object_data_shared = (ob->data == ob_active->data); | |||||
| draw_active_icon = draw_active_icon || object_data_shared; | |||||
Done Inline ActionsWould prefer not using bitwise operations for something that doesn't represent a bitfield. Severin: Would prefer not using bitwise operations for something that doesn't represent a bitfield. | |||||
| int icon; | int icon; | ||||
| const char *tip; | const char *tip; | ||||
| if (draw_active_icon) { | if (draw_active_icon) { | ||||
| icon = UI_icon_from_object_mode(ob_active->mode); | icon = UI_icon_from_object_mode(ob_active->mode); | ||||
| tip = TIP_("Remove from the current mode"); | tip = object_data_shared ? TIP_("Change the object in the current mode") : | ||||
| TIP_("Remove from the current mode"); | |||||
| } | } | ||||
| else { | else { | ||||
| 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"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,688 Lines • Show Last 20 Lines | |||||
There should be some kind of sanity check here, before just assuming this is an object.