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>2015-08-17 07:26:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-17 07:58:03 +0300
commitce2d342df5a4d82064e97dc455a5884cfc6c311a (patch)
treecbd783170b7ee159db921502af89455ba7826f09 /source
parentc58757006d17b4d0cf97ce1e3cde85fff37a5e3a (diff)
Fix T45802: View Lock w/ Curve-Parent fails
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/object.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 6aaf62d34a5..12346ab15c6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2082,17 +2082,26 @@ void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4])
/* extern */
int enable_cu_speed = 1;
-static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
+/**
+ * \param scene: Used when curve cache needs to be calculated, or for dupli-frame time.
+ * \return success if \a mat is set.
+ */
+static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
{
- Curve *cu;
+ Curve *cu = par->data;
float vec[4], dir[3], quat[4], radius, ctime;
-
- unit_m4(mat);
-
- cu = par->data;
- if (par->curve_cache == NULL) /* only happens on reload file, but violates depsgraph still... fix! */
+
+ /* only happens on reload file, but violates depsgraph still... fix! */
+ if (par->curve_cache == NULL) {
+ if (scene == NULL) {
+ return false;
+ }
BKE_displist_make_curveTypes(scene, par, 0);
- if (par->curve_cache->path == NULL) return;
+ }
+
+ if (par->curve_cache->path == NULL) {
+ return false;
+ }
/* catch exceptions: curve paths used as a duplicator */
if (enable_cu_speed) {
@@ -2112,6 +2121,11 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
CLAMP(ctime, 0.0f, 1.0f);
}
else {
+ /* For dupli-frames only */
+ if (scene == NULL) {
+ return false;
+ }
+
ctime = BKE_scene_frame_get(scene);
if (cu->pathlen) {
ctime /= cu->pathlen;
@@ -2120,6 +2134,8 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
CLAMP(ctime, 0.0f, 1.0f);
}
+ unit_m4(mat);
+
/* vec: 4 items! */
if (where_on_path(par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : NULL, &radius, NULL)) {
@@ -2153,6 +2169,8 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4])
copy_v3_v3(mat[3], vec);
}
+
+ return true;
}
static void ob_parbone(Object *ob, Object *par, float mat[4][4])
@@ -2369,8 +2387,9 @@ void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float p
case PAROBJECT:
ok = 0;
if (par->type == OB_CURVE) {
- if (scene && ((Curve *)par->data)->flag & CU_PATH) {
- ob_parcurve(scene, ob, par, tmat);
+ if ((((Curve *)par->data)->flag & CU_PATH) &&
+ (ob_parcurve(scene, ob, par, tmat)))
+ {
ok = 1;
}
}