Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_colortools.h1
-rw-r--r--source/blender/blenkernel/intern/colortools.c16
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/editors/interface/interface_draw.c155
-rw-r--r--source/blender/editors/space_image/space_image.c9
5 files changed, 98 insertions, 91 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index f78389fe4de..1f2dee6dcfc 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -76,6 +76,7 @@ void colorcorrection_do_ibuf(struct ImBuf *ibuf, const char *profile);
void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management);
void scopes_free(struct Scopes *scopes);
+void scopes_new(struct Scopes *scopes);
#endif
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 66ebac2e25e..2856a333a5f 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1110,3 +1110,19 @@ void scopes_free(Scopes *scopes)
scopes->vecscope = NULL;
}
}
+
+void scopes_new(Scopes *scopes)
+{
+ scopes->accuracy=30.0;
+ scopes->hist.mode=HISTO_MODE_RGB;
+ scopes->wavefrm_alpha=0.3;
+ scopes->vecscope_alpha=0.3;
+ scopes->wavefrm_height= 100;
+ scopes->vecscope_height= 100;
+ scopes->hist.height= 100;
+ scopes->ok= 0;
+ scopes->waveform_1 = NULL;
+ scopes->waveform_2 = NULL;
+ scopes->waveform_3 = NULL;
+ scopes->vecscope = NULL;
+}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 08835c4cb28..90503a83698 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10841,13 +10841,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
- sima->scopes.accuracy = 30.0;
- sima->scopes.hist.mode=HISTO_MODE_RGB;
- sima->scopes.wavefrm_alpha=0.3;
- sima->scopes.vecscope_alpha=0.3;
- sima->scopes.wavefrm_height= 100;
- sima->scopes.vecscope_height= 100;
- sima->scopes.hist.height= 100;
+ scopes_new(&sima->scopes);
}
}
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 16ef2dd5c9b..20359b2c3a4 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -880,76 +880,80 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
/* 7.5 IRE black point level for NTSC */
if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUM)
fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f);
-
- /* LUMA (1 channel) */
- glBlendFunc(GL_ONE,GL_ONE);
- glColor3f(alpha, alpha, alpha);
- if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUM){
-
- glBlendFunc(GL_ONE,GL_ONE);
-
- glPushMatrix();
- glEnableClientState(GL_VERTEX_ARRAY);
-
- glTranslatef(rect.xmin, yofs, 0.f);
- glScalef(w, h, 0.f);
- glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
- glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glPopMatrix();
- /* min max */
- glColor3f(.5f, .5f, .5f);
- min= yofs+scopes->minmax[0][0]*h;
- max= yofs+scopes->minmax[0][1]*h;
- CLAMP(min, rect.ymin, rect.ymax);
- CLAMP(max, rect.ymin, rect.ymax);
- fdrawline(rect.xmax-3,min,rect.xmax-3,max);
- }
-
- /* RGB / YCC (3 channels) */
- else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) {
- int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
+ if (scopes->ok && scopes->waveform_1 != NULL) {
+ /* LUMA (1 channel) */
glBlendFunc(GL_ONE,GL_ONE);
-
- glPushMatrix();
- glEnableClientState(GL_VERTEX_ARRAY);
-
- glTranslatef(rect.xmin, yofs, 0.f);
- glScalef(w3, h, 0.f);
-
- glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]);
- glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
- glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+ glColor3f(alpha, alpha, alpha);
+ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUM){
- glTranslatef(1.f, 0.f, 0.f);
- glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]);
- glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
- glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-
- glTranslatef(1.f, 0.f, 0.f);
- glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]);
- glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
- glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glPopMatrix();
-
-
- /* min max */
- for (c=0; c<3; c++) {
- if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
- glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
- else
- glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
- min= yofs+scopes->minmax[c][0]*h;
- max= yofs+scopes->minmax[c][1]*h;
+ glBlendFunc(GL_ONE,GL_ONE);
+
+ glPushMatrix();
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ glTranslatef(rect.xmin, yofs, 0.f);
+ glScalef(w, h, 0.f);
+ glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
+ glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glPopMatrix();
+
+ /* min max */
+ glColor3f(.5f, .5f, .5f);
+ min= yofs+scopes->minmax[0][0]*h;
+ max= yofs+scopes->minmax[0][1]*h;
CLAMP(min, rect.ymin, rect.ymax);
CLAMP(max, rect.ymin, rect.ymax);
- fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
+ fdrawline(rect.xmax-3,min,rect.xmax-3,max);
+ }
+
+ /* RGB / YCC (3 channels) */
+ else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) {
+ int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
+
+ glBlendFunc(GL_ONE,GL_ONE);
+
+ glPushMatrix();
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ glTranslatef(rect.xmin, yofs, 0.f);
+ glScalef(w3, h, 0.f);
+
+ glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]);
+ glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
+ glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+ glTranslatef(1.f, 0.f, 0.f);
+ glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]);
+ glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
+ glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+ glTranslatef(1.f, 0.f, 0.f);
+ glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]);
+ glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
+ glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glPopMatrix();
+
+
+ /* min max */
+ for (c=0; c<3; c++) {
+ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
+ glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
+ else
+ glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
+ min= yofs+scopes->minmax[c][0]*h;
+ max= yofs+scopes->minmax[c][1]*h;
+ CLAMP(min, rect.ymin, rect.ymax);
+ CLAMP(max, rect.ymin, rect.ymax);
+ fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
+ }
}
+
}
/* outline, scale gripper */
@@ -1030,8 +1034,6 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
GLint scissor[4];
- if (scopes==NULL) return;
-
rect.xmin = (float)recti->xmin+1;
rect.xmax = (float)recti->xmax-1;
rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
@@ -1079,25 +1081,24 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
for(i=0; i<6; i++)
vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
- /* pixel point cloud */
- glBlendFunc(GL_ONE,GL_ONE);
- glColor4f(alpha, alpha, alpha, alpha);
+ if (scopes->ok && scopes->vecscope != NULL) {
+ /* pixel point cloud */
+ glBlendFunc(GL_ONE,GL_ONE);
+ glColor3f(alpha, alpha, alpha);
- glPushMatrix();
- glEnableClientState(GL_VERTEX_ARRAY);
+ glPushMatrix();
+ glEnableClientState(GL_VERTEX_ARRAY);
- glTranslatef(centerx, centery, 0.f);
- glScalef(diam, diam, 0.f);
+ glTranslatef(centerx, centery, 0.f);
+ glScalef(diam, diam, 0.f);
- /*apparently this can sometimes be NULL? - joeedh*/
- if (scopes) {
glVertexPointer(2, GL_FLOAT, 0, scopes->vecscope);
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glPopMatrix();
}
- glDisableClientState(GL_VERTEX_ARRAY);
- glPopMatrix();
-
/* outline, scale gripper */
draw_scope_end(&rect, scissor);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 3d9f802d0d7..7e3cfcdb6bc 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -385,6 +385,8 @@ static SpaceLink *image_new(const bContext *C)
simage->iuser.ok= 1;
simage->iuser.fie_ima= 2;
simage->iuser.frames= 100;
+
+ scopes_new(&simage->scopes);
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for image");
@@ -409,13 +411,6 @@ static SpaceLink *image_new(const bContext *C)
ar->alignment= RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
- simage->scopes.accuracy=30.0;
- simage->scopes.hist.mode=HISTO_MODE_RGB;
- simage->scopes.wavefrm_alpha=0.3;
- simage->scopes.vecscope_alpha=0.3;
- simage->scopes.wavefrm_height= 100;
- simage->scopes.hist.height= 100;
-
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for image");