# Assets

In any animation project you need to make various Assets. Character rigs, Vehicles, Locations and many other assets. And some way to organize them is needed. This is why VCStudio is also a powerful asset management tool.

![](https://notabug.org/jyamihud/update_manager/raw/master/vcstudio/60.png)

### Chapters:

 - [Adding New Assets](#adding-new-assets)
 - [Asset Window](#asset-window)
 - [Source Code](#source-code)

# Adding New Assets

Before we can manage the assets we need to have them. They should be added somehow. Let's go over a few ways to add assets.

 - **Marking Assets**. In the [script writer](../../wiki/docs/Script-Writer.md) you can mark assets right in the text of your story. This is the best way to add assets.
 - **Manual**. In the [story editor](../../wiki/docs/Story-Editor.md) on the right you have the 4 icons. ![](../../settings/themes/OldSchool/icons/chr.png), ![](../../settings/themes/OldSchool/icons/veh.png), ![](../../settings/themes/OldSchool/icons/loc.png) and ![](../../settings/themes/OldSchool/icons/obj.png). This is the asset category. Click on one. You will see there is no add asset button anywhere. Type the name of the asset in the search. And the button will appear. 

# Asset Window

![](https://notabug.org/jyamihud/update_manager/raw/master/vcstudio/59.png)

Now let's look at the asset window it self.

As you can see this window is devided into 3 parts. The left side, the bigger middle part and the right side. This kind of layot will be in multiple places in the VCStudio. Usually it's because on the right there are checklists.

**The Right**

On the right is your asset checklist. This will determen the percentage of the asset. See [analytics](../../wiki/docs/Analytics.md) for more information about checklists.

**The middle**

The middle section is the main section of the asset window. This is where you will find the blend files. It usually gonna have one there by default. But you can create more using the search. On the picture above you can probably make out one blend file that is different. It has a purple top. It's the asset blend file. The final.

You can create the asset blend file using the ![](../../settings/themes/OldSchool/icons/link_configure.png) button above the files.

Beside it you can see the progress bar. Which going to show how much of the asset is finished. Most of the time it's going to mirror the checklist on the right. But if there is an asset blend file it's going to be filled up regardless to whether the checklist is all checked or not.

Also you can edit the preview of the asset by clicking the big square on the top left. Or adding a `Preview.png` into `renders` folder. Also about the folders.

There are ![](../../settings/themes/OldSchool/icons/blender.png), ![](../../settings/themes/OldSchool/icons/idea.png), ![](../../settings/themes/OldSchool/icons/texture.png) and ![](../../settings/themes/OldSchool/icons/render.png) which give you files from 4 different folders of the asset. Main folder for blend files, `references`, `tex` for textures and `renders`.

**The left**

Appart from usual ![](../../settings/themes/OldSchool/icons/schedule.png) schedules and ![](../../settings/themes/OldSchool/icons/history.png) history tabs. You also have a ![](../../settings/themes/OldSchool/icons/scene.png) complete list of mensions of this asset in the story. Clicking on those mensions will teleport you to the part in the script where this mention is.

Now to the fun part. The actual rabbit hole. The digging of pure information. The legendary Source Code part.

# Source Code

The best documentation is to read the code of the software directly. For the assets I recommend:

- [studio_asset_selectLayer.py](../../studio/studio_asset_selectLayer.py) The UI for selecting / creating assets.
- [studio/studio_assetLayer.py](../../studio/studio_assetLayer.py) The Asset Manager UI.
- [studio/checklist.py](../../studio/checklist.py) Makes the calculation of the assets.

**How does it draw the contents of the Blend-Files?**

With any modern installation of Blender comes a little python script [blender-thumbnailer.py](../../UI/blender-thumbnailer.py) which is getting the preview of the blend file and writes it into a PNG image 128 by 128 pixels in size.

I didn't write this file. But by reading it I've got some idea of how it works. In the blend file there is a location where the thumbnail is storred. It's prepared by Blender while you save the file. *It seems to work only when saving from the UI and opening blender without UI will not update the preview.* Which [seems to be a bug](https://devtalk.blender.org/t/creating-blend-file-preview-when-saving-files/13323) or a limitation. Anyway because this script is under the **GNU General Public License** I could just copy it over to VCStudio. And I'm using it every time I need a preview of a blend file.

**How does it adds a blend file?**

Simple. There are empty blender files in the [new_file](../../new_file) folder. And I'm just copying one from there into where ever you need it. Only it's not actually simple. You can see that when you type in the search of the blend files and the name is not found it also gives you to copy a file from somewhere else. And techincally you can choose any file anywhere on the operating system. Which introduces a problem if that file you chose had linked things in it. Like textures or other assets. Changing the directory will break all those links and break textures and other stuff. So in order to do this I wrote [copy_file()](../../settings/oscalls.py) function. That checks if we are coping a blend file. And if yes. It opens the blend file inside blender (`blender -b` without UI) and does `bpy.ops.wm.save_as_mainfile()` command. Which is making the blender save the file as instead of simply copying the file directly. This keeps all the textures and linked asset still functional.

# Help The Documentation

The documentation files are not perfect. And need maintenance.

*If you are reading it from the VCStudio build in Documentation:*

 - Press ![](../../settings/themes/OldSchool/icons/edit.png) to edit locally.
 - Press ![](../../settings/themes/OldSchool/icons/notabug.png) to commit in our NotABug repository.

*(C) J.Y.Amihud 2021. Under GPL v3 or later.*