SceneformAssets

public class SceneformAssets

Container for all of the Sceneform asset definitions in a Sceneform gradle project.

A SceneformAssets object exists at the top level of a gradle file which has the com.google.ar.sceneform.plugin gradle plugin applied via: apply plugin: 'com.google.ar.sceneform.plugin'

This object is named sceneform in the build.gradle file, and can be used to define asset rules via its various asset definition methods, each of which result in AssetDefinition objects being created.

The SceneformAssets object defines a rule named "compileSceneformAssets" which takes every compileAsset task generated in a contained AssetDefinition as a dependency. In Android projects, this rule is injected as a dependency of the "mergeAssets" and "mergeResources" tasks so that the outputs will be available to be bundled into an Android project either via the src/main/assets directory, or the source/main/res/raw directory.

Public Methods

void
asset(String modelPath, String materialPath, String sfaPath, String sfbPath)
Defines an AssetDefinition.
void
asset(String modelPath, String materialPath, String sfaPath, String sfbPath, List<String> animationPaths)
Defines an AssetDefinition.
void
asset(String modelPath, String sfbPath)
Defines an AssetDefinition using the default material and sfa location.
void
asset(Closure<Object> closure)
Defines an AssetDefinition.
void
before(String taskName)
Adds the compile Sceneform assets task as a dependency of the given task.

Inherited Methods

Public Methods

public void asset (String modelPath, String materialPath, String sfaPath, String sfbPath)

Defines an AssetDefinition.

Parameters
modelPath The path to the .obj, .fbx, or .gltf model.
materialPath The material to use. Accepted value: 'default'
sfaPath The path where the .sfa is placed.
sfbPath The path at which the .sfb should be generated.

public void asset (String modelPath, String materialPath, String sfaPath, String sfbPath, List<String> animationPaths)

Defines an AssetDefinition.

Parameters
modelPath The path to the .obj, .fbx, or .gltf model.
materialPath The material to use. Accepted value: 'default'
sfaPath The path where the .sfa is placed.
sfbPath The path at which the .sfb should be generated.
animationPaths A list of .fbx files from which animations will be included in the generated sfb file.

public void asset (String modelPath, String sfbPath)

Defines an AssetDefinition using the default material and sfa location.

Parameters
modelPath The path to the .obj, .fbx, or .gltf model.
sfbPath The path at which the .sfb should be generated.

public void asset (Closure<Object> closure)

Defines an AssetDefinition.

Parameters
closure The closure defining the AssetDefinition to add.

public void before (String taskName)

Adds the compile Sceneform assets task as a dependency of the given task.

The Sceneform plugin may be used outside of an Android build. This may be useful if a standalone asset build is needed for sceneform instead of integrating directly into the Android project build.

When the Sceneform plugin is used outside of an Android build, the Sceneform asset compilation task is not added to the dependency tree by default. Use this method to make asset compilation a dependency of the given task.

Parameters
taskName The task that should depend on the compileSceneformAssets task.