Fixed the lag with Follow Path and optimized constraint loops with Track To and Lock Track. I was plainly disabling the refresh of the target, but that caused a lag (3D window, not Render). Now, it raises a flag when it find a loop, so it only disables the refreshing when it needs to.
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user