HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArPackageResolver Class Referenceabstract

#include <packageResolver.h>

Public Member Functions

 ArPackageResolver (const ArPackageResolver &)=delete
 
ArPackageResolveroperator= (const ArPackageResolver &)=delete
 
virtual AR_API ~ArPackageResolver ()
 
Packaged Path Resolution Operations
virtual AR_API std::string Resolve (const std::string &resolvedPackagePath, const std::string &packagedPath)=0
 
Asset-specific Operations
virtual AR_API std::shared_ptr
< ArAsset
OpenAsset (const std::string &resolvedPackagePath, const std::string &resolvedPackagedPath)=0
 

Scoped Resolution Cache

These functions are called when scoped resolution caches are enabled via ArResolver.

See Also
Scoped Resolution Cache
virtual AR_API void BeginCacheScope (VtValue *cacheScopeData)=0
 
virtual AR_API void EndCacheScope (VtValue *cacheScopeData)=0
 
AR_API ArPackageResolver ()
 

Detailed Description

Interface for resolving assets within package assets. A package resolver is responsible for processing particular package asset formats and resolving information about assets stored within that package.

Each package resolver is associated with particular file formats and is invoked by asset resolution when handling package-relative paths involving those formats. ArPackageResolver instances are only used internally by Ar and are not directly exposed to clients.

Implementing a Package Resolver

To implement a package resolver, users must create a plugin containing a subclass of ArPackageResolver and register it with the plugin system so that it can be discovered and instantiated at runtime.

  • Implement an ArPackageResolver subclass
    class CustomPackageResolver : public ArPackageResolver {
    // ...
    }
  • In its implementation, register the ArPackageResolver subclass using AR_DEFINE_PACKAGE_RESOLVER
    # custom resolver's .cpp file
    AR_DEFINE_PACKAGE_RESOLVER(CustomPackageResolver, ArPackageResolver);
  • Declare the ArPackageResolver subclass in the plugin's plugInfo.json file. Note that the entry for the subclass must declare the file format it handles in the 'extensions' metadata.
    # plugInfo.json
    {
    "Plugins": [
    {
    "Info": {
    "Types" : {
    "CustomPackageResolver" : {
    "bases": [ "ArPackageResolver" ],
    "extensions": [ "pack" ]
    }
    }
    },
    ...
    },
    ...
    ]
    }

Definition at line 95 of file packageResolver.h.

Constructor & Destructor Documentation

ArPackageResolver::ArPackageResolver ( const ArPackageResolver )
delete
virtual AR_API ArPackageResolver::~ArPackageResolver ( )
virtual
AR_API ArPackageResolver::ArPackageResolver ( )
protected

Mark the start of a resolution caching scope.

See Also
ArResolver::BeginCacheScope

Member Function Documentation

virtual AR_API void ArPackageResolver::BeginCacheScope ( VtValue cacheScopeData)
pure virtual

Mark the start of a resolution caching scope.

See Also
ArResolver::BeginCacheScope
virtual AR_API void ArPackageResolver::EndCacheScope ( VtValue cacheScopeData)
pure virtual

Mark the end of a resolution caching scope.

See Also
ArResolver::EndCacheScope
virtual AR_API std::shared_ptr<ArAsset> ArPackageResolver::OpenAsset ( const std::string resolvedPackagePath,
const std::string resolvedPackagedPath 
)
pure virtual

Returns an ArAsset object for the asset at resolvedPackagedPath located in the package asset at resolvedPackagePath. Returns an invalid std::shared_ptr if object could not be created.

See Also
ArResolver::OpenAsset
ArPackageResolver& ArPackageResolver::operator= ( const ArPackageResolver )
delete
virtual AR_API std::string ArPackageResolver::Resolve ( const std::string resolvedPackagePath,
const std::string packagedPath 
)
pure virtual

Returns the resolved path for the asset located at packagedPath in the package specified by resolvedPackagePath if it exists. If the asset does not exist in the package, returns an empty string.

When ArResolver::Resolve is invoked on a package-relative path, the path will be parsed into the outermost package path, and the inner packaged path. The outermost package path will be resolved by the primary resolver. ArPackageResolver::Resolve will then be called on the corresponding package resolver with that resolved path and the inner packaged path. If the inner packaged path is itself a package-relative path, this process recurses until all paths have been resolved.

See Also
ArResolver::Resolve

The documentation for this class was generated from the following file: