ObjSaveOptions

Inheritance: java.lang.Object, com.aspose.threed.IOConfig, com.aspose.threed.SaveOptions

public class ObjSaveOptions extends SaveOptions

Save options for wavefront obj file

Constructors

ConstructorDescription
ObjSaveOptions()Constructor of ObjSaveOptions

Methods

MethodDescription
equals(Object arg0)
getApplyUnitScale()Apply AssetInfo.getUnitScaleFactor to the mesh.
getAxisSystem()Gets the axis system in the exported file.
getClass()
getEnableMaterials()Gets whether import/export materials for each object
getEncoding()Gets the default encoding for text-based files.
getExportTextures()Try to copy textures used in scene to output directory.
getFileFormat()Gets the file format that specified in current Save/Load option.
getFileName()The file name of the exporting/importing scene.
getFileSystem()Allow user to handle how to manage the external dependencies during load/save.
getFileSystemFactory()Gets the factory class for FileSystem.
getFlipCoordinateSystem()Gets whether flip coordinate system of control points/normal during importing/exporting.
getLookupPaths()Some files like OBJ depends on external file, the lookup paths will allows Aspose.3D to look for external file to load.
getPointCloud()Gets the flag whether the exporter should export the scene as point cloud(without topological structure), default value is false
getSerializeW()Gets whether serialize W component in model’s vertex position.
getVerbose()Gets whether generate comments for each section
hashCode()
notify()
notifyAll()
setApplyUnitScale(boolean value)Apply AssetInfo.getUnitScaleFactor to the mesh.
setAxisSystem(AxisSystem value)Sets the axis system in the exported file.
setEnableMaterials(boolean value)Sets whether import/export materials for each object
setEncoding(Charset value)Sets the default encoding for text-based files.
setExportTextures(boolean value)Try to copy textures used in scene to output directory.
setFileName(String value)The file name of the exporting/importing scene.
setFileSystem(FileSystem value)Allow user to handle how to manage the external dependencies during load/save.
setFileSystemFactory(FileSystemFactory value)Sets the factory class for FileSystem.
setFlipCoordinateSystem(boolean value)Sets whether flip coordinate system of control points/normal during importing/exporting.
setLookupPaths(ArrayList value)Some files like OBJ depends on external file, the lookup paths will allows Aspose.3D to look for external file to load.
setPointCloud(boolean value)Sets the flag whether the exporter should export the scene as point cloud(without topological structure), default value is false
setSerializeW(boolean value)Sets whether serialize W component in model’s vertex position.
setVerbose(boolean value)Sets whether generate comments for each section
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

ObjSaveOptions()

public ObjSaveOptions()

Constructor of ObjSaveOptions

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getApplyUnitScale()

public boolean getApplyUnitScale()

Apply AssetInfo.getUnitScaleFactor to the mesh. Default value is false.

Returns: boolean - Apply AssetInfo.getUnitScaleFactor to the mesh. Default value is false.

getAxisSystem()

public AxisSystem getAxisSystem()

Gets the axis system in the exported file.

Returns: AxisSystem - the axis system in the exported file. Remarks: FlipCoordinateSystem must be enabled to utilize this feature.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getEnableMaterials()

public boolean getEnableMaterials()

Gets whether import/export materials for each object

Returns: boolean - whether import/export materials for each object

getEncoding()

public Charset getEncoding()

Gets the default encoding for text-based files. Default value is null which means the importer/exporter will decide which encoding to use.

Returns: java.nio.charset.Charset - the default encoding for text-based files. Default value is null which means the importer/exporter will decide which encoding to use.

getExportTextures()

public boolean getExportTextures()

Try to copy textures used in scene to output directory.

Returns: boolean - Try to copy textures used in scene to output directory.

getFileFormat()

public FileFormat getFileFormat()

Gets the file format that specified in current Save/Load option.

Returns: FileFormat - the file format that specified in current Save/Load option.

getFileName()

public String getFileName()

The file name of the exporting/importing scene. This is optional, but useful when serialize external assets like OBJ’s material.

Returns: java.lang.String - The file name of the exporting/importing scene. This is optional, but useful when serialize external assets like OBJ’s material.

getFileSystem()

public FileSystem getFileSystem()

Allow user to handle how to manage the external dependencies during load/save.

Returns: FileSystem - Allow user to handle how to manage the external dependencies during load/save. Example: The default FileSystem is LocalFileSystem, it is not safe in environment like server side, But you can override the file system access by specifying a different implementation. Aspose.3D provides different FileSystem implementation like:

  • Memory-based file system
  • Directory-based file system
  • Dummy file system
  • Zip file system

And you can also use your own implementation.

Scene scene = new Scene();
             var material = new PhongMaterial();
             var boxNode = scene.getRootNode().createChildNode(new Box());
             boxNode.setMaterial(material);
 
             var opt = new ObjSaveOptions();
             var memFs = new HashMap<string, MemoryStream>();
             opt.setFileSystem(FileSystem.createMemoryFileSystem(memFs));
 			opt.setFileName("output.obj");
             try(var output = new ByteArrayOutputStream()) {
 				scene.save(output, opt);
 				//The material will be written to variable memFs named output.mtl
 				var materialInBytes = memFs["output.mtl"].toArray();
             }

getFileSystemFactory()

public static FileSystemFactory getFileSystemFactory()

Gets the factory class for FileSystem. The default factory will create com.aspose.threed.LocalFileSystem which is not suitable for server environment.

Returns: FileSystemFactory - the factory class for FileSystem. The default factory will create com.aspose.threed.LocalFileSystem which is not suitable for server environment. Example: The default FileSystem in SaveOptions/LoadOptions is directory-based file system, You can override the default implementation by specify it through IOConfig.FileSystemFactory:

IOConfig.setFileSystemFactory(new FileSystemFactory() {
 				@Override
 				public FileSystem call() {
 					return FileSystem.createDummyFileSystem();
 				}
 			});
 
             Scene scene = new Scene();
             var material = new PhongMaterial();
             var boxNode = scene.getRootNode().createChildNode(new Box());
             boxNode.setMaterial(material);
 
             //opt.FileSystem would be dummy file system now
             var opt = new ObjSaveOptions();
             scene.Save("output.obj", opt);
             //the material file output.mtl will not be written to any places because we've configured a dummy file system as default implementation.

getFlipCoordinateSystem()

public boolean getFlipCoordinateSystem()

Gets whether flip coordinate system of control points/normal during importing/exporting.

Returns: boolean - whether flip coordinate system of control points/normal during importing/exporting.

getLookupPaths()

public ArrayList<String> getLookupPaths()

Some files like OBJ depends on external file, the lookup paths will allows Aspose.3D to look for external file to load.

Returns: java.util.ArrayList<java.lang.String> - Some files like OBJ depends on external file, the lookup paths will allows Aspose.3D to look for external file to load. Example: The following code shows how to manually specify the look up textures, so the importer can find

var opt = new ObjLoadOptions();
             //Specify the lookup paths, so the textures can be located.
             opt.getLookupPaths().add("textures");
             var scene = Scene.fromFile("input.obj", opt);
             scene.save("output.glb");

getPointCloud()

public boolean getPointCloud()

Gets the flag whether the exporter should export the scene as point cloud(without topological structure), default value is false

Returns: boolean - the flag whether the exporter should export the scene as point cloud(without topological structure), default value is false

getSerializeW()

public boolean getSerializeW()

Gets whether serialize W component in model’s vertex position.

Returns: boolean - whether serialize W component in model’s vertex position.

getVerbose()

public boolean getVerbose()

Gets whether generate comments for each section

Returns: boolean - whether generate comments for each section

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setApplyUnitScale(boolean value)

public void setApplyUnitScale(boolean value)

Apply AssetInfo.getUnitScaleFactor to the mesh. Default value is false.

Parameters:

ParameterTypeDescription
valuebooleanNew value

setAxisSystem(AxisSystem value)

public void setAxisSystem(AxisSystem value)

Sets the axis system in the exported file.

Parameters:

ParameterTypeDescription
valueAxisSystemNew value Remarks: FlipCoordinateSystem must be enabled to utilize this feature.

setEnableMaterials(boolean value)

public void setEnableMaterials(boolean value)

Sets whether import/export materials for each object

Parameters:

ParameterTypeDescription
valuebooleanNew value

setEncoding(Charset value)

public void setEncoding(Charset value)

Sets the default encoding for text-based files. Default value is null which means the importer/exporter will decide which encoding to use.

Parameters:

ParameterTypeDescription
valuejava.nio.charset.CharsetNew value

setExportTextures(boolean value)

public void setExportTextures(boolean value)

Try to copy textures used in scene to output directory.

Parameters:

ParameterTypeDescription
valuebooleanNew value

setFileName(String value)

public void setFileName(String value)

The file name of the exporting/importing scene. This is optional, but useful when serialize external assets like OBJ’s material.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew value

setFileSystem(FileSystem value)

public void setFileSystem(FileSystem value)

Allow user to handle how to manage the external dependencies during load/save.

Parameters:

ParameterTypeDescription
valueFileSystemNew value Example: The default FileSystem is LocalFileSystem, it is not safe in environment like server side, But you can override the file system access by specifying a different implementation. Aspose.3D provides different FileSystem implementation like:
  • Memory-based file system
  • Directory-based file system
  • Dummy file system
  • Zip file system

And you can also use your own implementation.

Scene scene = new Scene();
             var material = new PhongMaterial();
             var boxNode = scene.getRootNode().createChildNode(new Box());
             boxNode.setMaterial(material);
 
             var opt = new ObjSaveOptions();
             var memFs = new HashMap<string, MemoryStream>();
             opt.setFileSystem(FileSystem.createMemoryFileSystem(memFs));
 			opt.setFileName("output.obj");
             try(var output = new ByteArrayOutputStream()) {
 				scene.save(output, opt);
 				//The material will be written to variable memFs named output.mtl
 				var materialInBytes = memFs["output.mtl"].toArray();
             }
``` |

### setFileSystemFactory(FileSystemFactory value) {#setFileSystemFactory-com.aspose.threed.FileSystemFactory-}

public static void setFileSystemFactory(FileSystemFactory value)



Sets the factory class for FileSystem. The default factory will create com.aspose.threed.LocalFileSystem which is not suitable for server environment.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | [FileSystemFactory](../../com.aspose.threed/filesystemfactory) | New value **Example:** The default FileSystem in SaveOptions/LoadOptions is directory-based file system, You can override the default implementation by specify it through IOConfig.FileSystemFactory:

IOConfig.setFileSystemFactory(new FileSystemFactory() { @Override public FileSystem call() { return FileSystem.createDummyFileSystem(); } });

         Scene scene = new Scene();
         var material = new PhongMaterial();
         var boxNode = scene.getRootNode().createChildNode(new Box());
         boxNode.setMaterial(material);

         //opt.FileSystem would be dummy file system now
         var opt = new ObjSaveOptions();
         scene.Save("output.obj", opt);
         //the material file output.mtl will not be written to any places because we've configured a dummy file system as default implementation.

### setFlipCoordinateSystem(boolean value) {#setFlipCoordinateSystem-boolean-}

public void setFlipCoordinateSystem(boolean value)



Sets whether flip coordinate system of control points/normal during importing/exporting.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | New value |

### setLookupPaths(ArrayList<String> value) {#setLookupPaths-java.util.ArrayList-java.lang.String--}

public void setLookupPaths(ArrayList value)



Some files like OBJ depends on external file, the lookup paths will allows Aspose.3D to look for external file to load.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | java.util.ArrayList<java.lang.String> | New value **Example:** The following code shows how to manually specify the look up textures, so the importer can find

var opt = new ObjLoadOptions(); //Specify the lookup paths, so the textures can be located. opt.getLookupPaths().add(“textures”); var scene = Scene.fromFile(“input.obj”, opt); scene.save(“output.glb”);


### setPointCloud(boolean value) {#setPointCloud-boolean-}

public void setPointCloud(boolean value)



Sets the flag whether the exporter should export the scene as point cloud(without topological structure), default value is false

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | New value |

### setSerializeW(boolean value) {#setSerializeW-boolean-}

public void setSerializeW(boolean value)



Sets whether serialize W component in model's vertex position.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | New value |

### setVerbose(boolean value) {#setVerbose-boolean-}

public void setVerbose(boolean value)



Sets whether generate comments for each section

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | boolean | New value |

### toString() {#toString--}

public String toString()





**Returns:**
java.lang.String
### wait() {#wait--}

public final void wait()





### wait(long arg0) {#wait-long-}

public final void wait(long arg0)





**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| arg0 | long |  |

### wait(long arg0, int arg1) {#wait-long-int-}

public final void wait(long arg0, int arg1)





**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| arg0 | long |  |
| arg1 | int |  |