struct ProjectLibraryUtility

Various helper methods for the purposes of project library.

Public

Methods

staticGetResourceName

static const String &GetResourceName(const Path &relativePath)

Returns the name of the resource stored in the package.

relativePath
Path to the resource entry in the project library. Path is relative to the project library imported resources folder.

Returns: Name of the resource.

staticGetResourcePathInPackage

static Path GetResourcePathInPackage(const Path &relativePath)

Returns the path of a resource within the package.

relativePath
Path to the resource entry in the project library. Path is relative to the project library imported resources folder.

Returns: Path of the resource inside the package (relative to the package root).

staticGetPackageName

static const String &GetPackageName(const Path &relativePath)

Returns the name of the package based on project library entry path.

relativePath
Path to the entry in the project library. Path is relative to the project library imported resources folder.

Returns: Name of the package.

staticGetRelativePathToPackage

static Path GetRelativePathToPackage(const Path &relativePath)

Returns the path to the package a project library entry is stored in.

relativePath
Path to the entry in the project library. Path is relative to the project library imported resources folder.

Returns: Relative path to the package. Path is relative to the project library imported resources folder.

staticGetRelativePathFromRelativePackagePath

static Path GetRelativePathFromRelativePackagePath(const Path &relativePackagePath)

Converts a relative path to a package into a relative project library entry path.

relativePackagePath
Path to the package. Path is relative to the project library imported resources folder.

Returns: Path to the project library entry. Path is relative to the project library imported resources folder.

staticGetVirtualPathPrefix

static Path GetVirtualPathPrefix(const Path &relativePath, bool isSynchronizedPackage = false)

Returns the prefix that should be used when loading a resource via a virtual path.

relativePath
Path to the entry in the project library. Path is relative to the project library imported resources folder.
isSynchronizedPackage
Set to true if points to a synchronized package rather than a resource.

Returns: Virtual path prefix. Generally this includes the global project library virtual path prefix, followed by the relative path to the folder the resource is located in.

staticGetVirtualPath

static Path GetVirtualPath(const Path &relativePath)

Returns a virtual path that may be used for loading a resource at the provided project library path.

relativePath
Path to the resource entry in the project library. Path is relative to the project library imported resources folder.

Returns: Virtual path that may be used for loading the resource.

staticFindImportOptions

static SPtr<ImportOptions> FindImportOptions(const Path &relativePath)

Attempts to a find import options for a resource at the specified path.

relativePath
Path to the entry to search. Relative to the project library imported resources folder.

Returns: Found entry, or null if not found.

staticFindImportOptions

static SPtr<ImportOptions> FindImportOptions(const UUID &resourceId)

Attempts to a find import options for a resource with the specified ID.

resourceId
ID of the resource to look up.

Returns: Found entry, or null if not found.

staticFindRelativePath

static Path FindRelativePath(const UUID &resourceId)

Attempts to find a project library path for a resource with the specified id.

resourceId
ID of the resource to look up.

Returns: Path of the resource, relative to the project library imported resources folder or empty string if not found.

staticGetSourceResourcePath

static Path GetSourceResourcePath(const Path &relativePath)

Returns an absolute physical source resource path associated with the project library entry at the provided location.

relativePath
Path relative to the project library imported resources folder.

Returns: Absolute physical path to the associated source resource, or empty path if none exists.

staticGeneratePreviewIcon

static HTexture GeneratePreviewIcon(Resource &resource)

Generates a preview icon for the provided resource.

staticGeneratePreviewIconAndAddToPackage

static HTexture GeneratePreviewIconAndAddToPackage(Resource &resource, const SPtr<Package> &package)

Generates a preview icon for the provided resource and adds it to the package.

resource
Resource for which to generate the preview icon for.
package
Package into which to add the preview icon. Icon will be added to folder within the package specified by , and using the resource ID as the filename.

Returns: Generated preview icon, or null if not generated.

Private

Methods

staticRenderThreadGeneratePreviewPyramid

static void RenderThreadGeneratePreviewPyramid(const SPtr<render::Texture> &input, const SPtr<render::Texture> &output)

Generates a preview image for the provided resource.

Render thread only.

input
Resource to generate the preview for.
output
Pre-allocated texture with render-target usage, to which the preview image will be generated. to