mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 21:19:18 +00:00
ExportSpriteSheet: setup text of columns/width/height when the other fields are modified
This commit is contained in:
parent
400ab0c464
commit
414427e879
@ -161,8 +161,11 @@ public:
|
|||||||
columns()->setTextf("%d", data->columns());
|
columns()->setTextf("%d", data->columns());
|
||||||
onColumnsChange();
|
onColumnsChange();
|
||||||
|
|
||||||
if (data->width() > 0) fitWidth()->getEntryWidget()->setTextf("%d", data->width());
|
if (data->width() > 0 || data->height() > 0) {
|
||||||
if (data->height() > 0) fitHeight()->getEntryWidget()->setTextf("%d", data->height());
|
if (data->width() > 0) fitWidth()->getEntryWidget()->setTextf("%d", data->width());
|
||||||
|
if (data->height() > 0) fitHeight()->getEntryWidget()->setTextf("%d", data->height());
|
||||||
|
onSizeChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
columns()->setText("4");
|
columns()->setText("4");
|
||||||
@ -233,13 +236,19 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onColumnsChange() {
|
void onColumnsChange() {
|
||||||
fitWidth()->getEntryWidget()->setTextf("");
|
int nframes = m_sprite->totalFrames();
|
||||||
fitHeight()->getEntryWidget()->setTextf("");
|
int columns = columnsValue();
|
||||||
|
columns = MID(1, columns, nframes);
|
||||||
|
int sheet_w = m_sprite->width()*columns;
|
||||||
|
int sheet_h = m_sprite->height()*((nframes/columns)+((nframes%columns)>0?1:0));
|
||||||
|
|
||||||
|
fitWidth()->getEntryWidget()->setTextf("%d", sheet_w);
|
||||||
|
fitHeight()->getEntryWidget()->setTextf("%d", sheet_h);
|
||||||
bestFit()->setSelected(false);
|
bestFit()->setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSizeChange() {
|
void onSizeChange() {
|
||||||
columns()->setTextf("");
|
columns()->setTextf("%d", fitWidthValue() / m_sprite->width());
|
||||||
bestFit()->setSelected(false);
|
bestFit()->setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user