FYI, only tested when exporting FBX to OBJ.
When exporting FBX files to OBJ, the image files are not copied into the OBJ directory.
I have the following input file structure:
- C:\Users\username\AppData\Local\Temp\reprojector
- input_files
- file_1
model_1.fbx
model_1_image.jpg
model_2_image.jpg
- file_2
same structure as file_1
The below is what I expect the output to look like once I save to OBJ, note the base folder path is the same:
- C:\Users\username\AppData\Local\Temp\reprojector
- processed_files
- file_1
model_1.obj
model_1.mtl
model_1_image.jpg
model_2_image.jpg
- file_2
same structure as file_1
Instead, the output is the following:
- C:\Users\username\AppData\Local\Temp\reprojector
- processed_files
- file_1
model_1.obj
model_1.mtl
- file_2
same structure as file_1
The path to the image file within the mtl file for file_1 is as follows:
map_Kd model_1_image.jpg
map_Kd model_2_image.jpg
Clearly the .jpg files are not present within the same directory as the .mtl file, as the .mtl file suggests.
My Load/Save options use a LocalFileSystem, where I have tried using different inputs for the base directory. This only changes the location the .mtl file is saved, but the path to the .mtl file within the .obj file assumes the .mtl file is within the same directory as the .obj, even though the .mtl file is in a different directory.
I have also tried not using a LocalFileSystem, where the paths are still incorrect to the .jpg files.
My OBJ Save Options are as follows (hard coding the variables for clarity).
As a note, I have tried a combination of different values for the lookup paths & base LocalFileSystem:
var lookupPaths = new List<string> {
"@C:\Users\username\AppData\Local\Temp\reprojector\input_files\file_1\",
"@C:\Users\username\AppData\Local\Temp\reprojector\processed_files\file_1\" };
var options = new ObjSaveOptions
{
FileName = "@C:\Users\username\AppData\Local\Temp\reprojector\processed_files\file_1\model_1.obj",
Verbose = false,
EnableMaterials = true,
LookupPaths = lookupPaths,
FileSystem = new LocalFileSystem(@"C:\Users\username\AppData\Local\Temp\reprojector");
};
Are the image files not copied by Aspose?
Is the developer meant to copy the image files over manually?
Or is Aspose meant to copy the image files and something is going wrong?
Or is Aspose meant to have the full path to the input image files within the .mtl file? i.e. is the path in the .mtl meant to look something like this:
map_Kd ..\..\input_files\file_1\model_1_image.jpg
What am I doing wrong?
I don’t mind if the .jpgs are not copied, the correct path to the original .jpg (relative or absolute?) within the .mtl will suffice.
FYI saving:
scene.Save(
@C:\Users\username\AppData\Local\Temp\reprojector\processed_files\file_1\model_1.obj,
options,
cancellationToken)
Thanks,
Tom