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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_camera.h70
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c8
-rw-r--r--source/blender/blenkernel/intern/camera.c338
-rw-r--r--source/blender/blenkernel/intern/constraint.c27
-rw-r--r--source/blender/blenkernel/intern/fcurve.c4
-rw-r--r--source/blender/blenkernel/intern/mball.c12
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/blenkernel/intern/object.c11
-rw-r--r--source/blender/blenkernel/intern/tracking.c11
-rw-r--r--source/blender/blenlib/intern/math_geom.c12
-rw-r--r--source/blender/blenlib/intern/math_rotation.c4
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/include/ED_transform.h8
-rw-r--r--source/blender/editors/include/ED_view3d.h9
-rw-r--r--source/blender/editors/include/UI_resources.h3
-rw-r--r--source/blender/editors/interface/interface.c5
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_panel.c59
-rw-r--r--source/blender/editors/interface/interface_regions.c17
-rw-r--r--source/blender/editors/interface/interface_style.c1
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
-rw-r--r--source/blender/editors/interface/resources.c14
-rw-r--r--source/blender/editors/interface/view2d.c4
-rw-r--r--source/blender/editors/interface/view2d_ops.c4
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/area.c109
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c25
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c167
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c42
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c256
-rw-r--r--source/blender/editors/transform/transform_snap.c132
-rw-r--r--source/blender/imbuf/intern/anim_movie.c2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h17
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c2
-rw-r--r--source/blender/makesrna/intern/rna_camera.c27
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c66
-rw-r--r--source/blender/makesrna/intern/rna_controller.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c26
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c6
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c63
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c2
-rw-r--r--source/blender/python/generic/noise_py_api.c18
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h1
-rw-r--r--source/blender/render/intern/include/render_types.h3
-rw-r--r--source/blender/render/intern/source/envmap.c12
-rw-r--r--source/blender/render/intern/source/initrender.c59
57 files changed, 909 insertions, 800 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 73f2fdc2a51..a64ebe56c9c 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260
-#define BLENDER_SUBVERSION 4
+#define BLENDER_SUBVERSION 5
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index fc0ef0248f3..72e22dc1583 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -36,28 +36,80 @@
extern "C" {
#endif
+#include "DNA_vec_types.h"
+
struct Camera;
struct Object;
+struct RegionView3D;
struct RenderData;
struct Scene;
struct rctf;
struct View3D;
+/* Camera Datablock */
+
void *add_camera(const char *name);
struct Camera *copy_camera(struct Camera *cam);
void make_local_camera(struct Camera *cam);
void free_camera(struct Camera *ca);
-float dof_camera(struct Object *ob);
+/* Camera Usage */
+
+float object_camera_dof_distance(struct Object *ob);
+void object_camera_mode(struct RenderData *rd, struct Object *ob);
+
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
+
+/* Camera Parameters:
+ *
+ * Intermediate struct for storing camera parameters from various sources,
+ * to unify computation of viewplane, window matrix, ... */
+
+typedef struct CameraParams {
+ /* lens */
+ int is_ortho;
+ float lens;
+ float ortho_scale;
+ float zoom;
+
+ float shiftx;
+ float shifty;
+ float offsetx;
+ float offsety;
+
+ /* sensor */
+ float sensor_x;
+ float sensor_y;
+ int sensor_fit;
+
+ /* clipping */
+ float clipsta;
+ float clipend;
+
+ /* fields */
+ int use_fields;
+ int field_second;
+ int field_odd;
+
+ /* computed viewplane */
+ float ycor;
+ float viewdx;
+ float viewdy;
+ rctf viewplane;
+
+ /* computed matrix */
+ float winmat[4][4];
+} CameraParams;
+
+void camera_params_init(CameraParams *params);
+void camera_params_from_object(CameraParams *params, struct Object *camera);
+void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
+
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
+void camera_params_compute_matrix(CameraParams *params);
-void object_camera_mode(struct RenderData *rd, struct Object *camera);
-void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
- float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit);
-void object_camera_matrix(
- struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
- float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens,
- float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
- float *viewdx, float *viewdy);
+/* Camera View Frame */
void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index cb79c7a7290..5eb9529b2fc 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -94,7 +94,6 @@ void object_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat4(struct Object *ob, float mat[][4]);
void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
-void set_no_parent_ipo(int val);
struct Object *object_pose_armature_get(struct Object *ob);
void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 63ab74fc105..b32421a6b3d 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
static float nlastrip_get_influence (NlaStrip *strip, float cframe)
{
/* sanity checks - normalise the blendin/out values? */
- strip->blendin= (float)fabs(strip->blendin);
- strip->blendout= (float)fabs(strip->blendout);
+ strip->blendin= fabsf(strip->blendin);
+ strip->blendout= fabsf(strip->blendout);
/* result depends on where frame is in respect to blendin/out values */
if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) {
/* there is some blend-in */
- return (float)fabs(cframe - strip->start) / (strip->blendin);
+ return fabsf(cframe - strip->start) / (strip->blendin);
}
else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) {
/* there is some blend-out */
- return (float)fabs(strip->end - cframe) / (strip->blendout);
+ return fabsf(strip->end - cframe) / (strip->blendout);
}
else {
/* in the middle of the strip, we should be full strength */
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 6ba7a76dd5c..da7c0ab1774 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -35,6 +35,7 @@
#include "DNA_lamp_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_view3d_types.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -45,6 +46,9 @@
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_screen.h"
+
+/****************************** Camera Datablock *****************************/
void *add_camera(const char *name)
{
@@ -70,7 +74,9 @@ Camera *copy_camera(Camera *cam)
Camera *camn;
camn= copy_libblock(&cam->id);
-
+
+ id_lib_extern((ID *)camn->dof_ob);
+
return camn;
}
@@ -121,8 +127,26 @@ void make_local_camera(Camera *cam)
}
}
+void free_camera(Camera *ca)
+{
+ BKE_free_animdata((ID *)ca);
+}
+
+/******************************** Camera Usage *******************************/
+
+void object_camera_mode(RenderData *rd, Object *cam_ob)
+{
+ rd->mode &= ~(R_ORTHO|R_PANORAMA);
+
+ if(cam_ob && cam_ob->type==OB_CAMERA) {
+ Camera *cam= cam_ob->data;
+ if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
+ if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+ }
+}
+
/* get the camera's dof value, takes the dof object into account */
-float dof_camera(Object *ob)
+float object_camera_dof_distance(Object *ob)
{
Camera *cam = (Camera *)ob->data;
if (ob->type != OB_CAMERA)
@@ -136,180 +160,212 @@ float dof_camera(Object *ob)
normalize_m4(obmat);
invert_m4_m4(imat, obmat);
mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
- return (float)fabs(mat[3][2]);
+ return fabsf(mat[3][2]);
}
return cam->YF_dofdist;
}
-void free_camera(Camera *ca)
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
{
- BKE_free_animdata((ID *)ca);
+ /* sensor size used to fit to. for auto, sensor_x is both x and y. */
+ if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
+ return sensor_y;
+
+ return sensor_x;
}
-void object_camera_mode(RenderData *rd, Object *camera)
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
{
- rd->mode &= ~(R_ORTHO|R_PANORAMA);
- if(camera && camera->type==OB_CAMERA) {
- Camera *cam= camera->data;
- if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
- if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+ if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
+ if(sizex >= sizey)
+ return CAMERA_SENSOR_FIT_HOR;
+ else
+ return CAMERA_SENSOR_FIT_VERT;
}
+
+ return sensor_fit;
}
-void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
- float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit)
+/******************************** Camera Params *******************************/
+
+void camera_params_init(CameraParams *params)
{
- Camera *cam= NULL;
+ memset(params, 0, sizeof(CameraParams));
- (*shiftx)= 0.0f;
- (*shifty)= 0.0f;
+ /* defaults */
+ params->sensor_x= DEFAULT_SENSOR_WIDTH;
+ params->sensor_y= DEFAULT_SENSOR_HEIGHT;
+ params->sensor_fit= CAMERA_SENSOR_FIT_AUTO;
- (*sensor_x)= DEFAULT_SENSOR_WIDTH;
- (*sensor_y)= DEFAULT_SENSOR_HEIGHT;
- (*sensor_fit)= CAMERA_SENSOR_FIT_AUTO;
+ params->zoom= 1.0f;
+}
- if(camera->type==OB_CAMERA) {
- cam= camera->data;
+void camera_params_from_object(CameraParams *params, Object *ob)
+{
+ if(!ob)
+ return;
- if(cam->type == CAM_ORTHO) {
- *is_ortho= TRUE;
- }
+ if(ob->type==OB_CAMERA) {
+ /* camera object */
+ Camera *cam= ob->data;
- /* solve this too... all time depending stuff is in convertblender.c?
- * Need to update the camera early because it's used for projection matrices
- * and other stuff BEFORE the animation update loop is done
- * */
-#if 0 // XXX old animation system
- if(cam->ipo) {
- calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra));
- execute_ipo(&cam->id, cam->ipo);
- }
-#endif // XXX old animation system
- (*shiftx)=cam->shiftx;
- (*shifty)=cam->shifty;
- (*lens)= cam->lens;
- (*sensor_x)= cam->sensor_x;
- (*sensor_y)= cam->sensor_y;
- (*clipsta)= cam->clipsta;
- (*clipend)= cam->clipend;
- (*sensor_fit)= cam->sensor_fit;
+ if(cam->type == CAM_ORTHO)
+ params->is_ortho= TRUE;
+ params->lens= cam->lens;
+ params->ortho_scale= cam->ortho_scale;
+
+ params->shiftx= cam->shiftx;
+ params->shifty= cam->shifty;
+
+ params->sensor_x= cam->sensor_x;
+ params->sensor_y= cam->sensor_y;
+ params->sensor_fit= cam->sensor_fit;
+
+ params->clipsta= cam->clipsta;
+ params->clipend= cam->clipend;
}
- else if(camera->type==OB_LAMP) {
- Lamp *la= camera->data;
+ else if(ob->type==OB_LAMP) {
+ /* lamp object */
+ Lamp *la= ob->data;
float fac= cosf((float)M_PI*la->spotsize/360.0f);
float phi= acos(fac);
- (*lens)= 16.0f*fac/sinf(phi);
- if((*lens)==0.0f)
- (*lens)= 35.0f;
- (*clipsta)= la->clipsta;
- (*clipend)= la->clipend;
- }
- else { /* envmap exception... */;
- if((*lens)==0.0f) /* is this needed anymore? */
- (*lens)= 16.0f;
+ params->lens= 16.0f*fac/sinf(phi);
+ if(params->lens==0.0f)
+ params->lens= 35.0f;
- if((*clipsta)==0.0f || (*clipend)==0.0f) {
- (*clipsta)= 0.1f;
- (*clipend)= 1000.0f;
- }
+ params->clipsta= la->clipsta;
+ params->clipend= la->clipend;
}
-
- (*cam_r)= cam;
}
-/* 'lens' may be set for envmap only */
-void object_camera_matrix(
- RenderData *rd, Object *camera, int winx, int winy, short field_second,
- float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens,
- float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
- float *viewdx, float *viewdy)
+void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d)
{
- Camera *cam=NULL;
- float pixsize;
- float shiftx=0.0, shifty=0.0, winside, viewfac;
- short is_ortho= FALSE;
-
- /* question mark */
- (*ycor)= rd->yasp / rd->xasp;
- if(rd->mode & R_FIELDS)
- (*ycor) *= 2.0f;
-
- object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit);
-
- /* ortho only with camera available */
- if(cam && is_ortho) {
- if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
- if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx;
- else viewfac= (*ycor) * winy;
- }
- else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
- viewfac= winx;
- }
- else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
- viewfac= (*ycor) * winy;
- }
+ /* common */
+ params->lens= v3d->lens;
+ params->clipsta= v3d->near;
+ params->clipend= v3d->far;
+
+ if(rv3d->persp==RV3D_CAMOB) {
+ /* camera view */
+ camera_params_from_object(params, v3d->camera);
+
+ params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
+
+ params->offsetx= 2.0f*rv3d->camdx*params->zoom;
+ params->offsety= 2.0f*rv3d->camdy*params->zoom;
+
+ params->shiftx *= params->zoom;
+ params->shifty *= params->zoom;
- /* ortho_scale == 1.0 means exact 1 to 1 mapping */
- pixsize= cam->ortho_scale/viewfac;
+ params->zoom= 1.0f/params->zoom;
+ }
+ else if(rv3d->persp==RV3D_ORTHO) {
+ /* orthographic view */
+ params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality
+ params->clipsta= - params->clipend;
+
+ params->is_ortho= TRUE;
+ params->ortho_scale = rv3d->dist;
+ params->zoom= 2.0f;
}
else {
- if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
- if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx) / (*sensor_x);
- else viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x);
- }
- else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
- viewfac= ((*lens) * winx) / (*sensor_x);
- }
- else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
- viewfac= ((*lens) * winy) / (*sensor_y);
- }
-
- pixsize= (*clipsta) / viewfac;
+ /* perspective view */
+ params->zoom= 2.0f;
}
+}
- /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
- winside= MAX2(winx, winy);
-
- if(cam) {
- if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR)
- winside= winx;
- else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT)
- winside= winy;
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp)
+{
+ rctf viewplane;
+ float pixsize, viewfac, sensor_size, dx, dy;
+ int sensor_fit;
+
+ /* fields rendering */
+ params->ycor= yasp/xasp;
+ if(params->use_fields)
+ params->ycor *= 2.0f;
+
+ if(params->is_ortho) {
+ /* orthographic camera */
+ /* scale == 1.0 means exact 1 to 1 mapping */
+ pixsize= params->ortho_scale;
+ }
+ else {
+ /* perspective camera */
+ sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
+ pixsize= (sensor_size * params->clipsta)/params->lens;
}
- viewplane->xmin= -0.5f*(float)winx + shiftx*winside;
- viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside;
- viewplane->xmax= 0.5f*(float)winx + shiftx*winside;
- viewplane->ymax= 0.5f*(*ycor)*(float)winy + shifty*winside;
+ /* determine sensor fit */
+ sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
- if(field_second) {
- if(rd->mode & R_ODDFIELD) {
- viewplane->ymin-= 0.5f * (*ycor);
- viewplane->ymax-= 0.5f * (*ycor);
+ if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+ viewfac= winx;
+ else
+ viewfac= params->ycor * winy;
+
+ pixsize /= viewfac;
+
+ /* extra zoom factor */
+ pixsize *= params->zoom;
+
+ /* compute view plane:
+ * fully centered, zbuffer fills in jittered between -.5 and +.5 */
+ viewplane.xmin= -0.5f*(float)winx;
+ viewplane.ymin= -0.5f*params->ycor*(float)winy;
+ viewplane.xmax= 0.5f*(float)winx;
+ viewplane.ymax= 0.5f*params->ycor*(float)winy;
+
+ /* lens shift and offset */
+ dx= params->shiftx*viewfac + winx*params->offsetx;
+ dy= params->shifty*viewfac + winy*params->offsety;
+
+ viewplane.xmin += dx;
+ viewplane.ymin += dy;
+ viewplane.xmax += dx;
+ viewplane.ymax += dy;
+
+ /* fields offset */
+ if(params->field_second) {
+ if(params->field_odd) {
+ viewplane.ymin-= 0.5f * params->ycor;
+ viewplane.ymax-= 0.5f * params->ycor;
}
else {
- viewplane->ymin+= 0.5f * (*ycor);
- viewplane->ymax+= 0.5f * (*ycor);
+ viewplane.ymin+= 0.5f * params->ycor;
+ viewplane.ymax+= 0.5f * params->ycor;
}
}
+
/* the window matrix is used for clipping, and not changed during OSA steps */
/* using an offset of +0.5 here would give clip errors on edges */
- viewplane->xmin *= pixsize;
- viewplane->xmax *= pixsize;
- viewplane->ymin *= pixsize;
- viewplane->ymax *= pixsize;
+ viewplane.xmin *= pixsize;
+ viewplane.xmax *= pixsize;
+ viewplane.ymin *= pixsize;
+ viewplane.ymax *= pixsize;
+
+ params->viewdx= pixsize;
+ params->viewdy= params->ycor * pixsize;
+ params->viewplane= viewplane;
+}
- (*viewdx)= pixsize;
- (*viewdy)= (*ycor) * pixsize;
+/* viewplane is assumed to be already computed */
+void camera_params_compute_matrix(CameraParams *params)
+{
+ rctf viewplane= params->viewplane;
- if(is_ortho)
- orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
+ /* compute projection matrix */
+ if(params->is_ortho)
+ orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+ viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
else
- perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
-
+ perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+ viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
}
+/***************************** Camera View Frame *****************************/
+
void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
{
@@ -320,25 +376,16 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
if (scene) {
float aspx= (float) scene->r.xsch*scene->r.xasp;
float aspy= (float) scene->r.ysch*scene->r.yasp;
+ int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
- if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- if(aspx < aspy) {
- r_asp[0]= aspx / aspy;
- r_asp[1]= 1.0;
- }
- else {
- r_asp[0]= 1.0;
- r_asp[1]= aspy / aspx;
- }
+ if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ r_asp[0]= 1.0;
+ r_asp[1]= aspy / aspx;
}
- else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+ else {
r_asp[0]= aspx / aspy;
r_asp[1]= 1.0;
}
- else {
- r_asp[0]= 1.0;
- r_asp[1]= aspy / aspx;
- }
}
else {
r_asp[0]= 1.0f;
@@ -419,6 +466,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
}
/* dont move the camera, just yield the fit location */
+/* only valid for perspective cameras */
int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
{
float shift[2];
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 8c313cc84a1..3ff9b74ecc1 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3990,7 +3990,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
MovieTrackingMarker *marker;
float vec[3], disp[3], axis[3], mat[4][4];
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
- float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f;
+ float len, d;
where_is_object_mat(scene, camob, mat);
@@ -4008,23 +4008,20 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
len= len_v3(disp);
if (len > FLT_EPSILON) {
- float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f;
- short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO;
- Camera *cam= NULL;
+ CameraParams params;
+ float pos[2], rmat[4][4];
user.framenr= scene->r.cfra;
marker= BKE_tracking_get_marker(track, user.framenr);
add_v2_v2v2(pos, marker->pos, track->offset);
- object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit);
-
- if (is_ortho) {
- if (cam)
- ortho_scale= cam->ortho_scale;
-
- vec[0]= ortho_scale * (pos[0]-0.5f+shiftx);
- vec[1]= ortho_scale * (pos[1]-0.5f+shifty);
+ camera_params_init(&params);
+ camera_params_from_object(&params, camob);
+
+ if (params.is_ortho) {
+ vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx);
+ vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty);
vec[2]= -len;
if (aspect > 1.0f) vec[1] /= aspect;
@@ -4039,10 +4036,10 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
copy_v3_v3(cob->matrix[3], disp);
}
else {
- d= (len*sensor_x) / (2.0f*lens);
+ d= (len*params.sensor_x) / (2.0f*params.lens);
- vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f);
- vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f);
+ vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f);
+ vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f);
vec[2]= -len;
if (aspect > 1.0f) vec[1] /= aspect;
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 4bb9dc47fda..d01e3de0796 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1707,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
* - len2 = length of handle of end key
*/
len= v4[0]- v1[0];
- len1= (float)fabs(h1[0]);
- len2= (float)fabs(h2[0]);
+ len1= fabsf(h1[0]);
+ len2= fabsf(h2[0]);
/* if the handles have no length, no need to do any corrections */
if ((len1+len2) == 0.0f)
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index d8628e526ef..3e3f16dcfa3 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
- size= (float)fabs( vec[0] );
+ size= fabsf( vec[0] );
if( size > totsize ) totsize= size;
- size= (float)fabs( vec[1] );
+ size= fabsf( vec[1] );
if( size > totsize ) totsize= size;
- size= (float)fabs( vec[2] );
+ size= fabsf( vec[2] );
if( size > totsize ) totsize= size;
vec[0]= mainb[a]->x - mainb[a]->rad;
@@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
- size= (float)fabs( vec[0] );
+ size= fabsf( vec[0] );
if( size > totsize ) totsize= size;
- size= (float)fabs( vec[1] );
+ size= fabsf( vec[1] );
if( size > totsize ) totsize= size;
- size= (float)fabs( vec[2] );
+ size= fabsf( vec[2] );
if( size > totsize ) totsize= size;
}
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 8a908097862..fd184b9def4 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* scaling */
if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
- scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */
+ scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
/* length of referenced action */
actlength = strip->actend - strip->actstart;
@@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
{
const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
- const float boundsLen= (float)fabs(max - min);
+ const float boundsLen= fabsf(max - min);
/* sanity checks */
if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c0c19b2604e..d0e34ab371c 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1900,13 +1900,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
}
}
-// XXX what the hell is this?
-static int no_parent_ipo=0;
-void set_no_parent_ipo(int val)
-{
- no_parent_ipo= val;
-}
-
static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
{
float *fp1, *fp2;
@@ -1914,7 +1907,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
int a;
// include framerate
- fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) );
+ fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
if(fac1 >= 1.0f) return 0;
fac2= 1.0f-fac1;
@@ -1946,7 +1939,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
/* hurms, code below conflicts with depgraph... (ton) */
/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
- if(no_parent_ipo==0 && stime != par->ctime) {
+ if(stime != par->ctime) {
// only for ipo systems?
Object tmp= *par;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 59fdf403f0f..49e6d598ea2 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1285,8 +1285,10 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
MovieTrackingTrack *track;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
MovieReconstructedCamera *reconstructed;
- float origin[3]= {0.0f, 0.0f, 0.0f};
int ok= 1;
+ float imat[4][4];
+
+ unit_m4(imat);
track= tracking->tracks.first;
while(track) {
@@ -1354,12 +1356,13 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
mat[i][j]= matd[i][j];
if(!origin_set) {
- copy_v3_v3(origin, mat[3]);
+ copy_m4_m4(imat, mat);
+ invert_m4(imat);
origin_set= 1;
}
if(origin_set)
- sub_v3_v3(mat[3], origin);
+ mul_m4_m4m4(mat, mat, imat);
copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
reconstructed[reconstruction->camnr].framenr= a;
@@ -1380,7 +1383,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
track= tracking->tracks.first;
while(track) {
if(track->flag&TRACK_HAS_BUNDLE)
- sub_v3_v3(track->bundle_pos, origin);
+ mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
track= track->next;
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index fa041158c90..eecaed10bcc 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
int a, px=0, py=1;
/* first: find dominant axis: 0==X, 1==Y, 2==Z */
- x= (float)fabs(normal[0]);
- y= (float)fabs(normal[1]);
- z= (float)fabs(normal[2]);
+ x= fabsf(normal[0]);
+ y= fabsf(normal[1]);
+ z= fabsf(normal[2]);
max = MAX3(x, y, z);
if(max==y) py=2;
else if(max==x) {
@@ -1689,9 +1689,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float
/* find best projection of face XY, XZ or YZ: barycentric weights of
the 2d projected coords are the same and faster to compute */
- xn= (float)fabs(n[0]);
- yn= (float)fabs(n[1]);
- zn= (float)fabs(n[2]);
+ xn= fabsf(n[0]);
+ yn= fabsf(n[1]);
+ zn= fabsf(n[2]);
if(zn>=xn && zn>=yn) {i= 0; j= 1;}
else if(yn>=xn && yn>=zn) {i= 0; j= 2;}
else {i= 1; j= 2;}
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 1637cd16161..e4664798f5d 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma
compatible_eul(eul1, oldrot);
compatible_eul(eul2, oldrot);
- d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]);
- d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]);
+ d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]);
+ d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]);
/* return best, which is just the one with lowest difference */
if (d1 > d2)
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 081d604819d..def6cd61370 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -794,7 +794,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
* deal with the camera border, otherwise map the coords to the camera border. */
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
rctf rectf;
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */
BLI_copy_rcti_rctf(&rect, &rectf);
}
else {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 65db5e27ed7..9a492153b7f 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -468,7 +468,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene= CTX_data_scene(C);
- ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, TRUE); /* no shift */
return 1;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 2dd8ef4da94..f09797bf6f1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1258,7 +1258,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */
+ ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, TRUE); /* no shift */
p->subrect= &p->subrect_data;
}
}
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 37f647abfd9..2ca3e2bfe7f 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -183,10 +183,10 @@ typedef enum SnapMode
#define SNAP_MIN_DISTANCE 30
-int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]);
-int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]);
-int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
-int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
+int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
+int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
+int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
+int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
#endif
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 51e0e25f545..07fc4e77ac1 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -209,13 +209,13 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]);
void project_float(struct ARegion *ar, const float vec[3], float adr[2]);
void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
-void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend);
int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
-int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend);
void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
+void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift);
void ED_view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
-void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
+void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
/* drawobject.c iterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);
@@ -294,6 +294,7 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
/* copy the view to the camera, return TRUE if */
int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
-struct BGpic *ED_view3D_background_image_add(struct View3D *v3d);
+struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
+void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
#endif /* ED_VIEW3D_H */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 4b1371c532c..37a057303e9 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -318,6 +318,9 @@ void UI_ThemeClearColor(int colorid);
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
+// get current theme
+struct bTheme *UI_GetTheme(void);
+
/* only for buttons in theme editor! */
const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index b34b56f31ed..4b7adbc1064 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2618,11 +2618,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
else
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
- if(value == item[i].value) {
+ if(value == item[i].value)
icon= item[i].icon;
- if(!tip)
- tip= item[i].description;
- }
}
str= BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 089458f1da4..1b7308d328e 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -506,7 +506,7 @@ static void init_brush_icons(void)
static void init_internal_icons(void)
{
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
ImBuf *bbuf= NULL;
int x, y, icontype;
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
@@ -950,6 +950,7 @@ static int get_draw_size(enum eIconSizes size)
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
{
+ bTheme *btheme= UI_GetTheme();
Icon *icon = NULL;
DrawInfo *di = NULL;
IconImage *iimg;
@@ -957,6 +958,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
int w, h;
icon = BKE_icon_get(icon_id);
+ alpha *= btheme->tui.icon_alpha;
if (icon==NULL) {
if (G.f & G_DEBUG)
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 16e0153b910..d6460f9046e 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -112,7 +112,7 @@ typedef enum {
/* internal panel drawing defines */
#define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */
-#define PNL_HEADER UI_UNIT_Y /* 20 default */
+#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */
/* panel->flag */
#define PNL_SELECT 1
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index aa80cb632ec..ad79e550575 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -59,6 +59,7 @@
#include "ED_screen.h"
#include "UI_interface.h"
+#include "UI_resources.h"
#include "interface_intern.h"
@@ -173,7 +174,6 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
{
- uiStyle *style= UI_GetStyle();
Panel *pa, *patab, *palast, *panext;
char *drawname= pt->label;
char *idname= pt->idname;
@@ -208,7 +208,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
}
pa->ofsx= 0;
- pa->ofsy= style->panelouter;
+ pa->ofsy= 0;
pa->sizex= 0;
pa->sizey= 0;
pa->runtime_flag |= PNL_NEW_ADDED;
@@ -482,6 +482,7 @@ static void rectf_scale(rctf *rect, float scale)
/* panel integrated in buttonswindow, tool/property lists etc */
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
{
+ bTheme *btheme= UI_GetTheme();
Panel *panel= block->panel;
rcti headrect;
rctf itemrect;
@@ -493,19 +494,37 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* calculate header rect */
/* + 0.001f to prevent flicker due to float inaccuracy */
headrect= *rect;
- headrect.ymin= headrect.ymax;
+ headrect.ymin= headrect.ymax - 2.0f/block->aspect;
headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
- if(!(panel->runtime_flag & PNL_FIRST)) {
- float minx= rect->xmin+5.0f/block->aspect;
- float maxx= rect->xmax-5.0f/block->aspect;
+ {
+ float minx= rect->xmin;
+ float maxx= rect->xmax;
float y= headrect.ymax;
-
+
glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- fdrawline(minx, y+1, maxx, y+1);
- glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
- fdrawline(minx, y, maxx, y);
+
+ if(btheme->tui.panel.show_header) {
+ /* draw with background color */
+ glEnable(GL_BLEND);
+ glColor4ubv((unsigned char*)btheme->tui.panel.header);
+ glRectf(minx, headrect.ymin, maxx, y);
+
+ fdrawline(minx, y, maxx, y);
+ fdrawline(minx, y, maxx, y);
+ }
+ else if(!(panel->runtime_flag & PNL_FIRST)) {
+ /* draw embossed separator */
+ minx += 5.0f/block->aspect;
+ maxx -= 5.0f/block->aspect;
+
+ glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
+ fdrawline(minx, y+1, maxx, y+1);
+ glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
+ fdrawline(minx, y, maxx, y);
+ glDisable(GL_BLEND);
+ }
+
glDisable(GL_BLEND);
}
@@ -518,7 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
- rectf_scale(&itemrect, 0.8f);
+
+ rectf_scale(&itemrect, 0.7f);
ui_draw_panel_dragwidget(&itemrect);
}
@@ -538,7 +558,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* in some occasions, draw a border */
if(panel->flag & PNL_SELECT) {
if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
- else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
+ else uiSetRoundBox(UI_CNR_NONE);
UI_ThemeColorShade(TH_BACK, -120);
uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
@@ -567,7 +587,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
itemrect.ymin= headrect.ymin;
itemrect.ymax= headrect.ymax;
- rectf_scale(&itemrect, 0.5f);
+ rectf_scale(&itemrect, 0.35f);
if(panel->flag & PNL_CLOSEDY)
ui_draw_tria_rect(&itemrect, 'h');
@@ -589,12 +609,12 @@ static int get_panel_header(Panel *pa)
return PNL_HEADER;
}
-static int get_panel_size_y(uiStyle *style, Panel *pa)
+static int get_panel_size_y(Panel *pa)
{
if(pa->type && (pa->type->flag & PNL_NO_HEADER))
return pa->sizey;
- return PNL_HEADER + pa->sizey + style->panelouter;
+ return PNL_HEADER + pa->sizey;
}
/* this function is needed because uiBlock and Panel itself dont
@@ -667,7 +687,6 @@ static int compare_panel(const void *a1, const void *a2)
/* returns 1 when it did something */
static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
{
- uiStyle *style= UI_GetStyle();
Panel *pa;
PanelSort *ps, *panelsort, *psnext;
int a, tot=0, done;
@@ -719,18 +738,18 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
ps= panelsort;
ps->pa->ofsx= 0;
- ps->pa->ofsy= -get_panel_size_y(style, ps->pa);
+ ps->pa->ofsy= -get_panel_size_y(ps->pa);
for(a=0; a<tot-1; a++, ps++) {
psnext= ps+1;
if(align==BUT_VERTICAL) {
psnext->pa->ofsx= ps->pa->ofsx;
- psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(style, psnext->pa);
+ psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
}
else {
psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
- psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(style, ps->pa) - get_panel_size_y(style, psnext->pa);
+ psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
}
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 513f084b6e8..47dde3f03f0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -376,17 +376,18 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
data->totline++;
}
- if(but->type == ROW) {
+ if(ELEM(but->type, ROW, MENU)) {
EnumPropertyItem *item;
int i, totitem, free;
+ int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but);
RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
- if(item[i].identifier[0] && item[i].value == (int)but->hardmax) {
+ if(item[i].identifier[0] && item[i].value == value) {
if(item[i].description[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description);
- data->color[data->totline]= 0xFFFFFF;
+ data->color[data->totline]= 0xDDDDDD;
data->totline++;
}
break;
@@ -1446,6 +1447,8 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
void ui_popup_block_scrolltest(uiBlock *block)
{
uiBut *bt;
+ /* Knowing direction is necessary for multi-column menus... */
+ int is_flip = (block->direction & UI_TOP) && !(block->flag & UI_BLOCK_NO_FLIP);
block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP);
@@ -1462,9 +1465,9 @@ void ui_popup_block_scrolltest(uiBlock *block)
block->flag |= UI_BLOCK_CLIPBOTTOM;
/* make space for arrow */
if(bt->y2 < block->miny +10) {
- if(bt->next && bt->next->y1 > bt->y1)
+ if(is_flip && bt->next && bt->next->y1 > bt->y1)
bt->next->flag |= UI_SCROLLED;
- if(bt->prev && bt->prev->y1 > bt->y1)
+ else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1)
bt->prev->flag |= UI_SCROLLED;
}
}
@@ -1473,9 +1476,9 @@ void ui_popup_block_scrolltest(uiBlock *block)
block->flag |= UI_BLOCK_CLIPTOP;
/* make space for arrow */
if(bt->y1 > block->maxy -10) {
- if(bt->next && bt->next->y2 < bt->y2)
+ if(!is_flip && bt->next && bt->next->y2 < bt->y2)
bt->next->flag |= UI_SCROLLED;
- if(bt->prev && bt->prev->y2 < bt->y2)
+ else if(is_flip && bt->prev && bt->prev->y2 < bt->y2)
bt->prev->flag |= UI_SCROLLED;
}
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 0e9dbaf3022..3caafe308d0 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -124,7 +124,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id
style->buttonspacex= 8;
style->buttonspacey= 2;
style->panelspace= 8;
- style->panelouter= 4;
return style;
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c9fcb7f1d24..9a438070e1e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1617,7 +1617,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
if(state & UI_SELECT)
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
else {
- bTheme *btheme= U.themes.first; /* XXX */
+ bTheme *btheme= UI_GetTheme(); /* XXX */
copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text);
}
@@ -2760,7 +2760,7 @@ static void widget_disabled(rcti *rect)
static uiWidgetType *widget_type(uiWidgetTypeEnum type)
{
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
static uiWidgetType wt;
/* defaults */
@@ -2945,7 +2945,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
/* conversion from old to new buttons, so still messy */
void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
{
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
ThemeUI *tui= &btheme->tui;
uiFontStyle *fstyle= &style->widget;
uiWidgetType *wt= NULL;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 738531e3bad..66add6d8f0c 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -839,6 +839,11 @@ void UI_SetTheme(int spacetype, int regionid)
}
}
+bTheme *UI_GetTheme()
+{
+ return U.themes.first;
+}
+
// for space windows only
void UI_ThemeColor(int colorid)
{
@@ -1668,6 +1673,15 @@ void init_userdef_do_versions(void)
}
}
+ if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
+ bTheme *btheme;
+
+ for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
+ btheme->tui.icon_alpha= 1.0;
+ }
+ }
+
/* GL Texture Garbage Collection (variable abused above!) */
if (U.textimeout == 0) {
U.texcollectrate = 60;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 5e97e01aed6..c2c482b0a2c 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1558,7 +1558,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
if (scroll & V2D_SCROLL_HORIZONTAL) {
/* only draw scrollbar when it doesn't fill the entire space */
if(vs->horfull==0) {
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
int state;
@@ -1669,7 +1669,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
if (scroll & V2D_SCROLL_VERTICAL) {
/* only draw scrollbar when it doesn't fill the entire space */
if(vs->vertfull==0) {
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
rcti slider;
int state;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 998e70d5e25..5706da93fe9 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -985,12 +985,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
/* x-axis transform */
dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f;
- dx= 1.0f - ((float)fabs(vzd->lastx - dist) + 2.0f) / ((float)fabs(event->x - dist) + 2.0f);
+ dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
/* y-axis transform */
dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f;
- dy= 1.0f - ((float)fabs(vzd->lasty - dist) + 2.0f) / ((float)fabs(event->y - dist) + 2.0f);
+ dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
}
else {
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index fa764e6eefc..843918e9173 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -147,7 +147,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rctf viewplane;
float clipsta, clipend;
- int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
+ int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 6a93e39a662..4a06ee6d0ae 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -175,6 +175,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
dx= copysign(ceil(0.3f*fabs(dx)), dx);
dy= copysign(ceil(0.3f*fabs(dy)), dy);
+ glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glColor4ub(255, 255, 255, 180);
@@ -192,6 +193,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_BLEND);
}
static void region_draw_azone_icon(AZone *az)
@@ -228,6 +230,49 @@ static void region_draw_azone_icon(AZone *az)
sdrawline(midx-2, midy, midx+3, midy);
}
+static void draw_azone_plus(float x1, float y1, float x2, float y2)
+{
+ float width = 2.0f;
+ float pad = 4.0f;
+
+ glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad);
+ glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f);
+ glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f);
+}
+
+static void region_draw_azone_tab_plus(AZone *az)
+{
+ extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
+
+ glEnable(GL_BLEND);
+
+ /* add code to draw region hidden as 'too small' */
+ switch(az->edge) {
+ case AE_TOP_TO_BOTTOMRIGHT:
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
+ break;
+ case AE_BOTTOM_TO_TOPLEFT:
+ uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
+ break;
+ case AE_LEFT_TO_TOPRIGHT:
+ uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
+ break;
+ case AE_RIGHT_TO_TOPLEFT:
+ uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
+ break;
+ }
+
+ glColor4f(0.05f, 0.05f, 0.05f, 0.5f);
+ uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+
+ glEnable(GL_BLEND);
+
+ glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
+ draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2);
+
+ glDisable(GL_BLEND);
+}
+
static void region_draw_azone_tab(AZone *az)
{
float col[3];
@@ -326,13 +371,14 @@ void ED_area_overdraw(bContext *C)
if(az->ar) {
/* only display tab or icons when the region is hidden */
if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-
- if(G.rt==2)
+ if(G.rt==3)
+ region_draw_azone_icon(az);
+ else if(G.rt==2)
region_draw_azone_tria(az);
else if(G.rt==1)
region_draw_azone_tab(az);
else
- region_draw_azone_icon(az);
+ region_draw_azone_tab_plus(az);
}
}
}
@@ -665,6 +711,51 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
}
}
+#define AZONEPAD_TAB_PLUSW 16
+#define AZONEPAD_TAB_PLUSH 16
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
+{
+ AZone *azt;
+ int tot= 0, add;
+
+ for(azt= sa->actionzones.first; azt; azt= azt->next) {
+ if(azt->edge == az->edge) tot++;
+ }
+
+ switch(az->edge) {
+ case AE_TOP_TO_BOTTOMRIGHT:
+ if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+ az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
+ az->y1= ar->winrct.ymax - add;
+ az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
+ az->y2= ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
+ break;
+ case AE_BOTTOM_TO_TOPLEFT:
+ az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
+ az->y1= ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
+ az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
+ az->y2= ar->winrct.ymin;
+ break;
+ case AE_LEFT_TO_TOPRIGHT:
+ az->x1= ar->winrct.xmin + 1 - AZONEPAD_TAB_PLUSH;
+ az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
+ az->x2= ar->winrct.xmin + 1;
+ az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+ break;
+ case AE_RIGHT_TO_TOPLEFT:
+ az->x1= ar->winrct.xmax - 1;
+ az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
+ az->x2= ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
+ az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+ break;
+ }
+ /* rect needed for mouse pointer test */
+ BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}
+
+
#define AZONEPAD_TABW 18
#define AZONEPAD_TABH 7
@@ -766,12 +857,14 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
az->edge= edge;
if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
- if(G.rt==2)
+ if(G.rt==3)
+ region_azone_icon(sa, az, ar);
+ else if(G.rt==2)
region_azone_tria(sa, az, ar);
else if(G.rt==1)
region_azone_tab(sa, az, ar);
else
- region_azone_icon(sa, az, ar);
+ region_azone_tab_plus(sa, az, ar);
} else {
region_azone_edge(az, ar);
}
@@ -1481,7 +1574,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
}
x= 0;
- y= -style->panelouter;
+ y= 0;
/* create panels */
uiBeginPanels(C, ar);
@@ -1553,11 +1646,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
if(pt->flag & PNL_NO_HEADER)
y += yco;
else
- y += yco-style->panelouter;
+ y += yco;
}
else {
x += w;
- miny= MIN2(y, yco-style->panelouter-header);
+ miny= MIN2(y, yco-header);
}
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c0d4b9106e6..7ae5f433ff3 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3060,25 +3060,24 @@ static void project_paint_begin(ProjPaintState *ps)
invert_m4_m4(viewinv, viewmat);
}
else if (ps->source==PROJ_SRC_IMAGE_CAM) {
- Object *camera= ps->scene->camera;
-
- /* dont actually use these */
- float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
- short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
- rctf _viewplane;
+ Object *cam_ob= ps->scene->camera;
+ CameraParams params;
/* viewmat & viewinv */
- copy_m4_m4(viewinv, ps->scene->camera->obmat);
+ copy_m4_m4(viewinv, cam_ob->obmat);
normalize_m4(viewinv);
invert_m4_m4(viewmat, viewinv);
- /* camera winmat */
- object_camera_mode(&ps->scene->r, camera);
- object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0,
- winmat, &_viewplane, &ps->clipsta, &ps->clipend,
- &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy);
+ /* window matrix, clipping and ortho */
+ camera_params_init(&params);
+ camera_params_from_object(&params, cam_ob);
+ camera_params_compute_viewplane(&params, ps->winx, ps->winy, 1.0f, 1.0f);
+ camera_params_compute_matrix(&params);
- ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0;
+ copy_m4_m4(winmat, params.winmat);
+ ps->clipsta= params.clipsta;
+ ps->clipend= params.clipend;
+ ps->is_ortho= params.is_ortho;
}
/* same as view3d_get_object_project_mat */
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index d59d947f0c8..2465d42bbf1 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1179,7 +1179,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
{
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
uiWidgetColors wcol= btheme->tui.wcol_scroll;
unsigned char col[4];
float rad;
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index bbc72500df4..17cb1ce2995 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -115,7 +115,7 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
* color set (based on the theme colors for 3d-view) is used.
*/
if (color_index > 0) {
- bTheme *btheme= U.themes.first;
+ bTheme *btheme= UI_GetTheme();
bcolor= &btheme->tarm[(color_index - 1)];
}
else if (color_index == -1) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 44bacd7a20e..959e267f50e 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1696,7 +1696,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
if(cam->flag & CAM_SHOWLIMITS) {
draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
/* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */
- draw_focus_cross(dof_camera(ob), cam->drawsize);
+ draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize);
}
wrld= scene->world;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 7ce758d4f47..7dae02aba39 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -923,75 +923,48 @@ static void draw_selected_name(Scene *scene, Object *ob)
BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1);
}
-void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2])
+static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift, short no_zoom)
{
- float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
- short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-
- if(camob && camob->type==OB_CAMERA) {
- Camera *cam= (Camera *)camob->data;
- sensor_fit= cam->sensor_fit;
- }
+ CameraParams params;
+ rctf rect_view, rect_camera;
+
+ /* get viewport viewplane */
+ camera_params_init(&params);
+ camera_params_from_view3d(&params, v3d, rv3d);
+ if(no_zoom)
+ params.zoom= 1.0f;
+ camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
+ rect_view= params.viewplane;
+
+ /* get camera viewplane */
+ camera_params_init(&params);
+ camera_params_from_object(&params, v3d->camera);
+ if(no_shift) {
+ params.shiftx= 0.0f;
+ params.shifty= 0.0f;
+ }
+ camera_params_compute_viewplane(&params, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp);
+ rect_camera= params.viewplane;
+
+ /* get camera border within viewport */
+ viewborder_r->xmin= ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+ viewborder_r->xmax= ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+ viewborder_r->ymin= ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+ viewborder_r->ymax= ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+}
- if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- float winmax= MAX2(ar->winx, ar->winy);
+void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
+{
+ rctf viewborder;
- if(aspect > 1.0f) {
- size_r[0]= winmax;
- size_r[1]= winmax/aspect;
- } else {
- size_r[0]= winmax*aspect;
- size_r[1]= winmax;
- }
- }
- else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
- size_r[0]= ar->winx;
- size_r[1]= ar->winx/aspect;
- }
- else {
- size_r[0]= ar->winy*aspect;
- size_r[1]= ar->winy;
- }
+ view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
+ size_r[0]= viewborder.xmax - viewborder.xmin;
+ size_r[1]= viewborder.ymax - viewborder.ymin;
}
-void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift)
+void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift)
{
- const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
- float size[2];
- float dx= 0.0f, dy= 0.0f;
-
- view3d_viewborder_size_get(scene, v3d->camera, ar, size);
-
- size[0]= size[0]*zoomfac;
- size[1]= size[1]*zoomfac;
-
- /* center in window */
- viewborder_r->xmin= 0.5f * ar->winx - 0.5f * size[0];
- viewborder_r->ymin= 0.5f * ar->winy - 0.5f * size[1];
- viewborder_r->xmax= viewborder_r->xmin + size[0];
- viewborder_r->ymax= viewborder_r->ymin + size[1];
-
- dx= ar->winx*rv3d->camdx*zoomfac*2.0f;
- dy= ar->winy*rv3d->camdy*zoomfac*2.0f;
-
- /* apply offset */
- viewborder_r->xmin-= dx;
- viewborder_r->ymin-= dy;
- viewborder_r->xmax-= dx;
- viewborder_r->ymax-= dy;
-
- if(do_shift && v3d->camera && v3d->camera->type==OB_CAMERA) {
- Camera *cam= v3d->camera->data;
- float w = viewborder_r->xmax - viewborder_r->xmin;
- float h = viewborder_r->ymax - viewborder_r->ymin;
- float side = MAX2(w, h);
-
- if(do_shift == -1) side *= -1;
- viewborder_r->xmin+= cam->shiftx*side;
- viewborder_r->xmax+= cam->shiftx*side;
- viewborder_r->ymin+= cam->shifty*side;
- viewborder_r->ymax+= cam->shifty*side;
- }
+ view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, FALSE);
}
static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac)
@@ -1228,19 +1201,39 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
}
if (ca && (ca->flag & CAM_SHOWSENSOR)) {
- /* assume fixed sensor width for now */
-
- /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */
- float sensor_scale = (x2i-x1i) / ca->sensor_x;
- float sensor_height = sensor_scale * ca->sensor_y;
+ /* determine sensor fit, and get sensor x/y, for auto fit we
+ assume and square sensor and only use sensor_x */
+ float sizex= scene->r.xsch*scene->r.xasp;
+ float sizey= scene->r.ysch*scene->r.yasp;
+ int sensor_fit = camera_sensor_fit(ca->sensor_fit, sizex, sizey);
+ float sensor_x= ca->sensor_x;
+ float sensor_y= (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO)? ca->sensor_x: ca->sensor_y;
+
+ /* determine sensor plane */
+ rctf rect;
+
+ if(sensor_fit == CAMERA_SENSOR_FIT_HOR) {
+ float sensor_scale = (x2i-x1i) / sensor_x;
+ float sensor_height = sensor_scale * sensor_y;
+
+ rect.xmin= x1i;
+ rect.xmax= x2i;
+ rect.ymin= (y1i + y2i)*0.5f - sensor_height*0.5f;
+ rect.ymax= rect.ymin + sensor_height;
+ }
+ else {
+ float sensor_scale = (y2i-y1i) / sensor_y;
+ float sensor_width = sensor_scale * sensor_x;
- float ymid = y1i + (y2i-y1i)/2.f;
- float sy1= ymid - sensor_height/2.f;
- float sy2= ymid + sensor_height/2.f;
+ rect.xmin= (x1i + x2i)*0.5f - sensor_width*0.5f;
+ rect.xmax= rect.xmin + sensor_width;
+ rect.ymin= y1i;
+ rect.ymax= y2i;
+ }
+ /* draw */
UI_ThemeColorShade(TH_WIRE, 100);
-
- uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f);
+ uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f);
}
}
@@ -2485,15 +2478,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
/* render 3d view */
if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
- float winmat[4][4];
- float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
- short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
- rctf _viewplane;
+ CameraParams params;
- object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens,
- &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
+ camera_params_init(&params);
+ camera_params_from_object(&params, v3d->camera);
+ camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
+ camera_params_compute_matrix(&params);
- ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
+ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat);
}
else {
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, NULL);
@@ -2546,10 +2538,17 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w
invert_m4_m4(rv3d.viewmat, rv3d.viewinv);
{
- float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
- short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
- rctf _viewplane;
- object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
+ CameraParams params;
+
+ camera_params_init(&params);
+ camera_params_from_object(&params, v3d.camera);
+ camera_params_compute_viewplane(&params, width, height, scene->r.xasp, scene->r.yasp);
+ camera_params_compute_matrix(&params);
+
+ copy_m4_m4(rv3d.winmat, params.winmat);
+ v3d.near= params.clipsta;
+ v3d.far= params.clipend;
+ v3d.lens= params.lens;
}
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 7eaa5d42dd0..32e162fd09c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -47,6 +47,7 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_library.h"
@@ -2265,7 +2266,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
rv3d->camdx= rv3d->camdy= 0.0f;
- view3d_viewborder_size_get(scene, v3d->camera, ar, size);
+ ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
/* 4px is just a little room from the edge of the area */
xfac= (float)ar->winx / (float)(size[0] + 4);
@@ -2533,7 +2534,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
float size[2];
int im_width= (scene->r.size*scene->r.xsch)/100;
- view3d_viewborder_size_get(scene, v3d->camera, ar, size);
+ ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
@@ -2944,7 +2945,7 @@ static BGpic *background_image_add(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
- return ED_view3D_background_image_add(v3d);
+ return ED_view3D_background_image_new(v3d);
}
static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3014,16 +3015,13 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
/* ***** remove image operator ******* */
static int background_image_remove_exec(bContext *C, wmOperator *op)
{
- View3D *vd = CTX_wm_view3d(C);
+ View3D *v3d = CTX_wm_view3d(C);
int index = RNA_int_get(op->ptr, "index");
- BGpic *bgpic_rem= BLI_findlink(&vd->bgpicbase, index);
+ BGpic *bgpic_rem= BLI_findlink(&v3d->bgpicbase, index);
if(bgpic_rem) {
- BLI_remlink(&vd->bgpicbase, bgpic_rem);
- if(bgpic_rem->ima) id_us_min(&bgpic_rem->ima->id);
- if(bgpic_rem->clip) id_us_min(&bgpic_rem->clip->id);
- MEM_freeN(bgpic_rem);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, vd);
+ ED_view3D_background_image_remove(v3d, bgpic_rem);
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
}
else {
@@ -3516,8 +3514,12 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
{
ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
- if (lens) {
- ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL);
+ if(lens) {
+ CameraParams params;
+
+ camera_params_init(&params);
+ camera_params_from_object(&params, ob);
+ *lens= params.lens;
}
}
@@ -3529,7 +3531,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co
object_apply_mat4(ob, mat, TRUE, TRUE);
}
-BGpic *ED_view3D_background_image_add(View3D *v3d)
+BGpic *ED_view3D_background_image_new(View3D *v3d)
{
BGpic *bgpic= MEM_callocN(sizeof(BGpic), "Background Image");
@@ -3538,8 +3540,22 @@ BGpic *ED_view3D_background_image_add(View3D *v3d)
bgpic->iuser.fie_ima= 2;
bgpic->iuser.ok= 1;
bgpic->view= 0; /* 0 for all */
+ bgpic->flag |= V3D_BGPIC_EXPANDED;
BLI_addtail(&v3d->bgpicbase, bgpic);
return bgpic;
}
+
+void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic)
+{
+ BLI_remlink(&v3d->bgpicbase, bgpic);
+
+ if(bgpic->ima)
+ id_us_min(&bgpic->ima->id);
+
+ if(bgpic->clip)
+ id_us_min(&bgpic->clip->id);
+
+ MEM_freeN(bgpic);
+}
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 775cb45066a..42f58ba26f7 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -140,7 +140,6 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void view3d_clr_clipping(void);
void view3d_set_clipping(RegionView3D *rv3d);
void add_view3d_after(ListBase *lb, Base *base, int flag);
-void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 1b4b26aeaaa..1a5e86aee71 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -104,31 +104,6 @@ float *give_cursor(Scene *scene, View3D *v3d)
}
-/* Gets the lens and clipping values from a camera of lamp type object */
-void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend)
-{
- if(ob->type==OB_LAMP ) {
- Lamp *la = ob->data;
- if (lens) {
- float x1, fac;
- fac= cosf((float)M_PI*la->spotsize/360.0f);
- x1= saacos(fac);
- *lens= 16.0f*fac/sinf(x1);
- }
- if (clipsta) *clipsta= la->clipsta;
- if (clipend) *clipend= la->clipend;
- }
- else if(ob->type==OB_CAMERA) {
- Camera *cam= ob->data;
- if (lens) *lens= cam->lens;
- if (clipsta) *clipsta= cam->clipsta;
- if (clipend) *clipend= cam->clipend;
- }
- else {
- if (lens) *lens= 35.0f;
- }
-}
-
/* ****************** smooth view operator ****************** */
/* This operator is one of the 'timer refresh' ones like animation playback */
@@ -367,7 +342,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
/* ****************** change view operators ****************** */
-static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
+static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -394,7 +369,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
}
-static int view3d_setcameratoview_poll(bContext *C)
+static int view3d_camera_to_view_poll(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
@@ -415,8 +390,8 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
ot->idname= "VIEW3D_OT_camera_to_view";
/* api callbacks */
- ot->exec= view3d_setcameratoview_exec;
- ot->poll= view3d_setcameratoview_poll;
+ ot->exec= view3d_camera_to_view_exec;
+ ot->poll= view3d_camera_to_view_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -456,6 +431,24 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
}
}
+static int view3d_camera_to_view_selected_poll(bContext *C)
+{
+ View3D *v3d= CTX_wm_view3d(C);
+ if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ if(rv3d) {
+ if (rv3d->is_persp == FALSE) {
+ CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
+ }
+ else if (!rv3d->viewlock) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
{
/* identifiers */
@@ -465,7 +458,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
/* api callbacks */
ot->exec= view3d_camera_to_view_selected_exec;
- // ot->poll= view3d_setcameratoview_poll;
+ ot->poll= view3d_camera_to_view_selected_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -983,202 +976,31 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
/* copies logic of get_view3d_viewplane(), keep in sync */
int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
{
- int orth= 0;
+ CameraParams params;
- *clipsta= v3d->near;
- *clipend= v3d->far;
+ camera_params_init(&params);
+ camera_params_from_view3d(&params, v3d, rv3d);
- if(rv3d->persp==RV3D_CAMOB) {
- if(v3d->camera) {
- if(v3d->camera->type==OB_LAMP ) {
- Lamp *la= v3d->camera->data;
- *clipsta= la->clipsta;
- *clipend= la->clipend;
- }
- else if(v3d->camera->type==OB_CAMERA) {
- Camera *cam= v3d->camera->data;
- *clipsta= cam->clipsta;
- *clipend= cam->clipend;
-
- if(cam->type==CAM_ORTHO)
- orth= 1;
- }
- }
- }
-
- if(rv3d->persp==RV3D_ORTHO) {
- *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
- *clipsta= - *clipend;
- orth= 1;
- }
+ if(clipsta) *clipsta= params.clipsta;
+ if(clipend) *clipend= params.clipend;
- return orth;
+ return params.is_ortho;
}
/* also exposed in previewrender.c */
-int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
+int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, rctf *viewplane, float *clipsta, float *clipend)
{
- Camera *cam=NULL;
- float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2;
- float winx= (float)winxi, winy= (float)winyi;
- int orth= 0;
- short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-
- /* currnetly using sensor size (depends on fov calculating method) */
- float sensor= DEFAULT_SENSOR_WIDTH;
-
- lens= v3d->lens;
-
- *clipsta= v3d->near;
- *clipend= v3d->far;
-
- if(rv3d->persp==RV3D_CAMOB) {
- if(v3d->camera) {
- if(v3d->camera->type==OB_LAMP ) {
- Lamp *la;
-
- la= v3d->camera->data;
- fac= cosf(((float)M_PI)*la->spotsize/360.0f);
-
- x1= saacos(fac);
- lens= 16.0f*fac/sinf(x1);
-
- *clipsta= la->clipsta;
- *clipend= la->clipend;
- }
- else if(v3d->camera->type==OB_CAMERA) {
- cam= v3d->camera->data;
- lens= cam->lens;
- sensor_x= cam->sensor_x;
- sensor_y= cam->sensor_y;
- *clipsta= cam->clipsta;
- *clipend= cam->clipend;
- sensor_fit= cam->sensor_fit;
-
- sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x);
- }
- }
- }
-
- if(rv3d->persp==RV3D_ORTHO) {
- if(winx>winy) x1= -rv3d->dist;
- else x1= -winx*rv3d->dist/winy;
- x2= -x1;
-
- if(winx>winy) y1= -winy*rv3d->dist/winx;
- else y1= -rv3d->dist;
- y2= -y1;
-
- *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
- *clipsta= - *clipend;
- orth= 1;
- }
- else {
- /* fac for zoom, also used for camdx */
- if(rv3d->persp==RV3D_CAMOB) {
- fac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 4.0f;
- }
- else {
- fac= 2.0;
- }
-
- /* viewplane size depends... */
- if(cam && cam->type==CAM_ORTHO) {
- /* ortho_scale == 1 means exact 1 to 1 mapping */
- float dfac= 2.0f*cam->ortho_scale/fac;
-
- if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- if(winx>winy) {
- x1= -dfac;
- y1= -winy*dfac/winx;
- }
- else {
- x1= -winx*dfac/winy;
- y1= -dfac;
- }
- }
- else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
- x1= -dfac;
- y1= -winy*dfac/winx;
- }
- else {
- x1= -winx*dfac/winy;
- y1= -dfac;
- }
-
- x2= -x1;
- y2= -y1;
-
- orth= 1;
- }
- else {
- float dfac;
-
- if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- if(winx>winy) dfac= (sensor_x * 2.0f) / (fac*winx*lens);
- else dfac= (sensor_x * 2.0f) / (fac*winy*lens);
- }
- else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
- dfac= (sensor_x * 2.0f) / (fac*winx*lens);
- }
- else {
- dfac= (sensor_y * 2.0f) / (fac*winy*lens);
- }
-
- x1= - *clipsta * winx*dfac;
- x2= -x1;
- y1= - *clipsta * winy*dfac;
- y2= -y1;
- orth= 0;
- }
- /* cam view offset */
- if(cam) {
- float dx= 0.5f*fac*rv3d->camdx*(x2-x1);
- float dy= 0.5f*fac*rv3d->camdy*(y2-y1);
-
- /* shift offset */
- if(cam->type==CAM_ORTHO) {
- dx += cam->shiftx * cam->ortho_scale;
- dy += cam->shifty * cam->ortho_scale;
- }
- else {
- dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor;
- dy += cam->shifty * (cam->clipsta / cam->lens) * sensor;
- }
+ CameraParams params;
- x1+= dx;
- x2+= dx;
- y1+= dy;
- y2+= dy;
- }
- }
-
- if(pixsize) {
- float viewfac;
-
- if(orth) {
- viewfac= (winx >= winy)? winx: winy;
- *pixsize= 1.0f/viewfac;
- }
- else {
- float size= ((winx >= winy)? winx: winy);
-
- if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
- size= winx;
- else if(sensor_fit==CAMERA_SENSOR_FIT_VERT)
- size= winy;
+ camera_params_init(&params);
+ camera_params_from_view3d(&params, v3d, rv3d);
+ camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
- viewfac= (size*lens)/sensor;
- *pixsize= *clipsta/viewfac;
- }
- }
-
- viewplane->xmin= x1;
- viewplane->ymin= y1;
- viewplane->xmax= x2;
- viewplane->ymax= y2;
+ if(viewplane) *viewplane= params.viewplane;
+ if(clipsta) *clipsta= params.clipsta;
+ if(clipend) *clipend= params.clipend;
- return orth;
+ return params.is_ortho;
}
void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for picking */
@@ -1188,7 +1010,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick
float clipsta, clipend, x1, y1, x2, y2;
int orth;
- orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
+ orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend);
rv3d->is_persp= !orth;
// printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index cf8defe3968..e108262758a 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -96,9 +96,9 @@ static void setSnappingCallback(TransInfo *t);
static void ApplySnapTranslation(TransInfo *t, float vec[3]);
static void ApplySnapRotation(TransInfo *t, float *vec);
-static void ApplySnapResize(TransInfo *t, float *vec);
+static void ApplySnapResize(TransInfo *t, float vec[2]);
-static void CalcSnapGrid(TransInfo *t, float *vec);
+/* static void CalcSnapGrid(TransInfo *t, float *vec); */
static void CalcSnapGeometry(TransInfo *t, float *vec);
static void TargetSnapMedian(TransInfo *t);
@@ -703,7 +703,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
/********************** CALC **************************/
-static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec))
+static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec))
{
snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
}
@@ -1037,7 +1037,7 @@ static void TargetSnapClosest(TransInfo *t)
}
/*================================================================*/
#ifndef USE_BVH_FACE_SNAP
-static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth)
{
float lambda;
int result;
@@ -1089,7 +1089,9 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
}
#endif
-static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3],
+ const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
float intersect[3] = {0, 0, 0}, ray_end[3], dvec[3];
int result;
@@ -1143,11 +1145,11 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
* this takes care of series of connected edges a bit slanted w.r.t the viewport
* otherwise, it would stick to the verts of the closest edge and not slide along merrily
* */
- if (new_dist <= *dist && new_depth < *depth * 1.001f)
+ if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f)
{
float n1[3], n2[3];
- *depth = new_depth;
+ *r_depth = new_depth;
retval = 1;
sub_v3_v3v3(edge_loc, v1co, v2co);
@@ -1155,18 +1157,18 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
- if (no)
+ if (r_no)
{
normal_short_to_float_v3(n1, v1no);
normal_short_to_float_v3(n2, v2no);
- interp_v3_v3v3(no, n2, n1, mul);
- mul_m3_v3(timat, no);
- normalize_v3(no);
+ interp_v3_v3v3(r_no, n2, n1, mul);
+ mul_m3_v3(timat, r_no);
+ normalize_v3(r_no);
}
- copy_v3_v3(loc, location);
+ copy_v3_v3(r_loc, location);
- *dist = new_dist;
+ *r_dist = new_dist;
}
}
}
@@ -1174,7 +1176,9 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
return retval;
}
-static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], float timat[][3],
+ const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
int retval = 0;
float dvec[3];
@@ -1192,33 +1196,35 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], fl
mul_m4_v3(obmat, location);
- new_depth = len_v3v3(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *dist && new_depth < *depth)
+ if (new_dist <= *r_dist && new_depth < *r_depth)
{
- *depth = new_depth;
+ *r_depth = new_depth;
retval = 1;
- copy_v3_v3(loc, location);
+ copy_v3_v3(r_loc, location);
- if (no)
+ if (r_no)
{
- normal_short_to_float_v3(no, vno);
- mul_m3_v3(timat, no);
- normalize_v3(no);
+ normal_short_to_float_v3(r_no, vno);
+ mul_m3_v3(timat, r_no);
+ normalize_v3(r_no);
}
- *dist = new_dist;
+ *r_dist = new_dist;
}
}
return retval;
}
-static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth)
+static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float mval[2],
+ float r_loc[3], float *UNUSED(r_no), int *r_dist, float *r_depth)
{
float imat[4][4];
float ray_start_local[3], ray_normal_local[3];
@@ -1243,11 +1249,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
switch (snap_mode)
{
case SCE_SNAP_MODE_VERTEX:
- retval |= snapVertex(ar, eBone->head, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
- retval |= snapVertex(ar, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+ retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
case SCE_SNAP_MODE_EDGE:
- retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
}
}
@@ -1269,11 +1275,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
switch (snap_mode)
{
case SCE_SNAP_MODE_VERTEX:
- retval |= snapVertex(ar, head_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
- retval |= snapVertex(ar, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+ retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
case SCE_SNAP_MODE_EDGE:
- retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
}
}
@@ -1283,10 +1289,9 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
return retval;
}
-static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
- DerivedMesh *dm, BMEditMesh *em, float obmat[][4],
- float ray_start[3], float ray_normal[3], float mval[2],
- float *loc, float *no, int *dist, float *depth)
+static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, BMEditMesh *em, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
int retval = 0;
int totvert = dm->getNumVerts(dm);
@@ -1335,21 +1340,21 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
hit.index = -1;
- hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale);
+ hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
{
- if(hit.dist/local_scale <= *depth) {
- *depth= hit.dist/local_scale;
- copy_v3_v3(loc, hit.co);
- copy_v3_v3(no, hit.no);
+ if(hit.dist/local_scale <= *r_depth) {
+ *r_depth= hit.dist/local_scale;
+ copy_v3_v3(r_loc, hit.co);
+ copy_v3_v3(r_no, hit.no);
/* back to worldspace */
- mul_m4_v3(obmat, loc);
- copy_v3_v3(no, hit.no);
+ mul_m4_v3(obmat, r_loc);
+ copy_v3_v3(r_no, hit.no);
- mul_m3_v3(timat, no);
- normalize_v3(no);
+ mul_m3_v3(timat, r_no);
+ normalize_v3(r_no);
retval |= 1;
}
@@ -1488,7 +1493,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
if (test)
{
- retval |= snapVertex(ar, v->co, v->no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
+ retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
@@ -1550,7 +1555,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
if (test)
{
- retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
+ retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
@@ -1567,7 +1572,9 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
return retval;
}
-static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth)
+static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
ToolSettings *ts= scene->toolsettings;
int retval = 0;
@@ -1588,19 +1595,20 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
}
- retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+ retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth);
dm->release(dm);
}
else if (ob->type == OB_ARMATURE)
{
- retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+ retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth);
}
return retval;
}
-static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, const float mval[2],
+ int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
{
Base *base;
float depth = FLT_MAX;
@@ -1613,7 +1621,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
{
Object *ob = obedit;
- retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+ retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
}
/* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
@@ -1625,7 +1633,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
if(base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT)
{
Object *ob = base->object;
- retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+ retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
}
for ( base = FIRSTBASE; base != NULL; base = base->next ) {
@@ -1641,30 +1649,30 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
{
Object *dob = dupli_ob->ob;
- retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+ retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
}
free_object_duplilist(lb);
}
- retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+ retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
}
}
return retval;
}
-int snapObjectsTransform(TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+int snapObjectsTransform(TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
{
- return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, dist, loc, no, mode);
+ return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, r_dist, r_loc, r_no, mode);
}
-int snapObjectsContext(bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+int snapObjectsContext(bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
{
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
- return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, dist, loc, no, mode);
+ return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, r_dist, r_loc, r_no, mode);
}
/******************** PEELING *********************************/
@@ -1724,7 +1732,9 @@ static void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float n
peel->flag = 0;
}
-static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels)
+static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float UNUSED(mval[2]),
+ ListBase *depth_peels)
{
int retval = 0;
int totvert = dm->getNumVerts(dm);
@@ -1832,7 +1842,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float
return retval;
}
-static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, float mval[2])
+static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2])
{
Base *base;
int retval = 0;
@@ -1915,12 +1925,12 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
return retval;
}
-int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, float mval[2])
+int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2])
{
return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval);
}
-int peelObjectsContext(bContext *C, ListBase *depth_peels, float mval[2])
+int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2])
{
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 3c32332cd8d..db27c1cee63 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -895,7 +895,7 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx)
static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
IMB_Timecode_Type tc) {
- unsigned long long pts_to_search = 0;
+ int64_t pts_to_search = 0;
double frame_rate;
double pts_time_base;
long long st_time;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 92c32470057..a25ed938c0f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -112,9 +112,8 @@ typedef struct uiStyle {
short buttonspacex;
short buttonspacey;
short panelspace;
- short panelouter;
- short pad[1];
+ short pad[2];
} uiStyle;
typedef struct uiWidgetColors {
@@ -139,6 +138,12 @@ typedef struct uiWidgetStateColors {
float blend, pad;
} uiWidgetStateColors;
+typedef struct uiPanelColors {
+ char header[4];
+ short show_header;
+ short pad;
+} uiPanelColors;
+
typedef struct ThemeUI {
/* Interface Elements (buttons, menus, icons) */
@@ -149,9 +154,13 @@ typedef struct ThemeUI {
uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item;
uiWidgetStateColors wcol_state;
-
+
+ uiPanelColors panel;
+
char iconfile[80]; // FILE_MAXFILE length
-
+ float icon_alpha;
+
+ float pad;
} ThemeUI;
/* try to put them all in one, if needed a special struct can be created as well
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b941e9ebed7..392aa6a7f5a 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -626,7 +626,7 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack");
+ RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 1e7a969caaa..6f6a4baec92 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -39,34 +39,21 @@
#ifdef RNA_RUNTIME
+#include "BKE_camera.h"
#include "BKE_object.h"
#include "BKE_depsgraph.h"
-/* only for rad/deg conversion! can remove later */
-static float get_camera_sensor(Camera *cam)
-{
- if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- return cam->sensor_x;
- }
- else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) {
- return cam->sensor_x;
- }
- else {
- return cam->sensor_y;
- }
-}
-
static float rna_Camera_angle_get(PointerRNA *ptr)
{
Camera *cam= ptr->id.data;
- float sensor= get_camera_sensor(cam);
+ float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
return focallength_to_fov(cam->lens, sensor);
}
static void rna_Camera_angle_set(PointerRNA *ptr, float value)
{
Camera *cam= ptr->id.data;
- float sensor= get_camera_sensor(cam);
+ float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
cam->lens= fov_to_focallength(value, sensor);
}
@@ -126,9 +113,9 @@ void RNA_def_camera(BlenderRNA *brna)
{CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem sensor_fit_items[] = {
- {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Calculate field of view using sensor size, with direction depending on image resolution"},
- {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Calculate field of view using sensor width"},
- {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Calculate field of view using sensor height"},
+ {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"},
+ {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
+ {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Camera", "ID");
@@ -151,7 +138,7 @@ void RNA_def_camera(BlenderRNA *brna)
prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
RNA_def_property_enum_items(prop, sensor_fit_items);
- RNA_def_property_ui_text(prop, "Sensor Fit", "Mode of calculating field of view from sensor dimensions and focal length");
+ RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
/* Number values */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 0cd36eb3755..4ab14550fd1 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -367,7 +367,7 @@ static void rna_def_constraint_childof(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Child Of Constraint", "Creates constraint-based parent-child relationship");
+ RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -440,7 +440,7 @@ static void rna_def_constraint_python(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Python Constraint", "Uses Python script for constraint evaluation");
+ RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
@@ -641,7 +641,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Track To Constraint", "Aims the constrained object toward the target");
+ RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -685,7 +685,7 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target");
+ RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -748,7 +748,7 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copies the rotation of the target");
+ RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -804,7 +804,7 @@ static void rna_def_constraint_size_like(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target");
+ RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -852,7 +852,7 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintains a constant volume along a single scaling axis");
+ RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis");
RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
@@ -874,7 +874,7 @@ static void rna_def_constraint_transform_like(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copies all the transforms of the target");
+ RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -910,7 +910,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "FloorConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Floor Constraint", "Uses the target object for location limitation");
+ RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1038,7 +1038,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Points toward the target along the track axis, while locking the other axis");
+ RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1092,7 +1092,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Locks motion to the target path");
+ RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1137,7 +1137,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
- RNA_def_property_ui_text(prop, "Curve Radius", "Objects scale by the curve radius");
+ RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -1159,7 +1159,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretches to meet the target object");
+ RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1209,9 +1209,9 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem pivot_items[] = {
- {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allows rotations around all axes"},
- {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Works in one plane, allows rotations around one axis only"},
- {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allows rotations around all axes with limits for the cone and twist axes"},
+ {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"},
+ {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"},
+ {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"},
{CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
{0, NULL, 0, NULL, NULL}};
@@ -1343,7 +1343,7 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
/* Limit Booleans */
prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
- RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum x limit");
+ RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
@@ -1358,17 +1358,17 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
- RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit");
+ RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 16);
- RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum y angular limit");
+ RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
- RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit");
+ RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -1403,7 +1403,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box");
+ RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -1553,7 +1553,7 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limits the location of the constrained object");
+ RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object");
RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
@@ -1634,7 +1634,7 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object");
+ RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
@@ -1700,7 +1700,7 @@ static void rna_def_constraint_size_limit(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limits the scaling of the constrained object");
+ RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
@@ -1781,7 +1781,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object");
+ RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1825,13 +1825,13 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrinks the location to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the location to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the location to the nearest target vertex"},
+ {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship");
+ RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1844,7 +1844,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
+ RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
@@ -1884,7 +1884,7 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Points toward target by taking the shortest rotation path");
+ RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -2039,7 +2039,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track");
+ RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track");
RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
/* movie clip */
@@ -2074,7 +2074,7 @@ static void rna_def_constraint_camera_solver(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the reconstructed camera movenment");
+ RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the reconstructed camera movement");
RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
/* movie clip */
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index 89239c10ffd..5278c1e3532 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -258,7 +258,7 @@ void RNA_def_controller(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
+ RNA_def_property_ui_text(prop, "Module", "Module name and function to run, e.g. \"someModule.main\" (internal texts and external python files can be used)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index afe11656aee..ee3193b5429 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1125,8 +1125,8 @@ static void rna_def_transform_orientation(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8fb232332d5..a33622cf8a1 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -891,15 +891,26 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
bgpic->blend = 1.0f - value;
}
-static BGpic *rna_BackgroundImage_add(View3D *v3d)
+static BGpic *rna_BackgroundImage_new(View3D *v3d)
{
- BGpic *bgpic= ED_view3D_background_image_add(v3d);;
+ BGpic *bgpic= ED_view3D_background_image_new(v3d);
- WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
+ WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d);
return bgpic;
}
+static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, BGpic *bgpic)
+{
+ if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) {
+ BKE_report(reports, RPT_ERROR, "BackgroundImage can't be removed");
+ }
+ else {
+ ED_view3D_background_image_remove(v3d, bgpic);
+ WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d);
+ }
+}
+
/* Space Node Editor */
static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value)
@@ -1307,11 +1318,16 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
- func= RNA_def_function(srna, "add", "rna_BackgroundImage_add");
+ func= RNA_def_function(srna, "new", "rna_BackgroundImage_new");
RNA_def_function_ui_description(func, "Add new background image");
-
parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
+ RNA_def_function_ui_description(func, "Remove background image");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_space_view3d(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 73b2914fba1..269860e1d7e 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -451,9 +451,9 @@ static void rna_def_trackingMarker(BlenderRNA *brna)
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
/* enable */
- prop= RNA_def_property(srna, "enable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_DISABLED);
- RNA_def_property_ui_text(prop, "Enable", "Is marker enabled for current frame");
+ prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
+ RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 329a8b70d85..34ee95c2962 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -506,6 +506,25 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
+static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "ThemePanelColors", NULL);
+ RNA_def_struct_sdna(srna, "uiPanelColors");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
+
+ prop= RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Header", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Header", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+}
+
static void rna_def_userdef_theme_ui(BlenderRNA *brna)
{
StructRNA *srna;
@@ -513,6 +532,7 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
rna_def_userdef_theme_ui_wcol(brna);
rna_def_userdef_theme_ui_wcol_state(brna);
+ rna_def_userdef_theme_ui_panel(brna);
srna= RNA_def_struct(brna, "ThemeUserInterface", NULL);
RNA_def_struct_sdna(srna, "ThemeUI");
@@ -521,127 +541,102 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_regular");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_tool");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_radio");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_text");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Text Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_option");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Option Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_num");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Number Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_numslider");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_box");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_pulldown");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_back");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_item");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Menu Item Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_progress");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_list_item");
- RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "List Item Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "wcol_state");
- RNA_def_property_struct_type(prop, "ThemeWidgetStateColors");
RNA_def_property_ui_text(prop, "State Colors", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "panel", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Panel Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "iconfile");
RNA_def_property_ui_text(prop, "Icon File", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop= RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype)
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 20174740215..de43bdb8131 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -46,6 +46,7 @@
#include "BLI_utildefines.h"
+#include "BKE_camera.h"
#include "BKE_DerivedMesh.h"
#include "MOD_modifiertypes.h"
@@ -195,20 +196,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
free_uci= 1;
}
else {
- float sensor= (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : cam->sensor_x;
+ float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+ int sensor_fit= camera_sensor_fit(cam->sensor_fit, aspx, aspy);
float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale;
float xmax, xmin, ymax, ymin;
- if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
- if(aspect > 1.0f) {
- xmax = 0.5f * scale;
- ymax = xmax / aspect;
- } else {
- ymax = 0.5f * scale;
- xmax = ymax * aspect;
- }
- }
- else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
xmax = 0.5f * scale;
ymax = xmax / aspect;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 515d24dcc51..f1c2fb321d1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -261,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
if (camob && camob->type==OB_CAMERA) {
Camera* cam = (Camera*)camob->data;
cam_lens = cam->lens;
- cam_fdist = dof_camera(camob);
+ cam_fdist = object_camera_dof_distance(camob);
if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */
cam_invfdist = 1.f/cam_fdist;
}
diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c
index c84aab83b7e..902e64eb7c1 100644
--- a/source/blender/python/generic/noise_py_api.c
+++ b/source/blender/python/generic/noise_py_api.c
@@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
amp = 1.f;
out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
if (hard)
- out = (float)fabs(out);
+ out = fabsf(out);
for (i = 1; i < oct; i++) {
amp *= ampscale;
x *= freqscale;
@@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
z *= freqscale;
t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f));
if (hard)
- t = (float)fabs(t);
+ t = fabsf(t);
out += t;
}
return out;
@@ -321,16 +321,16 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
/* Turbulence Vector */
static void vTurb(float x, float y, float z, int oct, int hard, int nb,
- float ampscale, float freqscale, float v[3])
+ float ampscale, float freqscale, float v[3])
{
float amp, t[3];
int i;
amp = 1.f;
noise_vector(x, y, z, nb, v);
if (hard) {
- v[0] = (float)fabs(v[0]);
- v[1] = (float)fabs(v[1]);
- v[2] = (float)fabs(v[2]);
+ v[0] = fabsf(v[0]);
+ v[1] = fabsf(v[1]);
+ v[2] = fabsf(v[2]);
}
for (i = 1; i < oct; i++) {
amp *= ampscale;
@@ -339,9 +339,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
z *= freqscale;
noise_vector(x, y, z, nb, t);
if (hard) {
- t[0] = (float)fabs(t[0]);
- t[1] = (float)fabs(t[1]);
- t[2] = (float)fabs(t[2]);
+ t[0] = fabsf(t[0]);
+ t[1] = fabsf(t[1]);
+ t[2] = fabsf(t[2]);
}
v[0] += amp * t[0];
v[1] += amp * t[1];
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index c00df7db87e..bcce7cbdfcc 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -188,6 +188,7 @@ void RE_SetDispRect (struct Render *re, rcti *disprect);
/* set up the viewplane/perspective matrix, three choices */
struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */
void RE_SetCamera(struct Render *re, struct Object *camera);
+void RE_SetEnvmapCamera(struct Render *re, struct Object *cam_ob, float viewscale, float clipsta, float clipend);
void RE_SetWindow (struct Render *re, rctf *viewplane, float clipsta, float clipend);
void RE_SetOrtho (struct Render *re, rctf *viewplane, float clipsta, float clipend);
void RE_SetPixelSize(struct Render *re, float pixsize);
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 7cad8c36df4..a931de04737 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -152,10 +152,7 @@ struct Render
int partx, party;
/* values for viewing */
- float lens;
- float sensor_x, sensor_y; /* image sensor size, same variable in camera */
float ycor; /* (scene->xasp / scene->yasp), multiplied with 'winy' */
- short sensor_fit;
float panophi, panosi, panoco, panodxp, panodxv;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 62cb29c3d5f..3512ffa865b 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -131,6 +131,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
static Render *envmap_render_copy(Render *re, EnvMap *env)
{
Render *envre;
+ float viewscale;
int cuberes;
envre= RE_NewRender("Envmap");
@@ -156,15 +157,8 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
envre->lay= re->lay;
/* view stuff in env render */
- envre->lens= 16.0f;
- envre->sensor_x= 32.0f;
- if(env->type==ENV_PLANE)
- envre->lens*= env->viewscale;
- envre->ycor= 1.0f;
- envre->clipsta= env->clipsta; /* render_scene_set_window() respects this for now */
- envre->clipend= env->clipend;
-
- RE_SetCamera(envre, env->object);
+ viewscale= (env->type == ENV_PLANE)? env->viewscale: 1.0f;
+ RE_SetEnvmapCamera(envre, env->object, viewscale, env->clipsta, env->clipend);
/* callbacks */
envre->display_draw= re->display_draw;
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 7bd8dad6502..b7254cd1221 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -451,15 +451,64 @@ struct Object *RE_GetCamera(Render *re)
return re->camera_override ? re->camera_override : re->scene->camera;
}
+static void re_camera_params_get(Render *re, CameraParams *params, Object *cam_ob)
+{
+ copy_m4_m4(re->winmat, params->winmat);
+
+ re->clipsta= params->clipsta;
+ re->clipend= params->clipend;
+
+ re->ycor= params->ycor;
+ re->viewdx= params->viewdx;
+ re->viewdy= params->viewdy;
+ re->viewplane= params->viewplane;
+
+ object_camera_mode(&re->r, cam_ob);
+}
+
+void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clipsta, float clipend)
+{
+ CameraParams params;
+
+ /* setup parameters */
+ camera_params_init(&params);
+ camera_params_from_object(&params, cam_ob);
+
+ params.lens= 16.0f*viewscale;
+ params.sensor_x= 32.0f;
+ params.sensor_y= 32.0f;
+ params.sensor_fit = CAMERA_SENSOR_FIT_AUTO;
+ params.clipsta= clipsta;
+ params.clipend= clipend;
+
+ /* compute matrix, viewplane, .. */
+ camera_params_compute_viewplane(&params, re->winx, re->winy, 1.0f, 1.0f);
+ camera_params_compute_matrix(&params);
+
+ /* extract results */
+ re_camera_params_get(re, &params, cam_ob);
+}
+
/* call this after InitState() */
/* per render, there's one persistent viewplane. Parts will set their own viewplanes */
-void RE_SetCamera(Render *re, Object *camera)
+void RE_SetCamera(Render *re, Object *cam_ob)
{
- object_camera_mode(&re->r, camera);
+ CameraParams params;
+
+ /* setup parameters */
+ camera_params_init(&params);
+ camera_params_from_object(&params, cam_ob);
+
+ params.use_fields= (re->r.mode & R_FIELDS);
+ params.field_second= (re->flag & R_SEC_FIELD);
+ params.field_odd= (re->r.mode & R_ODDFIELD);
+
+ /* compute matrix, viewplane, .. */
+ camera_params_compute_viewplane(&params, re->winx, re->winy, re->r.xasp, re->r.yasp);
+ camera_params_compute_matrix(&params);
- object_camera_matrix(&re->r, camera, re->winx, re->winy, re->flag & R_SEC_FIELD,
- re->winmat, &re->viewplane, &re->clipsta, &re->clipend,
- &re->lens, &re->sensor_x, &re->sensor_y, &re->sensor_fit, &re->ycor, &re->viewdx, &re->viewdy);
+ /* extract results */
+ re_camera_params_get(re, &params, cam_ob);
}
void RE_SetPixelSize(Render *re, float pixsize)