Camera visualisation changes and features (from tuho)

* Made the in-camera view dashed border lines less jarring
and disturbing. We will give it some testing here, feedback
is welcome.
* Showing the title safe zone is now an option in the
camera edit buttons. It's not very useful if you're not
making stuff for video/broadcast so you can turn it off.
* Passepartout is now a flag per camera, rather than per
scene. It never really belonged in the render buttons or as
Scene data, though it could be up for debate whether it's
better as camera data or view data (i.e. in the view
properties panel). Old files get converted over nicely with
this so if you had passepartout on before, it stays on the
cameras.
* Added an option to show the current camera's name at
the bottom of the in-camera view, to help keep track of
which one you're seeing when using multiple cameras.
* In the 3D View (non-camera view) the active camera is
drawn with a solid line as before, while non-active
cameras are drawn with a dashed line, to help visualise
which one is active.
This commit is contained in:
Matt Ebb 2005-10-27 11:28:43 +00:00
parent c753365403
commit dd409399ec
7 changed files with 106 additions and 42 deletions

@ -447,6 +447,7 @@ void *add_camera()
cam->clipend= 100.0f; cam->clipend= 100.0f;
cam->drawsize= 0.5f; cam->drawsize= 0.5f;
cam->ortho_scale= 6.0; cam->ortho_scale= 6.0;
cam->flag |= CAM_SHOWTITLESAFE;
return cam; return cam;
} }

@ -4989,6 +4989,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} }
if(main->versionfile <= 239) { if(main->versionfile <= 239) {
Object *ob; Object *ob;
Scene *sce= main->scene.first;
Camera *cam= main->camera.first;
/* deformflag is local in modifier now */ /* deformflag is local in modifier now */
for(ob=main->object.first; ob; ob= ob->id.next) { for(ob=main->object.first; ob; ob= ob->id.next) {
@ -5004,7 +5006,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} }
} }
} }
} }
while(sce) {
while(cam) {
/* convert the passepartout scene flag to a camera flag */
if(sce->r.scemode & R_PASSEPARTOUT)
cam->flag |= CAM_SHOWPASSEPARTOUT;
/* make sure old cameras have title safe on */
if (!(cam->flag & CAM_SHOWTITLESAFE))
cam->flag |= CAM_SHOWTITLESAFE;
cam= cam->id.next;
}
sce= sce->id.next;
}
} }
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT!!!: pointers from libdata have not been converted yet here! */

@ -69,8 +69,12 @@ typedef struct Camera {
/* flag */ /* flag */
#define CAM_SHOWLIMITS 1 #define CAM_SHOWLIMITS 1
#define CAM_SHOWMIST 2 #define CAM_SHOWMIST 2
#define CAM_SHOWPASSEPARTOUT 4
#define CAM_SHOWTITLESAFE 8
#define CAM_SHOWNAME 16
/* yafray: dof sampling switch */ /* yafray: dof sampling switch */
#define CAM_YF_NO_QMC 4 #define CAM_YF_NO_QMC 512
#ifdef __cplusplus #ifdef __cplusplus

@ -2261,23 +2261,43 @@ static void editing_panel_camera_type(Object *ob, Camera *cam)
block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win); block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return; if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
if(cam->type==CAM_ORTHO) if(cam->type==CAM_ORTHO) {
uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:", 470,178,160,20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera"); uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:",
else 0, 145, 150, 20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera"); } else {
uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
0, 145, 150, 20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
}
uiDefButS(block, TOG, REDRAWVIEW3D, "Orthographic",
0, 120, 150, 20, &cam->type, 0, 0, 0, 0, "Render orthogonally");
uiDefBut(block, LABEL, 0, "Clipping:", 0, 90, 150, 20, 0, 0.0, 0.0, 0, 0, "");
uiBlockBeginAlign(block);
uiDefButF(block, NUM,REDRAWVIEW3D, "Start:",
0, 70, 150, 20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view");
uiDefButF(block, NUM,REDRAWVIEW3D, "End:",
0, 50, 150, 20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view");
uiBlockEndAlign(block);
uiDefBut(block, LABEL, 0, "Show:", 160, 155, 150, 20, 0, 0.0, 0.0, 0, 0, "");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM,REDRAWVIEW3D, "ClipSta:", 470,147,160,20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view"); uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "Limits",
uiDefButF(block, NUM,REDRAWVIEW3D, "ClipEnd:", 470,125,160,20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view"); 160, 135, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
uiBlockEndAlign(block); uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Mist",
160, 115, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera"); uiDefButS(block, TOG|BIT|2,REDRAWVIEW3D, "Passepartout",
160, 95, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw a darkened passepartout over the off-screen area in camera view");
uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,29,61,60, &cam->type, 0, 0, 0, 0, "Render orthogonally"); uiDefButS(block, TOG|BIT|3,REDRAWVIEW3D, "Title Safe",
uiBlockBeginAlign(block); 160, 75, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw a the title safe zone in camera view");
uiDefButBitS(block, TOG, CAM_SHOWLIMITS, REDRAWVIEW3D, "ShowLimits", 533,59,97,30, &cam->flag, 0, 0, 0, 0, "Draw the field of view"); uiDefButS(block, TOG|BIT|4,REDRAWVIEW3D, "Name",
uiDefButBitS(block, TOG, CAM_SHOWMIST, REDRAWVIEW3D, "Show Mist", 533,29,97,30, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area"); 160, 55, 150, 20, &cam->flag, 0, 0, 0, 0, "Draw the active camera's name in camera view");
uiBlockEndAlign(block); uiBlockEndAlign(block);
uiDefButF(block, NUM,REDRAWVIEW3D, "Size:",
160, 30, 150, 20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera");
} }
/* yafray: extra camera panel to set Depth-of-Field parameters */ /* yafray: extra camera panel to set Depth-of-Field parameters */

@ -1042,7 +1042,6 @@ static void render_panel_output(void)
uiBlockEndAlign(block); uiBlockEndAlign(block);
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, R_PASSEPARTOUT, REDRAWVIEW3D, "Passepartout", 72, 30, 122, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Draws darkened passepartout in camera view");
uiDefButS(block, ROW, B_REDR, "DispWin", 72, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window"); uiDefButS(block, ROW, B_REDR, "DispWin", 72, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
uiDefButS(block, ROW, B_REDR, "DispView", 134, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view"); uiDefButS(block, ROW, B_REDR, "DispView", 134, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
uiBlockEndAlign(block); uiBlockEndAlign(block);

@ -715,12 +715,16 @@ void drawcamera(Object *ob)
vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth; vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth;
vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth; vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth;
/* draw inactive cameras with dashed lines */
if (ob != G.vd->camera) setlinestyle(3);
glBegin(GL_LINE_LOOP); glBegin(GL_LINE_LOOP);
glVertex3fv(vec[1]); glVertex3fv(vec[1]);
glVertex3fv(vec[2]); glVertex3fv(vec[2]);
glVertex3fv(vec[3]); glVertex3fv(vec[3]);
glVertex3fv(vec[4]); glVertex3fv(vec[4]);
glEnd(); glEnd();
if(G.vd->persp>=2 && ob==G.vd->camera) return; if(G.vd->persp>=2 && ob==G.vd->camera) return;
@ -732,6 +736,9 @@ void drawcamera(Object *ob)
glVertex3fv(vec[0]); glVertex3fv(vec[0]);
glVertex3fv(vec[3]); glVertex3fv(vec[3]);
glEnd(); glEnd();
/* make sure it's solid line again */
setlinestyle(0);
/* arrow on top */ /* arrow on top */

@ -56,6 +56,7 @@
#include "DNA_action_types.h" #include "DNA_action_types.h"
#include "DNA_armature_types.h" #include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h" #include "DNA_constraint_types.h"
#include "DNA_curve_types.h" #include "DNA_curve_types.h"
#include "DNA_group_types.h" #include "DNA_group_types.h"
@ -903,10 +904,15 @@ void view3d_set_1_to_1_viewborder(View3D *v3d)
static void drawviewborder(void) static void drawviewborder(void)
{ {
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad); // interface_panel.c
float fac, a; float fac, a;
float x1, x2, y1, y2; float x1, x2, y1, y2;
float x3, y3, x4, y4; float x3, y3, x4, y4;
rcti viewborder; rcti viewborder;
Camera *ca;
ca = G.scene->camera->data;
if (ca==NULL) return;
calc_viewborder(G.vd, &viewborder); calc_viewborder(G.vd, &viewborder);
x1= viewborder.xmin; x1= viewborder.xmin;
@ -915,7 +921,7 @@ static void drawviewborder(void)
y2= viewborder.ymax; y2= viewborder.ymax;
/* passepartout, in color of backdrop minus 50 */ /* passepartout, in color of backdrop minus 50 */
if(G.scene->r.scemode & R_PASSEPARTOUT) { if (ca->flag & CAM_SHOWPASSEPARTOUT) {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_BLEND); glEnable(GL_BLEND);
glColor4ub(0, 0, 0, 50); glColor4ub(0, 0, 0, 50);
@ -930,14 +936,26 @@ static void drawviewborder(void)
} }
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
/* edge */
setlinestyle(3);
cpack(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glRectf(x1+1, y1-1, x2+1, y2-1);
cpack(0xFFFFFF); /* edge */
glRectf(x1, y1, x2, y2); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
setlinestyle(0);
BIF_ThemeColor(TH_BACK);
glRectf(x1, y1, x2, y2);
setlinestyle(3);
BIF_ThemeColor(TH_WIRE);
glRectf(x1, y1, x2, y2);
/* camera name */
if (ca->flag & CAM_SHOWNAME) {
glRasterPos2f(x1, y1-15);
BMF_DrawString(G.font, G.scene->camera->id.name+2);
}
/* border */ /* border */
if(G.scene->r.mode & R_BORDER) { if(G.scene->r.mode & R_BORDER) {
@ -948,29 +966,28 @@ static void drawviewborder(void)
x4= x1+ G.scene->r.border.xmax*(x2-x1); x4= x1+ G.scene->r.border.xmax*(x2-x1);
y4= y1+ G.scene->r.border.ymax*(y2-y1); y4= y1+ G.scene->r.border.ymax*(y2-y1);
glRectf(x3+1, y3-1, x4+1, y4-1);
cpack(0x4040FF); cpack(0x4040FF);
glRectf(x3, y3, x4, y4); glRectf(x3, y3, x4, y4);
} }
/* safety border */ /* safety border */
if (ca->flag & CAM_SHOWTITLESAFE) {
fac= 0.1; fac= 0.1;
a= fac*(x2-x1);
x1+= a;
x2-= a;
a= fac*(y2-y1);
y1+= a;
y2-= a;
BIF_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
uiSetRoundBox(15);
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
}
a= fac*(x2-x1);
x1+= a;
x2-= a;
a= fac*(y2-y1);
y1+= a;
y2-= a;
cpack(0);
glRectf(x1+1, y1-1, x2+1, y2-1);
cpack(0xFFFFFF);
glRectf(x1, y1, x2, y2);
setlinestyle(0); setlinestyle(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);