EyeonTips:Script/Reference/Applications/Fusion/Classes/Composition/AskUser

From VFXPedia

Jump to: navigation, search
  • Fusion 6.1 build 697 added "Multibutton". Usage is identical to Dropdown.
  • Fusion 6.2 now allows "ClipBrowse" rather than "FileBrowse" to get sequence gathering and appropriate file filters.

AskUser in Python

The AskUser function in Python expects a dictionary object but you can't use the "syntactic sugar" of LUA tables, which allows you to omit indices. You have to add 1, 2 and so on and you have to use strings for key names (like "Default") as well. So this is the Python version of one of the examples above:

dialog = {1: {1: "dlgDir",   "Name": "Select a Directory", 2: "PathBrowse"},
          2: {1: "dlgCheck", "Name": "A Check Box",        2: "Checkbox", "Default": 1}}
ret = composition.AskUser("A sample dialog", dialog)

This is an example of a dropdown list. It's a good idea to build the nested dictionaries step by step instead of all at once.

dropdown = {1: "ping", 2: "pong"}
dialog = {}
dialog[1] = {1: "choice", 2: "Dropdown", "Options": dropdown}
comp.AskUser("This is a dropdown", dialog)

AskUser returns a dictionary of return values or "None" if the dialog was canceled.