def buildAutoNameTool(self, parent, vis=True): containerName = 'AutoNameContainer' self.containerName = MelColumn(parent, vis=vis) #>>> Begin the section mc.setParent(self.containerName) guiFactory.header('Tag and Release') guiFactory.lineSubBreak() #>>> Guessed Name GenratedNameRow = MelHLayout(self.containerName, ut='cgmUIInstructionsTemplate') self.GeneratedNameField = MelLabel( GenratedNameRow, bgc=dictionary.returnStateColor('help'), align='center', label='Name will preview here...') GenratedNameRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() guiFactory.lineSubBreak() #>>> Load To Field #clear our variables if not mc.optionVar(ex='cgmVar_AutoNameObject'): mc.optionVar(sv=('cgmVar_AutoNameObject', '')) LoadAutoNameObjectRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5) MelSpacer(LoadAutoNameObjectRow, w=5) MelLabel(LoadAutoNameObjectRow, l='Object:', align='right') self.AutoNameObjectField = MelTextField(LoadAutoNameObjectRow, w=125, ut='cgmUIReservedTemplate', editable=False) if mc.optionVar(q='cgmVar_AutoNameObject'): self.AutoNameObjectField( edit=True, text=mc.optionVar(q='cgmVar_AutoNameObject')) guiFactory.doButton2(LoadAutoNameObjectRow, '<<', 'tdToolsLib.uiLoadAutoNameObject(cgmTDToolsWin)', 'Load to field') LoadAutoNameObjectRow.setStretchWidget(self.AutoNameObjectField) guiFactory.doButton2(LoadAutoNameObjectRow, 'Up', lambda *a: tdToolsLib.uiAutoNameWalkUp(self), 'Load to field') guiFactory.doButton2(LoadAutoNameObjectRow, 'Down', lambda *a: tdToolsLib.uiAutoNameWalkDown(self), 'Load to field') guiFactory.doButton2( LoadAutoNameObjectRow, 'Name it', lambda *a: tdToolsLib.uiNameLoadedAutoNameObject(self), 'Load to field') guiFactory.doButton2( LoadAutoNameObjectRow, 'Name Children', lambda *a: tdToolsLib.uiNameLoadedAutoNameObjectChildren(self), 'Load to field') MelSpacer(LoadAutoNameObjectRow, w=5) LoadAutoNameObjectRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() #>>> Tag Labels TagLabelsRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=2) MelLabel(TagLabelsRow, label='Position') MelLabel(TagLabelsRow, label='Direction') MelLabel(TagLabelsRow, label='Name') MelLabel(TagLabelsRow, label='Type') TagLabelsRow.layout() #>>> Tags mc.setParent(self.containerName) TagsRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=3) self.PositionTagField = MelTextField( TagsRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag(self, 'cgmPosition'), w=75) self.DirectionTagField = MelTextField( TagsRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag(self, 'cgmDirection'), w=75) self.NameTagField = MelTextField( TagsRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag(self, 'cgmName'), w=75) """ self.NameTagFieldPopUp = MelPopupMenu(self.NameTagField,button = 3) self.NameTagLoadParentPopUp = MelMenuItem(self.NameTagFieldPopUp , label = 'Select parent name object', enable = False) """ self.ObjectTypeTagField = MelTextField( TagsRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag(self, 'cgmType'), w=75) TagsRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() #>>> ModifierTags mc.setParent(self.containerName) TagModifiersRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=3) MelLabel(TagModifiersRow, align='right', label='Modifiers ------->', w=75) self.DirectionModifierTagField = MelTextField( TagModifiersRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag( self, 'cgmDirectionModifier'), w=75) self.NameModifierTagField = MelTextField( TagModifiersRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag( self, 'cgmNameModifier'), w=75) self.ObjectTypeModifierTagField = MelTextField( TagModifiersRow, enable=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag( self, 'cgmTypeModifier'), w=75) TagModifiersRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() guiFactory.lineBreak() #>>> Basic mc.setParent(self.containerName) guiFactory.header('On Selection') guiFactory.lineSubBreak() BasicRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=2) guiFactory.doButton2(BasicRow, 'Name Object', 'tdToolsLib.uiNameObject(cgmTDToolsWin)', "Attempts to name an object") guiFactory.doButton2( BasicRow, 'Update Name', 'tdToolsLib.doUpdateObjectName(cgmTDToolsWin)', "Takes the name you've manually changed the object to, \n stores that to the cgmName tag then \n renames the object" ) guiFactory.doButton2( BasicRow, 'Name Heirarchy', 'tdToolsLib.doNameHeirarchy(cgmTDToolsWin)', "Attempts to intelligently name a \n heirarchy of objects") BasicRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() guiFactory.lineBreak() return self.containerName
def Main_buildLayout(self,parent): def modeSet( item ): i = self.setModes.index(item) self.SetToolsModeOptionVar.set( i ) self.setMode = i MainForm = MelFormLayout(parent) TopSection = MelColumnLayout(MainForm) SetHeader = guiFactory.header('Puppet') #>>> Top Section #Report self.puppetReport = MelLabel(TopSection, bgc = dictionary.returnStateColor('help'), align = 'center', label = '...', h=20) MelSeparator(TopSection,ut='cgmUITemplate',h=5) #Edit name and state mode buttons MasterPuppetRow = MelHSingleStretchLayout(TopSection,padding = 5) MelSpacer(MasterPuppetRow,w=5) self.MasterPuppetTF = MelTextField(MasterPuppetRow, bgc = [1,1,1], ec = lambda *a:puppetBoxLib.updatePuppetName(self)) MasterPuppetRow.setStretchWidget(self.MasterPuppetTF) self.puppetStateButtonsDict = {} for i,s in enumerate(self.puppetStateOptions): self.puppetStateButtonsDict[i] = guiFactory.doButton2(MasterPuppetRow,s.capitalize(), "print '%s'"%s, enable = False) MelSpacer(MasterPuppetRow,w=20) MasterPuppetRow.layout() #MelSeparator(TopSection,ut='cgmUITemplate',h=2) #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Define State Rows #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #Initial State Mode Row self.PuppetModeCollection = MelRadioCollection() self.PuppetModeCollectionChoices = [] self.InitialStateModeRow = MelHSingleStretchLayout(TopSection,padding = 2,vis=False) MelSpacer(self.InitialStateModeRow,w=5) MelLabel(self.InitialStateModeRow,l='Template Modes') Spacer = MelSeparator(self.InitialStateModeRow,w=10) for i,item in enumerate(CharacterTypes): self.PuppetModeCollectionChoices.append(self.PuppetModeCollection.createButton(self.InitialStateModeRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetBaseMode,self,i))) MelSpacer(self.InitialStateModeRow,w=3) self.InitialStateModeRow.setStretchWidget( Spacer ) MelSpacer(self.InitialStateModeRow,w=2) self.InitialStateModeRow.layout() mc.radioCollection(self.PuppetModeCollection ,edit=True,sl= (self.PuppetModeCollectionChoices[ (self.PuppetModeOptionVar.value) ])) self.UI_StateRows['define'].append(self.InitialStateModeRow) self.AxisFrame = MelFrameLayout(TopSection,label = 'Axis',vis=False, collapse=True, collapsable=True, ut = 'cgmUIHeaderTemplate') self.UI_StateRows['define'].append(self.AxisFrame) MelSeparator(TopSection,style='none',h=5) #Aim Axis Mode Row self.AimAxisCollection = MelRadioCollection() self.AimAxisCollectionChoices = [] self.AimAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.AimAxisRow,w=5) MelLabel(self.AimAxisRow,l='Aim ') Spacer = MelSeparator(self.AimAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.AimAxisCollectionChoices.append(self.AimAxisCollection.createButton(self.AimAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisAim,self,i))) MelSpacer(self.AimAxisRow,w=3) self.AimAxisRow.setStretchWidget( Spacer ) MelSpacer(self.AimAxisRow,w=2) self.AimAxisRow.layout() #Up Axis Mode Row self.UpAxisCollection = MelRadioCollection() self.UpAxisCollectionChoices = [] self.UpAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.UpAxisRow,w=5) MelLabel(self.UpAxisRow,l='Up ') Spacer = MelSeparator(self.UpAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.UpAxisCollectionChoices.append(self.UpAxisCollection.createButton(self.UpAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisUp,self,i))) MelSpacer(self.UpAxisRow,w=3) self.UpAxisRow.setStretchWidget( Spacer ) MelSpacer(self.UpAxisRow,w=2) self.UpAxisRow.layout() #Out Axis Mode Row self.OutAxisCollection = MelRadioCollection() self.OutAxisCollectionChoices = [] self.OutAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.OutAxisRow,w=5) MelLabel(self.OutAxisRow,l='Out ') Spacer = MelSeparator(self.OutAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.OutAxisCollectionChoices.append(self.OutAxisCollection.createButton(self.OutAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisOut,self,i))) MelSpacer(self.OutAxisRow,w=3) self.OutAxisRow.setStretchWidget( Spacer ) MelSpacer(self.OutAxisRow,w=2) self.OutAxisRow.layout() #Set toggles on menu mc.radioCollection(self.AimAxisCollection ,edit=True,sl= (self.AimAxisCollectionChoices[ (self.PuppetAimOptionVar.value) ])) mc.radioCollection(self.UpAxisCollection ,edit=True,sl= (self.UpAxisCollectionChoices[ (self.PuppetUpOptionVar.value) ])) mc.radioCollection(self.OutAxisCollection ,edit=True,sl= (self.OutAxisCollectionChoices[ (self.PuppetOutOptionVar.value) ])) #Initial State Button Row self.InitialStateButtonRow = MelHLayout(TopSection, h = 20,vis=False,padding = 5) guiFactory.doButton2(self.InitialStateButtonRow,'Add Geo', lambda *a:puppetBoxLib.doAddGeo(self)) guiFactory.doButton2(self.InitialStateButtonRow,'Build Size Template', lambda *a:puppetBoxLib.doBuildSizeTemplate(self)) self.InitialStateButtonRow.layout() self.UI_StateRows['define'].append(self.InitialStateButtonRow) #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Multi Module #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>> All Sets menu AllModulesRow = MelFormLayout(MainForm,height = 20) activeState = True i = 1 tmpActive = MelCheckBox(AllModulesRow, annotation = 'Sets all sets active', value = activeState, onCommand = Callback(puppetBoxLib.doSetAllSetsAsActive,self), offCommand = Callback(puppetBoxLib.doSetAllSetsAsInactive,self)) tmpSel = guiFactory.doButton2(AllModulesRow, ' s ', 'Select All Loaded/Active Sets') # Mode toggle box self.ModuleModeOptionMenu = MelOptionMenu(AllModulesRow, cc = modeSet) tmpKey = guiFactory.doButton2(AllModulesRow, ' k ', 'Key All Sets') tmpDeleteKey = guiFactory.doButton2(AllModulesRow, ' d ', 'Delete All Set Keys') tmpReset = guiFactory.doButton2(AllModulesRow, ' r ', 'Reset All Set Keys') mc.formLayout(AllModulesRow, edit = True, af = [(tmpActive, "left", 10), (tmpReset,"right",10)], ac = [(tmpSel,"left",0,tmpActive), (self.ModuleModeOptionMenu,"left",4,tmpSel), (self.ModuleModeOptionMenu,"right",4,tmpKey), (tmpKey,"right",2,tmpDeleteKey), (tmpDeleteKey,"right",2,tmpReset) ]) #>>> Sets building section allPopUpMenu = MelPopupMenu(self.ModuleModeOptionMenu ,button = 3) allCategoryMenu = MelMenuItem(allPopUpMenu, label = 'Make Type:', sm = True) #>>> Sets building section ModuleListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate') ModuleMasterForm = MelFormLayout(ModuleListScroll) self.ModuleListColumn = MelColumnLayout(ModuleMasterForm,ut = 'cgmUIInstructionsTemplate', adj = True, rowSpacing = 2) self.helpInfo = MelLabel(MainForm, h=20, l = "Add a Puppet", ut = 'cgmUIInstructionsTemplate', al = 'center', ww = True,vis = self.ShowHelpOptionVar.value) self.helpBlurbs.extend([self.helpInfo ]) VerifyRow = guiFactory.doButton2(MainForm, 'Check Puppet', 'Create new buffer from selected buffer') ModuleMasterForm(edit = True, af = [(self.ModuleListColumn,"top",0), (self.ModuleListColumn,"left",0), (self.ModuleListColumn,"right",0), (self.ModuleListColumn,"bottom",0)]) MainForm(edit = True, af = [(TopSection,"top",0), (TopSection,"left",0), (TopSection,"right",0), (AllModulesRow,"left",0), (AllModulesRow,"right",0), (ModuleListScroll,"left",0), (ModuleListScroll,"right",0), (ModuleListScroll,"left",0), (ModuleListScroll,"right",0), (self.helpInfo,"left",8), (self.helpInfo,"right",8), (VerifyRow,"left",4), (VerifyRow,"right",4), (VerifyRow,"bottom",4)], ac = [(AllModulesRow,"top",2,TopSection), (ModuleListScroll,"top",2,AllModulesRow), (ModuleListScroll,"bottom",0,self.helpInfo), (self.helpInfo,"bottom",0,VerifyRow)], attachNone = [(VerifyRow,"top")])
def uiLoadAutoNameObject(self): selected = [] bufferList = [] selected = (mc.ls (sl=True,flatten=True,shortNames=True)) fieldToKeyDict = {'cgmName':self.NameTagField, 'cgmType':self.ObjectTypeTagField, 'cgmNameModifier':self.NameModifierTagField, 'cgmTypeModifier':self.ObjectTypeModifierTagField, 'cgmDirectionModifier':self.DirectionModifierTagField, 'cgmDirection':self.DirectionTagField, 'cgmPosition':self.PositionTagField, 'cgmIterator':self.IteratorTagField} if selected: if len(selected) >= 2: guiFactory.warning('Only one object can be loaded') else: # Put the object in the field guiFactory.doLoadSingleObjectToTextField(self.AutoNameObjectField,'cgmVar_AutoNameObject') #Get the tag info for the object tagsDict = NameFactoryOld.returnObjectGeneratedNameDict(selected[0]) userAttrs = attributes.returnUserAttributes(selected[0]) cgmAttrs = NameFactoryOld.returnCGMOrder() usedAttrs = lists.returnMatchList(userAttrs,cgmAttrs) tagAttrs = tagsDict.keys() #Enable the tag fields for key in fieldToKeyDict.keys(): mc.textField(fieldToKeyDict.get(key),edit=True,enable=True, text = '', bgc = dictionary.returnStateColor('normal')) for key in tagsDict.keys(): currentField = fieldToKeyDict.get(key) buildSelectPopUp = {} buildLoadPopUp = {} #purge popup popUpBuffer = currentField(q=True, popupMenuArray = True) if popUpBuffer: for item in popUpBuffer: mc.deleteUI (item) mc.textField(currentField,edit=True,text = tagsDict.get(key), bgc = dictionary.returnStateColor('keyed')) # Set special color cases, if it's guessed or gotten upstream.... if usedAttrs: if key not in usedAttrs: mc.textField(currentField,edit = True, bgc = dictionary.returnStateColor('reserved')) # if it's connected elif (mc.connectionInfo ((selected[0]+'.'+key),isDestination=True)): driverObject = attributes.returnDriverObject(selected[0]+'.'+key) driverAttr = attributes.returnDriverAttribute(selected[0]+'.'+key) mc.textField(currentField,edit = True, text = (driverAttr), bgc = dictionary.returnStateColor('connected')) buildSelectPopUp['Select driver object'] = (driverObject) buildLoadPopUp['Load driver object'] = (driverObject) else: #Got it from a parent parentNameObjectRaw = search.returnTagUp(selected[0],key) if parentNameObjectRaw: if '|' in parentNameObjectRaw[1]: parentNameBuffer = parentNameObjectRaw[1].split('|') parentNameObject = parentNameBuffer[-1] else: parentNameObject = parentNameObjectRaw[1] mc.textField(currentField,edit = True, enable=True, text = parentNameObject, bgc = dictionary.returnStateColor('semiLocked')) buildSelectPopUp['Select parent name object'] = (parentNameObjectRaw[1]) buildLoadPopUp['Load parent name object'] = (parentNameObjectRaw[1]) else: mc.textField(currentField,edit = True, bgc = dictionary.returnStateColor('reserved')) if buildSelectPopUp or buildLoadPopUp: buffer = MelPopupMenu(currentField,button = 3) if buildSelectPopUp: for key in buildSelectPopUp.keys(): MelMenuItem(buffer , label = key, c = ('%s%s%s' %("mc.select('",buildSelectPopUp.get(key),"')"))) if buildLoadPopUp: for key in buildLoadPopUp.keys(): MelMenuItem(buffer , label = key, c = lambda *a:uiLoadParentNameObject(self,buildLoadPopUp.get(key))) # if it's connected uiUpdateAutoNamePreview(self) else: #clear the field guiFactory.doLoadSingleObjectToTextField(self.AutoNameObjectField,'cgmVar_AutoNameObject') # update the fields for key in fieldToKeyDict.keys(): mc.textField(fieldToKeyDict.get(key),edit=True,enable=False, text = '', bgc = dictionary.returnStateColor('normal')) # Fix previewer uiUpdateAutoNamePreview(self)
def buildAttributeEditingTool(self, parent, vis=True): #Container containerName = 'Attributes Constainer' self.containerName = MelColumn(parent, vis=vis) ###Create mc.setParent(self.containerName) guiFactory.header('Create') guiFactory.lineSubBreak() #>>>Create Row attrCreateRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5) MelSpacer(attrCreateRow) MelLabel(attrCreateRow, l='Names:', align='right') self.AttrNamesTextField = MelTextField( attrCreateRow, backgroundColor=[1, 1, 1], h=20, ec=lambda *a: attrToolsLib.doAddAttributesToSelected(self), annotation= "Names for the attributes. Create multiple with a ';'. \n Message nodes try to connect to the last object in a selection \n For example: 'Test1;Test2;Test3'" ) guiFactory.doButton2( attrCreateRow, 'Add', lambda *a: attrToolsLib.doAddAttributesToSelected(self), "Add the attribute names from the text field") MelSpacer(attrCreateRow, w=2) attrCreateRow.setStretchWidget(self.AttrNamesTextField) attrCreateRow.layout() #>>> modify Section self.buildAttrTypeRow(self.containerName) MelSeparator(self.containerName, ut='cgmUIHeaderTemplate', h=2) MelSeparator(self.containerName, ut='cgmUITemplate', h=10) ###Modify mc.setParent(self.containerName) guiFactory.header('Modify') AttrReportRow = MelHLayout(self.containerName, ut='cgmUIInstructionsTemplate', h=20) self.AttrReportField = MelLabel( AttrReportRow, bgc=dictionary.returnStateColor('help'), align='center', label='...', h=20) AttrReportRow.layout() MelSeparator(self.containerName, ut='cgmUISubTemplate', h=5) #>>> Load To Field LoadAttributeObjectRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5) MelSpacer(LoadAttributeObjectRow, w=5) guiFactory.doButton2(LoadAttributeObjectRow, '>>', lambda *a: attrToolsLib.uiLoadSourceObject(self), 'Load to field') self.SourceObjectField = MelTextField(LoadAttributeObjectRow, w=125, h=20, ut='cgmUIReservedTemplate', editable=False) LoadAttributeObjectRow.setStretchWidget(self.SourceObjectField) MelLabel(LoadAttributeObjectRow, l=' . ') self.ObjectAttributesOptionMenu = MelOptionMenu(LoadAttributeObjectRow, w=100) self.DeleteAttrButton = guiFactory.doButton2( LoadAttributeObjectRow, 'X', lambda *a: attrToolsLib.uiDeleteAttr( self, self.ObjectAttributesOptionMenu), 'Delete attribute', w=25, en=False) MelSpacer(LoadAttributeObjectRow, w=5) LoadAttributeObjectRow.layout() #>>> Standard Flags BasicAttrFlagsRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=2) MelSpacer(BasicAttrFlagsRow, w=5) self.KeyableAttrCB = MelCheckBox(BasicAttrFlagsRow, label='Keyable', en=False) MelSpacer(BasicAttrFlagsRow, w=5) self.HiddenAttrCB = MelCheckBox(BasicAttrFlagsRow, label='Hidden', en=False) MelSpacer(BasicAttrFlagsRow, w=5) self.LockedAttrCB = MelCheckBox(BasicAttrFlagsRow, label='Locked', en=False) MelSpacer(BasicAttrFlagsRow, w=5) BasicAttrFlagsRow.layout() #>>> Name Row self.EditNameSettingsRow = MelHSingleStretchLayout( self.containerName, ut='cgmUISubTemplate') self.EditNameSettingsRow.setStretchWidget( MelSpacer(self.EditNameSettingsRow, w=5)) NameLabel = MelLabel(self.EditNameSettingsRow, label='Name: ') self.NameField = MelTextField( self.EditNameSettingsRow, en=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiRenameAttr(self), h=20, w=75) NiceNameLabel = MelLabel(self.EditNameSettingsRow, label='Nice: ') self.NiceNameField = MelTextField( self.EditNameSettingsRow, en=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateNiceName(self), h=20, w=75) AliasLabel = MelLabel(self.EditNameSettingsRow, label='Alias: ') self.AliasField = MelTextField( self.EditNameSettingsRow, en=False, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateAlias(self), h=20, w=75) MelSpacer(self.EditNameSettingsRow, w=5) self.EditNameSettingsRow.layout() """mc.formLayout(self.EditNameSettingsRow, edit = True, af = [(NameLabel, "left", 5), (self.AliasField,"right",5)], ac = [(self.NameField,"left",2,NameLabel), (NiceNameLabel,"left",2,self.NameField), (self.NiceNameField,"left",2,NiceNameLabel), (AliasLabel,"left",2,self.NiceNameField), (self.AliasField,"left",2,AliasLabel), ])""" #>>> Int Row #self.EditDigitSettingsRow = MelFormLayout(self.containerName,ut='cgmUISubTemplate',vis = False) self.EditDigitSettingsRow = MelHSingleStretchLayout( self.containerName, ut='cgmUISubTemplate', vis=False) self.EditDigitSettingsRow.setStretchWidget( MelSpacer(self.EditDigitSettingsRow, w=5)) MinLabel = MelLabel(self.EditDigitSettingsRow, label='Min:') self.MinField = MelTextField( self.EditDigitSettingsRow, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateMinValue(self), h=20, w=35) MaxLabel = MelLabel(self.EditDigitSettingsRow, label='Max:') self.MaxField = MelTextField( self.EditDigitSettingsRow, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateMaxValue(self), h=20, w=35) DefaultLabel = MelLabel(self.EditDigitSettingsRow, label='dv:') self.DefaultField = MelTextField( self.EditDigitSettingsRow, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateDefaultValue(self), h=20, w=35) SoftMinLabel = MelLabel(self.EditDigitSettingsRow, label='sMin:') self.SoftMinField = MelTextField( self.EditDigitSettingsRow, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateSoftMinValue(self), h=20, w=35) SoftMaxLabel = MelLabel(self.EditDigitSettingsRow, label='sMax:') self.SoftMaxField = MelTextField( self.EditDigitSettingsRow, bgc=dictionary.returnStateColor('normal'), ec=lambda *a: attrToolsLib.uiUpdateSoftMaxValue(self), h=20, w=35) MelSpacer(self.EditDigitSettingsRow, w=5) self.EditDigitSettingsRow.layout() """mc.formLayout(self.EditDigitSettingsRow, edit = True, af = [(MinLabel, "left", 20), (self.SoftMinField,"right",20)], ac = [(self.MinField,"left",2,MinLabel), (MaxLabel,"left",2,self.MinField), (self.MaxField,"left",2,MaxLabel), (DefaultLabel,"left",2,self.MaxField), (self.DefaultField,"left",2,DefaultLabel), (SoftMaxLabel,"left",2,self.DefaultField), (self.SoftMaxField,"left",2,SoftMaxLabel), (SoftMinLabel,"left",2,self.SoftMaxField), (self.SoftMinField,"left",2,SoftMinLabel) ])""" #>>> Enum self.EditEnumRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5, vis=False) MelSpacer(self.EditEnumRow, w=10) MelLabel(self.EditEnumRow, label='Enum: ') self.EnumField = MelTextField( self.EditEnumRow, annotation= "Options divided by ':'. \n Set values with '=' \n For example: 'off:on=1:maybe=23'", bgc=dictionary.returnStateColor('normal'), h=20, w=75) MelSpacer(self.EditEnumRow, w=10) self.EditEnumRow.setStretchWidget(self.EnumField) self.EditEnumRow.layout() #>>> String self.EditStringRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5, vis=False) MelSpacer(self.EditStringRow, w=10) MelLabel(self.EditStringRow, label='String: ') self.StringField = MelTextField( self.EditStringRow, h=20, bgc=dictionary.returnStateColor('normal'), w=75) MelSpacer(self.EditStringRow, w=10) self.EditStringRow.setStretchWidget(self.StringField) self.EditStringRow.layout() #>>> Message self.EditMessageRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=5, vis=False) MelSpacer(self.EditMessageRow, w=10) MelLabel(self.EditMessageRow, label='Message: ') self.MessageField = MelTextField( self.EditMessageRow, h=20, enable=False, bgc=dictionary.returnStateColor('locked'), ec=lambda *a: tdToolsLib.uiUpdateAutoNameTag(self, 'cgmPosition'), w=75) self.LoadMessageButton = guiFactory.doButton2( self.EditMessageRow, '<<', lambda *a: attrToolsLib.uiUpdateMessage(self), 'Load to message') MelSpacer(self.EditMessageRow, w=10) self.EditMessageRow.setStretchWidget(self.MessageField) self.EditMessageRow.layout() #>>> Conversion self.buildAttrConversionRow(self.containerName) self.AttrConvertRow(e=True, vis=False) #>>> Connect Report self.ConnectionReportRow = MelHLayout(self.containerName, ut='cgmUIInstructionsTemplate', h=20, vis=False) self.ConnectionReportField = MelLabel( self.ConnectionReportRow, vis=False, bgc=dictionary.returnStateColor('help'), align='center', label='...', h=20) self.ConnectionReportRow.layout() self.ConnectedPopUpMenu = MelPopupMenu(self.ConnectionReportRow, button=3) MelSeparator(self.containerName, ut='cgmUIHeaderTemplate', h=2) mc.setParent(self.containerName) guiFactory.lineBreak() return self.containerName
def updateModulesUI(self): def optionMenuSet(item): print item #puppetBoxLib.uiModuleSetCGMTag(self,tag,item,index) """ i = self.setModes.index(item) self.SetToolsModeOptionVar.set( i ) self.setMode = i""" #deleteExisting self.ModuleListColumn.clear() if self.Puppet: for i,b in enumerate(self.Puppet.ModulesBuffer.bufferList): # NEED to get colors #Build label for Frame self.moduleFrames[i] = MelFrameLayout(self.ModuleListColumn,l='', collapse=True, collapsable=True, marginHeight=0, marginWidth=0, bgc = dictionary.guiDirectionColors['center']) puppetBoxLib.uiModuleUpdateFrameLabel(self,i) #Build Naming Row tmpNameRow = MelFormLayout(self.moduleFrames[i], h=25, ) tmpNameLabel = MelLabel(tmpNameRow,l='base:',align='right') self.moduleBaseNameFields[i] = MelTextField(tmpNameRow,text=self.Puppet.Module[i].nameBase or '', ec = Callback(puppetBoxLib.uiUpdateBaseName,self,i), w=50, h=20) tmpDirLabel = MelLabel(tmpNameRow,l='dir:',align='right') self.moduleDirectionMenus[i] = MelOptionMenu(tmpNameRow, cc = Callback(puppetBoxLib.uiModuleOptionMenuSet,self,self.moduleDirectionMenus,self.moduleDirections,'cgmDirection',i)) for cnt,o in enumerate(self.moduleDirections): self.moduleDirectionMenus[i].append(o) if o == self.Puppet.Module[i].ModuleNull.cgm['cgmDirection']: self.moduleDirectionMenus[i](edit = True, select = cnt + 1) tmpPosLabel = MelLabel(tmpNameRow,l='pos:',align='right') self.modulePositionMenus[i] = MelOptionMenu(tmpNameRow, cc = Callback(puppetBoxLib.uiModuleOptionMenuSet,self,self.modulePositionMenus,self.modulePositions,'cgmPosition',i)) for cnt,o in enumerate(self.modulePositions): self.modulePositionMenus[i].append(o) if o == self.Puppet.Module[i].ModuleNull.cgm['cgmPosition']: self.modulePositionMenus[i](edit = True, select = cnt + 1) mc.formLayout(tmpNameRow, edit = True, af = [(tmpNameLabel, "left", 10), (self.modulePositionMenus[i],"right",10)], ac = [(self.moduleBaseNameFields[i],"left",5,tmpNameLabel), (self.moduleBaseNameFields[i],"right",5,tmpDirLabel), (tmpDirLabel,"right",5,self.moduleDirectionMenus[i]), (self.moduleDirectionMenus[i],"right",5,tmpPosLabel), (tmpPosLabel,"right",5,self.modulePositionMenus[i] ), ]) #>>>>>>>>>>>>>>>>>>>>> if self.Puppet.Module[i].moduleClass == 'Limb': #Build Int Settings Row tmpIntRow = MelHSingleStretchLayout(self.moduleFrames[i], h=25, ) tmpIntRow.setStretchWidget(MelSpacer(tmpIntRow,w=5)) MelLabel(tmpIntRow,l='Handles:') self.moduleHandleFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionHandles.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleHandleFields,'optionHandles',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Roll:') self.moduleRollFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionRollJoints.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleRollFields,'optionRollJoints',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Stiff Index:') self.moduleStiffIndexFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionStiffIndex.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleStiffIndexFields,'optionStiffIndex',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Curve:') self.moduleCurveFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionCurveDegree.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleCurveFields,'optionCurveDegree',i), h = 20, w = 35) MelSpacer(tmpIntRow,w=10) tmpIntRow.layout() #PopUp Menu! popUpMenu = MelPopupMenu(self.moduleFrames[i],button = 3) MelMenuItem(popUpMenu, label = "cls: %s"%self.Puppet.Module[i].moduleClass, enable = False) #Parent/MIrror MelMenuItem(popUpMenu, label = "Set Parent>", enable = False) MelMenuItem(popUpMenu, label = "Set Mirror>", enable = False) if self.Puppet.Module[i].moduleClass == 'Limb': MelMenuItem(popUpMenu, label = 'FK', cb = self.Puppet.Module[i].optionFK.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionFK',i)) MelMenuItem(popUpMenu, label = 'IK', cb = self.Puppet.Module[i].optionIK.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionIK',i)) MelMenuItem(popUpMenu, label = 'Stretchy', cb = self.Puppet.Module[i].optionStretchy.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionStretchy',i)) MelMenuItem(popUpMenu, label = 'Bendy', cb = self.Puppet.Module[i].optionBendy.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionBendy',i)) MelMenuItemDiv(popUpMenu) # Object Aim Menu ObjectAimMenu = MelMenuItem(popUpMenu, l='Aim:', subMenu=True) self.ObjectAimCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionAimAxis.get() == index: checkState = True else: checkState = False self.ObjectAimCollection.createButton(ObjectAimMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetAimAxis,self.Puppet.Module[i],index), rb = checkState) ObjectUpMenu = MelMenuItem(popUpMenu, l='Up:', subMenu=True) self.ObjectUpCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionUpAxis.get() == index: checkState = True else: checkState = False self.ObjectUpCollection.createButton(ObjectUpMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetUpAxis,self.Puppet.Module[i],index), rb = checkState) ObjectOutMenu = MelMenuItem(popUpMenu, l='Out:', subMenu=True) self.ObjectOutCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionOutAxis.get() == index: checkState = True else: checkState = False self.ObjectOutCollection.createButton(ObjectOutMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetOutAxis,self.Puppet.Module[i],index), rb = checkState) ObjectOutMenu = MelMenuItem(popUpMenu, l='Copy from Parent', c= Callback(puppetBoxLib.doCopyAxisFromParent,self,self.Puppet.Module[i])) MelMenuItemDiv(popUpMenu) MelMenuItem(popUpMenu , label = 'Remove', c = Callback(puppetBoxLib.doRemoveModule,self,i)) MelMenuItem(popUpMenu , label = 'Delete', c = Callback(puppetBoxLib.doDeleteModule,self,i))
def setBGColorState(textFieldToChange, newState): mc.textField(textFieldToChange,edit = True, bgc = dictionary.returnStateColor(newState))
def buildAttributeEditingTool(self,parent, vis=True): #Container containerName = 'Attributes Constainer' self.containerName = MelColumn(parent,vis=vis) ###Create mc.setParent(self.containerName) guiFactory.header('Create') guiFactory.lineSubBreak() #>>>Create Row attrCreateRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 5) MelSpacer(attrCreateRow) MelLabel(attrCreateRow,l='Names:',align='right') self.AttrNamesTextField = MelTextField(attrCreateRow,backgroundColor = [1,1,1],h=20, ec = lambda *a: attrToolsLib.doAddAttributesToSelected(self), annotation = "Names for the attributes. Create multiple with a ';'. \n Message nodes try to connect to the last object in a selection \n For example: 'Test1;Test2;Test3'") guiFactory.doButton2(attrCreateRow,'Add', lambda *a: attrToolsLib.doAddAttributesToSelected(self), "Add the attribute names from the text field") MelSpacer(attrCreateRow,w=2) attrCreateRow.setStretchWidget(self.AttrNamesTextField) attrCreateRow.layout() #>>> modify Section self.buildAttrTypeRow(self.containerName) MelSeparator(self.containerName,ut = 'cgmUIHeaderTemplate',h=2) MelSeparator(self.containerName,ut = 'cgmUITemplate',h=10) ###Modify mc.setParent(self.containerName) guiFactory.header('Modify') AttrReportRow = MelHLayout(self.containerName ,ut='cgmUIInstructionsTemplate',h=20) self.AttrReportField = MelLabel(AttrReportRow, bgc = dictionary.returnStateColor('help'), align = 'center', label = '...', h=20) AttrReportRow.layout() MelSeparator(self.containerName,ut = 'cgmUISubTemplate',h=5) #>>> Load To Field LoadAttributeObjectRow = MelHSingleStretchLayout(self.containerName ,ut='cgmUISubTemplate',padding = 5) MelSpacer(LoadAttributeObjectRow,w=5) guiFactory.doButton2(LoadAttributeObjectRow,'>>', lambda *a:attrToolsLib.uiLoadSourceObject(self), 'Load to field') self.SourceObjectField = MelTextField(LoadAttributeObjectRow, w= 125, h=20, ut = 'cgmUIReservedTemplate', editable = False) LoadAttributeObjectRow.setStretchWidget(self.SourceObjectField ) MelLabel(LoadAttributeObjectRow, l=' . ') self.ObjectAttributesOptionMenu = MelOptionMenu(LoadAttributeObjectRow, w = 100) self.DeleteAttrButton = guiFactory.doButton2(LoadAttributeObjectRow,'X', lambda *a:attrToolsLib.uiDeleteAttr(self,self.ObjectAttributesOptionMenu), 'Delete attribute', w = 25, en = False) MelSpacer(LoadAttributeObjectRow,w=5) LoadAttributeObjectRow.layout() #>>> Standard Flags BasicAttrFlagsRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2) MelSpacer(BasicAttrFlagsRow,w=5) self.KeyableAttrCB = MelCheckBox(BasicAttrFlagsRow,label = 'Keyable',en=False) MelSpacer(BasicAttrFlagsRow,w=5) self.HiddenAttrCB = MelCheckBox(BasicAttrFlagsRow,label = 'Hidden',en=False) MelSpacer(BasicAttrFlagsRow,w=5) self.LockedAttrCB = MelCheckBox(BasicAttrFlagsRow,label = 'Locked',en=False) MelSpacer(BasicAttrFlagsRow,w=5) BasicAttrFlagsRow.layout() #>>> Name Row self.EditNameSettingsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate') self.EditNameSettingsRow.setStretchWidget(MelSpacer(self.EditNameSettingsRow,w=5)) NameLabel = MelLabel(self.EditNameSettingsRow,label = 'Name: ') self.NameField = MelTextField(self.EditNameSettingsRow,en = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiRenameAttr(self), h=20, w = 75) NiceNameLabel = MelLabel(self.EditNameSettingsRow,label = 'Nice: ') self.NiceNameField = MelTextField(self.EditNameSettingsRow,en = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateNiceName(self), h=20, w = 75) AliasLabel = MelLabel(self.EditNameSettingsRow,label = 'Alias: ') self.AliasField = MelTextField(self.EditNameSettingsRow,en = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateAlias(self), h=20, w = 75) MelSpacer(self.EditNameSettingsRow,w=5) self.EditNameSettingsRow.layout() """mc.formLayout(self.EditNameSettingsRow, edit = True, af = [(NameLabel, "left", 5), (self.AliasField,"right",5)], ac = [(self.NameField,"left",2,NameLabel), (NiceNameLabel,"left",2,self.NameField), (self.NiceNameField,"left",2,NiceNameLabel), (AliasLabel,"left",2,self.NiceNameField), (self.AliasField,"left",2,AliasLabel), ])""" #>>> Int Row #self.EditDigitSettingsRow = MelFormLayout(self.containerName,ut='cgmUISubTemplate',vis = False) self.EditDigitSettingsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',vis = False) self.EditDigitSettingsRow.setStretchWidget(MelSpacer(self.EditDigitSettingsRow,w=5)) MinLabel = MelLabel(self.EditDigitSettingsRow,label = 'Min:') self.MinField = MelTextField(self.EditDigitSettingsRow, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateMinValue(self), h = 20, w = 35) MaxLabel = MelLabel(self.EditDigitSettingsRow,label = 'Max:') self.MaxField = MelTextField(self.EditDigitSettingsRow, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateMaxValue(self), h = 20, w = 35) DefaultLabel = MelLabel(self.EditDigitSettingsRow,label = 'dv:') self.DefaultField = MelTextField(self.EditDigitSettingsRow, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateDefaultValue(self), h = 20, w = 35) SoftMinLabel = MelLabel(self.EditDigitSettingsRow,label = 'sMin:') self.SoftMinField = MelTextField(self.EditDigitSettingsRow, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateSoftMinValue(self), h = 20, w = 35) SoftMaxLabel = MelLabel(self.EditDigitSettingsRow,label = 'sMax:') self.SoftMaxField = MelTextField(self.EditDigitSettingsRow, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: attrToolsLib.uiUpdateSoftMaxValue(self), h = 20, w = 35) MelSpacer(self.EditDigitSettingsRow,w=5) self.EditDigitSettingsRow.layout() """mc.formLayout(self.EditDigitSettingsRow, edit = True, af = [(MinLabel, "left", 20), (self.SoftMinField,"right",20)], ac = [(self.MinField,"left",2,MinLabel), (MaxLabel,"left",2,self.MinField), (self.MaxField,"left",2,MaxLabel), (DefaultLabel,"left",2,self.MaxField), (self.DefaultField,"left",2,DefaultLabel), (SoftMaxLabel,"left",2,self.DefaultField), (self.SoftMaxField,"left",2,SoftMaxLabel), (SoftMinLabel,"left",2,self.SoftMaxField), (self.SoftMinField,"left",2,SoftMinLabel) ])""" #>>> Enum self.EditEnumRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 5, vis = False) MelSpacer(self.EditEnumRow,w=10) MelLabel(self.EditEnumRow,label = 'Enum: ') self.EnumField = MelTextField(self.EditEnumRow, annotation = "Options divided by ':'. \n Set values with '=' \n For example: 'off:on=1:maybe=23'", bgc = dictionary.returnStateColor('normal'), h = 20, w = 75) MelSpacer(self.EditEnumRow,w=10) self.EditEnumRow.setStretchWidget(self.EnumField) self.EditEnumRow.layout() #>>> String self.EditStringRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 5, vis = False) MelSpacer(self.EditStringRow,w=10) MelLabel(self.EditStringRow,label = 'String: ') self.StringField = MelTextField(self.EditStringRow, h=20, bgc = dictionary.returnStateColor('normal'), w = 75) MelSpacer(self.EditStringRow,w=10) self.EditStringRow.setStretchWidget(self.StringField) self.EditStringRow.layout() #>>> Message self.EditMessageRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 5, vis = False) MelSpacer(self.EditMessageRow,w=10) MelLabel(self.EditMessageRow,label = 'Message: ') self.MessageField = MelTextField(self.EditMessageRow, h=20, enable = False, bgc = dictionary.returnStateColor('locked'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmPosition'), w = 75) self.LoadMessageButton = guiFactory.doButton2(self.EditMessageRow,'<<', lambda *a:attrToolsLib.uiUpdateMessage(self), 'Load to message') MelSpacer(self.EditMessageRow,w=10) self.EditMessageRow.setStretchWidget(self.MessageField) self.EditMessageRow.layout() #>>> Conversion self.buildAttrConversionRow(self.containerName) self.AttrConvertRow(e=True, vis = False) #>>> Connect Report self.ConnectionReportRow = MelHLayout(self.containerName ,ut='cgmUIInstructionsTemplate',h=20,vis=False) self.ConnectionReportField = MelLabel(self.ConnectionReportRow,vis=False, bgc = dictionary.returnStateColor('help'), align = 'center', label = '...', h=20) self.ConnectionReportRow.layout() self.ConnectedPopUpMenu = MelPopupMenu(self.ConnectionReportRow,button = 3) MelSeparator(self.containerName,ut = 'cgmUIHeaderTemplate',h=2) mc.setParent(self.containerName ) guiFactory.lineBreak() return self.containerName
def uiLoadAutoNameObject(self): selected = [] bufferList = [] selected = (mc.ls(sl=True, flatten=True, shortNames=True)) fieldToKeyDict = { 'cgmName': self.NameTagField, 'cgmType': self.ObjectTypeTagField, 'cgmNameModifier': self.NameModifierTagField, 'cgmTypeModifier': self.ObjectTypeModifierTagField, 'cgmDirectionModifier': self.DirectionModifierTagField, 'cgmDirection': self.DirectionTagField, 'cgmPosition': self.PositionTagField, 'cgmIterator': self.IteratorTagField } if selected: if len(selected) >= 2: guiFactory.warning('Only one object can be loaded') else: # Put the object in the field guiFactory.doLoadSingleObjectToTextField(self.AutoNameObjectField, 'cgmVar_AutoNameObject') #Get the tag info for the object tagsDict = NameFactoryOld.returnObjectGeneratedNameDict( selected[0]) userAttrs = attributes.returnUserAttributes(selected[0]) cgmAttrs = NameFactoryOld.returnCGMOrder() usedAttrs = lists.returnMatchList(userAttrs, cgmAttrs) tagAttrs = tagsDict.keys() #Enable the tag fields for key in fieldToKeyDict.keys(): mc.textField(fieldToKeyDict.get(key), edit=True, enable=True, text='', bgc=dictionary.returnStateColor('normal')) for key in tagsDict.keys(): currentField = fieldToKeyDict.get(key) buildSelectPopUp = {} buildLoadPopUp = {} #purge popup popUpBuffer = currentField(q=True, popupMenuArray=True) if popUpBuffer: for item in popUpBuffer: mc.deleteUI(item) mc.textField(currentField, edit=True, text=tagsDict.get(key), bgc=dictionary.returnStateColor('keyed')) # Set special color cases, if it's guessed or gotten upstream.... if usedAttrs: if key not in usedAttrs: mc.textField( currentField, edit=True, bgc=dictionary.returnStateColor('reserved')) # if it's connected elif (mc.connectionInfo((selected[0] + '.' + key), isDestination=True)): driverObject = attributes.returnDriverObject( selected[0] + '.' + key) driverAttr = attributes.returnDriverAttribute( selected[0] + '.' + key) mc.textField( currentField, edit=True, text=(driverAttr), bgc=dictionary.returnStateColor('connected')) buildSelectPopUp['Select driver object'] = ( driverObject) buildLoadPopUp['Load driver object'] = (driverObject) else: #Got it from a parent parentNameObjectRaw = search.returnTagUp(selected[0], key) if parentNameObjectRaw: if '|' in parentNameObjectRaw[1]: parentNameBuffer = parentNameObjectRaw[1].split( '|') parentNameObject = parentNameBuffer[-1] else: parentNameObject = parentNameObjectRaw[1] mc.textField( currentField, edit=True, enable=True, text=parentNameObject, bgc=dictionary.returnStateColor('semiLocked')) buildSelectPopUp['Select parent name object'] = ( parentNameObjectRaw[1]) buildLoadPopUp['Load parent name object'] = ( parentNameObjectRaw[1]) else: mc.textField( currentField, edit=True, bgc=dictionary.returnStateColor('reserved')) if buildSelectPopUp or buildLoadPopUp: buffer = MelPopupMenu(currentField, button=3) if buildSelectPopUp: for key in buildSelectPopUp.keys(): MelMenuItem( buffer, label=key, c=('%s%s%s' % ("mc.select('", buildSelectPopUp.get(key), "')"))) if buildLoadPopUp: for key in buildLoadPopUp.keys(): MelMenuItem(buffer, label=key, c=lambda *a: uiLoadParentNameObject( self, buildLoadPopUp.get(key))) # if it's connected uiUpdateAutoNamePreview(self) else: #clear the field guiFactory.doLoadSingleObjectToTextField(self.AutoNameObjectField, 'cgmVar_AutoNameObject') # update the fields for key in fieldToKeyDict.keys(): mc.textField(fieldToKeyDict.get(key), edit=True, enable=False, text='', bgc=dictionary.returnStateColor('normal')) # Fix previewer uiUpdateAutoNamePreview(self)
def setBGColorState(textFieldToChange, newState): mc.textField(textFieldToChange, edit=True, bgc=dictionary.returnStateColor(newState))
def Main_buildLayout(self,parent): def modeSet( item ): i = self.setModes.index(item) self.SetToolsModeOptionVar.set( i ) self.setMode = i MainForm = MelFormLayout(parent) TopSection = MelColumnLayout(MainForm) SetHeader = guiFactory.header('Puppet') #>>> Top Section #Report self.puppetReport = MelLabel(TopSection, bgc = dictionary.returnStateColor('help'), align = 'center', label = '...', h=20) MelSeparator(TopSection,ut='cgmUITemplate',h=5) #Edit name and state mode buttons MasterPuppetRow = MelHSingleStretchLayout(TopSection,padding = 5) MelSpacer(MasterPuppetRow,w=5) self.MasterPuppetTF = MelTextField(MasterPuppetRow, bgc = [1,1,1], ec = lambda *a:puppetBoxLib.updatePuppetName(self)) MasterPuppetRow.setStretchWidget(self.MasterPuppetTF) self.puppetStateButtonsDict = {} for i,s in enumerate(self.puppetStateOptions): self.puppetStateButtonsDict[i] = guiFactory.doButton2(MasterPuppetRow,s.capitalize(), "print '%s'"%s, enable = False) MelSpacer(MasterPuppetRow,w=20) MasterPuppetRow.layout() #MelSeparator(TopSection,ut='cgmUITemplate',h=2) #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Define State Rows #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #Initial State Mode Row self.PuppetModeCollection = MelRadioCollection() self.PuppetModeCollectionChoices = [] self.InitialStateModeRow = MelHSingleStretchLayout(TopSection,padding = 2,vis=False) MelSpacer(self.InitialStateModeRow,w=5) MelLabel(self.InitialStateModeRow,l='Template Modes') Spacer = MelSeparator(self.InitialStateModeRow,w=10) for i,item in enumerate(CharacterTypes): self.PuppetModeCollectionChoices.append(self.PuppetModeCollection.createButton(self.InitialStateModeRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetBaseMode,self,i))) MelSpacer(self.InitialStateModeRow,w=3) self.InitialStateModeRow.setStretchWidget( Spacer ) MelSpacer(self.InitialStateModeRow,w=2) self.InitialStateModeRow.layout() mc.radioCollection(self.PuppetModeCollection ,edit=True,sl= (self.PuppetModeCollectionChoices[ (self.PuppetModeOptionVar.value) ])) self.UI_StateRows['define'].append(self.InitialStateModeRow) self.AxisFrame = MelFrameLayout(TopSection,label = 'Axis',vis=False, collapse=True, collapsable=True, ut = 'cgmUIHeaderTemplate') self.UI_StateRows['define'].append(self.AxisFrame) MelSeparator(TopSection,style='none',h=5) #Aim Axis Mode Row self.AimAxisCollection = MelRadioCollection() self.AimAxisCollectionChoices = [] self.AimAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.AimAxisRow,w=5) MelLabel(self.AimAxisRow,l='Aim ') Spacer = MelSeparator(self.AimAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.AimAxisCollectionChoices.append(self.AimAxisCollection.createButton(self.AimAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisAim,self,i))) MelSpacer(self.AimAxisRow,w=3) self.AimAxisRow.setStretchWidget( Spacer ) MelSpacer(self.AimAxisRow,w=2) self.AimAxisRow.layout() #Up Axis Mode Row self.UpAxisCollection = MelRadioCollection() self.UpAxisCollectionChoices = [] self.UpAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.UpAxisRow,w=5) MelLabel(self.UpAxisRow,l='Up ') Spacer = MelSeparator(self.UpAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.UpAxisCollectionChoices.append(self.UpAxisCollection.createButton(self.UpAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisUp,self,i))) MelSpacer(self.UpAxisRow,w=3) self.UpAxisRow.setStretchWidget( Spacer ) MelSpacer(self.UpAxisRow,w=2) self.UpAxisRow.layout() #Out Axis Mode Row self.OutAxisCollection = MelRadioCollection() self.OutAxisCollectionChoices = [] self.OutAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False) MelSpacer(self.OutAxisRow,w=5) MelLabel(self.OutAxisRow,l='Out ') Spacer = MelSeparator(self.OutAxisRow,w=10) for i,item in enumerate(axisDirectionsByString): self.OutAxisCollectionChoices.append(self.OutAxisCollection.createButton(self.OutAxisRow,label=item, onCommand = Callback(puppetBoxLib.setPuppetAxisOut,self,i))) MelSpacer(self.OutAxisRow,w=3) self.OutAxisRow.setStretchWidget( Spacer ) MelSpacer(self.OutAxisRow,w=2) self.OutAxisRow.layout() #Set toggles on menu mc.radioCollection(self.AimAxisCollection ,edit=True,sl= (self.AimAxisCollectionChoices[ (self.PuppetAimOptionVar.value) ])) mc.radioCollection(self.UpAxisCollection ,edit=True,sl= (self.UpAxisCollectionChoices[ (self.PuppetUpOptionVar.value) ])) mc.radioCollection(self.OutAxisCollection ,edit=True,sl= (self.OutAxisCollectionChoices[ (self.PuppetOutOptionVar.value) ])) #Initial State Button Row self.InitialStateButtonRow = MelHLayout(TopSection, h = 20,vis=False,padding = 5) guiFactory.doButton2(self.InitialStateButtonRow,'Add Geo', lambda *a:puppetBoxLib.doAddGeo(self)) guiFactory.doButton2(self.InitialStateButtonRow,'Build Size Template', lambda *a:puppetBoxLib.doBuildSizeTemplate(self)) self.InitialStateButtonRow.layout() self.UI_StateRows['define'].append(self.InitialStateButtonRow) #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Multi Module #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>> All Sets menu AllModulesRow = MelFormLayout(MainForm,height = 20) activeState = True i = 1 tmpActive = MelCheckBox(AllModulesRow, annotation = 'Sets all sets active', value = activeState, onCommand = Callback(puppetBoxLib.doSetAllSetsAsActive,self), offCommand = Callback(puppetBoxLib.doSetAllSetsAsInactive,self)) tmpSel = guiFactory.doButton2(AllModulesRow, ' s ', 'Select All Loaded/Active Sets') # Mode toggle box self.ModuleModeOptionMenu = MelOptionMenu(AllModulesRow, cc = modeSet) tmpKey = guiFactory.doButton2(AllModulesRow, ' k ', 'Key All Sets') tmpDeleteKey = guiFactory.doButton2(AllModulesRow, ' d ', 'Delete All Set Keys') tmpReset = guiFactory.doButton2(AllModulesRow, ' r ', 'Reset All Set Keys') mc.formLayout(AllModulesRow, edit = True, af = [(tmpActive, "left", 10), (tmpReset,"right",10)], ac = [(tmpSel,"left",0,tmpActive), (self.ModuleModeOptionMenu,"left",4,tmpSel), (self.ModuleModeOptionMenu,"right",4,tmpKey), (tmpKey,"right",2,tmpDeleteKey), (tmpDeleteKey,"right",2,tmpReset) ]) #>>> Sets building section allPopUpMenu = MelPopupMenu(self.ModuleModeOptionMenu ,button = 3) allCategoryMenu = MelMenuItem(allPopUpMenu, label = 'Make Type:', sm = True) #>>> Sets building section ModuleListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate') ModuleMasterForm = MelFormLayout(ModuleListScroll) self.ModuleListColumn = MelColumnLayout(ModuleMasterForm,ut = 'cgmUIInstructionsTemplate', adj = True, rowSpacing = 2) self.helpInfo = MelLabel(MainForm, h=20, l = "Add a Puppet", ut = 'cgmUIInstructionsTemplate', al = 'center', ww = True,vis = self.ShowHelpOptionVar.value) self.helpBlurbs.extend([self.helpInfo ]) VerifyRow = guiFactory.doButton2(MainForm, 'Check Puppet', 'Create new buffer from selected buffer') ModuleMasterForm(edit = True, af = [(self.ModuleListColumn,"top",0), (self.ModuleListColumn,"left",0), (self.ModuleListColumn,"right",0), (self.ModuleListColumn,"bottom",0)]) MainForm(edit = True, af = [(TopSection,"top",0), (TopSection,"left",0), (TopSection,"right",0), (AllModulesRow,"left",0), (AllModulesRow,"right",0), (ModuleListScroll,"left",0), (ModuleListScroll,"right",0), (ModuleListScroll,"left",0), (ModuleListScroll,"right",0), (self.helpInfo,"left",8), (self.helpInfo,"right",8), (VerifyRow,"left",4), (VerifyRow,"right",4), (VerifyRow,"bottom",4)], ac = [(AllModulesRow,"top",2,TopSection), (ModuleListScroll,"top",2,AllModulesRow), (ModuleListScroll,"bottom",0,self.helpInfo), (self.helpInfo,"bottom",0,VerifyRow)], attachNone = [(VerifyRow,"top")])
def updateModulesUI(self): def optionMenuSet(item): print item #puppetBoxLib.uiModuleSetCGMTag(self,tag,item,index) """ i = self.setModes.index(item) self.SetToolsModeOptionVar.set( i ) self.setMode = i""" #deleteExisting self.ModuleListColumn.clear() if self.Puppet: for i,b in enumerate(self.Puppet.ModulesBuffer.bufferList): # NEED to get colors #Build label for Frame self.moduleFrames[i] = MelFrameLayout(self.ModuleListColumn,l='', collapse=True, collapsable=True, marginHeight=0, marginWidth=0, bgc = dictionary.guiDirectionColors['center']) puppetBoxLib.uiModuleUpdateFrameLabel(self,i) #Build Naming Row tmpNameRow = MelFormLayout(self.moduleFrames[i], h=25, ) tmpNameLabel = MelLabel(tmpNameRow,l='base:',align='right') self.moduleBaseNameFields[i] = MelTextField(tmpNameRow,text=self.Puppet.Module[i].nameBase or '', ec = Callback(puppetBoxLib.uiUpdateBaseName,self,i), w=50, h=20) tmpDirLabel = MelLabel(tmpNameRow,l='dir:',align='right') self.moduleDirectionMenus[i] = MelOptionMenu(tmpNameRow, cc = Callback(puppetBoxLib.uiModuleOptionMenuSet,self,self.moduleDirectionMenus,self.moduleDirections,'cgmDirection',i)) for cnt,o in enumerate(self.moduleDirections): self.moduleDirectionMenus[i].append(o) if o == self.Puppet.Module[i].ModuleNull.cgm['cgmDirection']: self.moduleDirectionMenus[i](edit = True, select = cnt + 1) tmpPosLabel = MelLabel(tmpNameRow,l='pos:',align='right') self.modulePositionMenus[i] = MelOptionMenu(tmpNameRow, cc = Callback(puppetBoxLib.uiModuleOptionMenuSet,self,self.modulePositionMenus,self.modulePositions,'cgmPosition',i)) for cnt,o in enumerate(self.modulePositions): self.modulePositionMenus[i].append(o) if o == self.Puppet.Module[i].ModuleNull.cgm['cgmPosition']: self.modulePositionMenus[i](edit = True, select = cnt + 1) mc.formLayout(tmpNameRow, edit = True, af = [(tmpNameLabel, "left", 10), (self.modulePositionMenus[i],"right",10)], ac = [(self.moduleBaseNameFields[i],"left",5,tmpNameLabel), (self.moduleBaseNameFields[i],"right",5,tmpDirLabel), (tmpDirLabel,"right",5,self.moduleDirectionMenus[i]), (self.moduleDirectionMenus[i],"right",5,tmpPosLabel), (tmpPosLabel,"right",5,self.modulePositionMenus[i] ), ]) #>>>>>>>>>>>>>>>>>>>>> if self.Puppet.Module[i].moduleClass == 'Limb': #Build Int Settings Row tmpIntRow = MelHSingleStretchLayout(self.moduleFrames[i], h=25, ) tmpIntRow.setStretchWidget(MelSpacer(tmpIntRow,w=5)) MelLabel(tmpIntRow,l='Handles:') self.moduleHandleFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionHandles.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleHandleFields,'optionHandles',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Roll:') self.moduleRollFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionRollJoints.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleRollFields,'optionRollJoints',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Stiff Index:') self.moduleStiffIndexFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionStiffIndex.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleStiffIndexFields,'optionStiffIndex',i), h = 20, w = 35) MelLabel(tmpIntRow,l='Curve:') self.moduleCurveFields[i] = MelIntField(tmpIntRow, v = self.Puppet.Module[i].optionCurveDegree.value, bgc = dictionary.returnStateColor('normal'), ec = Callback(puppetBoxLib.uiModuleUpdateIntAttrFromField,self,self.moduleCurveFields,'optionCurveDegree',i), h = 20, w = 35) MelSpacer(tmpIntRow,w=10) tmpIntRow.layout() #PopUp Menu! popUpMenu = MelPopupMenu(self.moduleFrames[i],button = 3) MelMenuItem(popUpMenu, label = "cls: %s"%self.Puppet.Module[i].moduleClass, enable = False) #Parent/MIrror MelMenuItem(popUpMenu, label = "Set Parent>", enable = False) MelMenuItem(popUpMenu, label = "Set Mirror>", enable = False) if self.Puppet.Module[i].moduleClass == 'Limb': MelMenuItem(popUpMenu, label = 'FK', cb = self.Puppet.Module[i].optionFK.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionFK',i)) MelMenuItem(popUpMenu, label = 'IK', cb = self.Puppet.Module[i].optionIK.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionIK',i)) MelMenuItem(popUpMenu, label = 'Stretchy', cb = self.Puppet.Module[i].optionStretchy.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionStretchy',i)) MelMenuItem(popUpMenu, label = 'Bendy', cb = self.Puppet.Module[i].optionBendy.value, c = Callback(puppetBoxLib.uiModuleToggleBool,self,'optionBendy',i)) MelMenuItemDiv(popUpMenu) # Object Aim Menu ObjectAimMenu = MelMenuItem(popUpMenu, l='Aim:', subMenu=True) self.ObjectAimCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionAimAxis.get() == index: checkState = True else: checkState = False self.ObjectAimCollection.createButton(ObjectAimMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetAimAxis,self.Puppet.Module[i],index), rb = checkState) ObjectUpMenu = MelMenuItem(popUpMenu, l='Up:', subMenu=True) self.ObjectUpCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionUpAxis.get() == index: checkState = True else: checkState = False self.ObjectUpCollection.createButton(ObjectUpMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetUpAxis,self.Puppet.Module[i],index), rb = checkState) ObjectOutMenu = MelMenuItem(popUpMenu, l='Out:', subMenu=True) self.ObjectOutCollection = MelRadioMenuCollection() for index,axis in enumerate(dictionary.axisDirectionsByString): if self.Puppet.Module[i].optionOutAxis.get() == index: checkState = True else: checkState = False self.ObjectOutCollection.createButton(ObjectOutMenu,l=axis, c= Callback(puppetBoxLib.doSetAxisAndUpdateModule,self,functions.doSetOutAxis,self.Puppet.Module[i],index), rb = checkState) ObjectOutMenu = MelMenuItem(popUpMenu, l='Copy from Parent', c= Callback(puppetBoxLib.doCopyAxisFromParent,self,self.Puppet.Module[i])) MelMenuItemDiv(popUpMenu) MelMenuItem(popUpMenu , label = 'Remove', c = Callback(puppetBoxLib.doRemoveModule,self,i)) MelMenuItem(popUpMenu , label = 'Delete', c = Callback(puppetBoxLib.doDeleteModule,self,i))
def buildAutoNameTool(self,parent, vis=True): containerName = 'AutoNameContainer' self.containerName = MelColumn(parent,vis=vis) #>>> Begin the section mc.setParent(self.containerName ) guiFactory.header('Tag and Release') guiFactory.lineSubBreak() #>>> Guessed Name GenratedNameRow = MelHLayout(self.containerName ,ut='cgmUIInstructionsTemplate') self.GeneratedNameField = MelLabel(GenratedNameRow, bgc = dictionary.returnStateColor('help'), align = 'center', label = 'Name will preview here...') GenratedNameRow.layout() mc.setParent(self.containerName ) guiFactory.lineSubBreak() guiFactory.lineSubBreak() #>>> Load To Field #clear our variables if not mc.optionVar( ex='cgmVar_AutoNameObject' ): mc.optionVar( sv=('cgmVar_AutoNameObject', '') ) LoadAutoNameObjectRow = MelHSingleStretchLayout(self.containerName ,ut='cgmUISubTemplate',padding = 5) MelSpacer(LoadAutoNameObjectRow,w=5) MelLabel(LoadAutoNameObjectRow,l='Object:',align='right') self.AutoNameObjectField = MelTextField(LoadAutoNameObjectRow, w= 125, ut = 'cgmUIReservedTemplate', editable = False) if mc.optionVar( q = 'cgmVar_AutoNameObject'): self.AutoNameObjectField(edit=True,text = mc.optionVar( q = 'cgmVar_AutoNameObject')) guiFactory.doButton2(LoadAutoNameObjectRow,'<<', 'tdToolsLib.uiLoadAutoNameObject(cgmTDToolsWin)', 'Load to field') LoadAutoNameObjectRow.setStretchWidget(self.AutoNameObjectField ) guiFactory.doButton2(LoadAutoNameObjectRow,'Up', lambda *a:tdToolsLib.uiAutoNameWalkUp(self), 'Load to field') guiFactory.doButton2(LoadAutoNameObjectRow,'Down', lambda *a:tdToolsLib.uiAutoNameWalkDown(self), 'Load to field') guiFactory.doButton2(LoadAutoNameObjectRow,'Name it', lambda *a:tdToolsLib.uiNameLoadedAutoNameObject(self), 'Load to field') guiFactory.doButton2(LoadAutoNameObjectRow,'Name Children', lambda *a:tdToolsLib.uiNameLoadedAutoNameObjectChildren(self), 'Load to field') MelSpacer(LoadAutoNameObjectRow,w=5) LoadAutoNameObjectRow.layout() mc.setParent(self.containerName ) guiFactory.lineSubBreak() #>>> Tag Labels TagLabelsRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2) MelLabel(TagLabelsRow,label = 'Position') MelLabel(TagLabelsRow,label = 'Direction') MelLabel(TagLabelsRow,label = 'Name') MelLabel(TagLabelsRow,label = 'Type') TagLabelsRow.layout() #>>> Tags mc.setParent(self.containerName ) TagsRow = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 3) self.PositionTagField = MelTextField(TagsRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmPosition'), w = 75) self.DirectionTagField = MelTextField(TagsRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmDirection'), w = 75) self.NameTagField = MelTextField(TagsRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmName'), w = 75) """ self.NameTagFieldPopUp = MelPopupMenu(self.NameTagField,button = 3) self.NameTagLoadParentPopUp = MelMenuItem(self.NameTagFieldPopUp , label = 'Select parent name object', enable = False) """ self.ObjectTypeTagField = MelTextField(TagsRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmType'), w = 75) TagsRow.layout() mc.setParent(self.containerName ) guiFactory.lineSubBreak() #>>> ModifierTags mc.setParent(self.containerName ) TagModifiersRow = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 3) MelLabel(TagModifiersRow,align = 'right', label = 'Modifiers ------->',w = 75) self.DirectionModifierTagField = MelTextField(TagModifiersRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmDirectionModifier'), w = 75) self.NameModifierTagField = MelTextField(TagModifiersRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmNameModifier'), w = 75) self.ObjectTypeModifierTagField = MelTextField(TagModifiersRow, enable = False, bgc = dictionary.returnStateColor('normal'), ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmTypeModifier'), w = 75) TagModifiersRow.layout() mc.setParent(self.containerName ) guiFactory.lineSubBreak() guiFactory.lineBreak() #>>> Basic mc.setParent(self.containerName ) guiFactory.header('On Selection') guiFactory.lineSubBreak() BasicRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2) guiFactory.doButton2(BasicRow,'Name Object', 'tdToolsLib.uiNameObject(cgmTDToolsWin)', "Attempts to name an object") guiFactory.doButton2(BasicRow,'Update Name', 'tdToolsLib.doUpdateObjectName(cgmTDToolsWin)', "Takes the name you've manually changed the object to, \n stores that to the cgmName tag then \n renames the object") guiFactory.doButton2(BasicRow,'Name Heirarchy', 'tdToolsLib.doNameHeirarchy(cgmTDToolsWin)', "Attempts to intelligently name a \n heirarchy of objects") BasicRow.layout() mc.setParent(self.containerName ) guiFactory.lineSubBreak() guiFactory.lineBreak() return self.containerName