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
path: root/source
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
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')
-rw-r--r--source/blender/python/api2_2x/Camera.c27
-rw-r--r--source/blender/python/api2_2x/doc/Camera.py1
-rw-r--r--source/blender/src/buttons_shading.c2
-rw-r--r--source/blender/src/interface_draw.c78
4 files changed, 78 insertions, 30 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",
diff --git a/source/blender/python/api2_2x/doc/Camera.py b/source/blender/python/api2_2x/doc/Camera.py
index 2576c2cb740..c4e664efa66 100644
--- a/source/blender/python/api2_2x/doc/Camera.py
+++ b/source/blender/python/api2_2x/doc/Camera.py
@@ -50,6 +50,7 @@ class Camera:
@ivar type: The Camera type: 'persp' or 'ortho'
@ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
@ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
+ @ivar angle: The lens value in degrees [7.323871, 172.847331], only relevant to *persp* cameras.
@ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
@ivar clipStart: The clip start value in [0.0, 100.0].
@ivar clipEnd: The clip end value in [1.0, 5000.0].
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index ce9c2f53906..bd8dae311e8 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -2045,7 +2045,7 @@ static void world_panel_texture(World *wrld)
uiDefButS(block, ROW, B_WORLDPRV, "Tube", 235,90,65,20, &(mtex->texco), 4.0, (float)TEXCO_H_TUBEMAP, 0, 0, "For 360 degree panorama sky, cylindrical mapped, only top half");
uiDefButS(block, ROW, B_WORLDPRV, "Object", 100,70,70,20, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Uses linked object's coordinates for texture coordinates");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_WORLDPRV, "", 170,70,130,20, &(mtex->object), "");
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_WORLDPRV, "OB:", 170,70,130,20, &(mtex->object), "Object name to use for mapping");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, B_WORLDPRV, "dX", 100,40,100,19, mtex->ofs, -20.0, 20.0, 10, 0, "Fine tunes texture mapping X coordinate");
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
index 3c67975e96f..c7bcc510ef1 100644
--- a/source/blender/src/interface_draw.c
+++ b/source/blender/src/interface_draw.c
@@ -1207,16 +1207,17 @@ static void ui_draw_round(int type, int colorid, float asp, float x1, float y1,
static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
{
/* too much space between buttons */
- /*
- x1+= asp;
- x2-= asp;
- y1+= asp;
- y2-= asp;
- */
- /* Less space between buttons looks nicer */
- y2-= asp;
- x2-= asp;
+ if (type==TEX || type==IDPOIN) {
+ x1+= asp;
+ x2-= (asp*2);
+ //y1+= asp;
+ y2-= asp;
+ } else {
+ /* Less space between buttons looks nicer */
+ y2-= asp;
+ x2-= asp;
+ }
/* paper */
if(flag & UI_SELECT) {
@@ -1229,34 +1230,59 @@ static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1
}
glRectf(x1, y1, x2, y2);
-
- if(flag & UI_SELECT) {
+
+ if (type==TEX || type==IDPOIN) {
BIF_ThemeColorShade(colorid, -60);
/* top */
fdrawline(x1, y2, x2, y2);
/* left */
fdrawline(x1, y1, x1, y2);
- BIF_ThemeColorShade(colorid, +40);
-
- /* below */
- fdrawline(x1, y1, x2, y1);
- /* right */
- fdrawline(x2, y1, x2, y2);
- }
- else {
- BIF_ThemeColorShade(colorid, +40);
-
- /* top */
- fdrawline(x1, y2, x2, y2);
- /* left */
- fdrawline(x1, y1, x1, y2);
- BIF_ThemeColorShade(colorid, -60);
+
+ /* text underline, some */
+ BIF_ThemeColorShade(colorid, +50);
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(1, 0x8888);
+ fdrawline(x1+(asp*2), y1+(asp*3), x2-(asp*2), y1+(asp*3));
+ glDisable(GL_LINE_STIPPLE);
+
+
+ BIF_ThemeColorShade(colorid, +60);
/* below */
fdrawline(x1, y1, x2, y1);
/* right */
fdrawline(x2, y1, x2, y2);
+
+ } else {
+ if(flag & UI_SELECT) {
+ BIF_ThemeColorShade(colorid, -60);
+
+ /* top */
+ fdrawline(x1, y2, x2, y2);
+ /* left */
+ fdrawline(x1, y1, x1, y2);
+ BIF_ThemeColorShade(colorid, +40);
+
+ /* below */
+ fdrawline(x1, y1, x2, y1);
+ /* right */
+ fdrawline(x2, y1, x2, y2);
+ }
+ else {
+ BIF_ThemeColorShade(colorid, +40);
+
+ /* top */
+ fdrawline(x1, y2, x2, y2);
+ /* left */
+ fdrawline(x1, y1, x1, y2);
+
+ BIF_ThemeColorShade(colorid, -60);
+ /* below */
+ fdrawline(x1, y1, x2, y1);
+ /* right */
+ fdrawline(x2, y1, x2, y2);
+ }
}
/* special type decorations */