Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/colormanagement.c
| Show First 20 Lines • Show All 2,562 Lines • ▼ Show 20 Lines | |||||
| ColorManagedLook *colormanage_look_add(const char *name, const char *process_space, bool is_noop) | ColorManagedLook *colormanage_look_add(const char *name, const char *process_space, bool is_noop) | ||||
| { | { | ||||
| ColorManagedLook *look; | ColorManagedLook *look; | ||||
| int index = global_tot_looks; | int index = global_tot_looks; | ||||
| look = MEM_callocN(sizeof(ColorManagedLook), "ColorManagedLook"); | look = MEM_callocN(sizeof(ColorManagedLook), "ColorManagedLook"); | ||||
| look->index = index + 1; | look->index = index + 1; | ||||
| BLI_strncpy(look->name, name, sizeof(look->name)); | BLI_strncpy(look->name, name, sizeof(look->name)); | ||||
| BLI_strncpy(look->ui_name, name, sizeof(look->ui_name)); | |||||
| BLI_strncpy(look->process_space, process_space, sizeof(look->process_space)); | BLI_strncpy(look->process_space, process_space, sizeof(look->process_space)); | ||||
| look->is_noop = is_noop; | look->is_noop = is_noop; | ||||
| /* Detect view specific looks. */ | |||||
| const char *separator_offset = strstr(look->name, " - "); | |||||
| if (separator_offset) { | |||||
| BLI_strncpy(look->view, look->name, separator_offset - look->name + 1); | |||||
| BLI_strncpy(look->ui_name, separator_offset + strlen(" - "), sizeof(look->ui_name)); | |||||
| } | |||||
| BLI_addtail(&global_looks, look); | BLI_addtail(&global_looks, look); | ||||
| global_tot_looks++; | global_tot_looks++; | ||||
| return look; | return look; | ||||
| } | } | ||||
| ColorManagedLook *colormanage_look_get_named(const char *name) | ColorManagedLook *colormanage_look_get_named(const char *name) | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | if (display) { | ||||
| for (display_view = display->views.first; display_view; display_view = display_view->next) { | for (display_view = display->views.first; display_view; display_view = display_view->next) { | ||||
| view = display_view->data; | view = display_view->data; | ||||
| colormanagement_view_item_add(items, totitem, view); | colormanagement_view_item_add(items, totitem, view); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items, int *totitem) | void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items, int *totitem, const char *view_name) | ||||
| { | { | ||||
| ColorManagedLook *look; | ColorManagedLook *look; | ||||
| const char *view_filter = NULL; | |||||
| /* Test if this view transform is limited to specific looks. */ | |||||
| for (look = global_looks.first; look; look = look->next) { | for (look = global_looks.first; look; look = look->next) { | ||||
| if (STREQ(look->view, view_name)) { | |||||
| view_filter = view_name; | |||||
| } | |||||
| } | |||||
| for (look = global_looks.first; look; look = look->next) { | |||||
| if (!look->is_noop && view_filter && !STREQ(look->view, view_filter)) { | |||||
| continue; | |||||
| } | |||||
| EnumPropertyItem item; | EnumPropertyItem item; | ||||
| item.value = look->index; | item.value = look->index; | ||||
| item.name = look->name; | item.name = look->ui_name; | ||||
| item.identifier = look->name; | item.identifier = look->name; | ||||
| item.icon = 0; | item.icon = 0; | ||||
| item.description = ""; | item.description = ""; | ||||
| RNA_enum_item_add(items, totitem, &item); | RNA_enum_item_add(items, totitem, &item); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 751 Lines • Show Last 20 Lines | |||||