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