mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Fix data recovery about sprite user data
This commit is contained in:
parent
569ff7ed7c
commit
31ae8383fb
@ -381,9 +381,23 @@ private:
|
||||
spr->setGridBounds(gridBounds);
|
||||
}
|
||||
|
||||
// Read Sprite User Data
|
||||
if (!s.eof()) {
|
||||
UserData userData = readUserData(s);
|
||||
if (!userData.isEmpty())
|
||||
spr->setUserData(userData);
|
||||
}
|
||||
|
||||
return spr.release();
|
||||
}
|
||||
|
||||
UserData readUserData(std::ifstream& s) {
|
||||
UserData userData;
|
||||
userData.setText(read_string(s));
|
||||
userData.setColor(read32(s));
|
||||
return userData;
|
||||
}
|
||||
|
||||
gfx::ColorSpaceRef readColorSpace(std::ifstream& s) {
|
||||
const gfx::ColorSpace::Type type = (gfx::ColorSpace::Type)read16(s);
|
||||
const gfx::ColorSpace::Flag flags = (gfx::ColorSpace::Flag)read16(s);
|
||||
|
@ -194,6 +194,15 @@ private:
|
||||
// Grid bounds
|
||||
writeGridBounds(s, spr->gridBounds());
|
||||
|
||||
// Write Sprite User Data
|
||||
writeUserData(s, spr->userData());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool writeUserData(std::ofstream& s, const UserData& userData) {
|
||||
write_string(s, userData.text());
|
||||
write32(s, (uint32_t)userData.color());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user