Load and Save Options

Load and Save Options — Aspose.3D FOSS for Java

Properties

Wszystkie operacje importu i eksportu akceptują opcjonalny obiekt opcji pochodzący z LoadOptions lub SaveOptions. Przekaż odpowiednią podklasę do Scene.open() lub Scene.save() aby kontrolować zachowanie specyficzne dla formatu.

Properties: com.aspose.threed

import com.aspose.threed.*;

LoadOptions

Klasa bazowa dla wszystkich obiektów opcji ładowania. Rozszerza A3DObject.

PropertiesPropertiesPropertiesProperties
fileFormatFileFormatgetFileFormat()Format, z którym powiązana jest ta konfiguracja (tylko do odczytu)

SaveOptions

Klasa bazowa dla wszystkich obiektów opcji zapisu. Rozszerza A3DObject.


ObjLoadOptions

Opcje ładowania dla plików Wavefront OBJ (.obj).

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`    | Odwróć układ współrzędnych przy imporcie                         |
| `enableMaterials`      | `boolean`  | `getEnableMaterials()`      | `setEnableMaterials(boolean)`      | `true`     | Załaduj dołączony `.mtl` plik materiału                          |
| `scale`                | `double`   | `getScale()`                | `setScale(double)`                 | `1.0`      | Jednolita skala zastosowana do całej importowanej geometrii      |
| `normalizeNormal`      | `boolean`  | `getNormalizeNormal()`      | `setNormalizeNormal(boolean)`      | `true`     | Normalizuj importowane wektory normalne do długości jednostkowej |

---

## ObjSaveOptions

Opcje zapisu dla plików Wavefront OBJ.



ObjSaveOptions opts = new ObjSaveOptions();
opts.setEnableMaterials(false);
scene.save("output.obj", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
applyUnitScalebooleangetApplyUnitScale()setApplyUnitScale(boolean)falseZastosuj współczynnik skali jednostkowej sceny do wyeksportowanych współrzędnych
pointCloudbooleangetPointCloud()setPointCloud(boolean)falseEksportuj tylko wierzchołki (bez ścian wielokątów)
verbosebooleangetVerbose()setVerbose(boolean)falseDołącz dodatkowe komentarze OBJ w wyjściu
serializeWbooleangetSerializeW()setSerializeW(boolean)falseZapisz komponent W punktów kontrolnych
enableMaterialsbooleangetEnableMaterials()setEnableMaterials(boolean)trueNapisz .mtl plik materiałowy i odwołaj się do niego z .obj
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseOdwróć układ współrzędnych przy eksporcie

GltfLoadOptions

Wczytaj opcje dla plików glTF 2.0 i GLB (.gltf, .glb).

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`    | Odwróć układ współrzędnych przy imporcie            |
| `prettyPrint`          | `boolean`  | `getPrettyPrint()`          | `setPrettyPrint(boolean)`          | `false`    | Formatuj wyjściowy JSON z wcięciami dla czytelności |

---

## GltfSaveOptions

Opcje zapisu dla wyjścia glTF 2.0 i GLB.

```java
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);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.ASCIIUstaw na FileContentType.BINARY aby wygenerować samodzielny plik GLB; ustaw na FileContentType.ASCII dla JSON .gltf z zewnętrznym buforem
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseOdwróć system współrzędnych przy eksporcie
prettyPrintbooleangetPrettyPrint()setPrettyPrint(boolean)falseFormatuj wyjściowy JSON z wcięciami dla czytelności
bufferFilePrefixStringgetBufferFilePrefix()setBufferFilePrefix(String)nullPrefiks dla nazw plików zewnętrznego bufora
saveExtrasStringgetSaveExtras()setSaveExtras(String)nullNiestandardowe dodatkowe dane do uwzględnienia w wyjściu glTF

StlLoadOptions

Opcje ładowania dla plików STL (.stl).

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`    | Odwróć układ współrzędnych przy imporcie                     |
| `recalculateNormal`    | `boolean`         | `getRecalculateNormal()`    | `setRecalculateNormal(boolean)`    | `false`    | Przelicz ponownie wektory normalne z geometrii przy imporcie |
| `contentType`          | `FileContentType` | `getContentType()`          | `setContentType(FileContentType)`  | --         | Wskazówka dla wykrywania binarnego vs ASCII STL              |

---

## StlSaveOptions

Opcje zapisu dla wyjścia STL.



StlSaveOptions opts = new StlSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.stl", opts);
PropertiesPropertiesPropertiesPropertiesPropertiesProperties
flipCoordinateSystembooleangetFlipCoordinateSystem()setFlipCoordinateSystem(boolean)falseOdwróć układ współrzędnych przy eksporcie
axisSystemAxisSystemgetAxisSystem()setAxisSystem(AxisSystem)Zastąp docelowy układ osi przy eksporcie
contentTypeFileContentTypegetContentType()setContentType(FileContentType)FileContentType.BINARYUstaw na BINARY lub ASCII aby kontrolować format wyjściowy

FbxLoadOptions

Wczytaj opcje dla plików FBX (.fbx).

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`    | Odwróć układ współrzędnych przy imporcie |

---

## FbxSaveOptions

**Uwaga:** Eksport FBX jest **niedostępny** w edycji Java FOSS. FBX jest obsługiwany wyłącznie do importu. The `FbxSaveOptions` klasa istnieje w API, ale spowoduje błąd, jeśli zostanie użyta do zapisu. Użyj OBJ, STL, glTF lub GLB do eksportu zamiast tego.

---

## Zobacz także

- [Referencja klasy FileFormat.](/3d/java/file-format/)
- [Referencja klasy Scene](/3d/java/scene/)
 Polski