@@ -1666,6 +1666,7 @@ def __init__(self):
16661666 self .model = None # type = pm.nodetypes.Transform
16671667 self .uihost = None # type = str
16681668 self .switchedAttrShortName = None # type = str
1669+ self .combo_idx = 0
16691670
16701671 def createUI (self , parent = None ):
16711672 # type = (QtWidgets.QObject) -> None
@@ -1709,6 +1710,8 @@ def create_controls(self):
17091710 # this add suport QlistWidget
17101711 if isinstance (self .comboObj , QtWidgets .QListWidget ):
17111712 idx = self .comboObj .currentRow ()
1713+ elif isinstance (self .comboObj , (list , tuple )):
1714+ idx = self .combo_idx
17121715 else :
17131716 idx = self .comboObj .currentIndex ()
17141717 self .comboBoxSpaces .setCurrentIndex (idx )
@@ -1767,6 +1770,11 @@ def setComboBoxItemsFormComboObj(self, combo):
17671770 # type = (widegts.toggleCombo or QtWidgets.QListWidget) -> None
17681771
17691772 del self .comboItems [:]
1773+ if isinstance (combo , (list , tuple )):
1774+ for itm in combo :
1775+ self .comboItems .append (str (itm ))
1776+ return
1777+
17701778 for i in range (combo .count () - 1 ):
17711779 # this add suport QlistWidget
17721780 if isinstance (combo , QtWidgets .QListWidget ):
@@ -2063,6 +2071,12 @@ def showUI(combo, model, uihost, switchedAttrShortName, ctrl_name, *args):
20632071 ui .setCtrls (ctrl_name )
20642072 ui .setComboBoxItemsFormComboObj (ui .comboObj )
20652073
2074+ if isinstance (combo , (list , tuple )):
2075+ idx = getComboIndex_with_namespace (
2076+ getNamespace (model ), uihost , switchedAttrShortName
2077+ )
2078+ ui .combo_idx = idx
2079+
20662080 # Delete the UI if errors occur to avoid causing winEvent
20672081 # and event errors (in Maya 2014)
20682082 try :
0 commit comments