mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[c][cpp] Scale IK constraint and timeline data. See #1383.
This commit is contained in:
parent
ea60082019
commit
49dd7c97d0
@ -302,7 +302,7 @@ static spAnimation* _spSkeletonJson_readAnimation (spSkeletonJson* self, Json* r
|
||||
}
|
||||
}
|
||||
for (valueMap = constraintMap->child, frameIndex = 0; valueMap; valueMap = valueMap->next, ++frameIndex) {
|
||||
spIkConstraintTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "mix", 1), Json_getFloat(valueMap, "softness", 0),
|
||||
spIkConstraintTimeline_setFrame(timeline, frameIndex, Json_getFloat(valueMap, "time", 0), Json_getFloat(valueMap, "mix", 1), Json_getFloat(valueMap, "softness", 0) * self->scale,
|
||||
Json_getInt(valueMap, "bendPositive", 1) ? 1 : -1, Json_getInt(valueMap, "compress", 0) ? 1 : 0, Json_getInt(valueMap, "stretch", 0) ? 1 : 0);
|
||||
readCurve(valueMap, SUPER(timeline), frameIndex);
|
||||
}
|
||||
@ -753,7 +753,7 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
|
||||
data->stretch = Json_getInt(constraintMap, "stretch", 0) ? 1 : 0;
|
||||
data->uniform = Json_getInt(constraintMap, "uniform", 0) ? 1 : 0;
|
||||
data->mix = Json_getFloat(constraintMap, "mix", 1);
|
||||
data->softness = Json_getFloat(constraintMap, "softness", 0);
|
||||
data->softness = Json_getFloat(constraintMap, "softness", 0) * self->scale;
|
||||
|
||||
skeletonData->ikConstraints[i] = data;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
||||
}
|
||||
data->_target = skeletonData->_bones[readVarint(input, true)];
|
||||
data->_mix = readFloat(input);
|
||||
data->_softness = readFloat(input);
|
||||
data->_softness = readFloat(input) * _scale;
|
||||
data->_bendDirection = readSByte(input);
|
||||
data->_compress = readBoolean(input);
|
||||
data->_stretch = readBoolean(input);
|
||||
@ -810,7 +810,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||
float time = readFloat(input);
|
||||
float mix = readFloat(input);
|
||||
float softness = readFloat(input);
|
||||
float softness = readFloat(input) * _scale;
|
||||
signed char bendDirection = readSByte(input);
|
||||
bool compress = readBoolean(input);
|
||||
bool stretch = readBoolean(input);
|
||||
|
||||
@ -292,7 +292,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
|
||||
}
|
||||
|
||||
data->_mix = Json::getFloat(constraintMap, "mix", 1);
|
||||
data->_softness = Json::getFloat(constraintMap, "softness", 0);
|
||||
data->_softness = Json::getFloat(constraintMap, "softness", 0) * _scale;
|
||||
data->_bendDirection = Json::getInt(constraintMap, "bendPositive", 1) ? 1 : -1;
|
||||
data->_compress = Json::getInt(constraintMap, "compress", 0) ? true: false;
|
||||
data->_stretch = Json::getInt(constraintMap, "stretch", 0) ? true: false;
|
||||
@ -1005,7 +1005,7 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
||||
}
|
||||
}
|
||||
for (valueMap = constraintMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
||||
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), Json::getFloat(valueMap, "mix", 1), Json::getFloat(valueMap, "softness", 0),
|
||||
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), Json::getFloat(valueMap, "mix", 1), Json::getFloat(valueMap, "softness", 0) * _scale,
|
||||
Json::getInt(valueMap, "bendPositive", 1) ? 1 : -1, Json::getInt(valueMap, "compress", 0) ? true : false, Json::getInt(valueMap, "stretch", 0) ? true : false);
|
||||
readCurve(valueMap, timeline, frameIndex);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user