Dynamic Enum not accepting my values??
2 2

7 posts in this topic

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.) 

Share this post


Link to post
Share on other sites

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)?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2