2
"""module with option implementations, to be shown in finder layouts"""
3
__docformat__ = "restructuredtext"
5
from interface import iOptions
6
import mrv.maya.ui as ui
10
opts = mrv.maya.util.optionvars
12
class FileOpenOptions(ui.ColumnLayout, iOptions):
13
"""Options implementation providing options useful during file-open"""
16
kOVExecuteScriptNodes = 'fileExecuteSN'
17
kOVIgnoreVersion = 'fileOpenIgnoreVersion'
18
kOVSelectivePreload = 'fileSelPreload'
19
kOVRefLoadSetting = 'fileOpenRefLoadSetting'
23
self._create_ui_elements()
24
self._restore_saved_values()
26
def _create_ui_elements(self):
27
self.cbScriptNodes = ui.CheckBox(label="Execute ScriptNodes", value=1)
28
self.cbIgnoreVersion = ui.CheckBox(label="Ignore Version")
30
self.omReference = ui.OptionMenu(label="Load Settings")
32
ui.MenuItem(label="Load Default References")
33
ui.MenuItem(label="Load All References")
34
ui.MenuItem(label="Load Top References")
35
ui.MenuItem(label="Load No References")
37
self.cbSelectivePreload = ui.CheckBox(label="Selective Preload")
39
def _restore_saved_values(self):
40
self.cbScriptNodes.p_value = opts.get(self.kOVExecuteScriptNodes, True)
41
self.cbIgnoreVersion.p_value = opts.get(self.kOVIgnoreVersion, False)
42
self.cbSelectivePreload.p_value = opts.get(self.kOVSelectivePreload, False)
43
self.omReference.p_select = opts.get(self.kOVRefLoadSetting, 1)
45
def fileOptions(self):
46
""":return: dict with keyword options reflecting the settings of the
47
interface. These should be given to the file command"""
49
options['ignoreVersion'] = self.cbIgnoreVersion.p_value
50
options['executeScriptNodes'] = self.cbScriptNodes.p_value
52
# TODO: Handle selective Preload !
54
# TODO: use conditionals to work in older maya versions as well
55
refsl = self.omReference.p_sl
57
options['loadAllReferences'] = True
59
options['loadReferenceDepth'] = "topOnly"
61
options['loadNoReferences'] = True