ResourceInterface interface

Contract for a resource.

Signature:

interface ResourceInterface<TOptions extends KeyValueObject = KeyValueObject, TSources extends KeyValueObject = KeyValueObject> extends EventEmitter<ResourceEvents> 

Extends: EventEmitter<ResourceEvents>

Remarks

Resources are a fundamental part of the Core3D SDK that power all visual elements and extensions applied to Designs.

Once you create a resource it can be applied using , which will return an object implementing ModifierInterface, specific to the type of resource applied.

Resources are not associated to any specific Design, so you can create a resource and reuse it across any number of Designs.

Properties

Property

Modifiers

Type

Description

isResource

readonly

boolean

Used by isResource().

isSerializable

readonly

boolean

Whether the resource is serializable.

Methods

Method

Description

clone()

Clone the resource.

dispose()

Destroy the resource.

getDefault(key)

Get the default value for an option key.

getDefaults()

Get all option defaults.

getId()

Get the unique ID of this resource.

getIsRendering()

Whether the resource is currently rendering.

getMetadata()

Get any custom metadata for this resource.

getOption(key)

Get the current value of an option key.

getOptions()

Get all current option values.

getParent()

Get the parent resource, if one exists.

getSource(key)

Get the value of a source key.

getSources()

Get all current source values.

getType()

Get the resource type.

getValue(key)

Get the value of an option key, falling back to the default.

getValues()

Get values for all options, falling back to defaults.

load()

Load any external resources required by this resource.

render()

Render this resource.

resetOption(key)

Reset an option by key back to undefined.

resetOptions()

Reset all options to undefined.

resetSource(key)

Reset a source by key back to undefined.

resetSources()

Reset all sources to undefined.

setId(id)

Set a unique ID for this resource.

setMetadata(metadata)

Set custom metadata for this resource.

setOption(key, value)

Set an option by key.

setOptions(options)

Set options with a key/value object.

setParent(parent)

Set the parent resource, if one exists.

setSource(key, value)

Set a source by key.

setSources(sources)

Set sources with a key/value object.

toJSON()

Serialize this resource to JSON.

Get in touch

We'd love to learn more about your vision and how we can help.

PressPrivacyTermsSupportCopyright © 2024 Core3D, Inc. All Rights Reserved.