diff options
-rw-r--r-- | release/scripts/bpymodules/BPyRender.py | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 19 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneRender.c | 74 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 14 |
4 files changed, 60 insertions, 51 deletions
diff --git a/release/scripts/bpymodules/BPyRender.py b/release/scripts/bpymodules/BPyRender.py index 6f9c9997933..951e1ae6300 100644 --- a/release/scripts/bpymodules/BPyRender.py +++ b/release/scripts/bpymodules/BPyRender.py @@ -125,14 +125,14 @@ def imageFromObjectsOrtho(objects, path, width, height, smooth, alpha= True, cam # camera is wider then image res. # to make the image wider, reduce the aspy asp_diff= asp_image_res/asp_cam_mat - min_asp= int(round(asp_diff * 200)) + min_asp= asp_diff * 200 #print 'X', min_asp elif asp_cam_mat < asp_image_res: # asp_cam_mat < asp_image_res # camera is narrower then image res # to make the image narrower, reduce the aspx asp_diff= asp_cam_mat/asp_image_res - min_asp= int(round(asp_diff * 200)) + min_asp= asp_diff * 200 #print 'Y', min_asp else: min_asp= 200 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 05fce5e4598..e5056e048ce 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -202,14 +202,6 @@ typedef struct RenderData { */ short ysch; /** - * Adjustment factors for the aspect ratio in the x direction - */ - short xasp; - /** - * Adjustment factors for the aspect ratio in the x direction - */ - short yasp; - /** * The number of part to use in the x direction */ short xparts; @@ -225,7 +217,7 @@ typedef struct RenderData { short bufflag; short quality; - short rpad; + short rpad, rpad1, rpad2; /** * Flags for render settings. Use bit-masking to access the settings. @@ -260,6 +252,15 @@ typedef struct RenderData { /* information on different layers to be rendered */ ListBase layers; short actlay, pad; + + /** + * Adjustment factors for the aspect ratio in the x direction, was a short in 2.45 + */ + float xasp; + /** + * Adjustment factors for the aspect ratio in the x direction, was a short in 2.45 + */ + float yasp; float frs_sec_base; diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index b12ee85fe2b..5f81ea27176 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -919,6 +919,18 @@ PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args ) 0.5f, 1.5f ); } +PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args ) +{ + return M_Render_GetSetAttributeFloat( args, &self->renderContext->xasp, + 1.0f, 200.0f ); +} + +PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args ) +{ + return M_Render_GetSetAttributeFloat( args, &self->renderContext->yasp, + 1.0f, 200.0f ); +} + PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args ) { return M_Render_GetSetAttributeInt( args, &self->renderContext->sfra, @@ -949,18 +961,6 @@ PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args ) 4, 10000 ); } -PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args ) -{ - return M_Render_GetSetAttributeShort( args, &self->renderContext->xasp, - 1, 200 ); -} - -PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args ) -{ - return M_Render_GetSetAttributeShort( args, &self->renderContext->yasp, - 1, 200 ); -} - static int RenderData_setRenderer( BPy_RenderData * self, PyObject * value ) { int type; @@ -1868,6 +1868,12 @@ static PyObject *RenderData_getFloatAttr( BPy_RenderData *self, void *type ) case EXPP_RENDER_ATTR_BAKEBIAS: param = self->renderContext->bake_biasdist; break; + case EXPP_RENDER_ATTR_ASPECTX: + param = (long)self->renderContext->xasp; + break; + case EXPP_RENDER_ATTR_ASPECTY: + param = (long)self->renderContext->yasp; + break; default: return EXPP_ReturnPyObjError( PyExc_RuntimeError, "undefined type constant in RenderData_getFloatAttr" ); @@ -1911,6 +1917,16 @@ static int RenderData_setFloatAttrClamp( BPy_RenderData *self, PyObject *value, max = 1000.0f; param = &self->renderContext->bake_biasdist; break; + case EXPP_RENDER_ATTR_ASPECTX: + min = 1.0f; + max = 200.0f; + param = &self->renderContext->xasp; + break; + case EXPP_RENDER_ATTR_ASPECTY: + min = 1.0f; + max = 200.0f; + param = &self->renderContext->yasp; + break; default: return EXPP_ReturnIntError( PyExc_RuntimeError, "undefined type constant in RenderData_setFloatAttrClamp" ); @@ -1933,12 +1949,6 @@ static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type ) case EXPP_RENDER_ATTR_YPARTS: param = (long)self->renderContext->yparts; break; - case EXPP_RENDER_ATTR_ASPECTX: - param = (long)self->renderContext->xasp; - break; - case EXPP_RENDER_ATTR_ASPECTY: - param = (long)self->renderContext->yasp; - break; case EXPP_RENDER_ATTR_CFRAME: param = (long)self->renderContext->cfra; break; @@ -1996,18 +2006,6 @@ static int RenderData_setIValueAttrClamp( BPy_RenderData *self, PyObject *value, size = 'h'; param = &self->renderContext->yparts; break; - case EXPP_RENDER_ATTR_ASPECTX: - min = 1; - max = 200; - size = 'h'; - param = &self->renderContext->xasp; - break; - case EXPP_RENDER_ATTR_ASPECTY: - min = 1; - max = 200; - size = 'h'; - param = &self->renderContext->yasp; - break; case EXPP_RENDER_ATTR_CFRAME: min = 1; max = MAXFRAME; @@ -2726,14 +2724,6 @@ static PyGetSetDef BPy_RenderData_getseters[] = { (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp, "Number of vertical parts for image render", (void *)EXPP_RENDER_ATTR_YPARTS}, - {"aspectX", - (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp, - "Horizontal aspect ratio", - (void *)EXPP_RENDER_ATTR_ASPECTX}, - {"aspectY", - (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp, - "Vertical aspect ratio", - (void *)EXPP_RENDER_ATTR_ASPECTY}, {"cFrame", (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp, "The current frame for rendering", @@ -2771,6 +2761,14 @@ static PyGetSetDef BPy_RenderData_getseters[] = { (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp, "Motion blur factor", (void *)EXPP_RENDER_ATTR_MBLURFACTOR}, + {"aspectX", + (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp, + "Horizontal aspect ratio", + (void *)EXPP_RENDER_ATTR_ASPECTX}, + {"aspectY", + (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp, + "Vertical aspect ratio", + (void *)EXPP_RENDER_ATTR_ASPECTY}, {"mapOld", (getter)RenderData_getMapOld, (setter)RenderData_setMapOld, "Number of frames the Map Old will last", diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 40ff0d5cff6..0228754b599 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2497,8 +2497,18 @@ static void render_panel_format(void) uiBlockBeginAlign(block); uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:", 892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels"); uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:", 1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines"); - uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:", 892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio"); - uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:", 1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio"); + + uiDefButF(block, NUM, REDRAWVIEWCAM, "AspX:", + 892 ,114,112,20, + &G.scene->r.xasp, + 1, 200, 100, 2, + "Horizontal Aspect Ratio"); + uiDefButF(block, NUM, REDRAWVIEWCAM, "AspY:", + 1007,114,112,20, + &G.scene->r.yasp, + 1, 200, 100, 2, + "Vertical Aspect Ratio"); + uiBlockEndAlign(block); yofs = 54; |