Skip to content

Commit 78ac37c

Browse files
committed
Fixed output of texture.filename when path is empty
1 parent d09493d commit 78ac37c

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ std::string make_identifier(std::string string) {
405405

406406
// remove duplicate underscores and also from front and back
407407
auto after_underscore = true;
408-
for (auto i = 0; i < string.size(); ) {
408+
for (auto i = 0u; i < string.size(); ) {
409409
if (string[i] == '_') {
410410
if (after_underscore) {
411411
string.erase(i, 1);

src/output_description.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ namespace {
165165
json_texture["spriteIndices"] = slice_sprites[slice.index];
166166
json_texture["path"] = path_to_utf8(settings.output_path);
167167
json_texture["filename"] = path_to_utf8(
168-
std::filesystem::relative(texture.filename, settings.output_path));
168+
settings.output_path.empty() ? texture.filename :
169+
std::filesystem::relative(texture.filename, settings.output_path));
169170
json_texture["scale"] = output.scale;
170171
json_texture["width"] = to_int(slice.width * output.scale);
171172
json_texture["height"] = to_int(slice.height * output.scale);

src/pack_binpack.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ void pack_binpack(const SheetPtr& sheet_ptr, SpriteSpan sprites,
3838

3939
// update sprite rects
4040
auto slice_index = 0;
41-
auto packed_sprites = size_t{ };
4241
for (const auto& pack_sheet : pack_sheets) {
4342
for (const auto& pack_rect : pack_sheet.rects) {
4443
auto& sprite = sprites[to_unsigned(pack_rect.id)];
4544
sprite.rotated = pack_rect.rotated;
4645
sprite.slice_index = slice_index;
4746
sprite.trimmed_rect.x = pack_rect.x;
4847
sprite.trimmed_rect.y = pack_rect.y;
49-
++packed_sprites;
5048
}
5149
++slice_index;
5250
}

0 commit comments

Comments
 (0)