Color management: Tweak compatible look check
Change compatible look check so that if the view contains explicitly configured looks the non-explicit looks are not added to the list. In practice this means that if there are looks "Low Contrast" and "AgX - Low Contrast" only the latter one is considered to be compatible with the "AgX" view. Ref #110685 Pull Request: https://projects.blender.org/blender/blender/pulls/111229
This commit is contained in:
committed by
Sergey Sharybin
parent
259bfc4553
commit
d0dcfb8159
@@ -737,14 +737,47 @@ void colormanagement_exit()
|
||||
/** \name Internal functions
|
||||
* \{ */
|
||||
|
||||
static bool colormanage_compatible_look(ColorManagedLook *look, const char *view_name)
|
||||
static bool has_explicit_look_for_view(const char *view_name)
|
||||
{
|
||||
if (!view_name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (ColorManagedLook *, look, &global_looks) {
|
||||
if (STREQ(look->view, view_name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool colormanage_compatible_look(const ColorManagedLook *look,
|
||||
const char *view_name,
|
||||
const bool has_explicit_look)
|
||||
{
|
||||
if (look->is_noop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Skip looks only relevant to specific view transforms. */
|
||||
return (look->view[0] == 0 || (view_name && STREQ(look->view, view_name)));
|
||||
/* Skip looks only relevant to specific view transforms.
|
||||
* If the view transform has view-specific look ignore non-specific looks. */
|
||||
|
||||
if (view_name && STREQ(look->view, view_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (has_explicit_look) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return look->view[0] == '\0';
|
||||
}
|
||||
|
||||
static bool colormanage_compatible_look(const ColorManagedLook *look, const char *view_name)
|
||||
{
|
||||
const bool has_explicit_look = has_explicit_look_for_view(view_name);
|
||||
return colormanage_compatible_look(look, view_name, has_explicit_look);
|
||||
}
|
||||
|
||||
static bool colormanage_use_look(const char *look, const char *view_name)
|
||||
@@ -3405,8 +3438,10 @@ void IMB_colormanagement_look_items_add(EnumPropertyItem **items,
|
||||
int *totitem,
|
||||
const char *view_name)
|
||||
{
|
||||
const bool has_explicit_look = has_explicit_look_for_view(view_name);
|
||||
|
||||
LISTBASE_FOREACH (ColorManagedLook *, look, &global_looks) {
|
||||
if (!colormanage_compatible_look(look, view_name)) {
|
||||
if (!colormanage_compatible_look(look, view_name, has_explicit_look)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user