Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 338a108

Browse files
committed
cli: set nomip flag when there are no mips
1 parent 71e05fc commit 338a108

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/cli/action_convert.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ bool ActionConvert::process_file(
281281
const auto verStr = opts.get<std::string>(opts::version);
282282
const auto isNormal = opts.get<bool>(opts::normal);
283283

284-
const auto nomips = opts.get<bool>(opts::nomips);
285-
this->m_mips = nomips ? 1 : std::max(opts.get<int>(opts::mips), 1);
284+
auto nomips = opts.get<bool>(opts::nomips);
285+
m_mips = nomips ? 1 : std::max(opts.get<int>(opts::mips), 1);
286286

287287
m_width = opts.get<int>(opts::width);
288288
m_height = opts.get<int>(opts::height);
@@ -478,6 +478,10 @@ bool ActionConvert::set_properties(VTFLib::CVTFFile* vtfFile) {
478478
if (m_opts->get<bool>(opts::srgb))
479479
vtfFile->SetFlag(TEXTUREFLAGS_SRGB, true);
480480

481+
// Mip count gets set earlier by user input
482+
if (vtfFile->GetMipmapCount() == 1)
483+
vtfFile->SetFlag(TEXTUREFLAGS_NOMIP, true);
484+
481485
// Same deal for the below issues- only override default if specified
482486
if (m_opts->has(opts::startframe))
483487
vtfFile->SetStartFrame(m_opts->get<int>(opts::startframe));

0 commit comments

Comments
 (0)