summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorleo2005-06-02 21:49:24 +0000
committerleo2005-06-02 21:49:24 +0000
commit5b217f8219049830630c8f6ecf8e6d6257962288 (patch)
tree580808229a2687c7d948a6b29cda65db08831b59 /common
parent03704039b0a228bc36ea208ac4ca2a0a40471576 (diff)
Fixed copying keys from instructions to animations.
git-svn-id: http://svn.leocad.org/trunk@399 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common')
-rwxr-xr-xcommon/object.cpp71
1 files changed, 37 insertions, 34 deletions
diff --git a/common/object.cpp b/common/object.cpp
index d229388..cdcb107 100755
--- a/common/object.cpp
+++ b/common/object.cpp
@@ -295,40 +295,43 @@ void Object::CalculateKeys (unsigned short nTime, bool bAnimation)
void Object::CalculateSingleKey (unsigned short nTime, bool bAnimation, int keytype, float *value) const
{
- LC_OBJECT_KEY *next = NULL, *prev = NULL, *node;
-
- if (bAnimation)
- node = m_pAnimationKeys;
- else
- node = m_pInstructionKeys;
-
- while (node)
- {
- if (node->time <= nTime)
- prev = node;
- else
- {
- if (next == NULL)
- {
- next = node;
- break;
- }
- }
-
- node = node->next;
- }
-
- // TODO: USE KEY IN/OUT WEIGHTS
- if (bAnimation && (next != NULL) && (prev->time != nTime))
- {
- float t = (float)(nTime - prev->time)/(next->time - prev->time);
-
- for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
- value[j] = prev->param[j] + (next->param[j] - prev->param[j])*t;
- }
- else
- for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
- value[j] = prev->param[j];
+ LC_OBJECT_KEY *next = NULL, *prev = NULL, *node;
+
+ if (bAnimation)
+ node = m_pAnimationKeys;
+ else
+ node = m_pInstructionKeys;
+
+ while (node)
+ {
+ if (node->type == keytype)
+ {
+ if (node->time <= nTime)
+ prev = node;
+ else
+ {
+ if (next == NULL)
+ {
+ next = node;
+ break;
+ }
+ }
+ }
+
+ node = node->next;
+ }
+
+ // TODO: USE KEY IN/OUT WEIGHTS
+ if (bAnimation && (next != NULL) && (prev->time != nTime))
+ {
+ float t = (float)(nTime - prev->time)/(next->time - prev->time);
+
+ for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
+ value[j] = prev->param[j] + (next->param[j] - prev->param[j])*t;
+ }
+ else
+ for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
+ value[j] = prev->param[j];
}
void Object::InsertTime (unsigned short start, bool animation, unsigned short time)