Tim Edelmann Posted March 16, 2018 Report Share Posted March 16, 2018 Hello again, we would like to use Dynamic Enums to let our team-members select maya plugins from a drop-down which is populated from a folder containing all plugins available. For this we prepare the dropdown contents like described here: http://ftrack.rtd.ftrack.com/en/3.3.7/developing/dynamic_enumerator.html The resulting list looks like this: [{'name': '3Delight - 8.0.572', 'value': 'C:\\ConfigurationSync\\Maya\\3Delight\\3Delight_8.0.572'}, {'name': 'abcToA - 3.0.0 - 2018 - 2.0.1', 'value': 'C:\\ConfigurationSync\\Maya\\abcToA\\3.0.0_2018_2.0.1'}, {'name': 'abcToA - 3.0.1 - 2018 - 2.1.0.1', 'value': 'C:\\ConfigurationSync\\Maya\\abcToA\\3.0.1_2018_2.1.0.1'}, {'name': 'aTools - 2.0.1', 'value': 'C:\\ConfigurationSync\\Maya\\aTools\\2.0.1'}, {'name': 'aTools - 2.0.2', 'value': 'C:\\ConfigurationSync\\Maya\\aTools\\2.0.2'}, {'name': 'bonusTools - 2018', 'value': 'C:\\ConfigurationSync\\Maya\\bonusTools\\2018'}, {'name': 'cosmos - 1.0', 'value': 'C:\\ConfigurationSync\\Maya\\cosmos\\1.0'}, {'name': 'exocortex - crate - 1.1.153', 'value': 'C:\\ConfigurationSync\\Maya\\exocortex_crate\\1.1.153'}] This list has about 150 entries in the end. We noticed, that having 2-3 entries sometimes works and sometimes not. We Cannot figure out, what the problem with this might be. Are we missing anything here? Why is this not working? Thanks very much in advance Tim Link to comment Share on other sites More sharing options...
Remus Avram Posted March 18, 2018 Report Share Posted March 18, 2018 Hi @Tim Edelmann which version of Ftrack are you running? Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted March 19, 2018 Report Share Posted March 19, 2018 Hi Tim, Could you provide a small script to reproduce this issue along with some steps that you take in the UI? Please make the script self-contained and return a static list of options so that I can run it here and help you debug the issue. Link to comment Share on other sites More sharing options...
Tim Edelmann Posted March 19, 2018 Author Report Share Posted March 19, 2018 Hi Remus, we're using: python-API: 1.4.0 javascript: 0.4.5 Server: 3.5.20.4615 Link to comment Share on other sites More sharing options...
Tim Edelmann Posted March 19, 2018 Author Report Share Posted March 19, 2018 Hey Mattias, here a short test: # :coding: utf-8 import os import sys import ftrack_api class DynamicEnumMayaPlugins(object): label = "Dynamic Enumerator Plugins" description = 'Returns a list of all plugins for maya' identifier = "DynamicEnumMayaPlugins" def __init__(self, session): super(DynamicEnumMayaPlugins, self).__init__() self.session = session def register(self): self.session.event_hub.subscribe('topic=ftrack.dynamic-enumerator', self.launch) def launch(self, event): if 'Maya_Plugins' not in event['data']['attributeName']: return return [{'name':'Plugin1 - 8.0.572','value':'C:\\Path\\to\\Plugin1\\Plugin1_8.0.572'}, {'name':'Plugin2 - 8.0.572','value':'C:\\Path\\to\\Plugin2\\Plugin2_8.0.572'}, {'name':'Plugin3 - 8.0.572','value':'C:\\Path\\to\\Plugin3\\Plugin3_8.0.572'}] def register(session, **kw): action = DynamicEnumMayaPlugins(session) action.register() # startup os.environ['FTRACK_SERVER'] = '<YOUR_SERVER_URL>' os.environ['FTRACK_APIKEY'] = '<YOUR_APIKEY>' os.environ['FTRACK_EVENT_PLUGIN_PATH'] = '.' session = ftrack_api.Session() register(session) print('Waiting for events') session.event_hub.wait() You need to note your server-url and apikey.. Seems to work in about 30% of my tests. I setup a custom attribute "Briefing_Workflows_04_Maya_Plugins" in its own group of custom attributes. Its a multi selection field were every role can read and write despite our 'Artist'-Role which is not allowed to write. When I click the dropdown, it simply doesn't show the returned list of entries. If I click it about 3-7 times, it comes up (in 30% of my tests). So its working .. somehow.. but not reliably hope this helps Little addition: It seems as if the returned list is read from a folder and created first (instead of just returning a fixed sample -- as seen above) its working even less.. Litte addition2: When I cache the created list of plugins, the dropdown gets populated but still not every time clicked (about every 5th-15th click.) Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted March 21, 2018 Report Share Posted March 21, 2018 Hi Tim, I've tried with the script that you provided and it works 100% of the time for me. If you run the above script as it is with no other actions/event listeners in the same script/python process, does it still only work 30% of the time? If you add a print or two in the launch method, does it seem to get called (trying ot locate if the issue is in the UI or in the python api)? Link to comment Share on other sites More sharing options...
Tim Edelmann Posted March 21, 2018 Author Report Share Posted March 21, 2018 yep. my bad I had another action (on another pc) registering for 'topic=ftrack.dynamic-enumerator' as well... So they seem to have interfered. It works when each registering instance makes use of 'event.stop()' if its to be handled here. Thanks for looking into this! Tim Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.