Scene

Inheritance: java.lang.Object, com.aspose.threed.A3DObject, com.aspose.threed.SceneObject

public class Scene extends SceneObject

A scene is a top-level object that contains the nodes, geometries, materials, textures, animation, poses, sub-scenes and etc. Scene can have sub-scenes, acts as multiple-document support in files like collada/blender/fbx Node hierarchy can be accessed through getRootNode getLibrary is used to keep a reference of unattached objects during serialization(like meta data or custom objects) so it can be used as a library.

Constructors

Constructor 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, String name) Initializes a new instance of the Scene class as a sub-scene.
Scene(String fileName) Initializes a new instance of the Scene class and open the file immediately.

Fields

Field Description
VERSION

Methods

Method Description
clear() Clears the scene content and restores the default settings.
createAnimationClip(String name) A shorthand function to create and register the AnimationClip The first AnimationClip will be assigned to the getCurrentAnimationClip
equals(Object arg0)
findProperty(String propertyName) Finds the property.
fromFile(String fileName) Opens the scene from given path
fromFile(String fileName, Cancellation cancellationToken) Opens the scene from given path
fromFile(String fileName, FileFormat format) Opens the scene from given path using specified file format.
fromFile(String fileName, FileFormat format, Cancellation cancellationToken) Opens the scene from given path using specified file format.
fromFile(String fileName, LoadOptions options) Opens the scene from given path using specified file format.
fromFile(String fileName, LoadOptions options, Cancellation cancellationToken) Opens the scene from given path using specified file format.
fromStream(Stream stream) Opens the scene from given stream
fromStream(Stream stream, Cancellation cancellationToken) Opens the scene from given stream
fromStream(Stream stream, FileFormat format) Opens the scene from given stream using specified file format.
fromStream(Stream stream, FileFormat format, Cancellation cancellationToken) Opens the scene from given stream using specified file format.
fromStream(Stream stream, LoadOptions options) Opens the scene from given stream using specified IO config.
fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken) Opens the scene from given stream using specified IO config.
getAnimationClip(String name) Gets a named AnimationClip
getAnimationClips() Gets all AnimationClip defined in the scene.
getAssetInfo() Gets the top-level asset information
getClass()
getCurrentAnimationClip() Gets the active AnimationClip
getLibrary() Objects that not directly used in scene hierarchy can be defined in Library.
getName() Gets the name.
getPoses() Gets all Pose used in this scene.
getProperties() Gets the collection of all properties.
getProperty(String property) Get the value of specified property
getRootNode() Gets the root node of the scene.
getScene() Gets the scene that this object belongs to
getSubScenes() Gets all sub-scenes
hashCode()
notify()
notifyAll()
open(Stream stream) Opens the scene from given stream
open(Stream stream, Cancellation cancellationToken) Opens the scene from given stream
open(Stream stream, FileFormat format) Opens the scene from given stream using specified file format.
open(Stream stream, FileFormat format, Cancellation cancellationToken) Opens the scene from given stream using specified file format.
open(Stream stream, LoadOptions options) Opens the scene from given stream using specified IO config.
open(Stream stream, LoadOptions options, Cancellation cancellationToken) Opens the scene from given stream using specified IO config.
open(String fileName) Opens the scene from given path
open(String fileName, Cancellation cancellationToken) Opens the scene from given path
open(String fileName, FileFormat format) Opens the scene from given path using specified file format.
open(String fileName, FileFormat format, Cancellation cancellationToken) Opens the scene from given path using specified file format.
open(String fileName, LoadOptions options) Opens the scene from given path using specified file format.
open(String fileName, LoadOptions options, Cancellation cancellationToken) Opens the scene from given path using specified file format.
removeProperty(Property property) Removes a dynamic property.
removeProperty(String property) Remove the specified property identified by name
render(Camera camera, BufferedImage bitmap) Render the scene into bitmap from given camera’s perspective.
render(Camera camera, BufferedImage bitmap, ImageRenderOptions options) Render the scene into bitmap from given camera’s perspective.
render(Camera camera, String fileName) Render the scene into external file from given camera’s perspective.
render(Camera camera, String fileName, Dimension size, String format) Render the scene into external file from given camera’s perspective.
render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options) Render the scene into external file from given camera’s perspective.
save(Stream stream, FileFormat format) Saves the scene to stream using specified file format.
save(Stream stream, FileFormat format, Cancellation cancellationToken) Saves the scene to stream using specified file format.
save(Stream stream, SaveOptions options) Saves the scene to stream using specified file format.
save(Stream stream, SaveOptions options, Cancellation cancellationToken) Saves the scene to stream using specified file format.
save(String fileName) Saves the scene to specified path using specified file format.
save(String fileName, FileFormat format) Saves the scene to specified path using specified file format.
save(String fileName, FileFormat format, Cancellation cancellationToken) Saves the scene to specified path using specified file format.
save(String fileName, SaveOptions options) Saves the scene to specified path using specified file format.
save(String fileName, SaveOptions options, Cancellation cancellationToken) Saves the scene to specified path using specified file format.
setAssetInfo(AssetInfo value) Sets the top-level asset information
setCurrentAnimationClip(AnimationClip value) Sets the active AnimationClip
setName(String value) Sets the name.
setProperty(String property, Object value) Sets the value of specified property
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

Scene()

public Scene()

Initializes a new instance of the Scene class.

Scene(Entity entity)

public Scene(Entity entity)

Initializes a new instance of the Scene class with an entity attached to a new node.

Parameters:

Parameter Type Description
entity Entity The initial entity that attached to the scene

Scene(Scene parentScene, String name)

public Scene(Scene parentScene, String name)

Initializes a new instance of the Scene class as a sub-scene.

Parameters:

Parameter Type Description
parentScene Scene The parent scene.
name java.lang.String Scene’s name.

Scene(String fileName)

public Scene(String fileName)

Initializes a new instance of the Scene class and open the file immediately. This is an obsoleted constructor, please use Scene.

Parameters:

Parameter Type Description
fileName java.lang.String File’s name to open.

VERSION

public static final String VERSION

clear()

public void clear()

Clears the scene content and restores the default settings.

createAnimationClip(String name)

public AnimationClip createAnimationClip(String name)

A shorthand function to create and register the AnimationClip The first AnimationClip will be assigned to the getCurrentAnimationClip

Parameters:

Parameter Type Description
name java.lang.String Animation clip’s name

Returns: AnimationClip

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

findProperty(String propertyName)

public Property findProperty(String propertyName)

Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name)

Parameters:

Parameter Type Description
propertyName java.lang.String Property name.

Returns: Property - The property.

fromFile(String fileName)

public static Scene fromFile(String fileName)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.

Returns: Scene

fromFile(String fileName, Cancellation cancellationToken)

public static Scene fromFile(String fileName, Cancellation cancellationToken)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromFile(String fileName, FileFormat format)

public static Scene fromFile(String fileName, FileFormat format)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.

Returns: Scene

fromFile(String fileName, FileFormat format, Cancellation cancellationToken)

public static Scene fromFile(String fileName, FileFormat format, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromFile(String fileName, LoadOptions options)

public static Scene fromFile(String fileName, LoadOptions options)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.

Returns: Scene

fromFile(String fileName, LoadOptions options, Cancellation cancellationToken)

public static Scene fromFile(String fileName, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream)

public static Scene fromStream(Stream stream)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.

Returns: Scene

fromStream(Stream stream, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, Cancellation cancellationToken)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream, FileFormat format)

public static Scene fromStream(Stream stream, FileFormat format)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.

Returns: Scene

fromStream(Stream stream, FileFormat format, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, FileFormat format, Cancellation cancellationToken)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

fromStream(Stream stream, LoadOptions options)

public static Scene fromStream(Stream stream, LoadOptions options)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.

Returns: Scene

fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken)

public static Scene fromStream(Stream stream, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

Returns: Scene

getAnimationClip(String name)

public AnimationClip getAnimationClip(String name)

Gets a named AnimationClip

Parameters:

Parameter Type Description
name java.lang.String The AnimationClip’s name to look up

Returns: AnimationClip - Returned AnimationClip

getAnimationClips()

public List<AnimationClip> getAnimationClips()

Gets all AnimationClip defined in the scene.

Returns: java.util.List<com.aspose.threed.AnimationClip>

getAssetInfo()

public AssetInfo getAssetInfo()

Gets the top-level asset information

Returns: AssetInfo

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getCurrentAnimationClip()

public AnimationClip getCurrentAnimationClip()

Gets the active AnimationClip

Returns: AnimationClip

getLibrary()

public List<A3DObject> getLibrary()

Objects that not directly used in scene hierarchy can be defined in Library. This is useful when you’re using sub-scenes and put reusable components under sub-scenes.

Returns: java.util.List<com.aspose.threed.A3DObject>

getName()

public String getName()

Gets the name.

Returns: java.lang.String

getPoses()

public Collection<Pose> getPoses()

Gets all Pose used in this scene.

Returns: java.util.Collection<com.aspose.threed.Pose>

getProperties()

public PropertyCollection getProperties()

Gets the collection of all properties.

Returns: PropertyCollection

getProperty(String property)

public Object getProperty(String property)

Get the value of specified property

Parameters:

Parameter Type Description
property java.lang.String Property name

Returns: java.lang.Object - The value of the found property

getRootNode()

public Node getRootNode()

Gets the root node of the scene.

Returns: Node

getScene()

public Scene getScene()

Gets the scene that this object belongs to

Returns: Scene

getSubScenes()

public List<Scene> getSubScenes()

Gets all sub-scenes

Returns: java.util.List<com.aspose.threed.Scene>

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

open(Stream stream)

public void open(Stream stream)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.

open(Stream stream, Cancellation cancellationToken)

public void open(Stream stream, Cancellation cancellationToken)

Opens the scene from given stream

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
cancellationToken Cancellation Cancellation token to the load task

open(Stream stream, FileFormat format)

public void open(Stream stream, FileFormat format)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.

open(Stream stream, FileFormat format, Cancellation cancellationToken)

public void open(Stream stream, FileFormat format, Cancellation cancellationToken)

Opens the scene from given stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

open(Stream stream, LoadOptions options)

public void open(Stream stream, LoadOptions options)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.

open(Stream stream, LoadOptions options, Cancellation cancellationToken)

public void open(Stream stream, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given stream using specified IO config.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName)

public void open(String fileName)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.

open(String fileName, Cancellation cancellationToken)

public void open(String fileName, Cancellation cancellationToken)

Opens the scene from given path

Parameters:

Parameter Type Description
fileName java.lang.String File name.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName, FileFormat format)

public void open(String fileName, FileFormat format)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.

open(String fileName, FileFormat format, Cancellation cancellationToken)

public void open(String fileName, FileFormat format, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat File format.
cancellationToken Cancellation Cancellation token to the load task

open(String fileName, LoadOptions options)

public void open(String fileName, LoadOptions options)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.

open(String fileName, LoadOptions options, Cancellation cancellationToken)

public void open(String fileName, LoadOptions options, Cancellation cancellationToken)

Opens the scene from given path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options LoadOptions More detailed configuration to open the stream.
cancellationToken Cancellation Cancellation token to the load task

removeProperty(Property property)

public boolean removeProperty(Property property)

Removes a dynamic property.

Parameters:

Parameter Type Description
property Property Which property to remove

Returns: boolean - true if the property is successfully removed

removeProperty(String property)

public boolean removeProperty(String property)

Remove the specified property identified by name

Parameters:

Parameter Type Description
property java.lang.String

Returns: boolean

render(Camera camera, BufferedImage bitmap)

public void render(Camera camera, BufferedImage bitmap)

Render the scene into bitmap from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
bitmap java.awt.image.BufferedImage Target of the rendered result

render(Camera camera, BufferedImage bitmap, ImageRenderOptions options)

public void render(Camera camera, BufferedImage bitmap, ImageRenderOptions options)

Render the scene into bitmap from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
bitmap java.awt.image.BufferedImage Target of the rendered result
options ImageRenderOptions The option to customize some internal settings.

render(Camera camera, String fileName)

public void render(Camera camera, String fileName)

Render the scene into external file from given camera’s perspective. The default output size is 1024x768 and output format is png

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file

render(Camera camera, String fileName, Dimension size, String format)

public void render(Camera camera, String fileName, Dimension size, String format)

Render the scene into external file from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file
size java.awt.Dimension The size of final rendered image
format java.lang.String The image format of the output file

render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options)

public void render(Camera camera, String fileName, Dimension size, String format, ImageRenderOptions options)

Render the scene into external file from given camera’s perspective.

Parameters:

Parameter Type Description
camera Camera From which camera’s perspective to render the scene
fileName java.lang.String The file name of output file
size java.awt.Dimension The size of final rendered image
format java.lang.String The image format of the output file
options ImageRenderOptions The option to customize some internal settings.

save(Stream stream, FileFormat format)

public void save(Stream stream, FileFormat format)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat Format.

save(Stream stream, FileFormat format, Cancellation cancellationToken)

public void save(Stream stream, FileFormat format, Cancellation cancellationToken)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
format FileFormat Format.
cancellationToken Cancellation Cancellation token to the save task

save(Stream stream, SaveOptions options)

public void save(Stream stream, SaveOptions options)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options SaveOptions More detailed configuration to save the stream.

save(Stream stream, SaveOptions options, Cancellation cancellationToken)

public void save(Stream stream, SaveOptions options, Cancellation cancellationToken)

Saves the scene to stream using specified file format.

Parameters:

Parameter Type Description
stream com.aspose.csporter.helpers.Stream Input stream, user is responsible for closing the stream.
options SaveOptions More detailed configuration to save the stream.
cancellationToken Cancellation Cancellation token to the save task

save(String fileName)

public void save(String fileName)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.

save(String fileName, FileFormat format)

public void save(String fileName, FileFormat format)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat Format.

save(String fileName, FileFormat format, Cancellation cancellationToken)

public void save(String fileName, FileFormat format, Cancellation cancellationToken)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
format FileFormat Format.
cancellationToken Cancellation Cancellation token to the save task

save(String fileName, SaveOptions options)

public void save(String fileName, SaveOptions options)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options SaveOptions More detailed configuration to save the stream.

save(String fileName, SaveOptions options, Cancellation cancellationToken)

public void save(String fileName, SaveOptions options, Cancellation cancellationToken)

Saves the scene to specified path using specified file format.

Parameters:

Parameter Type Description
fileName java.lang.String File name.
options SaveOptions More detailed configuration to save the stream.
cancellationToken Cancellation Cancellation token to the save task

setAssetInfo(AssetInfo value)

public void setAssetInfo(AssetInfo value)

Sets the top-level asset information

Parameters:

Parameter Type Description
value AssetInfo New value

setCurrentAnimationClip(AnimationClip value)

public void setCurrentAnimationClip(AnimationClip value)

Sets the active AnimationClip

Parameters:

Parameter Type Description
value AnimationClip New value

setName(String value)

public void setName(String value)

Sets the name.

Parameters:

Parameter Type Description
value java.lang.String New value

setProperty(String property, Object value)

public void setProperty(String property, Object value)

Sets the value of specified property

Parameters:

Parameter Type Description
property java.lang.String Property name
value java.lang.Object The value of the property

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int