Assetclass
Methods31
Showing 31 methods
public void CancelThumbBuild()
void—public virtual void ClearInMemoryReplacement()
Reverse the changes of SetInMemoryReplacement
void—public virtual bool Compile(bool full)
Forcibly recompile the asset.
| Parameter | Type | Description |
|---|---|---|
| full | bool | TODO |
bool—public virtual System.Threading.Tasks.ValueTask`1<bool> CompileIfNeededAsync(float timeout = 30)
Returns a task that will resolve when the asset is compiled. If the asset is already compiled, do nothing. Does not support maps.
| Parameter | Type | Description |
|---|---|---|
| timeout = 30 | float | — |
ValueTask<bool>true if the compile was needed, and was successful.public void Delete()
Delete this asset. Will send the source and compiled files to the recycle bin.
void—public System.Threading.Tasks.Task DumpThumbnail()
Renders the thumbnail and then saves it to disk.
Task—public virtual string FindStringEditInfo(string name)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
string—public virtual System.Collections.Generic.List`1<string> GetAdditionalContentFiles()
Gets additional content-side related files. This includes like .rect files for materials, all .fbx and .lxo files for models, etc.
List<string>—public virtual System.Collections.Generic.List`1<string> GetAdditionalGameFiles()
Gets additional game-side files to be packaged (e.g. navdata). These are files that are loaded by managed code, not as native resources.
List<string>—public Editor.Pixmap GetAssetThumb(bool generateIfNotInCache = True)
Returns the asset preview thumbnail, with fallback to the asset type icon if there is no preview.
| Parameter | Type | Description |
|---|---|---|
| generateIfNotInCache = True | bool | — |
public virtual string GetCompiledFile(bool absolute = False)
Returns the compiled file path, if the asset is compiled.
| Parameter | Type | Description |
|---|---|---|
| absolute = False | bool | Whether the path should be absolute or relative. |
stringThe compiled file path, or null if the asset was not compiled.public virtual System.Collections.Generic.List`1<Editor.Asset> GetDependants(bool deep)
Returns assets that depend/use this asset.
| Parameter | Type | Description |
|---|---|---|
| deep | bool | Whether to recurse. For example, will also include maps that are using models which use this material asset, as opposed to returning just the models. |
public virtual System.Collections.Generic.List`1<string> GetInputDependencies()
Gets input dependencies for an asset. This'll be tga's for a texture and stuff like that.
List<string>—public virtual System.Collections.Generic.List`1<Editor.Asset> GetParents(bool deep)
Returns assets that are parents of this asset (i.e. this asset is a compiled child resource of the returned assets).
| Parameter | Type | Description |
|---|---|---|
| deep | bool | Whether to recurse up the parent chain. |
public virtual Sandbox.Model GetPreviewModel()
Try to create a preview model if we're fbx, obj, etc
public virtual System.Collections.Generic.List`1<Editor.Asset> GetReferences(bool deep)
Returns assets that this asset references/uses.
| Parameter | Type | Description |
|---|---|---|
| deep | bool | Whether to recurse. For example, will also include textures referenced by the materials used by this model asset, as opposed to returning just the materials. |
public virtual string GetSourceFile(bool absolute = False)
Returns the source file path, if the sources are present.
| Parameter | Type | Description |
|---|---|---|
| absolute = False | bool | Whether the path should be absolute or relative. |
stringThe source file path, or null if the source files are not present.public virtual System.Collections.Generic.List`1<string> GetUnrecognizedReferencePaths()
Unrecognized reference paths listed by the data that could not be resolved into Asset*s
List<string>—protected void LoadUserTags()
void—public virtual void OpenInEditor(string nativeEditor = null)
Try to open this asset in a supported editor. You can specify nativeEditor to open in a specific editor.
| Parameter | Type | Description |
|---|---|---|
| nativeEditor = null | string | A native editor specified in enginetools.txt (e.g modeldoc_editor, hammer, pet..) |
void—public void OverrideThumbnail(Editor.Pixmap pixmap)
Override the Assets thumbnail with given one.
| Parameter | Type | Description |
|---|---|---|
| pixmap | Pixmap | — |
void—public string ReadJson()
Try to get the raw Json string, for a managed asset type (a GameResource)
string—public void RebuildThumbnail(bool startBuild = True)
Delete existing cached thumbnail, optionally queuing for building a new one ASAP.
| Parameter | Type | Description |
|---|---|---|
| startBuild = True | bool | Queue building the new thumbnail ASAP, as opposed to waiting when it is actually needed and doing it then. |
void—public virtual void RecordOpened()
Tell asset system that this asset was opened. Sticks it on the recent opened list.
void—public System.Threading.Tasks.Task`1<Editor.Pixmap> RenderThumb()
Immediately render a preview thumbnail for this asset, and return it.
Task<Pixmap>The rendered preview thumbnail, or null if asset type does not support previews.public virtual bool SaveToDisk(Sandbox.GameResource obj)
Save a game resource instance to disk. This is used internally by asset inspector and for asset creation.
| Parameter | Type | Description |
|---|---|---|
| obj | GameResource | The instance data to save. |
boolWhether the instance was successfully saved or not.public virtual bool SetInMemoryReplacement(string sourceData)
Set data for this asset which will be compiled in memory. This is used to preview asset changes (like materials) before committing to disk.
| Parameter | Type | Description |
|---|---|---|
| sourceData | string | — |
bool—public bool TryLoadResource(T obj)
Try to load this asset as a `Sandbox.Resource` of given type.
| Parameter | Type | Description |
|---|---|---|
| obj | T | Output resource on success, null on failure. |
booltrue if `obj` was successfully set.No results match this filter.
Properties24
Showing 24 properties
public string Editor.Asset.AbsolutePath { get; set; }
The absolute path as it is on disk (ie .wav not .vsnd)
string—public virtual bool Editor.Asset.CanOpenInEditor { get; set; }
Whether `Editor.Asset.OpenInEditor(System.String)` can do anything useful for this asset. Used to decide whether to offer an "Open" action for assets that have no file on disk (e.g. mounted resources).
bool—public virtual bool Editor.Asset.CanRecompile { get; set; }
Can this asset be recompiled?
bool—public bool Editor.Asset.HasCachedThumbnail { get; set; }
bool—public virtual bool Editor.Asset.HasCompiledFile { get; set; }
True if we have a compiled file, and aren't just a source file
bool—public virtual bool Editor.Asset.HasSourceFile { get; set; }
True if we have a source file, and aren't just a _c file
bool—public bool Editor.Asset.HasUnsavedChanges { get; set; }
A free-use variable for the editor to use to portray that this asset somehow has changes that need to be saved to disk.
bool—public virtual bool Editor.Asset.IsCloud { get; set; }
This asset is from the cloud, it's in the cloud folder
bool—public virtual bool Editor.Asset.IsCompiled { get; set; }
Whether the asset is compiled.
bool—public virtual bool Editor.Asset.IsCompiledAndUpToDate { get; set; }
Whether the asset is compiled and all dependencies are up to date. (Slower than IsCompiled)
bool—public virtual bool Editor.Asset.IsCompileFailed { get; set; }
Whether the asset failed to compile.
bool—public bool Editor.Asset.IsDeleted { get; set; }
Whether the asset is deleted or not. This can happen after `Editor.Asset.Delete` was called on it, or `Editor.Asset.AbsolutePath` is empty.
bool—public virtual bool Editor.Asset.IsProcedural { get; set; }
If true then this asset is generated at runtime somehow. Possibly from a mount system.
bool—public virtual bool Editor.Asset.IsTransient { get; set; }
This asset is generated in the transient folder. You don't need to see it, or keep it around. It will re-generate from something else.
bool—public bool Editor.Asset.IsTrivialChild { get; set; }
The asset was generated from another asset compile and has no source asset of its own. For example model break gibs .vmdl, .vtex files for materials, etc.
bool—public System.Nullable`1<System.DateTime> Editor.Asset.LastOpened { get; set; }
When the asset was last opened through the editor.
Nullable<DateTime>—public Editor.MetaData Editor.Asset.MetaData { get; set; }
Asset type specific key-value based data storage.
public string Editor.Asset.Name { get; set; }
Name of the asset, usually the filename.
string—public Sandbox.Package Editor.Asset.Package { get; set; }
If this asset was downloaded from sbox.game then this will be the package from which this asset was downloaded. If not then it'll be null.
public string Editor.Asset.Path { get; set; }
The relative path with the asset extension. ie .wav becomes .vsnd
string—public Editor.Asset.PublishSettings Editor.Asset.Publishing { get; set; }
Access the asset publisher config.
public string Editor.Asset.RelativePath { get; set; }
The relative path as it is on disk (ie .wav not .vsnd)
string—No results match this filter.