Source Filmmaker

Source Filmmaker

Asset Browser
 This topic has been pinned, so it's probably important
Kiwano  [developer] 16 Jan, 2023 @ 9:42pm
How to Use
https://github.com/KiwifruitDev/SFM-Asset-Browser

The asset browser can be opened using the "Scripts" tab > "KiwifruitDev" > "Asset Browser" in SFM.

Here are some rundowns of the workflow and features of the asset browser.

Indexing


The first time you open the asset browser, no assets will be indexed. This gives you an opportunity to filter before indexing, or to load an existing index hive.

To index assets, click the "Refresh" button in the toolbar. This will recursively search through the `game` folder while filtering out anything specified.

Saving and Loading Index Hives & Settings


Opening the "File Options" menu in the toolbar will provide options to save and load index hives and filter settings.

There are options for saving to a current file, saving to a new file, loading while merging, and loading while replacing.

Reload options are also available, which restores the index hive and filter settings to the last saved state.

Merging the index hive will append the new index hive to the current one, and will not remove any assets that are not in the new index hive.

Replacing the index hive will discard the current index hive and replace it with the new one.

Settings will always be replaced.

Filtering


The filter settings can be found in the toolbar. You can filter by asset type, mod, root folder, and search term.

The search term is a simple string search, and will match any asset that contains the search term in its name.

Filtering after building the index hive will be non-destructive, and will only hide assets that do not match the filter.

Only filtered assets will be included in the index hive.

Tags


Tags are a way to group assets together, or to mark assets as special.

At the moment, tags cannot be added or removed from the asset browser. They must be added to a specific JSON file located at "game/assetbrowser/assettags.json".

Tags will forcibly add assets to the index hive, even if they are filtered out. This is to ensure that assets with tags are always available and can be excluded without filtering.

Adding Tags to Assets

To add a tag to an asset, right click on the asset and check the tag you want to add. The tag will be added to the asset.

If the asset is discarded through rebuilding the index hive or is otherwise unavailable, the tag will add the asset back to the index hive.

Only files can be tagged, folders will not provide tagging options.

Adding a tag will write to the tag JSON file, so it can be persisted between sessions.

Removing Tags from Assets

To remove a tag from an asset, right click on the asset and uncheck the tag you want to remove. The tag will be removed from the asset.

Removing a tag will write to the tag JSON file.

Creating Tags

To create a tag, add a new object to the "tags" array in the JSON file. The object must have the following properties:
        
  • "tagName": The name of the tag. This will be displayed in the asset browser.
            Example: "My Custom Tag"
        
  • "tagValue": The value of the tag. This must be unique.
            Example: "my_custom_tag"
        
  • "tagImage": The icon to use for the tag. This must be a valid path to an image file.
            Example: "assetbrowser/images/assettags/tag_sm.png"
        
  • "children": An array of asset paths. Filling this out is optional, but it must be present as an array.
            Example: [".\\hl2\\models\\props_c17\\furniturefridge001a.mdl"]

Removing Tags

To remove a tag, remove the object from the "tags" array in the JSON file.

Previewing Assets


To preview an asset, double click on it. This will open the asset in its default application.

Previewing a model asset will prompt you with information about adding models to the current scene.

Single clicking on sound assets will play the sound in the game window. The game window (F11) must be open for this to work.

Adding Models to the Scene


To add a model to the scene, add the special "Model Stack" tag to the asset.

Then, right click on any animation set within the "Animation Set Editor" window and click on "Rig" > "asset_browser_import_models".

This bypasses an SFM limitation where models cannot be created by scripts dynamically.

Copying Paths


Right clicking on an asset will provide a context menu with options to copy the relative or full path to the clipboard.

The relative path can be useful for copying paths to use in existing SFM import dialog boxes, such as when adding sounds to the timeline.

Visiting in Explorer


To visit the location of an asset in explorer, right click on the asset and click "Open folder".

For folder assets, this will open the folder itself.

For file assets, this will open the folder containing the file.

Thumbnails


Thumbnails can be optionally added to assets.

First, you'll need an image. This can be an external image file or an image saved to the clipboard.

Then, right click on the asset and click "Set thumbnail from file" or "Set thumbnail from clipboard".

The thumbnail will be saved to the "game/assetbrowser/thumbnails" folder with the directory structure of the asset.

To clear a thumbnail, right click on the asset and click "Clear thumbnail". This will delete the thumbnail file.

There is no way to generate a thumbnail from an asset.

If you would like to quickly set thumbnails, you may use the Snipping Tool (Win + Shift + S) to take a screenshot of the asset preview and then set the thumbnail from the clipboard.
Last edited by Kiwano; 18 Jan, 2023 @ 7:42pm
< >
Showing 1-2 of 2 comments
Agent47 2 Nov, 2024 @ 9:32am 
Hello, I would like to know how I import the models to my scene using this script,where the hell is the asset import models option?
Agent47 2 Nov, 2024 @ 9:34am 
I know where the animation set editor window is but I have the mouse pressing right click etc and the damn option does not open /"Animation Set Editor" window and click on "Rig" > "asset_browser_import_models"/
explain to me well
< >
Showing 1-2 of 2 comments
Per page: 1530 50