# Candera AssetLoader

#### AssetDescriptor

[AssetContext](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_context.html "Encapsulates main list of objects' names that define an asset context. The scene context is provided ...") class has become deprecated and its functionality is taken by the new [AssetDescriptor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_descriptor.html "Descriptor of the loaded asset.") class.

**Old Interface:**

```
<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html" title="Implements objects handling mechanisms. It implements the interface AssetProvider and holds an asset ...">Candera::DefaultAssetProvider</a>* provider = m_assetProvider;
<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_context.html" title="Encapsulates main list of objects' names that define an asset context. The scene context is provided ...">Candera::AssetContext</a>* assetContext = provider->GetAssetContext();
if (assetContext != 0) {
    for (Int i = 0; i < assetContext->GetAnimationCount(); i++) {
        const Candera::Char* animation = assetContext->GetAnimationName(i);
        //Use animation name
    }
}
```

**New Interface in 3.0.0:**

```
<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html" title="Implements objects handling mechanisms. It implements the interface AssetProvider and holds an asset ...">Candera::DefaultAssetProvider</a>* provider = m_assetProvider;
for (<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_forward_iterator.html" title="Forward iterator wrapper.">Candera::AssetDescriptor::AssetIdIterator</a> animationIdIterator =  provider-><a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html#ac6785af7778a6b1d4b15b10c2379b9c4" title="Retrieve the AssetDescriptor object associated to this DefaultAssetProvider instance.">GetAssetDescriptor</a>().<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_descriptor.html#a0d22d16a59544b51649d3a67330f5414" title="Get an iterator over object AssetIds.">GetAssetIdIterator</a>(<a class="code" href="http://dev.doc.cgistudio.at/APILINK/group___asset_loader_base.html#gga55cedfecc49c10372c78ba9f8e779cc2a22048a4d98d870ee3527a929b714f283" title="Library for AnimationPlayer objects.">AnimationLib</a>); animationIdIterator.IsValid(); ++animationIdIterator) {
    //use animation AssetId: *animationIdIterator
    //or use animation name: provider->GetNameById(AnimationLib, *animationIdIterator, 0)
}
```

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock"><div class="fragment">  
</div>---

</div></div></div>#### AssetId

AssetId is a unique binary identifier that should be used to retrieve objects from the asset though the [AssetProvider](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_provider.html "Abstract class providing methods for retrieving objects.") interface. AssetIds are supposed to replace the identification of objects by their name/path.

AssetIds should not be hard coded, but referenced through <span style="color: rgb(230, 126, 35);">[Symbolic Names](https://doc316en.candera.eu/link/36#bkmrk-symbolic-names)</span>. For more information see <span style="color: rgb(230, 126, 35);">[Accessing Items via AssetId](https://doc316en.candera.eu/link/418#bkmrk-using-asset-ids)</span>. AssetIds can also be retrieved via the [AssetDescriptor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_descriptor.html "Descriptor of the loaded asset.") class iterators as shown in the [AssetDescriptor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_descriptor.html "Descriptor of the loaded asset.") example above.

**Old Interface:**

```
<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html" title="Implements objects handling mechanisms. It implements the interface AssetProvider and holds an asset ...">Candera::DefaultAssetProvider</a>* provider = m_assetProvider;
Bitmap::SharedPointer bitmap = provider->GetBitmap(bitmapName);            
```

**New Interface in 3.0.0:**

```
<a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html" title="Implements objects handling mechanisms. It implements the interface AssetProvider and holds an asset ...">Candera::DefaultAssetProvider</a>* provider = m_assetProvider;
 //copy AssetId directly from SceneComposer, but better use specified symbolic name or retrieve it via AssetIdIterator
AssetId assetId = CDA_LIBRARY_ASSETID(0x0, 0x100);
Bitmap::SharedPointer bitmap = provider-><a class="code" href="http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_asset_provider.html#a85e81d0b45b8340905ac5a98920389d5">GetBitmapById</a>(assetId);
```

---