forked from bartvdbraak/blender
style cleanup: screen
This commit is contained in:
parent
f9d07ff3ee
commit
facc976371
File diff suppressed because it is too large
Load Diff
@ -92,7 +92,7 @@ GLubyte stipple_quarttone[128] = {
|
|||||||
|
|
||||||
|
|
||||||
GLubyte stipple_diag_stripes_pos[128] = {
|
GLubyte stipple_diag_stripes_pos[128] = {
|
||||||
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
|
0x00, 0xff, 0x00, 0xff, 0x01, 0xfe, 0x01, 0xfe,
|
||||||
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
|
0x03, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x07, 0xf8,
|
||||||
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
|
0x0f, 0xf0, 0x0f, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0,
|
||||||
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
|
0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80,
|
||||||
@ -111,7 +111,7 @@ GLubyte stipple_diag_stripes_pos[128] = {
|
|||||||
|
|
||||||
|
|
||||||
GLubyte stipple_diag_stripes_neg[128] = {
|
GLubyte stipple_diag_stripes_neg[128] = {
|
||||||
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
|
0xff, 0x00, 0xff, 0x00, 0xfe, 0x01, 0xfe, 0x01,
|
||||||
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
|
0xfc, 0x03, 0xfc, 0x03, 0xf8, 0x07, 0xf8, 0x07,
|
||||||
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
|
0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xe0, 0x1f,
|
||||||
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
|
0xc0, 0x3f, 0xc0, 0x3f, 0x80, 0x7f, 0x80, 0x7f,
|
||||||
@ -134,16 +134,16 @@ void fdrawbezier(float vec[4][3])
|
|||||||
float dist;
|
float dist;
|
||||||
float curve_res = 24, spline_step = 0.0f;
|
float curve_res = 24, spline_step = 0.0f;
|
||||||
|
|
||||||
dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
|
dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
|
||||||
|
|
||||||
/* check direction later, for top sockets */
|
/* check direction later, for top sockets */
|
||||||
vec[1][0]= vec[0][0]+dist;
|
vec[1][0] = vec[0][0] + dist;
|
||||||
vec[1][1]= vec[0][1];
|
vec[1][1] = vec[0][1];
|
||||||
|
|
||||||
vec[2][0]= vec[3][0]-dist;
|
vec[2][0] = vec[3][0] - dist;
|
||||||
vec[2][1]= vec[3][1];
|
vec[2][1] = vec[3][1];
|
||||||
/* we can reuse the dist variable here to increment the GL curve eval amount*/
|
/* we can reuse the dist variable here to increment the GL curve eval amount*/
|
||||||
dist = 1.0f/curve_res;
|
dist = 1.0f / curve_res;
|
||||||
|
|
||||||
cpack(0x0);
|
cpack(0x0);
|
||||||
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
|
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
|
||||||
@ -193,7 +193,7 @@ void fdrawbox(float x1, float y1, float x2, float y2)
|
|||||||
|
|
||||||
void fdrawcheckerboard(float x1, float y1, float x2, float y2)
|
void fdrawcheckerboard(float x1, float y1, float x2, float y2)
|
||||||
{
|
{
|
||||||
unsigned char col1[4]= {40, 40, 40}, col2[4]= {50, 50, 50};
|
unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50};
|
||||||
|
|
||||||
GLubyte checker_stipple[32 * 32 / 8] = {
|
GLubyte checker_stipple[32 * 32 / 8] = {
|
||||||
255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
|
255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
|
||||||
@ -238,11 +238,11 @@ void sdrawline(short x1, short y1, short x2, short y2)
|
|||||||
static void sdrawtripoints(short x1, short y1, short x2, short y2)
|
static void sdrawtripoints(short x1, short y1, short x2, short y2)
|
||||||
{
|
{
|
||||||
short v[2];
|
short v[2];
|
||||||
v[0]= x1; v[1]= y1;
|
v[0] = x1; v[1] = y1;
|
||||||
glVertex2sv(v);
|
glVertex2sv(v);
|
||||||
v[0]= x1; v[1]= y2;
|
v[0] = x1; v[1] = y2;
|
||||||
glVertex2sv(v);
|
glVertex2sv(v);
|
||||||
v[0]= x2; v[1]= y1;
|
v[0] = x2; v[1] = y1;
|
||||||
glVertex2sv(v);
|
glVertex2sv(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ void sdrawbox(short x1, short y1, short x2, short y2)
|
|||||||
|
|
||||||
void setlinestyle(int nr)
|
void setlinestyle(int nr)
|
||||||
{
|
{
|
||||||
if (nr==0) {
|
if (nr == 0) {
|
||||||
glDisable(GL_LINE_STIPPLE);
|
glDisable(GL_LINE_STIPPLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -295,20 +295,20 @@ void setlinestyle(int nr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invert line handling */
|
/* Invert line handling */
|
||||||
|
|
||||||
#define gl_toggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
|
#define gl_toggle(mode, onoff) (((onoff) ? glEnable : glDisable)(mode))
|
||||||
|
|
||||||
void set_inverted_drawing(int enable)
|
void set_inverted_drawing(int enable)
|
||||||
{
|
{
|
||||||
glLogicOp(enable?GL_INVERT:GL_COPY);
|
glLogicOp(enable ? GL_INVERT : GL_COPY);
|
||||||
gl_toggle(GL_COLOR_LOGIC_OP, enable);
|
gl_toggle(GL_COLOR_LOGIC_OP, enable);
|
||||||
gl_toggle(GL_DITHER, !enable);
|
gl_toggle(GL_DITHER, !enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdrawXORline(int x0, int y0, int x1, int y1)
|
void sdrawXORline(int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
if (x0==x1 && y0==y1) return;
|
if (x0 == x1 && y0 == y1) return;
|
||||||
|
|
||||||
set_inverted_drawing(1);
|
set_inverted_drawing(1);
|
||||||
|
|
||||||
@ -323,35 +323,35 @@ void sdrawXORline(int x0, int y0, int x1, int y1)
|
|||||||
void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
|
void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
|
||||||
{
|
{
|
||||||
static short old[4][2][2];
|
static short old[4][2][2];
|
||||||
static char flags[4]= {0, 0, 0, 0};
|
static char flags[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
/* with builtin memory, max 4 lines */
|
/* with builtin memory, max 4 lines */
|
||||||
|
|
||||||
set_inverted_drawing(1);
|
set_inverted_drawing(1);
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
if (nr== -1) { /* flush */
|
if (nr == -1) { /* flush */
|
||||||
for (nr=0; nr<4; nr++) {
|
for (nr = 0; nr < 4; nr++) {
|
||||||
if (flags[nr]) {
|
if (flags[nr]) {
|
||||||
glVertex2sv(old[nr][0]);
|
glVertex2sv(old[nr][0]);
|
||||||
glVertex2sv(old[nr][1]);
|
glVertex2sv(old[nr][1]);
|
||||||
flags[nr]= 0;
|
flags[nr] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (nr>=0 && nr<4) {
|
if (nr >= 0 && nr < 4) {
|
||||||
if (flags[nr]) {
|
if (flags[nr]) {
|
||||||
glVertex2sv(old[nr][0]);
|
glVertex2sv(old[nr][0]);
|
||||||
glVertex2sv(old[nr][1]);
|
glVertex2sv(old[nr][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
old[nr][0][0]= x0;
|
old[nr][0][0] = x0;
|
||||||
old[nr][0][1]= y0;
|
old[nr][0][1] = y0;
|
||||||
old[nr][1][0]= x1;
|
old[nr][1][0] = x1;
|
||||||
old[nr][1][1]= y1;
|
old[nr][1][1] = y1;
|
||||||
|
|
||||||
flags[nr]= 1;
|
flags[nr] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
glVertex2i(x0, y0);
|
glVertex2i(x0, y0);
|
||||||
@ -364,14 +364,14 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
|
|||||||
|
|
||||||
void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
|
void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
|
||||||
{
|
{
|
||||||
if (hw==0) return;
|
if (hw == 0) return;
|
||||||
|
|
||||||
set_inverted_drawing(1);
|
set_inverted_drawing(1);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(xofs, yofs, 0.0f);
|
glTranslatef(xofs, yofs, 0.0f);
|
||||||
glScalef(1.0f, hh / hw, 1.0f);
|
glScalef(1.0f, hh / hw, 1.0f);
|
||||||
glutil_draw_lined_arc(0.0, M_PI*2.0, hw, 20);
|
glutil_draw_lined_arc(0.0, M_PI * 2.0, hw, 20);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
set_inverted_drawing(0);
|
set_inverted_drawing(0);
|
||||||
@ -382,7 +382,7 @@ void fdrawXORcirc(float xofs, float yofs, float rad)
|
|||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(xofs, yofs, 0.0);
|
glTranslatef(xofs, yofs, 0.0);
|
||||||
glutil_draw_lined_arc(0.0, M_PI*2.0, rad, 20);
|
glutil_draw_lined_arc(0.0, M_PI * 2.0, rad, 20);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
set_inverted_drawing(0);
|
set_inverted_drawing(0);
|
||||||
@ -394,11 +394,11 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment
|
|||||||
|
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
glVertex2f(0.0, 0.0);
|
glVertex2f(0.0, 0.0);
|
||||||
for (i=0; i<nsegments; i++) {
|
for (i = 0; i < nsegments; i++) {
|
||||||
float t= (float) i/(nsegments-1);
|
float t = (float) i / (nsegments - 1);
|
||||||
float cur= start + t*angle;
|
float cur = start + t * angle;
|
||||||
|
|
||||||
glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
|
glVertex2f(cosf(cur) * radius, sinf(cur) * radius);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
@ -408,11 +408,11 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
for (i=0; i<nsegments; i++) {
|
for (i = 0; i < nsegments; i++) {
|
||||||
float t= (float) i/(nsegments-1);
|
float t = (float) i / (nsegments - 1);
|
||||||
float cur= start + t*angle;
|
float cur = start + t * angle;
|
||||||
|
|
||||||
glVertex2f(cosf(cur)*radius, sinf(cur)*radius);
|
glVertex2f(cosf(cur) * radius, sinf(cur) * radius);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
@ -433,29 +433,29 @@ float glaGetOneFloat(int param)
|
|||||||
|
|
||||||
void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
|
void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
|
||||||
{
|
{
|
||||||
GLubyte dummy= 0;
|
GLubyte dummy = 0;
|
||||||
|
|
||||||
/* As long as known good coordinates are correct
|
/* As long as known good coordinates are correct
|
||||||
* this is guaranteed to generate an ok raster
|
* this is guaranteed to generate an ok raster
|
||||||
* position (ignoring potential (real) overflow
|
* position (ignoring potential (real) overflow
|
||||||
* issues).
|
* issues).
|
||||||
*/
|
*/
|
||||||
glRasterPos2f(known_good_x, known_good_y);
|
glRasterPos2f(known_good_x, known_good_y);
|
||||||
|
|
||||||
/* Now shift the raster position to where we wanted
|
/* Now shift the raster position to where we wanted
|
||||||
* it in the first place using the glBitmap trick.
|
* it in the first place using the glBitmap trick.
|
||||||
*/
|
*/
|
||||||
glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy);
|
glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_cached_work_texture(int *w_r, int *h_r)
|
static int get_cached_work_texture(int *w_r, int *h_r)
|
||||||
{
|
{
|
||||||
static GLint texid= -1;
|
static GLint texid = -1;
|
||||||
static int tex_w= 256;
|
static int tex_w = 256;
|
||||||
static int tex_h= 256;
|
static int tex_h = 256;
|
||||||
|
|
||||||
if (texid==-1) {
|
if (texid == -1) {
|
||||||
GLint ltexid= glaGetOneInteger(GL_TEXTURE_2D);
|
GLint ltexid = glaGetOneInteger(GL_TEXTURE_2D);
|
||||||
unsigned char *tbuf;
|
unsigned char *tbuf;
|
||||||
|
|
||||||
glGenTextures(1, (GLuint *)&texid);
|
glGenTextures(1, (GLuint *)&texid);
|
||||||
@ -465,28 +465,28 @@ static int get_cached_work_texture(int *w_r, int *h_r)
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
tbuf= MEM_callocN(tex_w*tex_h*4, "tbuf");
|
tbuf = MEM_callocN(tex_w * tex_h * 4, "tbuf");
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tbuf);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex_w, tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tbuf);
|
||||||
MEM_freeN(tbuf);
|
MEM_freeN(tbuf);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, ltexid);
|
glBindTexture(GL_TEXTURE_2D, ltexid);
|
||||||
}
|
}
|
||||||
|
|
||||||
*w_r= tex_w;
|
*w_r = tex_w;
|
||||||
*h_r= tex_h;
|
*h_r = tex_h;
|
||||||
return texid;
|
return texid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY)
|
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY)
|
||||||
{
|
{
|
||||||
unsigned char *uc_rect= (unsigned char*) rect;
|
unsigned char *uc_rect = (unsigned char *) rect;
|
||||||
float *f_rect= (float *)rect;
|
float *f_rect = (float *)rect;
|
||||||
float xzoom= glaGetOneFloat(GL_ZOOM_X), yzoom= glaGetOneFloat(GL_ZOOM_Y);
|
float xzoom = glaGetOneFloat(GL_ZOOM_X), yzoom = glaGetOneFloat(GL_ZOOM_Y);
|
||||||
int ltexid= glaGetOneInteger(GL_TEXTURE_2D);
|
int ltexid = glaGetOneInteger(GL_TEXTURE_2D);
|
||||||
int lrowlength= glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
|
int lrowlength = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
|
||||||
int subpart_x, subpart_y, tex_w, tex_h;
|
int subpart_x, subpart_y, tex_w, tex_h;
|
||||||
int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
|
int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
|
||||||
int texid= get_cached_work_texture(&tex_w, &tex_h);
|
int texid = get_cached_work_texture(&tex_w, &tex_h);
|
||||||
|
|
||||||
/* Specify the color outside this function, and tex will modulate it.
|
/* Specify the color outside this function, and tex will modulate it.
|
||||||
* This is useful for changing alpha without using glPixelTransferf()
|
* This is useful for changing alpha without using glPixelTransferf()
|
||||||
@ -505,66 +505,66 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* setup seamless 2=on, 0=off */
|
/* setup seamless 2=on, 0=off */
|
||||||
seamless= ((tex_w<img_w || tex_h<img_h) && tex_w>2 && tex_h>2)? 2: 0;
|
seamless = ((tex_w < img_w || tex_h < img_h) && tex_w > 2 && tex_h > 2) ? 2 : 0;
|
||||||
|
|
||||||
offset_x= tex_w - seamless;
|
offset_x = tex_w - seamless;
|
||||||
offset_y= tex_h - seamless;
|
offset_y = tex_h - seamless;
|
||||||
|
|
||||||
nsubparts_x= (img_w + (offset_x - 1))/(offset_x);
|
nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
|
||||||
nsubparts_y= (img_h + (offset_y - 1))/(offset_y);
|
nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
|
||||||
|
|
||||||
for (subpart_y=0; subpart_y<nsubparts_y; subpart_y++) {
|
for (subpart_y = 0; subpart_y < nsubparts_y; subpart_y++) {
|
||||||
for (subpart_x=0; subpart_x<nsubparts_x; subpart_x++) {
|
for (subpart_x = 0; subpart_x < nsubparts_x; subpart_x++) {
|
||||||
int remainder_x= img_w-subpart_x*offset_x;
|
int remainder_x = img_w - subpart_x * offset_x;
|
||||||
int remainder_y= img_h-subpart_y*offset_y;
|
int remainder_y = img_h - subpart_y * offset_y;
|
||||||
int subpart_w= (remainder_x<tex_w)? remainder_x: tex_w;
|
int subpart_w = (remainder_x < tex_w) ? remainder_x : tex_w;
|
||||||
int subpart_h= (remainder_y<tex_h)? remainder_y: tex_h;
|
int subpart_h = (remainder_y < tex_h) ? remainder_y : tex_h;
|
||||||
int offset_left= (seamless && subpart_x!=0)? 1: 0;
|
int offset_left = (seamless && subpart_x != 0) ? 1 : 0;
|
||||||
int offset_bot= (seamless && subpart_y!=0)? 1: 0;
|
int offset_bot = (seamless && subpart_y != 0) ? 1 : 0;
|
||||||
int offset_right= (seamless && remainder_x>tex_w)? 1: 0;
|
int offset_right = (seamless && remainder_x > tex_w) ? 1 : 0;
|
||||||
int offset_top= (seamless && remainder_y>tex_h)? 1: 0;
|
int offset_top = (seamless && remainder_y > tex_h) ? 1 : 0;
|
||||||
float rast_x= x+subpart_x*offset_x*xzoom;
|
float rast_x = x + subpart_x * offset_x * xzoom;
|
||||||
float rast_y= y+subpart_y*offset_y*yzoom;
|
float rast_y = y + subpart_y * offset_y * yzoom;
|
||||||
|
|
||||||
/* check if we already got these because we always get 2 more when doing seamless*/
|
/* check if we already got these because we always get 2 more when doing seamless*/
|
||||||
if (subpart_w<=seamless || subpart_h<=seamless)
|
if (subpart_w <= seamless || subpart_h <= seamless)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (format==GL_FLOAT) {
|
if (format == GL_FLOAT) {
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y * offset_y * img_w * 4 + subpart_x * offset_x * 4]);
|
||||||
|
|
||||||
/* add an extra border of pixels so linear looks ok at edges of full image. */
|
/* add an extra border of pixels so linear looks ok at edges of full image. */
|
||||||
if (subpart_w<tex_w)
|
if (subpart_w < tex_w)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y * offset_y * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
|
||||||
if (subpart_h<tex_h)
|
if (subpart_h < tex_h)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + subpart_x * offset_x * 4]);
|
||||||
if (subpart_w<tex_w && subpart_h<tex_h)
|
if (subpart_w < tex_w && subpart_h < tex_h)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y * offset_y * img_w * 4 + subpart_x * offset_x * 4]);
|
||||||
|
|
||||||
if (subpart_w<tex_w)
|
if (subpart_w < tex_w)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y * offset_y * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
|
||||||
if (subpart_h<tex_h)
|
if (subpart_h < tex_h)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + subpart_x * offset_x * 4]);
|
||||||
if (subpart_w<tex_w && subpart_h<tex_h)
|
if (subpart_w < tex_w && subpart_h < tex_h)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y * offset_y + subpart_h - 1) * img_w * 4 + (subpart_x * offset_x + subpart_w - 1) * 4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(0 + offset_bot)/tex_h);
|
glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h);
|
||||||
glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)offset_bot*xzoom);
|
glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * xzoom);
|
||||||
|
|
||||||
glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(0 + offset_bot)/tex_h);
|
glTexCoord2f((float)(subpart_w - offset_right) / tex_w, (float)(0 + offset_bot) / tex_h);
|
||||||
glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)offset_bot*xzoom);
|
glVertex2f(rast_x + (float)(subpart_w - offset_right) * xzoom * scaleX, rast_y + (float)offset_bot * xzoom);
|
||||||
|
|
||||||
glTexCoord2f((float)(subpart_w - offset_right)/tex_w, (float)(subpart_h - offset_top)/tex_h);
|
glTexCoord2f((float)(subpart_w - offset_right) / tex_w, (float)(subpart_h - offset_top) / tex_h);
|
||||||
glVertex2f(rast_x + (float)(subpart_w - offset_right)*xzoom*scaleX, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY);
|
glVertex2f(rast_x + (float)(subpart_w - offset_right) * xzoom * scaleX, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY);
|
||||||
|
|
||||||
glTexCoord2f((float)(0 + offset_left)/tex_w, (float)(subpart_h - offset_top)/tex_h);
|
glTexCoord2f((float)(0 + offset_left) / tex_w, (float)(subpart_h - offset_top) / tex_h);
|
||||||
glVertex2f(rast_x + (float)offset_left*xzoom, rast_y + (float)(subpart_h - offset_top)*yzoom*scaleY);
|
glVertex2f(rast_x + (float)offset_left * xzoom, rast_y + (float)(subpart_h - offset_top) * yzoom * scaleY);
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
@ -587,51 +587,51 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
|
|||||||
|
|
||||||
void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect)
|
void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect)
|
||||||
{
|
{
|
||||||
float xzoom= glaGetOneFloat(GL_ZOOM_X);
|
float xzoom = glaGetOneFloat(GL_ZOOM_X);
|
||||||
float yzoom= glaGetOneFloat(GL_ZOOM_Y);
|
float yzoom = glaGetOneFloat(GL_ZOOM_Y);
|
||||||
|
|
||||||
|
/* The pixel space coordinate of the intersection of
|
||||||
|
* the [zoomed] image with the origin.
|
||||||
|
*/
|
||||||
|
float ix = -x / xzoom;
|
||||||
|
float iy = -y / yzoom;
|
||||||
|
|
||||||
/* The pixel space coordinate of the intersection of
|
/* The maximum pixel amounts the image can be cropped
|
||||||
* the [zoomed] image with the origin.
|
* at the lower left without exceeding the origin.
|
||||||
*/
|
*/
|
||||||
float ix= -x/xzoom;
|
int off_x = floor(MAX2(ix, 0));
|
||||||
float iy= -y/yzoom;
|
int off_y = floor(MAX2(iy, 0));
|
||||||
|
|
||||||
/* The maximum pixel amounts the image can be cropped
|
/* The zoomed space coordinate of the raster position
|
||||||
* at the lower left without exceeding the origin.
|
* (starting at the lower left most unclipped pixel).
|
||||||
*/
|
*/
|
||||||
int off_x= floor(MAX2(ix, 0));
|
float rast_x = x + off_x * xzoom;
|
||||||
int off_y= floor(MAX2(iy, 0));
|
float rast_y = y + off_y * yzoom;
|
||||||
|
|
||||||
/* The zoomed space coordinate of the raster position
|
|
||||||
* (starting at the lower left most unclipped pixel).
|
|
||||||
*/
|
|
||||||
float rast_x= x + off_x*xzoom;
|
|
||||||
float rast_y= y + off_y*yzoom;
|
|
||||||
|
|
||||||
GLfloat scissor[4];
|
GLfloat scissor[4];
|
||||||
int draw_w, draw_h;
|
int draw_w, draw_h;
|
||||||
|
|
||||||
/* Determine the smallest number of pixels we need to draw
|
/* Determine the smallest number of pixels we need to draw
|
||||||
* before the image would go off the upper right corner.
|
* before the image would go off the upper right corner.
|
||||||
*
|
*
|
||||||
* It may seem this is just an optimization but some graphics
|
* It may seem this is just an optimization but some graphics
|
||||||
* cards (ATI) freak out if there is a large zoom factor and
|
* cards (ATI) freak out if there is a large zoom factor and
|
||||||
* a large number of pixels off the screen (probably at some
|
* a large number of pixels off the screen (probably at some
|
||||||
* level the number of image pixels to draw is getting multiplied
|
* level the number of image pixels to draw is getting multiplied
|
||||||
* by the zoom and then clamped). Making sure we draw the
|
* by the zoom and then clamped). Making sure we draw the
|
||||||
* fewest pixels possible keeps everyone mostly happy (still
|
* fewest pixels possible keeps everyone mostly happy (still
|
||||||
* fails if we zoom in on one really huge pixel so that it
|
* fails if we zoom in on one really huge pixel so that it
|
||||||
* covers the entire screen).
|
* covers the entire screen).
|
||||||
*/
|
*/
|
||||||
glGetFloatv(GL_SCISSOR_BOX, scissor);
|
glGetFloatv(GL_SCISSOR_BOX, scissor);
|
||||||
draw_w = MIN2(img_w-off_x, ceil((scissor[2]-rast_x)/xzoom));
|
draw_w = MIN2(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
|
||||||
draw_h = MIN2(img_h-off_y, ceil((scissor[3]-rast_y)/yzoom));
|
draw_h = MIN2(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
|
||||||
|
|
||||||
if (draw_w>0 && draw_h>0) {
|
if (draw_w > 0 && draw_h > 0) {
|
||||||
int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
|
int old_row_length = glaGetOneInteger(GL_UNPACK_ROW_LENGTH);
|
||||||
|
|
||||||
/* Don't use safe RasterPos (slower) if we can avoid it. */
|
/* Don't use safe RasterPos (slower) if we can avoid it. */
|
||||||
if (rast_x>=0 && rast_y>=0) {
|
if (rast_x >= 0 && rast_y >= 0) {
|
||||||
glRasterPos2f(rast_x, rast_y);
|
glRasterPos2f(rast_x, rast_y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -639,24 +639,24 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
|
|||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
|
||||||
if (format==GL_LUMINANCE || format==GL_RED) {
|
if (format == GL_LUMINANCE || format == GL_RED) {
|
||||||
if (type==GL_FLOAT) {
|
if (type == GL_FLOAT) {
|
||||||
float *f_rect= (float *)rect;
|
float *f_rect = (float *)rect;
|
||||||
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x));
|
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x));
|
||||||
}
|
}
|
||||||
else if (type==GL_INT || type==GL_UNSIGNED_INT) {
|
else if (type == GL_INT || type == GL_UNSIGNED_INT) {
|
||||||
int *i_rect= (int *)rect;
|
int *i_rect = (int *)rect;
|
||||||
glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*row_w + off_x));
|
glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y * row_w + off_x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* RGBA */
|
else { /* RGBA */
|
||||||
if (type==GL_FLOAT) {
|
if (type == GL_FLOAT) {
|
||||||
float *f_rect= (float *)rect;
|
float *f_rect = (float *)rect;
|
||||||
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x)*4);
|
glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y * row_w + off_x) * 4);
|
||||||
}
|
}
|
||||||
else if (type==GL_UNSIGNED_BYTE) {
|
else if (type == GL_UNSIGNED_BYTE) {
|
||||||
unsigned char *uc_rect= (unsigned char *) rect;
|
unsigned char *uc_rect = (unsigned char *) rect;
|
||||||
glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*row_w + off_x)*4);
|
glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y * row_w + off_x) * 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,17 +668,17 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
|
|||||||
|
|
||||||
void glaDefine2DArea(rcti *screen_rect)
|
void glaDefine2DArea(rcti *screen_rect)
|
||||||
{
|
{
|
||||||
int sc_w= screen_rect->xmax - screen_rect->xmin + 1;
|
int sc_w = screen_rect->xmax - screen_rect->xmin + 1;
|
||||||
int sc_h= screen_rect->ymax - screen_rect->ymin + 1;
|
int sc_h = screen_rect->ymax - screen_rect->ymin + 1;
|
||||||
|
|
||||||
glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
|
glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
|
||||||
glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
|
glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
|
||||||
|
|
||||||
/* The 0.375 magic number is to shift the matrix so that
|
/* The 0.375 magic number is to shift the matrix so that
|
||||||
* both raster and vertex integer coordinates fall at pixel
|
* both raster and vertex integer coordinates fall at pixel
|
||||||
* centers properly. For a longer discussion see the OpenGL
|
* centers properly. For a longer discussion see the OpenGL
|
||||||
* Programming Guide, Appendix H, Correctness Tips.
|
* Programming Guide, Appendix H, Correctness Tips.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
@ -703,7 +703,7 @@ struct gla2DDrawInfo {
|
|||||||
|
|
||||||
void gla2DGetMap(gla2DDrawInfo *di, rctf *rect)
|
void gla2DGetMap(gla2DDrawInfo *di, rctf *rect)
|
||||||
{
|
{
|
||||||
*rect= di->world_rect;
|
*rect = di->world_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
|
void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
|
||||||
@ -711,20 +711,20 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
|
|||||||
int sc_w, sc_h;
|
int sc_w, sc_h;
|
||||||
float wo_w, wo_h;
|
float wo_w, wo_h;
|
||||||
|
|
||||||
di->world_rect= *rect;
|
di->world_rect = *rect;
|
||||||
|
|
||||||
sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
|
sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
|
||||||
sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
|
sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
|
||||||
wo_w= (di->world_rect.xmax-di->world_rect.xmin);
|
wo_w = (di->world_rect.xmax - di->world_rect.xmin);
|
||||||
wo_h= (di->world_rect.ymax-di->world_rect.ymin);
|
wo_h = (di->world_rect.ymax - di->world_rect.ymin);
|
||||||
|
|
||||||
di->wo_to_sc[0]= sc_w/wo_w;
|
di->wo_to_sc[0] = sc_w / wo_w;
|
||||||
di->wo_to_sc[1]= sc_h/wo_h;
|
di->wo_to_sc[1] = sc_h / wo_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
||||||
{
|
{
|
||||||
gla2DDrawInfo *di= MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
|
gla2DDrawInfo *di = MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
|
||||||
int sc_w, sc_h;
|
int sc_w, sc_h;
|
||||||
float wo_w, wo_h;
|
float wo_w, wo_h;
|
||||||
|
|
||||||
@ -733,9 +733,9 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
|||||||
glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat);
|
glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat);
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat);
|
glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat);
|
||||||
|
|
||||||
di->screen_rect= *screen_rect;
|
di->screen_rect = *screen_rect;
|
||||||
if (world_rect) {
|
if (world_rect) {
|
||||||
di->world_rect= *world_rect;
|
di->world_rect = *world_rect;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
di->world_rect.xmin = di->screen_rect.xmin;
|
di->world_rect.xmin = di->screen_rect.xmin;
|
||||||
@ -744,13 +744,13 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
|||||||
di->world_rect.ymax = di->screen_rect.ymax;
|
di->world_rect.ymax = di->screen_rect.ymax;
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
|
sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
|
||||||
sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
|
sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
|
||||||
wo_w= (di->world_rect.xmax-di->world_rect.xmin);
|
wo_w = (di->world_rect.xmax - di->world_rect.xmin);
|
||||||
wo_h= (di->world_rect.ymax-di->world_rect.ymin);
|
wo_h = (di->world_rect.ymax - di->world_rect.ymin);
|
||||||
|
|
||||||
di->wo_to_sc[0]= sc_w/wo_w;
|
di->wo_to_sc[0] = sc_w / wo_w;
|
||||||
di->wo_to_sc[1]= sc_h/wo_h;
|
di->wo_to_sc[1] = sc_h / wo_h;
|
||||||
|
|
||||||
glaDefine2DArea(&di->screen_rect);
|
glaDefine2DArea(&di->screen_rect);
|
||||||
|
|
||||||
@ -759,13 +759,13 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
|||||||
|
|
||||||
void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r)
|
void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r)
|
||||||
{
|
{
|
||||||
*sc_x_r= (wo_x - di->world_rect.xmin)*di->wo_to_sc[0];
|
*sc_x_r = (wo_x - di->world_rect.xmin) * di->wo_to_sc[0];
|
||||||
*sc_y_r= (wo_y - di->world_rect.ymin)*di->wo_to_sc[1];
|
*sc_y_r = (wo_y - di->world_rect.ymin) * di->wo_to_sc[1];
|
||||||
}
|
}
|
||||||
void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2])
|
void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2])
|
||||||
{
|
{
|
||||||
screen_r[0]= (world[0] - di->world_rect.xmin)*di->wo_to_sc[0];
|
screen_r[0] = (world[0] - di->world_rect.xmin) * di->wo_to_sc[0];
|
||||||
screen_r[1]= (world[1] - di->world_rect.ymin)*di->wo_to_sc[1];
|
screen_r[1] = (world[1] - di->world_rect.ymin) * di->wo_to_sc[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void glaEnd2DDraw(gla2DDrawInfo *di)
|
void glaEnd2DDraw(gla2DDrawInfo *di)
|
||||||
@ -783,8 +783,8 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
|
|||||||
|
|
||||||
/* **************** GL_POINT hack ************************ */
|
/* **************** GL_POINT hack ************************ */
|
||||||
|
|
||||||
static int curmode=0;
|
static int curmode = 0;
|
||||||
static int pointhack=0;
|
static int pointhack = 0;
|
||||||
static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
|
static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
@ -792,15 +792,15 @@ static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
|
|||||||
|
|
||||||
void bglBegin(int mode)
|
void bglBegin(int mode)
|
||||||
{
|
{
|
||||||
curmode= mode;
|
curmode = mode;
|
||||||
|
|
||||||
if (mode==GL_POINTS) {
|
if (mode == GL_POINTS) {
|
||||||
float value[4];
|
float value[4];
|
||||||
glGetFloatv(GL_POINT_SIZE_RANGE, value);
|
glGetFloatv(GL_POINT_SIZE_RANGE, value);
|
||||||
if (value[1] < 2.0f) {
|
if (value[1] < 2.0f) {
|
||||||
glGetFloatv(GL_POINT_SIZE, value);
|
glGetFloatv(GL_POINT_SIZE, value);
|
||||||
pointhack= floor(value[0] + 0.5f);
|
pointhack = floor(value[0] + 0.5f);
|
||||||
if (pointhack>4) pointhack= 4;
|
if (pointhack > 4) pointhack = 4;
|
||||||
}
|
}
|
||||||
else glBegin(mode);
|
else glBegin(mode);
|
||||||
}
|
}
|
||||||
@ -814,8 +814,8 @@ int bglPointHack(void)
|
|||||||
glGetFloatv(GL_POINT_SIZE_RANGE, value);
|
glGetFloatv(GL_POINT_SIZE_RANGE, value);
|
||||||
if (value[1] < 2.0f) {
|
if (value[1] < 2.0f) {
|
||||||
glGetFloatv(GL_POINT_SIZE, value);
|
glGetFloatv(GL_POINT_SIZE, value);
|
||||||
pointhack_px= floorf(value[0]+0.5f);
|
pointhack_px = floorf(value[0] + 0.5f);
|
||||||
if (pointhack_px>4) pointhack_px= 4;
|
if (pointhack_px > 4) pointhack_px = 4;
|
||||||
return pointhack_px;
|
return pointhack_px;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -825,46 +825,46 @@ int bglPointHack(void)
|
|||||||
void bglVertex3fv(const float vec[3])
|
void bglVertex3fv(const float vec[3])
|
||||||
{
|
{
|
||||||
switch (curmode) {
|
switch (curmode) {
|
||||||
case GL_POINTS:
|
case GL_POINTS:
|
||||||
if (pointhack) {
|
if (pointhack) {
|
||||||
glRasterPos3fv(vec);
|
glRasterPos3fv(vec);
|
||||||
glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
|
glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
|
||||||
}
|
}
|
||||||
else glVertex3fv(vec);
|
else glVertex3fv(vec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bglVertex3f(float x, float y, float z)
|
void bglVertex3f(float x, float y, float z)
|
||||||
{
|
{
|
||||||
switch (curmode) {
|
switch (curmode) {
|
||||||
case GL_POINTS:
|
case GL_POINTS:
|
||||||
if (pointhack) {
|
if (pointhack) {
|
||||||
glRasterPos3f(x, y, z);
|
glRasterPos3f(x, y, z);
|
||||||
glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
|
glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
|
||||||
}
|
}
|
||||||
else glVertex3f(x, y, z);
|
else glVertex3f(x, y, z);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bglVertex2fv(const float vec[2])
|
void bglVertex2fv(const float vec[2])
|
||||||
{
|
{
|
||||||
switch (curmode) {
|
switch (curmode) {
|
||||||
case GL_POINTS:
|
case GL_POINTS:
|
||||||
if (pointhack) {
|
if (pointhack) {
|
||||||
glRasterPos2fv(vec);
|
glRasterPos2fv(vec);
|
||||||
glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
|
glBitmap(pointhack, pointhack, (float)pointhack / 2, pointhack / 2, 0.0, 0.0, Squaredot);
|
||||||
}
|
}
|
||||||
else glVertex2fv(vec);
|
else glVertex2fv(vec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void bglEnd(void)
|
void bglEnd(void)
|
||||||
{
|
{
|
||||||
if (pointhack) pointhack= 0;
|
if (pointhack) pointhack = 0;
|
||||||
else glEnd();
|
else glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -872,7 +872,7 @@ void bglEnd(void)
|
|||||||
/* Uses current OpenGL state to get view matrices for gluProject/gluUnProject */
|
/* Uses current OpenGL state to get view matrices for gluProject/gluUnProject */
|
||||||
void bgl_get_mats(bglMats *mats)
|
void bgl_get_mats(bglMats *mats)
|
||||||
{
|
{
|
||||||
const double badvalue= 1.0e-6;
|
const double badvalue = 1.0e-6;
|
||||||
|
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, mats->modelview);
|
glGetDoublev(GL_MODELVIEW_MATRIX, mats->modelview);
|
||||||
glGetDoublev(GL_PROJECTION_MATRIX, mats->projection);
|
glGetDoublev(GL_PROJECTION_MATRIX, mats->projection);
|
||||||
@ -901,7 +901,7 @@ void bgl_get_mats(bglMats *mats)
|
|||||||
/* dist is only for ortho now... */
|
/* dist is only for ortho now... */
|
||||||
void bglPolygonOffset(float viewdist, float dist)
|
void bglPolygonOffset(float viewdist, float dist)
|
||||||
{
|
{
|
||||||
static float winmat[16], offset=0.0;
|
static float winmat[16], offset = 0.0;
|
||||||
|
|
||||||
if (dist != 0.0f) {
|
if (dist != 0.0f) {
|
||||||
float offs;
|
float offs;
|
||||||
@ -915,11 +915,11 @@ void bglPolygonOffset(float viewdist, float dist)
|
|||||||
|
|
||||||
/* dist is from camera to center point */
|
/* dist is from camera to center point */
|
||||||
|
|
||||||
if (winmat[15]>0.5f) offs= 0.00001f*dist*viewdist; // ortho tweaking
|
if (winmat[15] > 0.5f) offs = 0.00001f * dist * viewdist; // ortho tweaking
|
||||||
else offs= 0.0005f*dist; // should be clipping value or so...
|
else offs = 0.0005f * dist; // should be clipping value or so...
|
||||||
|
|
||||||
winmat[14]-= offs;
|
winmat[14] -= offs;
|
||||||
offset+= offs;
|
offset += offs;
|
||||||
|
|
||||||
glLoadMatrixf(winmat);
|
glLoadMatrixf(winmat);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
@ -927,8 +927,8 @@ void bglPolygonOffset(float viewdist, float dist)
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
winmat[14]+= offset;
|
winmat[14] += offset;
|
||||||
offset= 0.0;
|
offset = 0.0;
|
||||||
glLoadMatrixf(winmat);
|
glLoadMatrixf(winmat);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
@ -72,19 +72,19 @@ const char *screen_context_dir[] = {
|
|||||||
|
|
||||||
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
|
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
|
||||||
{
|
{
|
||||||
bScreen *sc= CTX_wm_screen(C);
|
bScreen *sc = CTX_wm_screen(C);
|
||||||
Scene *scene= sc->scene;
|
Scene *scene = sc->scene;
|
||||||
Base *base;
|
Base *base;
|
||||||
unsigned int lay = scene->lay;
|
unsigned int lay = scene->lay;
|
||||||
|
|
||||||
#if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */
|
#if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */
|
||||||
Object *obact= CTX_data_active_object(C);
|
Object *obact = CTX_data_active_object(C);
|
||||||
Object *obedit= CTX_data_edit_object(C);
|
Object *obedit = CTX_data_edit_object(C);
|
||||||
base= CTX_data_active_base(C);
|
base = CTX_data_active_base(C);
|
||||||
#else
|
#else
|
||||||
Object *obedit= scene->obedit;
|
Object *obedit = scene->obedit;
|
||||||
Object *obact= OBACT;
|
Object *obact = OBACT;
|
||||||
base= BASACT;
|
base = BASACT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (CTX_data_dir(member)) {
|
if (CTX_data_dir(member)) {
|
||||||
@ -96,9 +96,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
|
else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
|
||||||
int visible_objects= CTX_data_equals(member, "visible_objects");
|
int visible_objects = CTX_data_equals(member, "visible_objects");
|
||||||
|
|
||||||
for (base=scene->base.first; base; base=base->next) {
|
for (base = scene->base.first; base; base = base->next) {
|
||||||
if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
|
if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
|
||||||
if (visible_objects)
|
if (visible_objects)
|
||||||
CTX_data_id_list_add(result, &base->object->id);
|
CTX_data_id_list_add(result, &base->object->id);
|
||||||
@ -110,11 +110,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
|
else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
|
||||||
int selectable_objects= CTX_data_equals(member, "selectable_objects");
|
int selectable_objects = CTX_data_equals(member, "selectable_objects");
|
||||||
|
|
||||||
for (base=scene->base.first; base; base=base->next) {
|
for (base = scene->base.first; base; base = base->next) {
|
||||||
if (base->lay & lay) {
|
if (base->lay & lay) {
|
||||||
if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
|
if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0 && (base->object->restrictflag & OB_RESTRICT_SELECT) == 0) {
|
||||||
if (selectable_objects)
|
if (selectable_objects)
|
||||||
CTX_data_id_list_add(result, &base->object->id);
|
CTX_data_id_list_add(result, &base->object->id);
|
||||||
else
|
else
|
||||||
@ -126,9 +126,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
|
else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
|
||||||
int selected_objects= CTX_data_equals(member, "selected_objects");
|
int selected_objects = CTX_data_equals(member, "selected_objects");
|
||||||
|
|
||||||
for (base=scene->base.first; base; base=base->next) {
|
for (base = scene->base.first; base; base = base->next) {
|
||||||
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
|
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
|
||||||
if (selected_objects)
|
if (selected_objects)
|
||||||
CTX_data_id_list_add(result, &base->object->id);
|
CTX_data_id_list_add(result, &base->object->id);
|
||||||
@ -140,12 +140,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
|
else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
|
||||||
int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
|
int selected_editable_objects = CTX_data_equals(member, "selected_editable_objects");
|
||||||
|
|
||||||
for (base=scene->base.first; base; base=base->next) {
|
for (base = scene->base.first; base; base = base->next) {
|
||||||
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
|
if ((base->flag & SELECT) && (base->lay & scene->lay)) {
|
||||||
if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
|
if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
|
||||||
if (0==BKE_object_is_libdata(base->object)) {
|
if (0 == BKE_object_is_libdata(base->object)) {
|
||||||
if (selected_editable_objects)
|
if (selected_editable_objects)
|
||||||
CTX_data_id_list_add(result, &base->object->id);
|
CTX_data_id_list_add(result, &base->object->id);
|
||||||
else
|
else
|
||||||
@ -158,13 +158,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
|
else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
|
||||||
bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
||||||
EditBone *ebone, *flipbone=NULL;
|
EditBone *ebone, *flipbone = NULL;
|
||||||
int editable_bones= CTX_data_equals(member, "editable_bones");
|
int editable_bones = CTX_data_equals(member, "editable_bones");
|
||||||
|
|
||||||
if (arm && arm->edbo) {
|
if (arm && arm->edbo) {
|
||||||
/* Attention: X-Axis Mirroring is also handled here... */
|
/* Attention: X-Axis Mirroring is also handled here... */
|
||||||
for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
|
||||||
/* first and foremost, bone must be visible and selected */
|
/* first and foremost, bone must be visible and selected */
|
||||||
if (EBONE_VISIBLE(arm, ebone)) {
|
if (EBONE_VISIBLE(arm, ebone)) {
|
||||||
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
||||||
@ -190,7 +190,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
/* only include bones if visible */
|
/* only include bones if visible */
|
||||||
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
||||||
|
|
||||||
if ((flipbone) && EBONE_VISIBLE(arm, flipbone)==0)
|
if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0)
|
||||||
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,13 +200,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
|
else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
|
||||||
bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
||||||
EditBone *ebone, *flipbone=NULL;
|
EditBone *ebone, *flipbone = NULL;
|
||||||
int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones");
|
int selected_editable_bones = CTX_data_equals(member, "selected_editable_bones");
|
||||||
|
|
||||||
if (arm && arm->edbo) {
|
if (arm && arm->edbo) {
|
||||||
/* Attention: X-Axis Mirroring is also handled here... */
|
/* Attention: X-Axis Mirroring is also handled here... */
|
||||||
for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
|
||||||
/* first and foremost, bone must be visible and selected */
|
/* first and foremost, bone must be visible and selected */
|
||||||
if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
|
if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
|
||||||
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
||||||
@ -242,12 +242,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "visible_pose_bones")) {
|
else if (CTX_data_equals(member, "visible_pose_bones")) {
|
||||||
Object *obpose= BKE_object_pose_armature_get(obact);
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
||||||
bArmature *arm= (obpose) ? obpose->data : NULL;
|
bArmature *arm = (obpose) ? obpose->data : NULL;
|
||||||
bPoseChannel *pchan;
|
bPoseChannel *pchan;
|
||||||
|
|
||||||
if (obpose && obpose->pose && arm) {
|
if (obpose && obpose->pose && arm) {
|
||||||
for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
|
for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||||
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
||||||
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
||||||
CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
|
CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
|
||||||
@ -258,12 +258,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_pose_bones")) {
|
else if (CTX_data_equals(member, "selected_pose_bones")) {
|
||||||
Object *obpose= BKE_object_pose_armature_get(obact);
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
||||||
bArmature *arm= (obpose) ? obpose->data : NULL;
|
bArmature *arm = (obpose) ? obpose->data : NULL;
|
||||||
bPoseChannel *pchan;
|
bPoseChannel *pchan;
|
||||||
|
|
||||||
if (obpose && obpose->pose && arm) {
|
if (obpose && obpose->pose && arm) {
|
||||||
for (pchan= obpose->pose->chanbase.first; pchan; pchan= pchan->next) {
|
for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||||
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
||||||
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
||||||
if (pchan->bone->flag & BONE_SELECTED)
|
if (pchan->bone->flag & BONE_SELECTED)
|
||||||
@ -276,7 +276,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "active_bone")) {
|
else if (CTX_data_equals(member, "active_bone")) {
|
||||||
if (obact && obact->type == OB_ARMATURE) {
|
if (obact && obact->type == OB_ARMATURE) {
|
||||||
bArmature *arm= obact->data;
|
bArmature *arm = obact->data;
|
||||||
if (arm->edbo) {
|
if (arm->edbo) {
|
||||||
if (arm->act_edbone) {
|
if (arm->act_edbone) {
|
||||||
CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
|
CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
|
||||||
@ -293,9 +293,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "active_pose_bone")) {
|
else if (CTX_data_equals(member, "active_pose_bone")) {
|
||||||
bPoseChannel *pchan;
|
bPoseChannel *pchan;
|
||||||
Object *obpose= BKE_object_pose_armature_get(obact);
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
||||||
|
|
||||||
pchan= BKE_pose_channel_active(obpose);
|
pchan = BKE_pose_channel_active(obpose);
|
||||||
if (pchan) {
|
if (pchan) {
|
||||||
CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
|
CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
|
||||||
return 1;
|
return 1;
|
||||||
@ -357,10 +357,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "sequences")) {
|
else if (CTX_data_equals(member, "sequences")) {
|
||||||
Editing *ed= seq_give_editing(scene, FALSE);
|
Editing *ed = seq_give_editing(scene, FALSE);
|
||||||
if (ed) {
|
if (ed) {
|
||||||
Sequence *seq;
|
Sequence *seq;
|
||||||
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||||
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
||||||
}
|
}
|
||||||
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
||||||
@ -368,10 +368,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_sequences")) {
|
else if (CTX_data_equals(member, "selected_sequences")) {
|
||||||
Editing *ed= seq_give_editing(scene, FALSE);
|
Editing *ed = seq_give_editing(scene, FALSE);
|
||||||
if (ed) {
|
if (ed) {
|
||||||
Sequence *seq;
|
Sequence *seq;
|
||||||
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||||
if (seq->flag & SELECT) {
|
if (seq->flag & SELECT) {
|
||||||
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
||||||
}
|
}
|
||||||
@ -381,10 +381,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "selected_editable_sequences")) {
|
else if (CTX_data_equals(member, "selected_editable_sequences")) {
|
||||||
Editing *ed= seq_give_editing(scene, FALSE);
|
Editing *ed = seq_give_editing(scene, FALSE);
|
||||||
if (ed) {
|
if (ed) {
|
||||||
Sequence *seq;
|
Sequence *seq;
|
||||||
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||||
if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
|
if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
|
||||||
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
||||||
}
|
}
|
||||||
@ -394,19 +394,19 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CTX_data_equals(member, "active_operator")) {
|
else if (CTX_data_equals(member, "active_operator")) {
|
||||||
wmOperator *op= NULL;
|
wmOperator *op = NULL;
|
||||||
|
|
||||||
SpaceFile *sfile= CTX_wm_space_file(C);
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||||
if (sfile) {
|
if (sfile) {
|
||||||
op= sfile->op;
|
op = sfile->op;
|
||||||
}
|
}
|
||||||
else if ((op= uiContextActiveOperator(C))) {
|
else if ((op = uiContextActiveOperator(C))) {
|
||||||
/* do nothign */
|
/* do nothign */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* note, this checks poll, could be a problem, but this also
|
/* note, this checks poll, could be a problem, but this also
|
||||||
* happens for the toolbar */
|
* happens for the toolbar */
|
||||||
op= WM_operator_last_redo(C);
|
op = WM_operator_last_redo(C);
|
||||||
}
|
}
|
||||||
/* TODO, get the operator from popup's */
|
/* TODO, get the operator from popup's */
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,24 +35,24 @@
|
|||||||
struct wmWindow;
|
struct wmWindow;
|
||||||
struct Scene;
|
struct Scene;
|
||||||
|
|
||||||
#define AZONESPOT 12
|
#define AZONESPOT 12
|
||||||
|
|
||||||
/* area.c */
|
/* area.c */
|
||||||
void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
|
void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space);
|
||||||
|
|
||||||
/* screen_edit.c */
|
/* screen_edit.c */
|
||||||
ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
|
ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
|
||||||
ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
|
ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
|
||||||
int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2);
|
int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2);
|
||||||
int area_getorientation(ScrArea *sa, ScrArea *sb);
|
int area_getorientation(ScrArea *sa, ScrArea *sb);
|
||||||
void select_connected_scredge(bScreen *sc, ScrEdge *edge);
|
void select_connected_scredge(bScreen *sc, ScrEdge *edge);
|
||||||
|
|
||||||
void removenotused_scrverts(bScreen *sc);
|
void removenotused_scrverts(bScreen *sc);
|
||||||
void removedouble_scrverts(bScreen *sc);
|
void removedouble_scrverts(bScreen *sc);
|
||||||
void removedouble_scredges(bScreen *sc);
|
void removedouble_scredges(bScreen *sc);
|
||||||
void removenotused_scredges(bScreen *sc);
|
void removenotused_scredges(bScreen *sc);
|
||||||
int scredge_is_horizontal(ScrEdge *se);
|
int scredge_is_horizontal(ScrEdge *se);
|
||||||
ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
|
ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
|
||||||
|
|
||||||
struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
|
struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
|
||||||
|
|
||||||
@ -66,7 +66,3 @@ void SCREEN_OT_screenshot(struct wmOperatorType *ot);
|
|||||||
void SCREEN_OT_screencast(struct wmOperatorType *ot);
|
void SCREEN_OT_screencast(struct wmOperatorType *ot);
|
||||||
|
|
||||||
#endif /* __SCREEN_INTERN_H__ */
|
#endif /* __SCREEN_INTERN_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,18 +78,18 @@ typedef struct ScreenshotData {
|
|||||||
/* get shot from frontbuffer */
|
/* get shot from frontbuffer */
|
||||||
static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy)
|
static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy)
|
||||||
{
|
{
|
||||||
wmWindow *win= CTX_wm_window(C);
|
wmWindow *win = CTX_wm_window(C);
|
||||||
int x=0, y=0;
|
int x = 0, y = 0;
|
||||||
unsigned int *dumprect= NULL;
|
unsigned int *dumprect = NULL;
|
||||||
|
|
||||||
x= 0;
|
x = 0;
|
||||||
y= 0;
|
y = 0;
|
||||||
*dumpsx= win->sizex;
|
*dumpsx = win->sizex;
|
||||||
*dumpsy= win->sizey;
|
*dumpsy = win->sizey;
|
||||||
|
|
||||||
if (*dumpsx && *dumpsy) {
|
if (*dumpsx && *dumpsy) {
|
||||||
|
|
||||||
dumprect= MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
|
dumprect = MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
|
||||||
glReadBuffer(GL_FRONT);
|
glReadBuffer(GL_FRONT);
|
||||||
glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
|
glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
|
||||||
glFinish();
|
glFinish();
|
||||||
@ -108,17 +108,17 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
|
|||||||
/* do redraw so we don't show popups/menus */
|
/* do redraw so we don't show popups/menus */
|
||||||
WM_redraw_windows(C);
|
WM_redraw_windows(C);
|
||||||
|
|
||||||
dumprect= screenshot(C, &dumpsx, &dumpsy);
|
dumprect = screenshot(C, &dumpsx, &dumpsy);
|
||||||
|
|
||||||
if (dumprect) {
|
if (dumprect) {
|
||||||
ScreenshotData *scd= MEM_callocN(sizeof(ScreenshotData), "screenshot");
|
ScreenshotData *scd = MEM_callocN(sizeof(ScreenshotData), "screenshot");
|
||||||
ScrArea *sa= CTX_wm_area(C);
|
ScrArea *sa = CTX_wm_area(C);
|
||||||
|
|
||||||
scd->dumpsx= dumpsx;
|
scd->dumpsx = dumpsx;
|
||||||
scd->dumpsy= dumpsy;
|
scd->dumpsy = dumpsy;
|
||||||
scd->dumprect= dumprect;
|
scd->dumprect = dumprect;
|
||||||
if (sa) {
|
if (sa) {
|
||||||
scd->crop= sa->totrct;
|
scd->crop = sa->totrct;
|
||||||
}
|
}
|
||||||
|
|
||||||
BKE_imformat_defaults(&scd->im_format);
|
BKE_imformat_defaults(&scd->im_format);
|
||||||
@ -128,46 +128,46 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
op->customdata= NULL;
|
op->customdata = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void screenshot_data_free(wmOperator *op)
|
static void screenshot_data_free(wmOperator *op)
|
||||||
{
|
{
|
||||||
ScreenshotData *scd= op->customdata;
|
ScreenshotData *scd = op->customdata;
|
||||||
|
|
||||||
if (scd) {
|
if (scd) {
|
||||||
if (scd->dumprect)
|
if (scd->dumprect)
|
||||||
MEM_freeN(scd->dumprect);
|
MEM_freeN(scd->dumprect);
|
||||||
MEM_freeN(scd);
|
MEM_freeN(scd);
|
||||||
op->customdata= NULL;
|
op->customdata = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void screenshot_crop(ImBuf *ibuf, rcti crop)
|
static void screenshot_crop(ImBuf *ibuf, rcti crop)
|
||||||
{
|
{
|
||||||
unsigned int *to= ibuf->rect;
|
unsigned int *to = ibuf->rect;
|
||||||
unsigned int *from= ibuf->rect + crop.ymin*ibuf->x + crop.xmin;
|
unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin;
|
||||||
int y, cropw= crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
|
int y, cropw = crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
|
||||||
|
|
||||||
if (cropw > 0 && croph > 0) {
|
if (cropw > 0 && croph > 0) {
|
||||||
for (y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
|
for (y = 0; y < croph; y++, to += cropw, from += ibuf->x)
|
||||||
memmove(to, from, sizeof(unsigned int)*cropw);
|
memmove(to, from, sizeof(unsigned int) * cropw);
|
||||||
|
|
||||||
ibuf->x= cropw;
|
ibuf->x = cropw;
|
||||||
ibuf->y= croph;
|
ibuf->y = croph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int screenshot_exec(bContext *C, wmOperator *op)
|
static int screenshot_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
ScreenshotData *scd= op->customdata;
|
ScreenshotData *scd = op->customdata;
|
||||||
|
|
||||||
if (scd == NULL) {
|
if (scd == NULL) {
|
||||||
/* when running exec directly */
|
/* when running exec directly */
|
||||||
screenshot_data_create(C, op);
|
screenshot_data_create(C, op);
|
||||||
scd= op->customdata;
|
scd = op->customdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scd) {
|
if (scd) {
|
||||||
@ -179,8 +179,8 @@ static int screenshot_exec(bContext *C, wmOperator *op)
|
|||||||
BLI_path_abs(path, G.main->name);
|
BLI_path_abs(path, G.main->name);
|
||||||
|
|
||||||
/* operator ensures the extension */
|
/* operator ensures the extension */
|
||||||
ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
|
ibuf = IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
|
||||||
ibuf->rect= scd->dumprect;
|
ibuf->rect = scd->dumprect;
|
||||||
|
|
||||||
/* crop to show only single editor */
|
/* crop to show only single editor */
|
||||||
if (!RNA_boolean_get(op->ptr, "full"))
|
if (!RNA_boolean_get(op->ptr, "full"))
|
||||||
@ -266,7 +266,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
|
|||||||
|
|
||||||
ot->flag = 0;
|
ot->flag = 0;
|
||||||
|
|
||||||
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
|
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
|
||||||
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screenshot the whole Blender window");
|
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screenshot the whole Blender window");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ typedef struct ScreenshotJob {
|
|||||||
|
|
||||||
static void screenshot_freejob(void *sjv)
|
static void screenshot_freejob(void *sjv)
|
||||||
{
|
{
|
||||||
ScreenshotJob *sj= sjv;
|
ScreenshotJob *sj = sjv;
|
||||||
|
|
||||||
if (sj->dumprect)
|
if (sj->dumprect)
|
||||||
MEM_freeN(sj->dumprect);
|
MEM_freeN(sj->dumprect);
|
||||||
@ -297,15 +297,15 @@ static void screenshot_freejob(void *sjv)
|
|||||||
/* called before redraw notifiers, copies a new dumprect */
|
/* called before redraw notifiers, copies a new dumprect */
|
||||||
static void screenshot_updatejob(void *sjv)
|
static void screenshot_updatejob(void *sjv)
|
||||||
{
|
{
|
||||||
ScreenshotJob *sj= sjv;
|
ScreenshotJob *sj = sjv;
|
||||||
unsigned int *dumprect;
|
unsigned int *dumprect;
|
||||||
|
|
||||||
if (sj->dumprect==NULL) {
|
if (sj->dumprect == NULL) {
|
||||||
dumprect= MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
|
dumprect = MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
|
||||||
glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
|
glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
|
||||||
glFinish();
|
glFinish();
|
||||||
|
|
||||||
sj->dumprect= dumprect;
|
sj->dumprect = dumprect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,13 +313,13 @@ static void screenshot_updatejob(void *sjv)
|
|||||||
/* only this runs inside thread */
|
/* only this runs inside thread */
|
||||||
static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress))
|
static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress))
|
||||||
{
|
{
|
||||||
ScreenshotJob *sj= sjv;
|
ScreenshotJob *sj = sjv;
|
||||||
RenderData rd= sj->scene->r;
|
RenderData rd = sj->scene->r;
|
||||||
bMovieHandle *mh= BKE_movie_handle_get(sj->scene->r.im_format.imtype);
|
bMovieHandle *mh = BKE_movie_handle_get(sj->scene->r.im_format.imtype);
|
||||||
|
|
||||||
/* we need this as local variables for renderdata */
|
/* we need this as local variables for renderdata */
|
||||||
rd.frs_sec= U.scrcastfps;
|
rd.frs_sec = U.scrcastfps;
|
||||||
rd.frs_sec_base= 1.0f;
|
rd.frs_sec_base = 1.0f;
|
||||||
|
|
||||||
if (BKE_imtype_is_movie(rd.im_format.imtype)) {
|
if (BKE_imtype_is_movie(rd.im_format.imtype)) {
|
||||||
if (!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
|
if (!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
|
||||||
@ -328,20 +328,20 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mh= NULL;
|
mh = NULL;
|
||||||
|
|
||||||
sj->stop= stop;
|
sj->stop = stop;
|
||||||
sj->do_update= do_update;
|
sj->do_update = do_update;
|
||||||
|
|
||||||
*do_update= 1; // wait for opengl rect
|
*do_update = 1; // wait for opengl rect
|
||||||
|
|
||||||
while (*stop==0) {
|
while (*stop == 0) {
|
||||||
|
|
||||||
if (sj->dumprect) {
|
if (sj->dumprect) {
|
||||||
|
|
||||||
if (mh) {
|
if (mh) {
|
||||||
if (mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
|
if (mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
|
||||||
sj->dumpsx, sj->dumpsy, &sj->reports))
|
sj->dumpsx, sj->dumpsy, &sj->reports))
|
||||||
{
|
{
|
||||||
BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
|
BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
|
||||||
printf("Appended frame %d\n", rd.cfra);
|
printf("Appended frame %d\n", rd.cfra);
|
||||||
@ -351,16 +351,16 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
|
ImBuf *ibuf = IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
|
||||||
char name[FILE_MAX];
|
char name[FILE_MAX];
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE);
|
BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE);
|
||||||
|
|
||||||
ibuf->rect= sj->dumprect;
|
ibuf->rect = sj->dumprect;
|
||||||
ok= BKE_imbuf_write(ibuf, name, &rd.im_format);
|
ok = BKE_imbuf_write(ibuf, name, &rd.im_format);
|
||||||
|
|
||||||
if (ok==0) {
|
if (ok == 0) {
|
||||||
printf("Write error: cannot save %s\n", name);
|
printf("Write error: cannot save %s\n", name);
|
||||||
BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
|
BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
|
||||||
break;
|
break;
|
||||||
@ -375,9 +375,9 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(sj->dumprect);
|
MEM_freeN(sj->dumprect);
|
||||||
sj->dumprect= NULL;
|
sj->dumprect = NULL;
|
||||||
|
|
||||||
*do_update= 1;
|
*do_update = 1;
|
||||||
|
|
||||||
rd.cfra++;
|
rd.cfra++;
|
||||||
|
|
||||||
@ -394,38 +394,38 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
|||||||
|
|
||||||
static int screencast_exec(bContext *C, wmOperator *op)
|
static int screencast_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
bScreen *screen= CTX_wm_screen(C);
|
bScreen *screen = CTX_wm_screen(C);
|
||||||
wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
|
wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
|
||||||
ScreenshotJob *sj= MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
|
ScreenshotJob *sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
|
||||||
|
|
||||||
/* setup sj */
|
/* setup sj */
|
||||||
if (RNA_boolean_get(op->ptr, "full")) {
|
if (RNA_boolean_get(op->ptr, "full")) {
|
||||||
wmWindow *win= CTX_wm_window(C);
|
wmWindow *win = CTX_wm_window(C);
|
||||||
sj->x= 0;
|
sj->x = 0;
|
||||||
sj->y= 0;
|
sj->y = 0;
|
||||||
sj->dumpsx= win->sizex;
|
sj->dumpsx = win->sizex;
|
||||||
sj->dumpsy= win->sizey;
|
sj->dumpsy = win->sizey;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ScrArea *curarea= CTX_wm_area(C);
|
ScrArea *curarea = CTX_wm_area(C);
|
||||||
sj->x= curarea->totrct.xmin;
|
sj->x = curarea->totrct.xmin;
|
||||||
sj->y= curarea->totrct.ymin;
|
sj->y = curarea->totrct.ymin;
|
||||||
sj->dumpsx= curarea->totrct.xmax - sj->x;
|
sj->dumpsx = curarea->totrct.xmax - sj->x;
|
||||||
sj->dumpsy= curarea->totrct.ymax - sj->y;
|
sj->dumpsy = curarea->totrct.ymax - sj->y;
|
||||||
}
|
}
|
||||||
sj->bmain= CTX_data_main(C);
|
sj->bmain = CTX_data_main(C);
|
||||||
sj->scene= CTX_data_scene(C);
|
sj->scene = CTX_data_scene(C);
|
||||||
|
|
||||||
BKE_reports_init(&sj->reports, RPT_PRINT);
|
BKE_reports_init(&sj->reports, RPT_PRINT);
|
||||||
|
|
||||||
/* setup job */
|
/* setup job */
|
||||||
WM_jobs_customdata(steve, sj, screenshot_freejob);
|
WM_jobs_customdata(steve, sj, screenshot_freejob);
|
||||||
WM_jobs_timer(steve, 0.1, 0, NC_SCREEN|ND_SCREENCAST);
|
WM_jobs_timer(steve, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
|
||||||
WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
|
WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
|
||||||
|
|
||||||
WM_jobs_start(CTX_wm_manager(C), steve);
|
WM_jobs_start(CTX_wm_manager(C), steve);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_SCREEN|ND_SCREENCAST, screen);
|
WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@ -445,6 +445,3 @@ void SCREEN_OT_screencast(wmOperatorType *ot)
|
|||||||
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||||
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screencast the whole Blender window");
|
RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screencast the whole Blender window");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user