Page Menu
Home
Search
Configure Global Search
Log In
Files
F3754
cameraang10.txt
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Juho Vepsalainen (bebraw)
Nov 13 2013, 1:12 PM
Size
5 KB
Subscribers
None
cameraang10.txt
View Options
Index: source/blender/blenkernel/intern/object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/object.c,v
retrieving revision 1.125
diff -u -p -u -r1.125 object.c
--- source/blender/blenkernel/intern/object.c 14 Mar 2007 09:08:40 -0000 1.125
+++ source/blender/blenkernel/intern/object.c 23 Mar 2007 08:15:33 -0000
@@ -496,6 +496,7 @@ void *add_camera(char *name)
cam= alloc_libblock(&G.main->camera, ID_CA, name);
cam->lens= 35.0f;
+ cam->angle= 49.14f;
cam->clipsta= 0.1f;
cam->clipend= 100.0f;
cam->drawsize= 0.5f;
@@ -2059,5 +2060,3 @@ void object_handle_update(Object *ob)
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
}
}
-
-
Index: source/blender/blenloader/intern/readfile.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/readfile.c,v
retrieving revision 1.371
diff -u -p -u -r1.371 readfile.c
--- source/blender/blenloader/intern/readfile.c 21 Mar 2007 02:23:27 -0000 1.371
+++ source/blender/blenloader/intern/readfile.c 23 Mar 2007 08:15:34 -0000
@@ -6367,6 +6367,17 @@ static void do_versions(FileData *fd, Li
sce->toolsettings->jointrilimit= 0.8f;
}
}
+
+ if(main->subversionfile < 6) { /* not so sure if this works yet alright */
+ Camera *cam = main->camera.first;
+
+ while(cam) {
+ if(cam->angle==0.0) {
+ cam->angle= 16 / tan(M_PI*cam->lens/360);
+ }
+ cam= cam->id.next;
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
Index: source/blender/makesdna/DNA_camera_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_camera_types.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 DNA_camera_types.h
--- source/blender/makesdna/DNA_camera_types.h 21 Dec 2006 18:11:06 -0000 1.15
+++ source/blender/makesdna/DNA_camera_types.h 23 Mar 2007 08:15:34 -0000
@@ -47,7 +47,9 @@ typedef struct Camera {
ID id;
short type, flag;
- float passepartalpha, pad1;
+ int pad1;
+ float angle;
+ float passepartalpha, pad2;
float clipsta, clipend;
float lens, ortho_scale, drawsize;
float shiftx, shifty;
@@ -76,6 +78,7 @@ typedef struct Camera {
#define CAM_SHOWPASSEPARTOUT 4
#define CAM_SHOWTITLESAFE 8
#define CAM_SHOWNAME 16
+#define CAM_ANGLETOGGLE 32
/* yafray: dof sampling switch */
#define CAM_YF_NO_QMC 512
@@ -86,4 +89,3 @@ typedef struct Camera {
#endif
#endif
-
Index: source/blender/python/api2_2x/Camera.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Camera.c,v
retrieving revision 1.54
diff -u -p -u -r1.54 Camera.c
--- source/blender/python/api2_2x/Camera.c 15 Mar 2007 01:47:51 -0000 1.54
+++ source/blender/python/api2_2x/Camera.c 23 Mar 2007 08:15:34 -0000
@@ -925,7 +925,11 @@ static PyGetSetDef BPy_Camera_getseters[
(getter)getFlagAttr, (setter)setFlagAttr,
"toggle the passPartOut display flag",
(void *)CAM_SHOWPASSEPARTOUT},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+ {"angleToggle",
+ (getter)getFlagAttr, (setter)setFlagAttr,
+ "toggle the camera input unit flag",
+ (void *)CAM_ANGLETOGGLE},
+ {NULL,NULL,NULL,NULL} /* Sentinel */
};
Index: source/blender/src/buttons_editing.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v
retrieving revision 1.371
diff -u -p -u -r1.371 buttons_editing.c
--- source/blender/src/buttons_editing.c 23 Mar 2007 04:45:17 -0000 1.371
+++ source/blender/src/buttons_editing.c 23 Mar 2007 08:15:35 -0000
@@ -2969,11 +2969,38 @@ static void editing_panel_curve_type(Obj
/* *************************** CAMERA ******************************** */
+/* callback to handle angle to lens conversion */
+static void do_angletolensconversion_cb(void *lens1, void *angle1) {
+ float *lens= (float *)lens1;
+ float *angle= (float *)angle1;
+ float anglevalue= *angle;
+
+ if(lens) {
+ *lens= 16 / tan(M_PI*anglevalue/360);
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+}
+
+/* callback to handle lens to angle conversion */
+static void do_lenstoangleconversion_cb(void *lens1, void *angle1) {
+ float *lens= (float *)lens1;
+ float *angle= (float *)angle1;
+ float lensvalue= *lens;
+
+ if(lens) {
+ *angle= 360 * atan(16/lensvalue) / M_PI;
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+}
static void editing_panel_camera_type(Object *ob, Camera *cam)
{
uiBlock *block;
+ uiBut *but;
float grid=0.0;
+ void *cb;
if(G.vd) grid= G.vd->grid;
if(grid<1.0) grid= 1.0;
@@ -2987,8 +3014,24 @@ static void editing_panel_camera_type(Ob
uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:",
10, 160, 150, 20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
} else {
- uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
- 10, 160, 150, 20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
+ if(cam->flag & CAM_ANGLETOGGLE) {
+ but= uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
+ 10, 160, 130, 20, &cam->angle, 1.0, 250.0, 100, 0, "Specify the lens of the camera in degrees");
+ uiButSetFunc(but,do_angletolensconversion_cb, &cam->lens, &cam->angle);
+
+ cb= do_lenstoangleconversion_cb;
+ }
+ else {
+ but= uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:",
+ 10, 160, 130, 20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
+ uiButSetFunc(but,do_lenstoangleconversion_cb, &cam->lens, &cam->angle);
+
+ cb= do_angletolensconversion_cb;
+ }
+
+ but= uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "D",
+ 140, 160, 20, 20, &cam->flag, 0, 0, 0, 0, "Use degree as the unit of the camera lens");
+ uiButSetFunc(but, cb, &cam->lens, &cam->angle);
}
/* qdn: focal dist. param. from yafray now enabled for Blender as well, to use with defocus composit node */
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
23/04/429a046b3c6692b6697f3502d9cd
Event Timeline
Log In to Comment