Add SubAssetFolder to model import option to redirect auto-imported materials and textures location
This commit is contained in:
@@ -124,7 +124,8 @@ CreateAssetResult ImportModelFile::Import(CreateAssetContext& context)
|
||||
// Import model file
|
||||
ModelData modelData;
|
||||
String errorMsg;
|
||||
String autoImportOutput = String(StringUtils::GetDirectoryName(context.TargetAssetPath)) / StringUtils::GetFileNameWithoutExtension(context.InputPath);
|
||||
String autoImportOutput(StringUtils::GetDirectoryName(context.TargetAssetPath));
|
||||
autoImportOutput /= options.SubAssetFolder.HasChars() ? options.SubAssetFolder.TrimTrailing() : StringUtils::GetFileNameWithoutExtension(context.InputPath);
|
||||
if (ModelTool::ImportModel(context.InputPath, modelData, options, errorMsg, autoImportOutput))
|
||||
{
|
||||
LOG(Error, "Cannot import model file. {0}", errorMsg);
|
||||
|
||||
@@ -396,6 +396,7 @@ void ModelTool::Options::Serialize(SerializeStream& stream, const void* otherObj
|
||||
SERIALIZE(SDFResolution);
|
||||
SERIALIZE(SplitObjects);
|
||||
SERIALIZE(ObjectIndex);
|
||||
SERIALIZE(SubAssetFolder);
|
||||
}
|
||||
|
||||
void ModelTool::Options::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
|
||||
@@ -441,6 +442,7 @@ void ModelTool::Options::Deserialize(DeserializeStream& stream, ISerializeModifi
|
||||
DESERIALIZE(SDFResolution);
|
||||
DESERIALIZE(SplitObjects);
|
||||
DESERIALIZE(ObjectIndex);
|
||||
DESERIALIZE(SubAssetFolder);
|
||||
|
||||
// [Deprecated on 23.11.2021, expires on 21.11.2023]
|
||||
int32 AnimationIndex = -1;
|
||||
|
||||
@@ -370,6 +370,12 @@ public:
|
||||
API_FIELD(Attributes="EditorOrder(2010), EditorDisplay(\"Splitting\")")
|
||||
int32 ObjectIndex = -1;
|
||||
|
||||
public: // Other
|
||||
|
||||
// If specified, will be used as sub-directory name for automatically imported sub assets such as textures and materials. Set to whitespace (single space) to import to the same directory.
|
||||
API_FIELD(Attributes="EditorOrder(3030), EditorDisplay(\"Other\")")
|
||||
String SubAssetFolder = TEXT("");
|
||||
|
||||
// Runtime data for objects splitting during import (used internally)
|
||||
void* SplitContext = nullptr;
|
||||
Function<bool(Options& splitOptions, const String& objectName)> OnSplitImport;
|
||||
|
||||
Reference in New Issue
Block a user