Created
August 5, 2026 19:53
-
-
Save MustafaJafar/201bc65eef1521b98ccd75af662e2971 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A minimal proof-of-concept demonstrating AYON OpenAssetIO Manager Plugin. | |
| This example simply resolves AYON entity URIs into physical file paths. | |
| It assumes you have the AYON Manager Plugin set up and its environment variables | |
| initialized as mentioned in the community forums: | |
| This example was inspired by the OpenAssetIO Blender demo: | |
| https://github.com/elliotcmorris/openassetio-relationships-blender/ | |
| """ | |
| from openassetio.access import ResolveAccess | |
| from openassetio.hostApi import HostInterface, ManagerFactory | |
| from openassetio.log import ConsoleLogger, SeverityFilter | |
| from openassetio.pluginSystem import PythonPluginSystemManagerImplementationFactory | |
| from openassetio_mediacreation.traits.content import LocatableContentTrait | |
| from openassetio_mediacreation.traits.identity import DisplayNameTrait | |
| class BasicHostInterface(HostInterface): | |
| """Provides the host application identity to OpenAssetIO plugins.""" | |
| def identifier(self): | |
| return "org.basichost.resolve.path" | |
| def displayName(self): | |
| return "Basic Host" | |
| class OpenAssetIOManagerWrapper: | |
| """Convenience wrapper around OpenAssetIO manager setup and entity resolution.""" | |
| def __init__(self, config_path=None): | |
| logger = SeverityFilter(ConsoleLogger()) | |
| impl_factory = PythonPluginSystemManagerImplementationFactory(logger) | |
| self.host_interface = BasicHostInterface() | |
| if config_path: | |
| self.manager = ManagerFactory.defaultManagerForInterface( | |
| config_path, self.host_interface, impl_factory, logger | |
| ) | |
| else: | |
| self.manager = ManagerFactory.defaultManagerForInterface( | |
| self.host_interface, impl_factory, logger | |
| ) | |
| if not self.manager: | |
| logger.debug( | |
| "No default manager configured, check " | |
| f"${ManagerFactory.kDefaultManagerConfigEnvVarName}" | |
| ) | |
| if not self.manager.hasCapability(self.manager.Capability.kResolution): | |
| logger.debug( | |
| f"The manager '{self.manager.identifier()}' does not support entity resolution" | |
| ) | |
| def get_entity_location(self, entity_ref_uri: str) -> str: | |
| """Resolves a URI string to a physical file location path.""" | |
| entity_reference = self.manager.createEntityReference(entity_ref_uri) | |
| context = self.manager.createContext() | |
| trait_set = {LocatableContentTrait.kId, DisplayNameTrait.kId} | |
| traits_data = self.manager.resolve( | |
| entity_reference, trait_set, ResolveAccess.kRead, context | |
| ) | |
| location = LocatableContentTrait(traits_data) | |
| return location.getLocation() | |
| # --- Usage --- | |
| if __name__ == "__main__": | |
| entity_ref_uri = "ayon+entity://Experiments/random/nuke?product=renderTest_renderTestWheel&version=v004&representation=exr" | |
| oa_client = OpenAssetIOManagerWrapper() | |
| print(entity_ref_uri, "->", oa_client.get_entity_location(entity_ref_uri)) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An example of testing this in Houdini.
The output looks like