Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-03 03:02:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-03 03:02:21 +0400
commitd74c56423517de6db8ef1a1b3a74e0b1c8fc1dc6 (patch)
tree6769e6a395cfd780ba4da2559c7388f707145391 /source
parent34c5698d2ef54e288090ec0e5c8feae639bfcd21 (diff)
parent06c3d5bd09e104d070d9e6c97e4baa265094240c (diff)
svn merge ^/trunk/blender -r42333:42361
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_math_geom.h2
-rw-r--r--source/blender/blenlib/intern/math_geom.c30
-rw-r--r--source/blender/blenlib/intern/scanfill.c16
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c14
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c20
-rw-r--r--source/blender/editors/animation/keyframing.c9
-rw-r--r--source/blender/editors/armature/meshlaplacian.c7
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c2
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/space_clip/clip_ops.c4
-rw-r--r--source/blender/editors/space_node/node_edit.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c15
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c2
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m2
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c12
-rw-r--r--source/blender/render/intern/source/render_texture.c10
-rw-r--r--source/blender/render/intern/source/shadeinput.c10
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c5
20 files changed, 69 insertions, 101 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index bb19a50f22e..c6ff87b498f 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -265,6 +265,8 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f);
float form_factor_hemi_poly(float p[3], float n[3],
float v1[3], float v2[3], float v3[3], float v4[3]);
+void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3]);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index e37c00078fa..e3ce31bd508 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -133,7 +133,8 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
float *cur, *prev;
int a, px=0, py=1;
- /* first: find dominant axis: 0==X, 1==Y, 2==Z */
+ /* first: find dominant axis: 0==X, 1==Y, 2==Z
+ * don't use 'axis_dominant_v3()' because we need max axis too */
x= fabsf(normal[0]);
y= fabsf(normal[1]);
z= fabsf(normal[2]);
@@ -1689,6 +1690,18 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
/****************************** Interpolation ********************************/
+/* get the 2 dominant axis values, 0==X, 1==Y, 2==Z */
+void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3])
+{
+ const float xn= fabsf(axis[0]);
+ const float yn= fabsf(axis[1]);
+ const float zn= fabsf(axis[2]);
+
+ if (zn >= xn && zn >= yn) { *axis_a= 0; *axis_b= 1; }
+ else if (yn >= xn && yn >= zn) { *axis_a= 0; *axis_b= 2; }
+ else { *axis_a= 1; *axis_b= 2; }
+}
+
static float tri_signed_area(const float v1[3], const float v2[3], const float v3[3], const int i, const int j)
{
return 0.5f*((v1[i]-v2[i])*(v2[j]-v3[j]) + (v1[j]-v2[j])*(v3[i]-v2[i]));
@@ -1696,17 +1709,10 @@ static float tri_signed_area(const float v1[3], const float v2[3], const float v
static int barycentric_weights(const float v1[3], const float v2[3], const float v3[3], const float co[3], const float n[3], float w[3])
{
- float xn, yn, zn, a1, a2, a3, asum;
- short i, j;
-
- /* find best projection of face XY, XZ or YZ: barycentric weights of
- the 2d projected coords are the same and faster to compute */
- 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;}
+ float a1, a2, a3, asum;
+ int i, j;
+
+ axis_dominant_v3(&i, &j, n);
a1= tri_signed_area(v2, v3, co, i, j);
a2= tri_signed_area(v3, v1, co, i, j);
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 04f83dd351e..7652cc4f4af 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -102,7 +102,7 @@ ListBase fillvertbase = {NULL, NULL};
ListBase filledgebase = {NULL, NULL};
ListBase fillfacebase = {NULL, NULL};
-static short cox, coy;
+static int cox, coy;
/* **** FUBCTIONS FOR QSORT *************************** */
@@ -889,19 +889,7 @@ int BLI_edgefill(short mat_nr)
if(len==0.0f) return 0; /* no fill possible */
- norm[0]= fabs(norm[0]);
- norm[1]= fabs(norm[1]);
- norm[2]= fabs(norm[2]);
-
- if(norm[2]>=norm[0] && norm[2]>=norm[1]) {
- cox= 0; coy= 1;
- }
- else if(norm[1]>=norm[0] && norm[1]>=norm[2]) {
- cox= 0; coy= 2;
- }
- else {
- cox= 1; coy= 2;
- }
+ axis_dominant_v3(&cox, &coy, norm);
/* STEP 1: COUNT POLYS */
eve= fillvertbase.first;
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 65aaa2203a4..00e51fbd32f 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -702,7 +702,7 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
BLI_array_staticdeclare(w, BM_NGON_STACK_SIZE);
BLI_array_staticdeclare(blocks, BM_NGON_STACK_SIZE);
BLI_array_staticdeclare(vblocks, BM_NGON_STACK_SIZE);
- int i, xn, yn, zn, ax, ay;
+ int i, ax, ay;
BM_Copy_Attributes(bm, bm, source, target->f);
@@ -722,14 +722,10 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
} while (l != bm_firstfaceloop(source));
/* find best projection of face XY, XZ or YZ: barycentric weights of
- the 2d projected coords are the same and faster to compute */
- xn= fabsf(source->no[0]);
- yn= fabsf(source->no[1]);
- zn= fabsf(source->no[2]);
- if (zn >= xn && zn >= yn) { ax= 0; ay= 1; }
- else if (yn >= xn && yn >= zn) { ax= 0; ay= 2; }
- else { ax= 1; ay= 2; }
-
+ * the 2d projected coords are the same and faster to compute */
+
+ axis_dominant_v3(&ax, &ay, source->no);
+
/* scale source face coordinates a bit, so points sitting directonly on an
edge will work.*/
mul_v3_fl(cent, 1.0f/(float)source->len);
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index edbc1520460..9e65261a3be 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -609,7 +609,7 @@ static int linecrossesf(float *v1, float *v2, float *v3, float *v4)
*/
int BM_Point_In_Face(BMesh *bm, BMFace *f, const float co[3])
{
- int xn, yn, zn, ax, ay;
+ int ax, ay;
float co2[3], cent[3] = {0.0f, 0.0f, 0.0f}, out[3] = {FLT_MAX*0.5f, FLT_MAX*0.5f, 0};
BMLoop *l;
int crosses = 0;
@@ -619,18 +619,12 @@ int BM_Point_In_Face(BMesh *bm, BMFace *f, const float co[3])
BM_Face_UpdateNormal(bm, f);
/* find best projection of face XY, XZ or YZ: barycentric weights of
- the 2d projected coords are the same and faster to compute
-
- this probably isn't all that accurate, but it has the advantage of
- being fast (especially compared to projecting into the face orientation)
- */
- xn= fabsf(f->no[0]);
- yn= fabsf(f->no[1]);
- zn= fabsf(f->no[2]);
-
- if (zn >= xn && zn >= yn) { ax= 0; ay= 1; }
- else if (yn >= xn && yn >= zn) { ax= 0; ay= 2; }
- else { ax= 1; ay= 2; }
+ * the 2d projected coords are the same and faster to compute
+ *
+ * this probably isn't all that accurate, but it has the advantage of
+ * being fast (especially compared to projecting into the face orientation)
+ */
+ axis_dominant_v3(&ax, &ay, f->no);
co2[0] = co[ax];
co2[1] = co[ay];
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 9f466ef52d3..4595bf3f64f 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -310,10 +310,17 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
beztr.vec[1][1]= y;
beztr.vec[2][0]= x+1.0f;
beztr.vec[2][1]= y;
- beztr.ipo= U.ipo_new; /* use default interpolation mode here... */
beztr.f1= beztr.f2= beztr.f3= SELECT;
beztr.h1= beztr.h2= U.keyhandles_new; /* use default handle type here */
//BEZKEYTYPE(&beztr)= scene->keytype; /* default keyframe type */
+
+ /* use default interpolation mode, with exceptions for int/discrete values */
+ beztr.ipo= U.ipo_new;
+
+ if(fcu->flag & FCURVE_DISCRETE_VALUES)
+ beztr.ipo = BEZT_IPO_CONST;
+ else if(beztr.ipo == BEZT_IPO_BEZ && (fcu->flag & FCURVE_INT_VALUES))
+ beztr.ipo = BEZT_IPO_LIN;
/* add temp beztriple to keyframes */
a= insert_bezt_fcurve(fcu, &beztr, flag);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 333cd2ef7ca..6197b66656a 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1612,7 +1612,7 @@ static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y
mdb->phi[acenter]= phi/totweight;
}
-static void meshdeform_matrix_solve(MeshDeformBind *mdb)
+static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind *mdb)
{
NLContext *context;
float vec[3], gridvec[3];
@@ -1714,7 +1714,8 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb)
}
}
else {
- error("Mesh Deform: failed to find solution");
+ modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?).");
+ error("Mesh Deform: failed to find bind solution.");
break;
}
@@ -1823,7 +1824,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
meshdeform_check_semibound(mdb, x, y, z);
/* solve */
- meshdeform_matrix_solve(mdb);
+ meshdeform_matrix_solve(mmd, mdb);
/* assign results */
if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 57dd1ef5572..760faf01b6c 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -125,7 +125,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
/* active */
block= uiLayoutGetBlock(sub);
icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
- but= uiDefIconBut(block, BUT, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Set active layer");
+ but= uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, &gpd->flag, 0.0, 0.0, 0.0, 0.0, "Set active layer");
uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
/* locked */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ab4ff20d503..437d2e880c1 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -338,7 +338,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* Add new object for the proxy */
newob= add_object(scene, OB_EMPTY);
- BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name);
+ BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name+2);
rename_id(&newob->id, name);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index c4a858797e5..7b1dbc82e82 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -893,7 +893,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
BKE_tracking_distortion_destroy(distortion);
}
-static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
+static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
{
wmJob * steve;
ProxyJob *pj;
@@ -932,7 +932,7 @@ void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
ot->description= "Rebuild all selected proxies and timecode indeces in the background";
/* api callbacks */
- ot->exec= sequencer_rebuild_proxy_exec;
+ ot->exec= clip_rebuild_proxy_exec;
ot->poll= ED_space_clip_poll;
/* flags */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index cd4e99900e7..4074e35f860 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -3276,10 +3276,6 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
SpaceNode *snode= CTX_wm_space_node(C);
bNode *node;
- /* no disabling inside of groups */
- if(node_tree_get_editgroup(snode->nodetree))
- return OPERATOR_CANCELLED;
-
ED_preview_kill_jobs(C);
for(node= snode->edittree->nodes.first; node; node= node->next) {
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 1c74437c37e..6df7ce45a64 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1345,7 +1345,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
BMIter iter, liter;
/* MTexPoly *tf; */ /* UNUSED */
MLoopUV *luv;
- float no[3], cube_size, *loc, dx, dy;
+ float cube_size, *loc, dx, dy;
int cox, coy;
/* add uvs if they don't exist yet */
@@ -1365,18 +1365,9 @@ static int cube_project_exec(bContext *C, wmOperator *op)
/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
if (!BM_TestHFlag(efa, BM_SELECT))
continue;
-
- VECCOPY(no, efa->no);
- no[0]= fabs(no[0]);
- no[1]= fabs(no[1]);
- no[2]= fabs(no[2]);
-
- cox=0; coy= 1;
- if(no[2]>=no[0] && no[2]>=no[1]);
- else if(no[1]>=no[0] && no[1]>=no[2]) coy= 2;
- else { cox= 1; coy= 2; }
-
+ axis_dominant_v3(&cox, &coy, efa->no);
+
dx = dy = 0;
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index d95cc1460df..3ec75dfa4fd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -62,7 +62,7 @@ void register_node_type_sh_camera(bNodeTreeType *ttype)
static bNodeType ntype;
node_type_base(ttype, &ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0);
- node_type_compatibility(&ntype, NODE_OLD_SHADING);
+ node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
node_type_socket_templates(&ntype, NULL, sh_node_camera_out);
node_type_size(&ntype, 95, 95, 120);
node_type_storage(&ntype, "node_camera", NULL, NULL);
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index bfdcb5d0917..0f85196a45d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -85,7 +85,7 @@ void register_node_type_sh_hue_sat(bNodeTreeType *ttype)
static bNodeType ntype;
node_type_base(ttype, &ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
- node_type_compatibility(&ntype, NODE_OLD_SHADING);
+ node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
node_type_size(&ntype, 150, 80, 250);
node_type_exec(&ntype, node_shader_exec_hue_sat);
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index b26781d8026..c2e364b6080 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -213,7 +213,7 @@ void makeqtstring (RenderData *rd, char *string) {
BLI_make_existing_file(string);
if (BLI_strcasecmp(string + strlen(string) - 4, ".mov")) {
- sprintf(txt, "%04d_%04d.mov", (rd->sfra) , (rd->efra) );
+ sprintf(txt, "%04d-%04d.mov", (rd->sfra) , (rd->efra) );
strcat(string, txt);
}
}
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index ffda20ead7f..18c1ed23f8a 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -507,7 +507,7 @@ void filepath_qt(char *string, RenderData *rd) {
BLI_make_existing_file(string);
if (BLI_strcasecmp(string + strlen(string) - 4, ".mov")) {
- sprintf(txt, "%04d_%04d.mov", (rd->sfra) , (rd->efra) );
+ sprintf(txt, "%04d-%04d.mov", (rd->sfra) , (rd->efra) );
strcat(string, txt);
}
}
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 1a58a665e0a..b8c4b05de50 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -485,18 +485,12 @@ void makeraytree(Render *re)
/* if(shi->osatex) */
static void shade_ray_set_derivative(ShadeInput *shi)
{
- float detsh, t00, t10, t01, t11, xn, yn, zn;
+ float detsh, t00, t10, t01, t11;
int axis1, axis2;
/* find most stable axis to project */
- xn= fabs(shi->facenor[0]);
- yn= fabs(shi->facenor[1]);
- zn= fabs(shi->facenor[2]);
-
- if(zn>=xn && zn>=yn) { axis1= 0; axis2= 1; }
- else if(yn>=xn && yn>=zn) { axis1= 0; axis2= 2; }
- else { axis1= 1; axis2= 2; }
-
+ axis_dominant_v3(&axis1, &axis2, shi->facenor);
+
/* compute u,v and derivatives */
if(shi->obi->flag & R_TRANSFORMED) {
float v1[3], v2[3], v3[3];
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 4ab5f1a61c2..412f45d184e 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -3494,17 +3494,11 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
static void textured_face_generate_uv(float *uv, float *normal, float *hit, float *v1, float *v2, float *v3)
{
- float detsh, t00, t10, t01, t11, xn, yn, zn;
+ float detsh, t00, t10, t01, t11;
int axis1, axis2;
/* find most stable axis to project */
- xn= fabs(normal[0]);
- yn= fabs(normal[1]);
- zn= fabs(normal[2]);
-
- if(zn>=xn && zn>=yn) { axis1= 0; axis2= 1; }
- else if(yn>=xn && yn>=zn) { axis1= 0; axis2= 2; }
- else { axis1= 1; axis2= 2; }
+ axis_dominant_v3(&axis1, &axis2, normal);
/* compute u,v and derivatives */
t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index f2a053e89d9..dd026740c33 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -756,17 +756,11 @@ void shade_input_set_uv(ShadeInput *shi)
}
else {
/* most of this could become re-used for faces */
- float detsh, t00, t10, t01, t11, xn, yn, zn;
+ float detsh, t00, t10, t01, t11;
int axis1, axis2;
/* find most stable axis to project */
- xn= fabs(shi->facenor[0]);
- yn= fabs(shi->facenor[1]);
- zn= fabs(shi->facenor[2]);
-
- if(zn>=xn && zn>=yn) { axis1= 0; axis2= 1; }
- else if(yn>=xn && yn>=zn) { axis1= 0; axis2= 2; }
- else { axis1= 1; axis2= 2; }
+ axis_dominant_v3(&axis1, &axis2, shi->facenor);
/* compute u,v and derivatives */
t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2];
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 5d48a3c7a7f..9d8f68115cf 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2667,6 +2667,11 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
key we don't want the key modifier */
if(event.keymodifier == event.type)
event.keymodifier= 0;
+ /* this case happened with an external numpad, it's not really clear
+ why, but it's also impossible to map a key modifier to an unknwon
+ key, so it shouldn't harm */
+ if(event.keymodifier == UNKNOWNKEY)
+ event.keymodifier= 0;
/* if test_break set, it catches this. XXX Keep global for now? */
if(event.type==ESCKEY)