Skip to content

Commit 5a44d9b

Browse files
committed
Add UI delegation plugin
Add first draft of a UI delegate plugin. This is functional, but limited, and could be cleaner. Ideally work will be done upstream in FPT to make this easier. Provide asset browsers fo both published files and workfiles. Workfiles are a particular pain point, since they cannot be queried from the server, i.e. they just exist on disk in strictly structured paths. Opening a workfile also triggers several FPT processes, and so we can't simply return a reference to the host application. Future work will have the manager plugin trigger these processes only once the workfile is resolved, via some mechanism to signal to FPT that the workfile is being resolved with the intention of opening it in a DCC (e.g. via the Context.locale). Provide an entity info panel showing asset information about the selected entity. This is an interesting case since it relies on the host asynchronously communicating the currently selected entity to the delegated UI element. Only read cases supported - i.e. no publishing support - at the moment. Due to the need to import sgtk apps at runtime, many classes must be defined inline. Alternative strategies exist, but this is left for future work. Since we're adapting pre-existing widgets, several overrides and fixes must be applied. In particular, we use a "widget stash" to keep FPT widgets alive as long as possible, to avoid issues with QThreads being destroyed without proper cleanup. Bump minimum version of OpenAssetIO to 1.0.0, where the UI delegation API is available; and MediaCreation to alpha.12, where some UI-specific traits are defined.
1 parent 3b2e498 commit 5a44d9b

File tree

4 files changed

+958
-12
lines changed

4 files changed

+958
-12
lines changed

plugin/fpt_openassetio_manager/FPTManagerInterface.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@
3636

3737
class FPTManagerInterface(ManagerInterface):
3838
"""
39-
Implement the OpenAssetIO ManagerInterface for Flow Production Tracking.
39+
Implement the OpenAssetIO ManagerInterface for Flow Production
40+
Tracking.
41+
4042
https://openassetio.github.io/OpenAssetIO/classopenassetio_1_1v1_1_1manager_api_1_1_manager_interface.html
4143
"""
4244

4345
# Entity references provided to this asset manager should be
4446
# prefixed with this string to be considered valid.
4547
# e.g. "fpt://asset/PublishedFile/123"
46-
__reference_prefix = "fpt://"
48+
reference_prefix = "fpt://"
4749

4850
def __init__(self):
4951
super().__init__()
@@ -66,7 +68,7 @@ def __init__(self):
6668

6769
def identifier(self):
6870
"""
69-
Unique identifier of this manager plugin.
71+
Retrieve the unique identifier of this manager plugin.
7072
"""
7173
return "org.foundry.fpt"
7274

@@ -143,7 +145,7 @@ def info(self):
143145
"""
144146
Arbitrary metadata about this plugin.
145147
"""
146-
return {constants.kInfoKey_EntityReferencesMatchPrefix: self.__reference_prefix}
148+
return {constants.kInfoKey_EntityReferencesMatchPrefix: self.reference_prefix}
147149

148150
def managementPolicy(self, traitSets, policyAccess, _context, _hostSession):
149151
"""
@@ -191,7 +193,7 @@ def isEntityReferenceString(self, someString, _hostSession):
191193
function will rarely, if ever, be called.
192194
"""
193195
# Check if the string starts with our prefix.
194-
return someString.startswith(self.__reference_prefix)
196+
return someString.startswith(self.reference_prefix)
195197

196198
def entityTraits(
197199
self,
@@ -430,13 +432,15 @@ def __parse_reference(self, ref_str: str) -> Optional["_ParsedReference"]:
430432
- fpt://asset/{asset_type}/{asset_id}
431433
- fpt://workfile/{template_name}/{field1}/{field2}...
432434
"""
433-
if not ref_str.startswith(self.__reference_prefix):
435+
if not ref_str.startswith(self.reference_prefix):
434436
return None
435437

436438
# Remove prefix and split path
437-
ref_type, *parts = ref_str[len(self.__reference_prefix) :].split("/")
439+
ref_type, *parts = ref_str[len(self.reference_prefix):].split("/")
440+
441+
min_num_parts = 2
438442

439-
if len(parts) < 2:
443+
if len(parts) < min_num_parts:
440444
return None
441445

442446
if ref_type == "asset":
@@ -457,7 +461,9 @@ def __parse_asset_reference(
457461
458462
I.e. fpt://asset/{asset_type}/{asset_id}
459463
"""
460-
if len(parts) != 2:
464+
expected_num_parts = 2
465+
466+
if len(parts) != expected_num_parts:
461467
return None
462468

463469
obj_type, ident_str = parts

0 commit comments

Comments
 (0)