From 56662f3d8b30534fd6332638f07bc1901ebf556e Mon Sep 17 00:00:00 2001 From: Tom Cowland Date: Tue, 9 May 2023 16:24:53 +0100 Subject: [PATCH] [Core] Remove custom locale There were two issues with the existing use of the locale: - It doesn't map to batching (as we have one locale per-call), so might encourage a dependency on context-specific data that then traps a host into single entity resolves. - The specification used on-the-stack classes which isn't in the spirit of using TraitGen to ensure that the definition is readily available to a manager's code base. As such, remove for now. Part of #16 Signed-off-by: Tom Cowland --- .../operations/openassetio_media_linker.py | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/otio_openassetio/operations/openassetio_media_linker.py b/otio_openassetio/operations/openassetio_media_linker.py index 9119112..bf97eb3 100644 --- a/otio_openassetio/operations/openassetio_media_linker.py +++ b/otio_openassetio/operations/openassetio_media_linker.py @@ -7,13 +7,10 @@ from collections import namedtuple -from openassetio import log, exceptions, SpecificationBase +from openassetio import log, exceptions from openassetio.hostApi import HostInterface, ManagerFactory from openassetio.pluginSystem import PythonPluginSystemManagerImplementationFactory - -import openassetio_mediacreation -from openassetio_mediacreation.traits.timeline import ClipTrait from openassetio_mediacreation.traits.content import LocatableContentTrait import opentimelineio as otio @@ -49,11 +46,6 @@ def link_media_reference(in_clip, media_linker_argument_map): if not entity_reference: return - # Update the locale with more information about this call - # This is perhaps more illustrative than useful at this point. - context = session_state.context - ClipTrait(context.locale).setName(in_clip.name) - # In this simple implementation, we only need the URL to the media, # so we use the LocatableContentTrait directly. As we don't know the # specifics of what the external reference may point to, using any @@ -62,7 +54,7 @@ def link_media_reference(in_clip, media_linker_argument_map): # manager fetching any data we are not going to use. try: entity_data = manager.resolve( - entity_reference, {LocatableContentTrait.kId}, context + entity_reference, {LocatableContentTrait.kId}, session_state.context ) mr.target_url = LocatableContentTrait(entity_data).getLocation() except Exception as exc: @@ -98,20 +90,6 @@ def displayName(self): return "OpenTimelineIO OpenAssetIO Media Linker plugin" -class OTIOClipLocale(SpecificationBase): - """ - An OpenAssetIO Locale that represents API calls for a track clip - """ - - kTraitSet = { - # Describe where we are in the OTIO structure a little - openassetio_mediacreation.traits.timeline.TimelineTrait.kId, - openassetio_mediacreation.traits.timeline.TrackTrait.kId, - openassetio_mediacreation.traits.timeline.ClipTrait.kId, - "otio", - } - - # # Session Management # @@ -152,8 +130,7 @@ def _sessionState(args: dict) -> SessionState: def _createSessionState(args: dict) -> SessionState: """ Configures a new SessionState with the manager + settings from the - supplied args. A new Context is created and configured for read - with the correct locale. + supplied args. A new Context is created and configured for read. If no identifier is provided in the settings, then the OpenAssetIO default manager config mechanism will be used as a fallback. @@ -179,6 +156,5 @@ def _createSessionState(args: dict) -> SessionState: # now though and is better than making a context per clip. context = manager.createContext() context.access = context.Access.kRead - context.locale = OTIOClipLocale.create().traitsData() return SessionState(manager=manager, context=context)