2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-12 11:37:27 +00:00

feat: verbose option sets log level to debug

This commit is contained in:
Jan Laupetin
2025-09-11 22:17:56 +02:00
parent 02f20f09b6
commit d693ace12f
13 changed files with 29 additions and 57 deletions

View File

@@ -79,8 +79,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
};
ImageConverterArgs::ImageConverterArgs()
: m_verbose(false),
m_game_to_convert_to(image_converter::Game::UNKNOWN),
: m_game_to_convert_to(image_converter::Game::UNKNOWN),
m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
{
}
@@ -105,11 +104,6 @@ void ImageConverterArgs::PrintVersion()
con::info("OpenAssetTools ImageConverter {}", GIT_VERSION);
}
void ImageConverterArgs::SetVerbose(const bool isVerbose)
{
m_verbose = isVerbose;
}
bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
@@ -144,7 +138,10 @@ bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shou
}
// -v; --verbose
SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE));
if (m_argument_parser.IsOptionSpecified(OPTION_VERBOSE))
con::globalLogLevel = con::LogLevel::DEBUG;
else
con::globalLogLevel = con::LogLevel::INFO;
return true;
}

View File

@@ -25,7 +25,6 @@ public:
ImageConverterArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);
bool m_verbose;
std::vector<std::string> m_files_to_convert;
image_converter::Game m_game_to_convert_to;
@@ -36,7 +35,5 @@ private:
static void PrintUsage();
static void PrintVersion();
void SetVerbose(bool isVerbose);
ArgumentParser m_argument_parser;
};

View File

@@ -129,8 +129,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
};
LinkerArgs::LinkerArgs()
: m_verbose(false),
m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
{
}
@@ -160,13 +159,6 @@ void LinkerArgs::SetBinFolder()
m_bin_folder = path.parent_path().string();
}
void LinkerArgs::SetVerbose(const bool isVerbose)
{
m_verbose = isVerbose;
ObjLoading::Configuration.Verbose = isVerbose;
ObjWriting::Configuration.Verbose = isVerbose;
}
bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
{
shouldContinue = true;
@@ -203,7 +195,10 @@ bool LinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContin
}
// -v; --verbose
SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE));
if (m_argument_parser.IsOptionSpecified(OPTION_VERBOSE))
con::globalLogLevel = con::LogLevel::DEBUG;
else
con::globalLogLevel = con::LogLevel::INFO;
// b; --base-folder
if (m_argument_parser.IsOptionSpecified(OPTION_BASE_FOLDER))

View File

@@ -17,8 +17,6 @@ public:
LinkerArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);
bool m_verbose;
std::vector<std::string> m_zones_to_load;
std::vector<std::string> m_project_specifiers_to_build;
@@ -38,7 +36,6 @@ private:
static void PrintVersion();
void SetBinFolder();
void SetVerbose(bool isVerbose);
ArgumentParser m_argument_parser;
};

View File

@@ -6,7 +6,6 @@ public:
static class Configuration_t
{
public:
bool Verbose = false;
bool MenuPermissiveParsing = false;
bool MenuNoOptimization = false;
} Configuration;

View File

@@ -26,14 +26,11 @@ void AbstractMaterialConstantZoneState::ExtractNamesFromZone()
const auto end = std::chrono::high_resolution_clock::now();
if (ObjWriting::Configuration.Verbose)
{
const auto durationInMs = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin);
con::debug("Built material constant name lookup in {}ms: {} constant names; {} texture def names",
durationInMs.count(),
m_constant_names_from_shaders.size(),
m_texture_def_names_from_shaders.size());
}
}
bool AbstractMaterialConstantZoneState::GetConstantName(const unsigned hash, std::string& constantName) const

View File

@@ -26,7 +26,6 @@ public:
GLB
};
bool Verbose = false;
std::vector<bool> AssetTypesToHandleBitfield;
ImageOutputFormat_e ImageOutputFormat = ImageOutputFormat_e::DDS;

View File

@@ -65,8 +65,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
};
RawTemplaterArguments::RawTemplaterArguments()
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
m_verbose(false)
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>)
{
}
@@ -120,7 +119,10 @@ bool RawTemplaterArguments::ParseArgs(const int argc, const char** argv, bool& s
}
// -v; --verbose
m_verbose = m_argument_parser.IsOptionSpecified(OPTION_VERBOSE);
if (m_argument_parser.IsOptionSpecified(OPTION_VERBOSE))
con::globalLogLevel = con::LogLevel::DEBUG;
else
con::globalLogLevel = con::LogLevel::INFO;
// -o; --output
if (m_argument_parser.IsOptionSpecified(OPTION_OUTPUT_FOLDER))

View File

@@ -17,8 +17,6 @@ class RawTemplaterArguments
static void PrintVersion();
public:
bool m_verbose;
std::vector<std::string> m_input_files;
std::string m_output_directory;

View File

@@ -146,8 +146,7 @@ UnlinkerArgs::UnlinkerArgs()
m_minimal_zone_def(false),
m_asset_type_handling(AssetTypeHandling::EXCLUDE),
m_skip_obj(false),
m_use_gdt(false),
m_verbose(false)
m_use_gdt(false)
{
}
@@ -171,13 +170,6 @@ void UnlinkerArgs::PrintVersion()
con::info("OpenAssetTools Unlinker {}", GIT_VERSION);
}
void UnlinkerArgs::SetVerbose(const bool isVerbose)
{
m_verbose = isVerbose;
ObjLoading::Configuration.Verbose = isVerbose;
ObjWriting::Configuration.Verbose = isVerbose;
}
bool UnlinkerArgs::SetImageDumpingMode() const
{
auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_IMAGE_FORMAT);
@@ -303,7 +295,10 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldCont
}
// -v; --verbose
SetVerbose(m_argument_parser.IsOptionSpecified(OPTION_VERBOSE));
if (m_argument_parser.IsOptionSpecified(OPTION_VERBOSE))
con::globalLogLevel = con::LogLevel::DEBUG;
else
con::globalLogLevel = con::LogLevel::INFO;
// -min; --minimal-zone
m_minimal_zone_def = m_argument_parser.IsOptionSpecified(OPTION_MINIMAL_ZONE_FILE);

View File

@@ -24,8 +24,6 @@ private:
*/
void PrintUsage() const;
static void PrintVersion();
void SetVerbose(bool isVerbose);
bool SetImageDumpingMode() const;
bool SetModelDumpingMode() const;
@@ -60,8 +58,6 @@ public:
bool m_skip_obj;
bool m_use_gdt;
bool m_verbose;
UnlinkerArgs();
bool ParseArgs(int argc, const char** argv, bool& shouldContinue);

View File

@@ -122,7 +122,6 @@ ZoneCodeGeneratorArguments::ZoneCodeGeneratorArguments()
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
m_task_flags(0u)
{
m_verbose = false;
}
void ZoneCodeGeneratorArguments::PrintUsage() const
@@ -166,7 +165,10 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
}
// -v; --verbose
m_verbose = m_argument_parser.IsOptionSpecified(OPTION_VERBOSE);
if (m_argument_parser.IsOptionSpecified(OPTION_VERBOSE))
con::globalLogLevel = con::LogLevel::DEBUG;
else
con::globalLogLevel = con::LogLevel::INFO;
// -p; --print
if (m_argument_parser.IsOptionSpecified(OPTION_PRINT))

View File

@@ -26,8 +26,6 @@ public:
[[nodiscard]] bool ShouldGenerate() const;
[[nodiscard]] bool ShouldPrint() const;
bool m_verbose;
std::vector<std::string> m_header_paths;
std::vector<std::string> m_command_paths;
std::string m_output_directory;