mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 15:28:11 -05:00
Dump IW4 xmodels as obj
This commit is contained in:
@ -66,6 +66,13 @@ const CommandLineOption* const OPTION_IMAGE_FORMAT =
|
||||
.WithParameter("imageFormatValue")
|
||||
.Build();
|
||||
|
||||
const CommandLineOption* const OPTION_MODEL_FORMAT =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithLongName("model-format")
|
||||
.WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ")
|
||||
.WithParameter("modelFormatValue")
|
||||
.Build();
|
||||
|
||||
const CommandLineOption* const OPTION_GDT =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithLongName("gdt")
|
||||
@ -82,6 +89,7 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]
|
||||
OPTION_OUTPUT_FOLDER,
|
||||
OPTION_SEARCH_PATH,
|
||||
OPTION_IMAGE_FORMAT,
|
||||
OPTION_MODEL_FORMAT,
|
||||
OPTION_GDT
|
||||
};
|
||||
|
||||
@ -140,6 +148,29 @@ bool UnlinkerArgs::SetImageDumpingMode()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnlinkerArgs::SetModelDumpingMode()
|
||||
{
|
||||
auto specifiedValue = m_argument_parser.GetValueForOption(OPTION_MODEL_FORMAT);
|
||||
for (auto& c : specifiedValue)
|
||||
c = static_cast<char>(tolower(c));
|
||||
|
||||
if (specifiedValue == "xmodel_export")
|
||||
{
|
||||
ObjWriting::Configuration.ModelOutputFormat = ObjWriting::Configuration_t::ModelOutputFormat_e::XMODEL_EXPORT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (specifiedValue == "obj")
|
||||
{
|
||||
ObjWriting::Configuration.ModelOutputFormat = ObjWriting::Configuration_t::ModelOutputFormat_e::XMODEL_EXPORT;
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::string originalValue = m_argument_parser.GetValueForOption(OPTION_MODEL_FORMAT);
|
||||
printf("Illegal value: \"%s\" is not a valid model output format. Use -? to see usage information.\n", originalValue.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
{
|
||||
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
|
||||
@ -203,6 +234,15 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
// --model-format
|
||||
if (m_argument_parser.IsOptionSpecified(OPTION_MODEL_FORMAT))
|
||||
{
|
||||
if (!SetModelDumpingMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --gdt
|
||||
m_use_gdt = m_argument_parser.IsOptionSpecified(OPTION_GDT);
|
||||
|
||||
|
Reference in New Issue
Block a user