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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-28 19:52:46 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-31 14:03:05 +0300
commit7400aa7e595063510ce9f29fa1b02ebd3f9296e2 (patch)
treed0fc86bfc15cf187b3a69b720e9a715489494f8a /source/blender/blenkernel/intern/object.c
parent3e072da45bee1ac5368b83c84839d2ccdde6e514 (diff)
Depsgraph: remove features incompatible with new system.
Some features are incompatible with multithreading and reliable evaluation of dependencies. We are now removing them as part of a bigger cleanup to fix bugs in keyframing and invalid animation evaluations. * Dupliframes have been removed. This was a hack added before there were more powerful features like the array modifier. * Slow parent has been removed, never worked in 2.8. It was always unreliable for use in production due to depending on whatever frame was previously evaluated, which was not always the previous frame. * Particle instanced objects used to have their transform evaluated at the particle time. Now it always gets the current time transform. * Boids can no longer do predictive avoidance of force field objects, but still for other particles. Differential Revision: https://developer.blender.org/D4274
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c112
1 files changed, 22 insertions, 90 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 4e1ba003228..341a15268ef 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -857,8 +857,6 @@ void BKE_object_init(Object *ob)
ob->upflag = OB_POSZ;
}
- ob->dupon = 1; ob->dupoff = 0;
- ob->dupsta = 1; ob->dupend = 100;
ob->dupfacesca = 1.0;
ob->col_group = 0x01;
@@ -1915,8 +1913,7 @@ void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4])
* \param depsgraph: Used for dupli-frame time.
* \return success if \a mat is set.
*/
-static bool ob_parcurve(Object *ob, Object *par,
- float dupli_ctime, int dupli_transflag, float mat[4][4])
+static bool ob_parcurve(Object *ob, Object *par, float mat[4][4])
{
Curve *cu = par->data;
float vec[4], dir[3], quat[4], radius, ctime;
@@ -1936,29 +1933,19 @@ static bool ob_parcurve(Object *ob, Object *par,
return false;
}
- /* catch exceptions: curve paths used as a duplicator */
- if ((dupli_transflag & OB_DUPLINOSPEED) == 0) {
- /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
- *
- * we divide the curvetime calculated in the previous step by the length of the path, to get a time
- * factor, which then gets clamped to lie within 0.0 - 1.0 range
- */
- if (cu->pathlen) {
- ctime = cu->ctime / cu->pathlen;
- }
- else {
- ctime = cu->ctime;
- }
- CLAMP(ctime, 0.0f, 1.0f);
+ /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
+ * but this will only work if it actually is animated...
+ *
+ * we divide the curvetime calculated in the previous step by the length of the path, to get a time
+ * factor, which then gets clamped to lie within 0.0 - 1.0 range
+ */
+ if (cu->pathlen) {
+ ctime = cu->ctime / cu->pathlen;
}
else {
- ctime = dupli_ctime;
- if (cu->pathlen) {
- ctime /= cu->pathlen;
- }
- CLAMP(ctime, 0.0f, 1.0f);
+ ctime = cu->ctime;
}
+ CLAMP(ctime, 0.0f, 1.0f);
unit_m4(mat);
@@ -2145,9 +2132,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
}
}
-void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
- float dupli_ctime, int dupli_transflag,
- float parentmat[4][4])
+void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
{
float tmat[4][4];
float vec[3];
@@ -2158,7 +2143,7 @@ void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
ok = 0;
if (par->type == OB_CURVE) {
if ((((Curve *)par->data)->flag & CU_PATH) &&
- (ob_parcurve(ob, par, dupli_ctime, dupli_transflag, tmat)))
+ (ob_parcurve(ob, par, tmat)))
{
ok = 1;
}
@@ -2188,20 +2173,13 @@ void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
copy_m4_m4(parentmat, par->obmat);
break;
}
-
-}
-
-void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
-{
- BKE_object_get_parent_matrix_for_dupli(ob, par, 0, 0, parentmat);
}
/**
* \param r_originmat: Optional matrix that stores the space the object is in (without its own matrix applied)
*/
-static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float slowmat[4][4],
- float r_originmat[3][3], const bool set_origin,
- float dupli_ctime, int dupli_transflag)
+static void solve_parenting(Object *ob, Object *par, float obmat[4][4],
+ float r_originmat[3][3], const bool set_origin)
{
float totmat[4][4];
float tmat[4][4];
@@ -2209,9 +2187,7 @@ static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float sl
BKE_object_to_mat4(ob, locmat);
- if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
-
- BKE_object_get_parent_matrix_for_dupli(ob, par, dupli_ctime, dupli_transflag, totmat);
+ BKE_object_get_parent_matrix(ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
@@ -2233,29 +2209,9 @@ static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float sl
}
}
-static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
-{
- float *fp1, *fp2;
- float fac1, fac2;
- int a;
-
- /* include framerate */
- fac1 = (1.0f / (1.0f + fabsf(ob->sf)));
- if (fac1 >= 1.0f) return false;
- fac2 = 1.0f - fac1;
-
- fp1 = obmat[0];
- fp2 = slowmat[0];
- for (a = 0; a < 16; a++, fp1++, fp2++) {
- fp1[0] = fac1 * fp1[0] + fac2 * fp2[0];
- }
-
- return true;
-}
-
/* note, scene is the active scene while actual_scene is the scene the object resides in */
void BKE_object_where_is_calc_time_ex(
- Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime, int dupli_transflag,
+ Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime,
RigidBodyWorld *rbw, float r_originmat[3][3])
{
if (ob == NULL) return;
@@ -2265,19 +2221,9 @@ void BKE_object_where_is_calc_time_ex(
if (ob->parent) {
Object *par = ob->parent;
- float slowmat[4][4];
/* calculate parent matrix */
- solve_parenting(ob, par, ob->obmat, slowmat, r_originmat, true,
- ctime, dupli_transflag);
-
- /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around
- * An old-fashioned hack which probably doesn't really cut it anymore
- */
- if (ob->partype & PARSLOW) {
- if (!where_is_object_parslow(ob, ob->obmat, slowmat))
- return;
- }
+ solve_parenting(ob, par, ob->obmat, r_originmat, true);
}
else {
BKE_object_to_mat4(ob, ob->obmat);
@@ -2303,32 +2249,18 @@ void BKE_object_where_is_calc_time_ex(
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, 0, NULL, NULL);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, NULL, NULL);
}
-void BKE_object_where_is_calc_time_for_dupli(
- Depsgraph *depsgraph, Scene *scene, struct Object *ob, float ctime, int dupli_transflag)
-{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, dupli_transflag, NULL, NULL);
-}
-
-
/* get object transformation matrix without recalculating dependencies and
* constraints -- assume dependencies are already solved by depsgraph.
* no changes to object and it's parent would be done.
* used for bundles orientation in 3d space relative to parented blender camera */
void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
{
-
if (ob->parent) {
- float slowmat[4][4];
-
Object *par = ob->parent;
-
- solve_parenting(ob, par, obmat, slowmat, NULL, false, 0.0f, 0);
-
- if (ob->partype & PARSLOW)
- where_is_object_parslow(ob, obmat, slowmat);
+ solve_parenting(ob, par, obmat, NULL, false);
}
else {
BKE_object_to_mat4(ob, obmat);
@@ -2337,11 +2269,11 @@ void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, rbw, r_originmat);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), rbw, r_originmat);
}
void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, NULL, NULL);
+ BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), NULL, NULL);
}
/**