Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spine binary data read issue. #4229

Merged
merged 2 commits into from Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 21 additions & 9 deletions cocos/editor-support/spine/SkeletonBinary.cpp
Expand Up @@ -487,19 +487,31 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo
case AttachmentType_Region: {
String path(readStringRef(input, skeletonData));
if (path.isEmpty()) path = name;
auto rotation = readFloat(input);
auto x = readFloat(input);
auto y = readFloat(input);
auto scaleX = readFloat(input);
auto scaleY = readFloat(input);
auto width = readFloat(input);
auto height = readFloat(input);

static Color color;
readColor(input, color);

RegionAttachment *region = _attachmentLoader->newRegionAttachment(*skin, String(name), String(path));
if (region == NULL){
return NULL;
return NULL;
}

region->_path = path;
region->_rotation = readFloat(input);
region->_x = readFloat(input) * _scale;
region->_y = readFloat(input) * _scale;
region->_scaleX = readFloat(input);
region->_scaleY = readFloat(input);
region->_width = readFloat(input) * _scale;
region->_height = readFloat(input) * _scale;
readColor(input, region->getColor());
region->_rotation = rotation;
region->_x = x * _scale;
region->_y = y * _scale;
region->_scaleX = scaleX;
region->_scaleY = scaleY;
region->_width = width * _scale;
region->_height = height * _scale;
region->_color = color;
region->updateOffset();
_attachmentLoader->configureAttachment(region);
return region;
Expand Down