Merge branch 'blender-v2.91-release'

This commit is contained in:
Hans Goudey 2020-11-02 22:35:15 -06:00
commit 6290bc4a37
3 changed files with 26 additions and 7 deletions

View File

@ -2522,7 +2522,9 @@ static void direct_link_ipo(BlendDataReader *reader, Ipo *ipo)
/* Undo generic endian switching. */
if (BLO_read_requires_endian_switch(reader)) {
BLI_endian_switch_int16(&ipo->blocktype);
BLI_endian_switch_int16(&icu->driver->blocktype);
if (icu->driver != NULL) {
BLI_endian_switch_int16(&icu->driver->blocktype);
}
}
}
}

View File

@ -59,6 +59,8 @@
#define BEVEL_SMALL_ANG DEG2RADF(10.0f)
/** Difference in dot products that corresponds to 10 degree difference between vectors. */
#define BEVEL_SMALL_ANG_DOT 1 - cosf(BEVEL_SMALL_ANG)
/** Difference in dot products that corresponds to 2.0 degree difference between vectors. */
#define BEVEL_EPSILON_ANG_DOT 1 - cosf(BEVEL_EPSILON_ANG)
#define BEVEL_MAX_ADJUST_PCT 10.0f
#define BEVEL_MAX_AUTO_ADJUST_PCT 300.0f
#define BEVEL_MATCH_SPEC_WEIGHT 0.2
@ -432,6 +434,18 @@ static bool nearly_parallel(const float d1[3], const float d2[3])
return (fabsf(ang) < BEVEL_EPSILON_ANG) || (fabsf(ang - (float)M_PI) < BEVEL_EPSILON_ANG);
}
/**
* \return True if d1 and d2 are parallel or nearly parallel.
*/
static bool nearly_parallel_normalized(const float d1[3], const float d2[3])
{
BLI_ASSERT_UNIT_V3(d1);
BLI_ASSERT_UNIT_V3(d2);
const float direction_dot = dot_v3v3(d1, d2);
return compare_ff(fabsf(direction_dot), 1.0f, BEVEL_EPSILON_ANG_DOT);
}
/* Make a new BoundVert of the given kind, inserting it at the end of the circular linked
* list with entry point bv->boundstart, and return it. */
static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const float co[3])
@ -1096,6 +1110,12 @@ static int edges_angle_kind(EdgeHalf *e1, EdgeHalf *e2, BMVert *v)
sub_v3_v3v3(dir2, v->co, v2->co);
normalize_v3(dir1);
normalize_v3(dir2);
/* First check for in-line edges using a simpler test. */
if (nearly_parallel_normalized(dir1, dir2)) {
return ANGLE_STRAIGHT;
}
/* Angles are in [0,pi]. Need to compare cross product with normal to see if they are reflex. */
float cross[3];
cross_v3_v3v3(cross, dir1, dir2);
@ -1110,11 +1130,8 @@ static int edges_angle_kind(EdgeHalf *e1, EdgeHalf *e2, BMVert *v)
else {
no = v->no;
}
float dot = dot_v3v3(cross, no);
if (fabsf(dot) < BEVEL_EPSILON_BIG) {
return ANGLE_STRAIGHT;
}
if (dot < 0.0f) {
if (dot_v3v3(cross, no) < 0.0f) {
return ANGLE_LARGER;
}
return ANGLE_SMALLER;

View File

@ -148,7 +148,7 @@ static void nla_init(struct wmWindowManager *wm, ScrArea *area)
/* init dopesheet data if non-existent (i.e. for old files) */
if (snla->ads == NULL) {
snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
snla->ads->source = (ID *)WM_window_get_active_scene(wm->winactive);
snla->ads->source = (wm->winactive) ? (ID *)WM_window_get_active_scene(wm->winactive) : NULL;
}
ED_area_tag_refresh(area);