public class Scene extends SceneObject
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VERSION
Gets the current release version
|
name, properties| Constructor and Description |
|---|
Scene()
Initializes a new instance of the
Scene class. |
Scene(Entity entity)
Initializes a new instance of the
Scene class with an entity attached to a new node. |
Scene(Scene parentScene,
java.lang.String name)
Initializes a new instance of the
Scene class as a sub-scene. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the scene content and restores the default settings.
|
AnimationClip |
createAnimationClip(java.lang.String name)
A shorthand function to create and register the
AnimationClip The first AnimationClip will be assigned to the getCurrentAnimationClip() |
static Scene |
fromFile(java.lang.String fileName)
Opens the scene from given path
|
static Scene |
fromFile(java.lang.String fileName,
Cancellation cancellationToken)
Opens the scene from given path
|
static Scene |
fromFile(java.lang.String fileName,
FileFormat format)
Opens the scene from given path using specified file format.
|
static Scene |
fromFile(java.lang.String fileName,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given path using specified file format.
|
static Scene |
fromFile(java.lang.String fileName,
LoadOptions options)
Opens the scene from given path using specified file format.
|
static Scene |
fromFile(java.lang.String fileName,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given path using specified file format.
|
static Scene |
fromStream(java.io.InputStream stream)
Opens the scene from given stream
|
static Scene |
fromStream(java.io.InputStream stream,
Cancellation cancellationToken)
Opens the scene from given stream
|
static Scene |
fromStream(java.io.InputStream stream,
FileFormat format)
Opens the scene from given stream using specified file format.
|
static Scene |
fromStream(java.io.InputStream stream,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given stream using specified file format.
|
static Scene |
fromStream(java.io.InputStream stream,
LoadOptions options)
Opens the scene from given stream using specified IO config.
|
static Scene |
fromStream(java.io.InputStream stream,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given stream using specified IO config.
|
static Scene |
fromStream(Stream stream)
Opens the scene from given stream
|
static Scene |
fromStream(Stream stream,
Cancellation cancellationToken)
Opens the scene from given stream
|
static Scene |
fromStream(Stream stream,
FileFormat format)
Opens the scene from given stream using specified file format.
|
static Scene |
fromStream(Stream stream,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given stream using specified file format.
|
static Scene |
fromStream(Stream stream,
LoadOptions options)
Opens the scene from given stream using specified IO config.
|
static Scene |
fromStream(Stream stream,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given stream using specified IO config.
|
AnimationClip |
getAnimationClip(java.lang.String name)
Gets a named
AnimationClip |
java.util.List<AnimationClip> |
getAnimationClips()
Gets all
AnimationClip defined in the scene. |
AssetInfo |
getAssetInfo()
Gets the top-level asset information
|
AnimationClip |
getCurrentAnimationClip()
Gets the active
AnimationClip |
java.util.List<A3DObject> |
getLibrary()
Objects that not directly used in scene hierarchy can be defined in Library.
|
java.util.Collection<Pose> |
getPoses()
Gets all
Pose used in this scene. |
Node |
getRootNode()
Gets the root node of the scene.
|
java.util.List<Scene> |
getSubScenes()
Gets all sub-scenes
|
void |
open(java.io.InputStream stream)
Opens the scene from given stream
|
void |
open(java.io.InputStream stream,
Cancellation cancellationToken)
Opens the scene from given stream
|
void |
open(java.io.InputStream stream,
FileFormat format)
Opens the scene from given stream using specified file format.
|
void |
open(java.io.InputStream stream,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given stream using specified file format.
|
void |
open(java.io.InputStream stream,
LoadOptions options)
Opens the scene from given stream using specified IO config.
|
void |
open(java.io.InputStream stream,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given stream using specified IO config.
|
void |
open(Stream stream)
Opens the scene from given stream
|
void |
open(Stream stream,
Cancellation cancellationToken)
Opens the scene from given stream
|
void |
open(Stream stream,
FileFormat format)
Opens the scene from given stream using specified file format.
|
void |
open(Stream stream,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given stream using specified file format.
|
void |
open(Stream stream,
LoadOptions options)
Opens the scene from given stream using specified IO config.
|
void |
open(Stream stream,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given stream using specified IO config.
|
void |
open(java.lang.String fileName)
Opens the scene from given path
|
void |
open(java.lang.String fileName,
Cancellation cancellationToken)
Opens the scene from given path
|
void |
open(java.lang.String fileName,
FileFormat format)
Opens the scene from given path using specified file format.
|
void |
open(java.lang.String fileName,
FileFormat format,
Cancellation cancellationToken)
Opens the scene from given path using specified file format.
|
void |
open(java.lang.String fileName,
LoadOptions options)
Opens the scene from given path using specified file format.
|
void |
open(java.lang.String fileName,
LoadOptions options,
Cancellation cancellationToken)
Opens the scene from given path using specified file format.
|
void |
save(java.io.OutputStream stream,
FileFormat format)
Saves the scene to stream using specified file format.
|
void |
save(java.io.OutputStream stream,
FileFormat format,
Cancellation cancellationToken)
Saves the scene to stream using specified file format.
|
void |
save(java.io.OutputStream stream,
SaveOptions options)
Saves the scene to stream using specified file format.
|
void |
save(java.io.OutputStream stream,
SaveOptions options,
Cancellation cancellationToken)
Saves the scene to stream using specified file format.
|
void |
save(Stream stream,
FileFormat format)
Saves the scene to stream using specified file format.
|
void |
save(Stream stream,
FileFormat format,
Cancellation cancellationToken)
Saves the scene to stream using specified file format.
|
void |
save(Stream stream,
SaveOptions options)
Saves the scene to stream using specified file format.
|
void |
save(Stream stream,
SaveOptions options,
Cancellation cancellationToken)
Saves the scene to stream using specified file format.
|
void |
save(java.lang.String fileName)
Saves the scene to specified path using specified file format.
|
void |
save(java.lang.String fileName,
FileFormat format)
Saves the scene to specified path using specified file format.
|
void |
save(java.lang.String fileName,
FileFormat format,
Cancellation cancellationToken)
Saves the scene to specified path using specified file format.
|
void |
save(java.lang.String fileName,
SaveOptions options)
Saves the scene to specified path using specified file format.
|
void |
save(java.lang.String fileName,
SaveOptions options,
Cancellation cancellationToken)
Saves the scene to specified path using specified file format.
|
void |
setAssetInfo(AssetInfo value)
Sets the top-level asset information
|
void |
setCurrentAnimationClip(AnimationClip value)
Sets the active
AnimationClip |
getScenefindProperty, getName, getProperties, getProperty, removeProperty, removeProperty, setName, setPropertypublic static final java.lang.String VERSION
public Scene(Entity entity)
Scene class with an entity attached to a new node.entity - The initial entity that attached to the scene
Example:
The following code shows how to create a SceneObject.getScene() directly from an Entity:
var scene = new Scene(new Box());
public Scene(Scene parentScene, java.lang.String name)
Scene class as a sub-scene.parentScene - The parent scene.name - Scene's name.public Scene()
Scene class.public static Scene fromStream(java.io.InputStream stream, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to create a scene from a stream
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input);
}
java.io.IOExceptionpublic static Scene fromStream(java.io.InputStream stream, FileFormat format) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.
Example:
The following code shows how to create a scene from a stream
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input);
}
java.io.IOExceptionpublic static Scene fromStream(java.io.InputStream stream, LoadOptions options, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to create a scene from a stream with load options
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input, opts);
}
java.io.IOExceptionpublic static Scene fromStream(java.io.InputStream stream, LoadOptions options) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.
Example:
The following code shows how to create a scene from a stream with load options
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input, opts);
}
java.io.IOExceptionpublic static Scene fromStream(java.io.InputStream stream, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to create a scene from a stream with a cancellation token source
var cts = new Cancellation();
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input, cts);
}
java.io.IOExceptionpublic static Scene fromStream(java.io.InputStream stream) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.
Example:
The following code shows how to create a scene from a stream with a cancellation token source
var cts = new Cancellation();
try(InputStream input = new FileInputStream("input.fbx")) {
Scene scene = Scene.fromStream(input);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream,
FileFormat format,
Cancellation cancellationToken)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to open a scene from stream
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
scene.open(fs, FileFormat.GLTF2);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream,
FileFormat format)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.
Example:
The following code shows how to open a scene from stream
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
scene.open(fs, FileFormat.GLTF2);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream,
LoadOptions options,
Cancellation cancellationToken)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to open a scene from stream with extra load options
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
scene.open(fs, opt);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream,
LoadOptions options)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.
Example:
The following code shows how to open a scene from stream with extra load options
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
scene.open(fs, opt);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.
Example:
The following code shows how to open a scene from stream
var scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
scene.open(fs);
}
java.io.IOExceptionpublic void open(java.io.InputStream stream,
Cancellation cancellationToken)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.cancellationToken - Cancellation token to the load task
Example:
The following code shows how to open a scene from stream with a cancellation token
var scene = new Scene();
Cancellation cts = new Cancellation();
try(var fs = new FileInputStream("input.fbx")) {
scene.open(fs, cts);
}
java.io.IOExceptionpublic void save(java.io.OutputStream stream,
FileFormat format)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - Format.
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, FileFormat.USDZ);
}
java.io.IOExceptionpublic void save(java.io.OutputStream stream,
FileFormat format,
Cancellation cancellationToken)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - Format.cancellationToken - Cancellation token to the save task
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var cts = new Cancellation();
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, FileFormat.USDZ, cts);
}
java.io.IOExceptionpublic void save(java.io.OutputStream stream,
SaveOptions options)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to save the stream.
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var opt = new UsdSaveOptions();
opt.setPrimitiveToMesh(true);
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, opt);
}
java.io.IOExceptionpublic void save(java.io.OutputStream stream,
SaveOptions options,
Cancellation cancellationToken)
throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to save the stream.cancellationToken - Cancellation token to the save task
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var cts = new Cancellation();
var opt = new UsdSaveOptions();
opt.setPrimitiveToMesh(true);
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, opt, cts);
}
java.io.IOExceptionpublic java.util.List<Scene> getSubScenes()
public java.util.List<A3DObject> getLibrary()
public java.util.List<AnimationClip> getAnimationClips()
AnimationClip defined in the scene.AnimationClip defined in the scene.public AnimationClip getCurrentAnimationClip()
AnimationClipAnimationClippublic void setCurrentAnimationClip(AnimationClip value)
AnimationClipvalue - New valuepublic AnimationClip getAnimationClip(java.lang.String name)
AnimationClipname - The AnimationClip's name to look uppublic AssetInfo getAssetInfo()
Scene scene = Scene.fromFile("test.fbx");
System.out.printf("The FBX file is created by %s %s",
scene.getAssetInfo().getApplicationName(),
scene.getAssetInfo().getApplicationVersion());
public void setAssetInfo(AssetInfo value)
value - New value
Example:
The following code shows how to read the application information from a FBX file:
Scene scene = Scene.fromFile("test.fbx");
System.out.printf("The FBX file is created by %s %s",
scene.getAssetInfo().getApplicationName(),
scene.getAssetInfo().getApplicationVersion());
public java.util.Collection<Pose> getPoses()
Pose used in this scene.Pose used in this scene.public Node getRootNode()
Scene scene = new Scene();
scene.getRootNode().createChildNode(new Box());
scene.save("box.stl");
public void clear()
public AnimationClip createAnimationClip(java.lang.String name)
AnimationClip The first AnimationClip will be assigned to the getCurrentAnimationClip()name - Animation clip's namepublic void open(Stream stream, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
scene.open(stream, FileFormat.GLTF2);
}
}
public void open(Stream stream, FileFormat format) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
scene.open(stream, FileFormat.GLTF2);
}
}
public void open(Stream stream, LoadOptions options, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream with extra load options
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
scene.open(stream, opt);
}
}
public void open(Stream stream, LoadOptions options) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream with extra load options
Scene scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
scene.open(stream, opt);
}
}
public void open(Stream stream) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream
var scene = new Scene();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
scene.open(stream);
}
}
public void open(Stream stream, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from stream with a cancellation token
var scene = new Scene();
Cancellation cts = new Cancellation();
try(var fs = new FileInputStream("input.fbx")) {
try (var stream = Stream.wrap(fs)) {
scene.open(stream, cts);
}
}
public void open(java.lang.String fileName,
FileFormat format,
Cancellation cancellationToken)
throws java.io.IOException
fileName - File name.format - File format.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name with a cancellation token
Scene scene = new Scene();
Cancellation cts = new Cancellation();
scene.open("input.fbx", FileFormat.FBX7400ASCII, cts);
public void open(java.lang.String fileName,
FileFormat format)
throws java.io.IOException
fileName - File name.format - File format.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name with a cancellation token
Scene scene = new Scene();
Cancellation cts = new Cancellation();
scene.open("input.fbx", FileFormat.FBX7400ASCII, cts);
public void open(java.lang.String fileName,
LoadOptions options)
throws java.io.IOException
fileName - File name.options - More detailed configuration to open the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name with extra load options
Scene scene = new Scene();
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
scene.open("input.fbx", opts);
public void open(java.lang.String fileName,
LoadOptions options,
Cancellation cancellationToken)
throws java.io.IOException
fileName - File name.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name with extra load options and cancellation token
var cts = new Cancellation();
Scene scene = new Scene();
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
scene.Open("input.fbx", opts, cts);
public void open(java.lang.String fileName)
throws java.io.IOException
fileName - File name.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name
Scene scene = new Scene();
scene.open("input.fbx");
public void open(java.lang.String fileName,
Cancellation cancellationToken)
throws java.io.IOException
fileName - File name.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to open a scene from file name and a cancellation token source
var cts = new Cancellation();
Scene scene = new Scene();
scene.open("input.fbx", cts);
public static Scene fromStream(Stream stream, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream);
}
}
public static Scene fromStream(Stream stream, FileFormat format) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - File format.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream);
}
}
public static Scene fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream with load options
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream, opts);
}
}
public static Scene fromStream(Stream stream, LoadOptions options) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to open the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream with load options
var opts = new FbxLoadOptions();
opts.getLookupPaths().add("textures");
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream, opts);
}
}
public static Scene fromStream(Stream stream, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream with a cancellation token source
var cts = new Cancellation();
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream, cts);
}
}
public static Scene fromStream(Stream stream) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a stream with a cancellation token source
var cts = new Cancellation();
try(InputStream input = new FileInputStream("input.fbx")) {
try(Stream stream = Stream.wrap(input)) {
Scene scene = Scene.fromStream(stream, cts);
}
}
public static Scene fromFile(java.lang.String fileName, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
fileName - File name.format - File format.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
var cts = new Cancellation();
Scene scene = Scene.fromFile("input.fbx", FileFormat.FBX7400ASCII, cts);
public static Scene fromFile(java.lang.String fileName, FileFormat format) throws java.io.IOException
fileName - File name.format - File format.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
var cts = new Cancellation();
Scene scene = Scene.fromFile("input.fbx", FileFormat.FBX7400ASCII, cts);
public static Scene fromFile(java.lang.String fileName, LoadOptions options, Cancellation cancellationToken) throws java.io.IOException
fileName - File name.options - More detailed configuration to open the stream.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
var cts = new Cancellation();
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
Scene scene = Scene.fromFile("input.fbx", opt, cts);
public static Scene fromFile(java.lang.String fileName, LoadOptions options) throws java.io.IOException
fileName - File name.options - More detailed configuration to open the stream.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
var cts = new Cancellation();
var opt = new FbxLoadOptions();
opt.getLookupPaths().add("textures");
Scene scene = Scene.fromFile("input.fbx", opt, cts);
public static Scene fromFile(java.lang.String fileName) throws java.io.IOException
fileName - File name.java.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
Scene scene = Scene.fromFile("input.fbx");
public static Scene fromFile(java.lang.String fileName, Cancellation cancellationToken) throws java.io.IOException
fileName - File name.cancellationToken - Cancellation token to the load taskjava.io.IOException - Thrown when failed at reading inputImportException - Thrown when input is not a valid 3D format
Example:
The following code shows how to create a scene from a file
var cts = new Cancellation();
Scene scene = Scene.fromFile("input.fbx", cts);
public void save(Stream stream, FileFormat format) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - Format.java.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, FileFormat.USDZ);
}
public void save(Stream stream, FileFormat format, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.format - Format.cancellationToken - Cancellation token to the save taskjava.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var cts = new Cancellation();
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, FileFormat.USDZ, cts);
}
public void save(Stream stream, SaveOptions options) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to save the stream.java.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var opt = new UsdSaveOptions();
opt.setPrimitiveToMesh(true);
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, opt);
}
public void save(Stream stream, SaveOptions options, Cancellation cancellationToken) throws java.io.IOException
stream - Input stream, user is responsible for closing the stream.options - More detailed configuration to save the stream.cancellationToken - Cancellation token to the save taskjava.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
var cts = new Cancellation();
var opt = new UsdSaveOptions();
opt.setPrimitiveToMesh(true);
try(var ms = new ByteArrayOutputStream())
{
scene.save(ms, opt, cts);
}
public void save(java.lang.String fileName)
throws java.io.IOException
fileName - File name.java.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
scene.save("output.usdz");
public void save(java.lang.String fileName,
FileFormat format)
throws java.io.IOException
fileName - File name.format - Format.java.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
Scene scene = Scene.fromFile("input.fbx");
scene.save("output.usdz", FileFormat.USDZ);
public void save(java.lang.String fileName,
FileFormat format,
Cancellation cancellationToken)
throws java.io.IOException
fileName - File name.format - Format.cancellationToken - Cancellation token to the save taskjava.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
var cts = new Cancellation();
Scene scene = Scene.fromFile("input.fbx");
scene.save("output.usdz", FileFormat.USDZ, cts);
public void save(java.lang.String fileName,
SaveOptions options)
throws java.io.IOException
fileName - File name.options - More detailed configuration to save the stream.java.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
var scene = Scene.fromFile("input.fbx");
var opts = new UsdSaveOptions();
opts.setPrimitiveToMesh(true);
scene.save("output.usdz", opts);
public void save(java.lang.String fileName,
SaveOptions options,
Cancellation cancellationToken)
throws java.io.IOException
fileName - File name.options - More detailed configuration to save the stream.cancellationToken - Cancellation token to the save taskjava.io.IOException - Thrown when failed at reading inputExportException - Thrown when failed to export the scene to specified 3D format
Example:
The following code shows how to save scene
var cts = new Cancellation();
var scene = Scene.fromFile("input.fbx");
var opts = new UsdSaveOptions();
opts.setPrimitiveToMesh(true);
scene.save("output.usdz", opts, cts);