Fixed the lag with Follow Path and optimized constraint loops with Track To and Lock...
authorMartin Poirier <theeth@yahoo.com>
Thu, 13 Nov 2003 23:04:46 +0000 (23:04 +0000)
committerMartin Poirier <theeth@yahoo.com>
Thu, 13 Nov 2003 23:04:46 +0000 (23:04 +0000)
This is a temporary fix, but a complete fix will require a rewrite of of some part of the where_is_object function, and that would take too much time before 2.31.

source/blender/blenkernel/intern/constraint.c
source/blender/makesdna/DNA_constraint_types.h
source/blender/src/editconstraint.c

index 6dbbf0d1697be261b87b643557bd656164ed7f37..10e2975934727ffe3b0d76776edeab06132bc770 100644 (file)
@@ -483,6 +483,9 @@ short get_constraint_target (bConstraint *con, short ownertype, void* ownerdata,
                        data = (bTrackToConstraint*)con->data;
 
                        if (data->tar){
+                               // Refresh the object if it isn't a constraint loop
+                               if (!(con->flag & CONSTRAINT_NOREFRESH))
+                                       where_is_object_time (data->tar, ctime);        
                                constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
                                valid=1;
                        }
@@ -511,6 +514,10 @@ short get_constraint_target (bConstraint *con, short ownertype, void* ownerdata,
                        data = (bLockTrackConstraint*)con->data;
 
                        if (data->tar){
+                               // Refresh the object if it isn't a constraint loop
+                               if (!(con->flag & CONSTRAINT_NOREFRESH))
+                                       where_is_object_time (data->tar, ctime);        
+
                                constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
                                valid=1;
                        }
@@ -528,6 +535,8 @@ short get_constraint_target (bConstraint *con, short ownertype, void* ownerdata,
                                float q[4], vec[4], dir[3], *quat, x1, totmat[4][4];
                                float curvetime;
 
+                               where_is_object_time (data->tar, ctime);        
+
                                Mat4One (totmat);
 
                                cu= data->tar->data;
index 7cd0272a8cbc0520cbef37d2eb7ea572c3047dcc..1fb28fb8d87d6a7f0b7932a1623b707b0c8ae2ef 100644 (file)
@@ -154,6 +154,7 @@ typedef struct bRotationConstraint{
 #define CONSTRAINT_DONE                        0x00000002
 #define CONSTRAINT_DISABLE             0x00000004
 #define CONSTRAINT_LOOPTESTED  0x00000008
+#define CONSTRAINT_NOREFRESH   0x00000010
 
 #define CONSTRAINT_EXPAND_BIT  0
 #define CONSTRAINT_DONE_BIT            1
index 947afad4c55ea47faa88c2142a766744b0c3a6a6..700ff38d8dbf66e79f5591052a5dca8f136cf1f8 100644 (file)
@@ -501,6 +501,9 @@ static short detect_constraint_loop (Object *owner, const char* substring, int d
                                                                //      return 1;
                                                        }
                                                }
+                                               if (typefrom == CONSTRAINT_TYPE_TRACKTO && typefrom == CONSTRAINT_TYPE_LOCKTRACK){
+                                                       curcon->flag |= CONSTRAINT_NOREFRESH;
+                                               }
                                                if (detect_constraint_loop (data->tar, data->subtarget, disable, CONSTRAINT_TYPE_TRACKTO)){
                                                        curcon->flag |= CONSTRAINT_DISABLE;
                                                        result = 1;
@@ -538,6 +541,9 @@ static short detect_constraint_loop (Object *owner, const char* substring, int d
                                                                //              return 1;
                                                        }
                                                }
+                                               if (typefrom == CONSTRAINT_TYPE_TRACKTO && typefrom == CONSTRAINT_TYPE_LOCKTRACK){
+                                                       curcon->flag |= CONSTRAINT_NOREFRESH;
+                                               }
                                                if (detect_constraint_loop (data->tar, data->subtarget, disable, CONSTRAINT_TYPE_LOCKTRACK)){
                                                        curcon->flag |= CONSTRAINT_DISABLE;
                                                        result = 1;