Fix T58502: scopes don't work in the image editor
There were two problems: 1. The scopes were only updated when the "Scopes" category is active, but this category has been removed in Blender 2.8. 2. The scopes moved from the TOOLS to the UI region. However the update-code still searched for the "Scopes" category in the TOOLS region. Both problems are fixed with this commit: 1. Scopes have there own category again. 2. The update code is in the correct draw function now. Reviewers: brecht Differential Revision: https://developer.blender.org/D4245
This commit is contained in:
@@ -1189,22 +1189,11 @@ class ImageScopesPanel:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_PT_view_scopes(ImageScopesPanel, Panel):
|
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
|
||||||
bl_region_type = 'UI'
|
|
||||||
bl_category = "Image"
|
|
||||||
bl_label = "Scopes"
|
|
||||||
|
|
||||||
def draw(self, layout):
|
|
||||||
return # nothing to draw.
|
|
||||||
|
|
||||||
|
|
||||||
class IMAGE_PT_view_histogram(ImageScopesPanel, Panel):
|
class IMAGE_PT_view_histogram(ImageScopesPanel, Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = "Image"
|
bl_category = "Scopes"
|
||||||
bl_label = "Histogram"
|
bl_label = "Histogram"
|
||||||
bl_parent_id = 'IMAGE_PT_view_scopes'
|
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -1222,9 +1211,8 @@ class IMAGE_PT_view_histogram(ImageScopesPanel, Panel):
|
|||||||
class IMAGE_PT_view_waveform(ImageScopesPanel, Panel):
|
class IMAGE_PT_view_waveform(ImageScopesPanel, Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = "Image"
|
bl_category = "Scopes"
|
||||||
bl_label = "Waveform"
|
bl_label = "Waveform"
|
||||||
bl_parent_id = 'IMAGE_PT_view_scopes'
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1241,9 +1229,8 @@ class IMAGE_PT_view_waveform(ImageScopesPanel, Panel):
|
|||||||
class IMAGE_PT_view_vectorscope(ImageScopesPanel, Panel):
|
class IMAGE_PT_view_vectorscope(ImageScopesPanel, Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = "Image"
|
bl_category = "Scopes"
|
||||||
bl_label = "Vectorscope"
|
bl_label = "Vectorscope"
|
||||||
bl_parent_id = 'IMAGE_PT_view_scopes'
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1257,9 +1244,8 @@ class IMAGE_PT_view_vectorscope(ImageScopesPanel, Panel):
|
|||||||
class IMAGE_PT_sample_line(ImageScopesPanel, Panel):
|
class IMAGE_PT_sample_line(ImageScopesPanel, Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = "Image"
|
bl_category = "Scopes"
|
||||||
bl_label = "Sample Line"
|
bl_label = "Sample Line"
|
||||||
bl_parent_id = 'IMAGE_PT_view_scopes'
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1279,9 +1265,8 @@ class IMAGE_PT_sample_line(ImageScopesPanel, Panel):
|
|||||||
class IMAGE_PT_scope_sample(ImageScopesPanel, Panel):
|
class IMAGE_PT_scope_sample(ImageScopesPanel, Panel):
|
||||||
bl_space_type = 'IMAGE_EDITOR'
|
bl_space_type = 'IMAGE_EDITOR'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = "Image"
|
bl_category = "Scopes"
|
||||||
bl_label = "Samples"
|
bl_label = "Samples"
|
||||||
bl_parent_id = 'IMAGE_PT_view_scopes'
|
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1351,7 +1336,6 @@ classes = (
|
|||||||
IMAGE_PT_tools_brush_appearance,
|
IMAGE_PT_tools_brush_appearance,
|
||||||
IMAGE_PT_uv_sculpt,
|
IMAGE_PT_uv_sculpt,
|
||||||
IMAGE_PT_uv_sculpt_curve,
|
IMAGE_PT_uv_sculpt_curve,
|
||||||
IMAGE_PT_view_scopes,
|
|
||||||
IMAGE_PT_view_histogram,
|
IMAGE_PT_view_histogram,
|
||||||
IMAGE_PT_view_waveform,
|
IMAGE_PT_view_waveform,
|
||||||
IMAGE_PT_view_vectorscope,
|
IMAGE_PT_view_vectorscope,
|
||||||
|
|||||||
@@ -793,6 +793,27 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
|
|||||||
|
|
||||||
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
|
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
|
||||||
{
|
{
|
||||||
|
SpaceImage *sima = CTX_wm_space_image(C);
|
||||||
|
Scene *scene = CTX_data_scene(C);
|
||||||
|
void *lock;
|
||||||
|
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
|
||||||
|
/* XXX performance regression if name of scopes category changes! */
|
||||||
|
PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
|
||||||
|
|
||||||
|
/* only update scopes if scope category is active */
|
||||||
|
if (category) {
|
||||||
|
if (ibuf) {
|
||||||
|
if (!sima->scopes.ok) {
|
||||||
|
BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
|
||||||
|
}
|
||||||
|
if (sima->image->flag & IMA_VIEW_AS_RENDER)
|
||||||
|
ED_space_image_scopes_update(C, sima, ibuf, true);
|
||||||
|
else
|
||||||
|
ED_space_image_scopes_update(C, sima, ibuf, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ED_space_image_release_buffer(sima, ibuf, lock);
|
||||||
|
|
||||||
ED_region_panels(C, ar);
|
ED_region_panels(C, ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,27 +868,6 @@ static void image_tools_region_init(wmWindowManager *wm, ARegion *ar)
|
|||||||
|
|
||||||
static void image_tools_region_draw(const bContext *C, ARegion *ar)
|
static void image_tools_region_draw(const bContext *C, ARegion *ar)
|
||||||
{
|
{
|
||||||
SpaceImage *sima = CTX_wm_space_image(C);
|
|
||||||
Scene *scene = CTX_data_scene(C);
|
|
||||||
void *lock;
|
|
||||||
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
|
|
||||||
/* XXX performance regression if name of scopes category changes! */
|
|
||||||
PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
|
|
||||||
|
|
||||||
/* only update scopes if scope category is active */
|
|
||||||
if (category) {
|
|
||||||
if (ibuf) {
|
|
||||||
if (!sima->scopes.ok) {
|
|
||||||
BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
|
|
||||||
}
|
|
||||||
if (sima->image->flag & IMA_VIEW_AS_RENDER)
|
|
||||||
ED_space_image_scopes_update(C, sima, ibuf, true);
|
|
||||||
else
|
|
||||||
ED_space_image_scopes_update(C, sima, ibuf, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ED_space_image_release_buffer(sima, ibuf, lock);
|
|
||||||
|
|
||||||
ED_region_panels(C, ar);
|
ED_region_panels(C, ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,7 +1041,7 @@ void ED_spacetype_image(void)
|
|||||||
art->listener = image_main_region_listener;
|
art->listener = image_main_region_listener;
|
||||||
BLI_addhead(&st->regiontypes, art);
|
BLI_addhead(&st->regiontypes, art);
|
||||||
|
|
||||||
/* regions: listview/buttons */
|
/* regions: listview/buttons/scopes */
|
||||||
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
||||||
art->regionid = RGN_TYPE_UI;
|
art->regionid = RGN_TYPE_UI;
|
||||||
art->prefsizex = 220; // XXX
|
art->prefsizex = 220; // XXX
|
||||||
@@ -1054,7 +1054,7 @@ void ED_spacetype_image(void)
|
|||||||
ED_uvedit_buttons_register(art);
|
ED_uvedit_buttons_register(art);
|
||||||
image_buttons_register(art);
|
image_buttons_register(art);
|
||||||
|
|
||||||
/* regions: statistics/scope buttons */
|
/* regions: tool(bar) */
|
||||||
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
||||||
art->regionid = RGN_TYPE_TOOLS;
|
art->regionid = RGN_TYPE_TOOLS;
|
||||||
art->prefsizex = 58; /* XXX */
|
art->prefsizex = 58; /* XXX */
|
||||||
|
|||||||
Reference in New Issue
Block a user