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:
authorCampbell Barton <ideasman42@gmail.com>2007-04-28 21:21:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-04-28 21:21:00 +0400
commit1d181b91080294b8ec51165791da69b53d535d51 (patch)
treef81c586d23bde4aaa68096b40eb3e93654d19175 /source/blender/python/api2_2x/Camera.c
parent6e27e1b6ebb76f937182468d4f8fa64f028c90e7 (diff)
removed doc_browser.py - since it covers ~half the BPY api, not documenting any of blenders data types.
replaced with a help_bpy_api.py, that opens a web browser at the Blender Python API page. Camera.c - added a veriable .angle to camera, same as .lens but adjusts the camera angle in degrees (like the D button) export_fbx.py - use the the camera angle property. object_cookie_cutter.py - use PointInTriangle2D rather then own function. buttons_shading.c - added OB: and tooltip to object world mapping. interface_draw.c - (Simple theme) text buttons looked exactly like normal buttons (more confusing when they had no text), made the text and ID buttons render inset so you can tell them apart.
Diffstat (limited to 'source/blender/python/api2_2x/Camera.c')
-rw-r--r--source/blender/python/api2_2x/Camera.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c
index 6f389396eb7..d4e74f5d9fc 100644
--- a/source/blender/python/api2_2x/Camera.c
+++ b/source/blender/python/api2_2x/Camera.c
@@ -52,6 +52,7 @@
enum cam_consts {
EXPP_CAM_ATTR_LENS = 0,
+ EXPP_CAM_ATTR_ANGLE,
EXPP_CAM_ATTR_DOFDIST,
EXPP_CAM_ATTR_CLIPEND,
EXPP_CAM_ATTR_CLIPSTART,
@@ -728,6 +729,9 @@ static PyObject *getFloatAttr( BPy_Camera *self, void *type )
case EXPP_CAM_ATTR_LENS:
param = cam->lens;
break;
+ case EXPP_CAM_ATTR_ANGLE:
+ param = 360.0f * atan(16.0f/cam->lens) / M_PI;
+ break;
case EXPP_CAM_ATTR_DOFDIST:
param = cam->YF_dofdist;
break;
@@ -772,14 +776,19 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
float *param;
struct Camera *cam = self->camera;
float min, max;
-
-
+ int ret;
+
switch( (int)type ) {
case EXPP_CAM_ATTR_LENS:
min = 1.0;
max = 250.0;
param = &cam->lens;
break;
+ case EXPP_CAM_ATTR_ANGLE:
+ min = 7.323871;
+ max = 172.847331;
+ param = &cam->lens;
+ break;
case EXPP_CAM_ATTR_DOFDIST:
min = 0.0;
max = 5000.0;
@@ -826,7 +835,14 @@ static int setFloatAttrClamp( BPy_Camera *self, PyObject *value, void *type )
"undefined type in setFloatAttrClamp" );
}
- return EXPP_setFloatClamped( value, param, min, max );
+ ret = EXPP_setFloatClamped( value, param, min, max );
+
+ if (ret==0) {
+ if ((int)type == EXPP_CAM_ATTR_ANGLE) {
+ cam->lens = 16.0f / tan(M_PI*cam->lens/360.0f);
+ }
+ }
+ return ret;
}
@@ -879,6 +895,11 @@ static PyGetSetDef BPy_Camera_getseters[] = {
(getter)getFloatAttr, (setter)setFloatAttrClamp,
"lens angle for perspective cameras",
(void *)EXPP_CAM_ATTR_LENS},
+ {"angle",
+ (getter)getFloatAttr, (setter)setFloatAttrClamp,
+ "lens angle for perspective cameras",
+ (void *)EXPP_CAM_ATTR_ANGLE},
+
{"scale",
(getter)getFloatAttr, (setter)setFloatAttrClamp,
"scale for ortho cameras",