[Bf-blender-cvs] [bfe1d0e0dc6] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Fri Jun 1 18:27:35 CEST 2018


Commit: bfe1d0e0dc6281d33448c3d4ddfa2e231bbc5566
Author: Campbell Barton
Date:   Fri Jun 1 18:26:42 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBbfe1d0e0dc6281d33448c3d4ddfa2e231bbc5566

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/anim_sys.c
index 4c338485393,924b1951d37..e5a68fa7476
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@@ -2660,10 -2622,21 +2660,10 @@@ static void animsys_evaluate_nla(Depsgr
  }
  
  /* NLA Evaluation function (mostly for use through do_animdata) 
-  *	- All channels that will be affected are not cleared anymore. Instead, we just evaluate into 
+  *	- All channels that will be affected are not cleared anymore. Instead, we just evaluate into
   *		some temp channels, where values can be accumulated in one go.
   */
 -static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
 +static void animsys_calculate_nla(Depsgraph *depsgraph, PointerRNA *ptr, AnimData *adt, float ctime)
  {
  	ListBase echannels = {NULL, NULL};
  
@@@ -2747,10 -2720,10 +2747,10 @@@ static void animsys_evaluate_overrides(
  /* Evaluation loop for evaluation animation data 
   *
   * This assumes that the animation-data provided belongs to the ID block in question,
-  * and that the flags for which parts of the anim-data settings need to be recalculated 
-  * have been set already by the depsgraph. Now, we use the recalc 
+  * and that the flags for which parts of the anim-data settings need to be recalculated
+  * have been set already by the depsgraph. Now, we use the recalc
   */
 -void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
 +void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
  {
  	PointerRNA id_ptr;
  	
diff --cc source/blender/blenkernel/intern/constraint.c
index 385c0f7f6bf,25a77821dd2..fe60d53a9a2
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@@ -101,9 -98,14 +101,9 @@@
  /* Constraint Target Macros */
  #define VALID_CONS_TARGET(ct) ((ct) && (ct->tar))
  
 -/* Workaround for cyclic depenndnecy with curves.
 - * In such case curve_cache might not be ready yet,
 - */
 -#define CYCLIC_DEPENDENCY_WORKAROUND
 -
  /* ************************ Constraints - General Utilities *************************** */
  /* These functions here don't act on any specific constraints, and are therefore should/will
-  * not require any of the special function-pointers afforded by the relevant constraint 
+  * not require any of the special function-pointers afforded by the relevant constraint
   * type-info structs.
   */
  
@@@ -4910,10 -4966,10 +4910,10 @@@ void BKE_constraint_targets_for_solving
  /* This function is called whenever constraints need to be evaluated. Currently, all
   * constraints that can be evaluated are every time this gets run.
   *
-  * BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and 
+  * BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and
   * after running this function, to sort out cob
   */
 -void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
 +void BKE_constraints_solve(struct Depsgraph *depsgraph, ListBase *conlist, bConstraintOb *cob, float ctime)
  {
  	bConstraint *con;
  	float oldmat[4][4];
diff --cc source/blender/blenkernel/intern/object.c
index c4460d5d909,ea3ecf29c15..2eb35908d63
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -3391,13 -3293,13 +3391,13 @@@ static void obrel_list_add(LinkNode **l
  }
  
  /*
 - * Iterates over all objects of the given scene.
 + * Iterates over all objects of the given scene layer.
   * Depending on the eObjectSet flag:
   * collect either OB_SET_ALL, OB_SET_VISIBLE or OB_SET_SELECTED objects.
-  * If OB_SET_VISIBLE or OB_SET_SELECTED are collected, 
+  * If OB_SET_VISIBLE or OB_SET_SELECTED are collected,
   * then also add related objects according to the given includeFilters.
   */
 -LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter)
 +LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, eObjectSet objectSet, eObRelationTypes includeFilter)
  {
  	LinkNode *links = NULL;
  
diff --cc source/blender/blenlib/intern/math_geom.c
index 0f98a648259,bebb5b02584..f8af6c20ae5
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@@ -769,217 -765,9 +769,217 @@@ float dist_squared_ray_to_aabb_v3_simpl
  /** \} */
  
  
 +/* -------------------------------------------------------------------- */
 +/** \name dist_squared_to_projected_aabb and helpers
 +* \{ */
 +
 +/**
 + * \param projmat: Projection Matrix (usually perspective
 + * matrix multiplied by object matrix).
 + */
 +void dist_squared_to_projected_aabb_precalc(
 +        struct DistProjectedAABBPrecalc *precalc,
 +        const float projmat[4][4], const float winsize[2], const float mval[2])
 +{
 +	float win_half[2], relative_mval[2], px[4], py[4];
 +
 +	mul_v2_v2fl(win_half, winsize, 0.5f);
 +	sub_v2_v2v2(precalc->mval, mval, win_half);
 +
 +	relative_mval[0] = precalc->mval[0] / win_half[0];
 +	relative_mval[1] = precalc->mval[1] / win_half[1];
 +
 +	copy_m4_m4(precalc->pmat, projmat);
 +	for (int i = 0; i < 4; i++) {
 +		px[i] = precalc->pmat[i][0] - precalc->pmat[i][3] * relative_mval[0];
 +		py[i] = precalc->pmat[i][1] - precalc->pmat[i][3] * relative_mval[1];
 +
 +		precalc->pmat[i][0] *= win_half[0];
 +		precalc->pmat[i][1] *= win_half[1];
 +	}
 +#if 0
 +	float projmat_trans[4][4];
 +	transpose_m4_m4(projmat_trans, projmat);
 +	if (!isect_plane_plane_plane_v3(
 +	        projmat_trans[0], projmat_trans[1], projmat_trans[3],
 +	        precalc->ray_origin))
 +	{
 +		/* Orthographic projection. */
 +		isect_plane_plane_v3(
 +		        px, py,
 +		        precalc->ray_origin,
 +		        precalc->ray_direction);
 +	}
 +	else {
 +		/* Perspective projection. */
 +		cross_v3_v3v3(precalc->ray_direction, py, px);
 +		//normalize_v3(precalc->ray_direction);
 +	}
 +#else
 +	if (!isect_plane_plane_v3(
 +	        px, py,
 +	        precalc->ray_origin,
 +	        precalc->ray_direction))
 +	{
 +		/* Matrix with weird coplanar planes. Undetermined origin.*/
 +		zero_v3(precalc->ray_origin);
 +		precalc->ray_direction[0] = precalc->pmat[0][3];
 +		precalc->ray_direction[1] = precalc->pmat[1][3];
 +		precalc->ray_direction[2] = precalc->pmat[2][3];
 +	}
 +#endif
 +
 +	for (int i = 0; i < 3; i++) {
 +		precalc->ray_inv_dir[i] =
 +		        (precalc->ray_direction[i] != 0.0f) ?
 +		        (1.0f / precalc->ray_direction[i]) : FLT_MAX;
 +	}
 +}
 +
 +/* Returns the distance from a 2d coordinate to a BoundBox (Projected) */
 +float dist_squared_to_projected_aabb(
 +        struct DistProjectedAABBPrecalc *data,
 +        const float bbmin[3], const float bbmax[3],
 +        bool r_axis_closest[3])
 +{
 +	float local_bvmin[3], local_bvmax[3];
 +	aabb_get_near_far_from_plane(
 +	        data->ray_direction, bbmin, bbmax, local_bvmin, local_bvmax);
 +
 +	const float tmin[3] = {
 +		(local_bvmin[0] - data->ray_origin[0]) * data->ray_inv_dir[0],
 +		(local_bvmin[1] - data->ray_origin[1]) * data->ray_inv_dir[1],
 +		(local_bvmin[2] - data->ray_origin[2]) * data->ray_inv_dir[2],
 +	};
 +	const float tmax[3] = {
 +		(local_bvmax[0] - data->ray_origin[0]) * data->ray_inv_dir[0],
 +		(local_bvmax[1] - data->ray_origin[1]) * data->ray_inv_dir[1],
 +		(local_bvmax[2] - data->ray_origin[2]) * data->ray_inv_dir[2],
 +	};
 +	/* `va` and `vb` are the coordinates of the AABB edge closest to the ray */
 +	float va[3], vb[3];
 +	/* `rtmin` and `rtmax` are the minimum and maximum distances of the ray hits on the AABB */
 +	float rtmin, rtmax;
 +	int main_axis;
 +
 +	if ((tmax[0] <= tmax[1]) && (tmax[0] <= tmax[2])) {
 +		rtmax = tmax[0];
 +		va[0] = vb[0] = local_bvmax[0];
 +		main_axis = 3;
 +		r_axis_closest[0] = data->ray_direction[0] < 0.0f;
 +	}
 +	else if ((tmax[1] <= tmax[0]) && (tmax[1] <= tmax[2])) {
 +		rtmax = tmax[1];
 +		va[1] = vb[1] = local_bvmax[1];
 +		main_axis = 2;
 +		r_axis_closest[1] = data->ray_direction[1] < 0.0f;
 +	}
 +	else {
 +		rtmax = tmax[2];
 +		va[2] = vb[2] = local_bvmax[2];
 +		main_axis = 1;
 +		r_axis_closest[2] = data->ray_direction[2] < 0.0f;
 +	}
 +
 +	if ((tmin[0] >= tmin[1]) && (tmin[0] >= tmin[2])) {
 +		rtmin = tmin[0];
 +		va[0] = vb[0] = local_bvmin[0];
 +		main_axis -= 3;
 +		r_axis_closest[0] = data->ray_direction[0] >= 0.0f;
 +	}
 +	else if ((tmin[1] >= tmin[0]) && (tmin[1] >= tmin[2])) {
 +		rtmin = tmin[1];
 +		va[1] = vb[1] = local_bvmin[1];
 +		main_axis -= 1;
 +		r_axis_closest[1] = data->ray_direction[1] >= 0.0f;
 +	}
 +	else {
 +		rtmin = tmin[2];
 +		va[2] = vb[2] = local_bvmin[2];
 +		main_axis -= 2;
 +		r_axis_closest[2] = data->ray_direction[2] >= 0.0f;
 +	}
 +	if (main_axis < 0) {
 +		main_axis += 3;
 +	}
 +
 +	/* if rtmin <= rtmax, ray intersect `AABB` */
 +	if (rtmin <= rtmax) {
 +		return 0;
 +	}
 +
 +	if (data->ray_direction[main_axis] >= 0.0f) {
 +		va[main_axis] = local_bvmin[main_axis];
 +		vb[main_axis] = local_bvmax[main_axis];
 +	}
 +	else {
 +		va[main_axis] = local_bvmax[main_axis];
 +		vb[main_axis] = local_bvmin[main_axis];
 +	}
 +	float scale = fabsf(local_bvmax[main_axis] - local_bvmin[main_axis]);
 +
 +	float va2d[2] = {
 +		(dot_m4_v3_row_x(data->pmat, va) + data->pmat[3][0]),
 +		(dot_m4_v3_row_y(data->pmat, va) + data->pmat[3][1]),
 +	};
 +	float vb2d[2] = {
 +		(va2d[0] + data->pmat[main_axis][0] * scale),
 +		(va2d[1] + data->pmat[main_axis][1] * scale),
 +	};
 +
 +	float w_a = mul_project_m4_v3_zfac(data->pmat, va);
 +	if (w_a != 1.0f) {
 +		/* Perspective Projection. */
 +		float w_b = w_a + data->pmat[main_axis][3] * scale;
 +		va2d[0] /= w_a;
 +		va2d[1] /= w_a;
 +		vb2d[0] /= w_b;
 +		vb2d[1] /= w_b;
 +	}
 +
 +	float dvec[2], edge[2], lambda, rdist_sq;
 +	sub_v2_v2v2(dvec, data->mval, va2d);
 +	sub_v2_v2v2(edge, vb2d, va2d);
 +	lambda = dot_v2v2(dvec, edge);
 +	if (lambda != 0.0f) {
 +		lambda /= len_squared_v2(edge);
 +		if (lambda <= 0.0f) {
 +			rdist_sq = len_squared_v2v2(data->mval, va2d);
 +			r_axis_closest[main_axis] = true;
 +		}
 +		else if (lambda >= 1.0f) {
 +			rdist_sq = len_squared_v2v2(data->mval, vb2d);
 +			r_axis_clo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list