Load and Save Options — Aspose.3D FOSS for Java
Properties
所有导入和导出操作都接受一个可选的 options 对象,派生自 LoadOptions 或 SaveOptions. 将适当的子类传递给 Scene.open() 或 Scene.save() 以控制特定格式的行为。.
Properties: com.aspose.threed
import com.aspose.threed.*;LoadOptions
所有 load-option 对象的基类。Extends A3DObject.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | 此配置关联的格式(只读) |
SaveOptions
所有 save-option 对象的基类。Extends A3DObject.
| Properties | Properties | Properties | Properties |
|---|---|---|---|
fileFormat | FileFormat | getFileFormat() | 此配置关联的格式(只读) |
ObjLoadOptions
Wavefront OBJ 文件的加载选项(.obj).
import com.aspose.threed.*;
ObjLoadOptions opts = new ObjLoadOptions();
opts.setFlipCoordinateSystem(true);
opts.setScale(0.01);
Scene scene = new Scene();
scene.open("model.obj", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 导入时翻转坐标系 |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | 加载随附的 .mtl 材质文件 |
scale | double | getScale() | setScale(double) | 1.0 | 对所有导入的几何体应用统一缩放 |
normalizeNormal | boolean | getNormalizeNormal() | setNormalizeNormal(boolean) | true | 将导入的法向量归一化为单位长度 |
ObjSaveOptions
Wavefront OBJ 文件的保存选项。.
import com.aspose.threed.*;
ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
applyUnitScale | boolean | getApplyUnitScale() | setApplyUnitScale(boolean) | false | 将场景的单位缩放因子应用于导出的坐标 |
pointCloud | boolean | getPointCloud() | setPointCloud(boolean) | false | 仅导出顶点(不包括多边形面) |
verbose | boolean | getVerbose() | setVerbose(boolean) | false | 在输出中包含额外的 OBJ 注释 |
serializeW | boolean | getSerializeW() | setSerializeW(boolean) | false | 写入控制点的 W 分量 |
enableMaterials | boolean | getEnableMaterials() | setEnableMaterials(boolean) | true | 写入 a .mtl 材质文件并从中引用它 .obj |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 在导出时翻转坐标系 |
GltfLoadOptions
加载 glTF 2.0 和 GLB 文件的选项(.gltf, .glb).
import com.aspose.threed.*;
GltfLoadOptions opts = new GltfLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("model.gltf", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 在导入时翻转坐标系 |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | 格式化输出 JSON,使其带有缩进以提高可读性 |
GltfSaveOptions
glTF 2.0 和 GLB 输出的保存选项。.
import com.aspose.threed.*;
import com.aspose.threed.FileContentType;
// Save as glTF JSON
GltfSaveOptions opts = new GltfSaveOptions();
scene.save("output.gltf", opts);
// Save as GLB (binary glTF)
GltfSaveOptions glbOpts = new GltfSaveOptions();
glbOpts.setContentType(FileContentType.BINARY);
scene.save("output.glb", glbOpts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.ASCII | 设置为 FileContentType.BINARY 以生成一个自包含的 GLB 文件;设置为 FileContentType.ASCII 用于 JSON .gltf 使用外部缓冲区 |
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 在导出时翻转坐标系 |
prettyPrint | boolean | getPrettyPrint() | setPrettyPrint(boolean) | false | 使用缩进格式化输出 JSON,以提高可读性 |
bufferFilePrefix | String | getBufferFilePrefix() | setBufferFilePrefix(String) | null | 外部缓冲区文件名的前缀 |
saveExtras | String | getSaveExtras() | setSaveExtras(String) | null | 在 glTF 输出中包含的自定义 extras 数据 |
StlLoadOptions
STL 文件的加载选项(.stl).
import com.aspose.threed.*;
StlLoadOptions opts = new StlLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("part.stl", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 导入时翻转坐标系 |
recalculateNormal | boolean | getRecalculateNormal() | setRecalculateNormal(boolean) | false | 导入时根据几何体重新计算法线 |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | – | 二进制与 ASCII STL 检测的提示 |
StlSaveOptions
STL 输出的保存选项。.
import com.aspose.threed.*;
StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 导出时翻转坐标系 |
axisSystem | AxisSystem | getAxisSystem() | setAxisSystem(AxisSystem) | – | 导出时覆盖目标轴系 |
contentType | FileContentType | getContentType() | setContentType(FileContentType) | FileContentType.BINARY | 设置为 BINARY 或 ASCII 用于控制输出格式 |
FbxLoadOptions
加载 FBX 文件的选项(.fbx).
import com.aspose.threed.*;
FbxLoadOptions opts = new FbxLoadOptions();
opts.setFlipCoordinateSystem(true);
Scene scene = new Scene();
scene.open("animation.fbx", opts);| Properties | Properties | Properties | Properties | Properties | Properties |
|---|---|---|---|---|---|
flipCoordinateSystem | boolean | getFlipCoordinateSystem() | setFlipCoordinateSystem(boolean) | false | 导入时翻转坐标系 |
FbxSaveOptions
注意:: FBX 导出是 不可用 在 Java FOSS 版中。FBX 仅支持导入。该 FbxSaveOptions class 在 API 中存在,但如果用于保存会产生错误。请改用 OBJ、STL、glTF 或 GLB 进行导出。.