What is Incisor?
Tutorials
Key Concepts
Reddit
Stack Overflow
Deprecation Schedule

GraphicAsset

A GraphicAsset is an object that represents a piece of visual content such as an image file or an 'OBJ'. GraphicAssets contain a Geometry, and a set of MaterialPresets that, when applied via 'GraphicObject.graphicAsset' or 'GraphicObject.setGraphicAsset', change the appearance of a GraphicObject to that of the GraphicAsset. [NON-INSTANTIABLE]

GraphicAsset

MEMBERS

geometry :Geometry

This GraphicAsset's geometry.

Example:
// Objective: Get the current Geometry of a GraphicAsset
// Expected Result: The console should have 2 log messages as follows:
//     myGraphicAsset (Box) sourceWidth, sourceHeight 100 100
//     myGraphicAsset (Triangle) sourceWidth, sourceHeight 50 100

// Create a GraphicObject using the white box GraphicAsset.
let myGraphicObject = new GraphicObject( nc.graphicAssets.whiteBox, nc.mainScene, "MyGraphicObject" );
// Get the GraphicAsset from the GraphicObject
let myGraphicAsset = myGraphicObject.graphicAsset;
// Console log the Geometry sourceWidth and sourceHeight of the GraphicAsset.
console.log("myGraphicAsset (Box) sourceWidth, sourceHeight", myGraphicAsset.geometry.sourceWidth, myGraphicAsset.geometry.sourceHeight);
// Update the Geometry of myGraphicAsset with the white triangle.
myGraphicAsset.geometry = nc.geometries.WhiteTriangle;
// Console log the Geometry sourceWidth and sourceHeight again.
console.log("myGraphicAsset (Triangle) sourceWidth, sourceHeight", myGraphicAsset.geometry.sourceWidth, myGraphicAsset.geometry.sourceHeight);

inheritedTypes :object

Dictionary object listing all of the types this object is compatible with.

materialPresets :Array.<MaterialPreset>

List of MaterialPresets associated with this GraphicAsset.

readonly name :string

The GraphicAsset's name.

Example:
// Objective: Set and Get the name of a GraphicAsset.
// Expected Result: The console should read "name is WhiteBox"

// Create a GraphicObject using the WhiteBox GraphicAsset.
let myGraphicObject = new GraphicObject( nc.graphicAssets.WhiteBox, nc.mainScene, "MyGraphicObject" );
// Get an instance of the GraphicAsset from its GraphicObject.
let myGraphicAsset = myGraphicObject.graphicAsset;
// Console log the name of the GraphicAsset.
console.log("name is", myGraphicAsset.name );

type :string

Type identifier