def buildSpecialLayout(self,parent): SpecialColumn = MelColumnLayout(parent) #>>> Center Section guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'Locate Center', lambda *a: locinatorLib.doLocCenter(self), 'Find the center point from a selection set') #>>> Closest Point Section guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'Locate Closest Point', lambda *a: locinatorLib.doLocClosest(self), 'Select the proximity object(s), then the object to find point on. Accepted target object types are - nurbsCurves and surfaces and poly objects') #>>> Curves Section guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'Loc CVs of curve', lambda *a: locinatorLib.doLocCVsOfObject(), "Locs the cv's at the cv coordinates") guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'Loc CVs on the curve', lambda *a: locinatorLib.doLocCVsOnObject(), "Locs cv's at closest point on the curve") guiFactory.lineBreak() #>>> Update Section guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'Update Selected', lambda *a: locinatorLib.doUpdateLoc(self), "Only works with locators created with this tool")
def Keys_buildLayout(self,parent): SpecialColumn = MelColumnLayout(parent) #>>> Center Section guiFactory.header('Tangents') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'autoTangent', lambda *a: mel.eval('autoTangent'), 'Fantastic script courtesy of Michael Comet') guiFactory.lineBreak() guiFactory.header('Breakdowns') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'tweenMachine', lambda *a: mel.eval('tweenMachine'), 'Breakdown tool courtesy of Justin Barrett') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'breakdownDragger', lambda *a: animToolsLib.ml_breakdownDraggerCall(), 'Breakdown tool courtesy of Morgan Loomis') guiFactory.lineBreak() guiFactory.header('Utilities') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'arcTracr', lambda *a: animToolsLib.ml_arcTracerCall(), 'Path tracing tool courtesy of Morgan Loomis') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'copy Anim', lambda *a: animToolsLib.ml_copyAnimCall(), 'Animation copy tool courtesy of Morgan Loomis') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'convert Rotation Order', lambda *a: animToolsLib.ml_convertRotationOrderCall(), 'Rotation Order Conversion tool courtesy of Morgan Loomis')
def buildMatchLayout(self,parent): MatchColumn = MelColumnLayout(parent) #>>> Tag Section guiFactory.lineSubBreak() guiFactory.doButton2(MatchColumn,'Tag it', lambda *a: locinatorLib.doTagObjects(self), "Tag the selected objects to the first locator in the selection set. After this relationship is set up, you can match objects to that locator.") #>>> Purge Section guiFactory.lineSubBreak() self.helpBlurbs.extend(guiFactory.instructions(" Purge all traces of cgmThinga tools from the object",vis = self.ShowHelpOption)) guiFactory.doButton2(MatchColumn,'Purge it', lambda *a: locinatorLib.doPurgeCGMAttrs(self), "Clean it") guiFactory.lineBreak() #>>> Update Section guiFactory.lineSubBreak() guiFactory.doButton2(MatchColumn,'Update Selected', lambda *a: locinatorLib.doUpdateLoc(self), "Only works with locators created with this tool")
def buildMatchLayout(self, parent): MatchColumn = MelColumnLayout(parent) #>>> Tag Section guiFactory.lineSubBreak() guiFactory.doButton2( MatchColumn, 'Tag it', lambda *a: locinatorLib.doTagObjects(self), "Tag the selected objects to the first locator in the selection set. After this relationship is set up, you can match objects to that locator." ) #>>> Purge Section guiFactory.lineSubBreak() self.helpBlurbs.extend( guiFactory.instructions( " Purge all traces of cgmThinga tools from the object", vis=self.ShowHelpOption)) guiFactory.doButton2(MatchColumn, 'Purge it', lambda *a: locinatorLib.doPurgeCGMAttrs(self), "Clean it") guiFactory.lineBreak() #>>> Update Section guiFactory.lineSubBreak() guiFactory.doButton2( MatchColumn, 'Update Selected', lambda *a: locinatorLib.doUpdateLoc(self), "Only works with locators created with this tool")
def buildAttributeUtilitiesTool(self, parent, vis=True): containerName = 'Utilities Container' self.containerName = MelColumn(parent, vis=vis) #>>> Tag Labels mc.setParent(self.containerName) guiFactory.header('Short cuts') guiFactory.lineSubBreak() AttributeUtilityRow1 = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=2) guiFactory.doButton2( AttributeUtilityRow1, 'cgmName to Float', lambda *a: tdToolsLib.doCGMNameToFloat(), 'Makes an animatalbe float attribute using the cgmName tag') mc.setParent(self.containerName) guiFactory.lineSubBreak() AttributeUtilityRow1.layout() #>>> SDK tools mc.setParent(self.containerName) guiFactory.lineBreak() guiFactory.header('SDK Tools') guiFactory.lineSubBreak() sdkRow = MelHLayout(self.containerName, ut='cgmUISubTemplate', padding=2) guiFactory.doButton2(sdkRow, 'Select Driven Joints', lambda *a: tdToolsLib.doSelectDrivenJoints(self), "Selects driven joints from an sdk attribute") sdkRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() return self.containerName
def showAbout(self): window = mc.window(title="About", iconName='About', ut='cgmUITemplate', resizeToFitChildren=True) mc.columnLayout(adjustableColumn=True) guiFactory.header(self.toolName, overrideUpper=True) mc.text(label='>>>A Part of the cgmTools Collection<<<', ut='cgmUIInstructionsTemplate') guiFactory.headerBreak() guiFactory.lineBreak() descriptionBlock = guiFactory.textBlock(self.description) guiFactory.lineBreak() mc.text(label=('%s%s' % ('Written by: ', self.author))) mc.text(label=('%s%s%s' % ('Copyright ', self.owner, ', 2011'))) guiFactory.lineBreak() mc.text(label='Version: %s' % self.version) mc.text(label='') guiFactory.doButton( 'Visit Website', 'import webbrowser;webbrowser.open("http://www.cgmonks.com")') guiFactory.doButton( 'Close', 'import maya.cmds as mc;mc.deleteUI(\"' + window + '\", window=True)') mc.setParent('..') mc.showWindow(window)
def Keys_buildLayout(self,parent): SpecialColumn = MelColumnLayout(parent) #>>> Center Section guiFactory.header('Tangents') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'autoTangent', lambda *a: mel.eval('autoTangent'), 'Fantastic script courtesy of Michael Comet') guiFactory.lineBreak() guiFactory.header('Breakdowns') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'tweenMachine', lambda *a: mel.eval('tweenMachine'), 'Breakdown tool courtesy of Justin Barrett') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'breakdownDragger', lambda *a: animToolsLib.ml_breakdownDraggerCall(), 'Breakdown tool courtesy of Morgan Loomis') guiFactory.lineBreak() guiFactory.header('Utilities') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'arcTracr', lambda *a: animToolsLib.ml_arcTracerCall(), 'Path tracing tool courtesy of Morgan Loomis') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'copy Anim', lambda *a: animToolsLib.ml_copyAnimCall(), 'Animation copy tool courtesy of Morgan Loomis') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'convert Rotation Order', lambda *a: animToolsLib.ml_convertRotationOrderCall(), 'Rotation Order Conversion tool courtesy of Morgan Loomis') guiFactory.lineSubBreak() guiFactory.doButton2(SpecialColumn,'stopwatch', lambda *a: animToolsLib.ml_stopwatchCall(), 'Stop Watch tool courtesy of Morgan Loomis')
def buildAttributeUtilitiesTool(self,parent, vis=True): containerName = 'Utilities Container' self.containerName = MelColumn(parent,vis=vis) #>>> Tag Labels mc.setParent(self.containerName) guiFactory.header('Short cuts') guiFactory.lineSubBreak() AttributeUtilityRow1 = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 2) guiFactory.doButton2(AttributeUtilityRow1,'cgmName to Float', lambda *a:tdToolsLib.doCGMNameToFloat(), 'Makes an animatalbe float attribute using the cgmName tag') mc.setParent(self.containerName) guiFactory.lineSubBreak() AttributeUtilityRow1.layout() #>>> SDK tools mc.setParent(self.containerName) guiFactory.lineBreak() guiFactory.header('SDK Tools') guiFactory.lineSubBreak() sdkRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2) guiFactory.doButton2(sdkRow,'Select Driven Joints', lambda *a:tdToolsLib.doSelectDrivenJoints(self), "Selects driven joints from an sdk attribute") sdkRow.layout() mc.setParent(self.containerName) guiFactory.lineSubBreak() return self.containerName
def showAbout(self): window = mc.window( title="About", iconName='About', ut = 'cgmUITemplate',resizeToFitChildren=True ) mc.columnLayout( adjustableColumn=True ) guiFactory.header(self.toolName,overrideUpper = True) mc.text(label='>>>A Part of the cgmTools Collection<<<', ut = 'cgmUIInstructionsTemplate') guiFactory.headerBreak() guiFactory.lineBreak() descriptionBlock = guiFactory.textBlock(self.description) guiFactory.lineBreak() mc.text(label=('%s%s' %('Written by: ',self.author))) mc.text(label=('%s%s%s' %('Copyright ',self.owner,', 2011'))) guiFactory.lineBreak() mc.text(label='Version: %s' % self.version) mc.text(label='') guiFactory.doButton('Visit Tool Webpage', 'import webbrowser;webbrowser.open(" http://www.cgmonks.com/tools/maya-tools/locinator/")') guiFactory.doButton('Close', 'import maya.cmds as mc;mc.deleteUI(\"' + window + '\", window=True)') mc.setParent( '..' ) mc.showWindow( window )
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 buildBasicLayout(self, parent): mc.setParent(parent) guiFactory.header('Update') #>>>Time Section UpdateOptionRadioCollection = MelRadioCollection() EveryFrameOption = mc.optionVar(q='cgmVar_LocinatorBakeState') mc.setParent(parent) guiFactory.lineSubBreak() #>>> Time Menu Container self.BakeModeOptionList = ['Current Frame', 'Bake'] cgmVar_Name = 'cgmVar_LocinatorBakeState' guiFactory.appendOptionVarList(self, 'cgmVar_LocinatorBakeState') if not mc.optionVar(ex=cgmVar_Name): mc.optionVar(iv=(cgmVar_Name, 0)) #build our sub section options self.ContainerList = [] #Mode Change row ModeSetRow = MelHSingleStretchLayout(parent, ut='cgmUISubTemplate') self.BakeModeRadioCollection = MelRadioCollection() self.BakeModeChoiceList = [] MelSpacer(ModeSetRow, w=2) self.BakeModeChoiceList.append( self.BakeModeRadioCollection.createButton( ModeSetRow, label=self.BakeModeOptionList[0], onCommand=Callback(guiFactory.toggleModeState, self.BakeModeOptionList[0], self.BakeModeOptionList, cgmVar_Name, self.ContainerList, True))) ModeSetRow.setStretchWidget(MelSpacer(ModeSetRow)) self.BakeModeChoiceList.append( self.BakeModeRadioCollection.createButton( ModeSetRow, label=self.BakeModeOptionList[1], onCommand=Callback(guiFactory.toggleModeState, self.BakeModeOptionList[1], self.BakeModeOptionList, cgmVar_Name, self.ContainerList, True))) ModeSetRow.layout() #>>> self.ContainerList.append(self.buildPlaceHolder(parent)) self.ContainerList.append(self.buildTimeSubMenu(parent)) mc.radioCollection( self.BakeModeRadioCollection, edit=True, sl=self.BakeModeChoiceList[mc.optionVar(q=cgmVar_Name)]) #>>> mc.setParent(parent) guiFactory.doButton2( parent, 'Do it!', lambda *a: locinatorLib.doUpdateLoc(self), 'Update a locator at a particular frame or through a timeline') guiFactory.lineSubBreak() #>>> Loc Me Section guiFactory.lineBreak() guiFactory.lineSubBreak() guiFactory.doButton2( parent, 'Just Loc Selected', lambda *a: locinatorLib.doLocMe(self), 'Create an updateable locator based off the selection and options')
def MainBackup_buildLayout(self,parent): BufferLayout = MelColumnLayout(parent) #>>> Snap Section guiFactory.header('Buffers') guiFactory.lineSubBreak() bufferScroll = MelScrollLayout(BufferLayout,cr = 1) for i,b in enumerate(self.objectBuffers): self.b = MelHSingleStretchLayout(bufferScroll,h = 20) MelSpacer(self.b, w = 2) """ lambda *a:bufferToolsLib.selectBufferObjects(self.objectBuffers[i]), "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.selectBufferObjects('",b,"')"), """ guiFactory.doButton2(self.b, 'Sel', "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.selectBufferObjects('",b,"')"), 'Select the buffer objects') tmp = MelTextField(self.b, w = 100,ut = 'cgmUIReservedTemplate', text = b, editable = False) self.b.setStretchWidget(tmp) guiFactory.doButton2(self.b, '+', "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.addSelected('",b,"')"), 'Add selected to the buffer') guiFactory.doButton2(self.b, '-', "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.removeSelected('",b,"')"), 'Remove selected to the buffer') guiFactory.doButton2(self.b, 'k', "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.keyBuffer('",b,"')"), 'Key buffer') guiFactory.doButton2(self.b, 'p', "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.purgeBuffer('",b,"')"), 'Purge buffer') MelSpacer(self.b, w = 2) self.b.layout() mc.setParent(BufferLayout) guiFactory.lineSubBreak() guiFactory.lineBreak() guiFactory.doButton2(BufferLayout, 'Create Buffer', lambda *a:bufferToolsLib.createBuffer(self), 'Create new buffer from selected buffer') """ for b in self.objectBuffers: self.b = MelFormLayout(BufferLayout,height = 20) tmpSel = guiFactory.doButton2(self.b, 'Sel', lambda *a:bufferToolsLib.selectBufferObjects(b), 'Select the buffer objects') tmpName = MelTextField(self.b, w = 100,ut = 'cgmUIReservedTemplate', text = b, editable = False) tmpAdd = guiFactory.doButton2(self.b, '+', lambda *a:bufferToolsLib.addSelected(b), 'Add selected to the buffer') tmpRem= guiFactory.doButton2(self.b, '-', lambda *a:bufferToolsLib.removeSelected(b), 'Remove selected to the buffer') tmpKey = guiFactory.doButton2(self.b, 'k', lambda *a:bufferToolsLib.keyBuffer(b), 'Key buffer') tmpPurge = guiFactory.doButton2(self.b, 'p', lambda *a:bufferToolsLib.purgeBuffer(b), 'Purge buffer') mc.formLayout(self.b, edit = True, af = [tmpSel, "left", 0], ac = [tmpName,"left",0,tmpSel], ac = [tmpName,"right",0,tmpAdd], ac = [tmpAdd,"right",0,tmpRem], ac = [tmpRem,"right",0,tmpKey], ac = [tmpKey,"right",0,tmpPurge], af = [tmpPurge,"right",0]) """ """
def buildBasicLayout(self,parent): mc.setParent(parent) guiFactory.header('Update') #>>>Time Section UpdateOptionRadioCollection = MelRadioCollection() EveryFrameOption = mc.optionVar( q='cgmVar_LocinatorBakeState' ) mc.setParent(parent) guiFactory.lineSubBreak() #>>> Time Menu Container self.BakeModeOptionList = ['Current Frame','Bake'] cgmVar_Name = 'cgmVar_LocinatorBakeState' guiFactory.appendOptionVarList(self,'cgmVar_LocinatorBakeState') if not mc.optionVar( ex=cgmVar_Name ): mc.optionVar( iv=(cgmVar_Name, 0) ) #build our sub section options self.ContainerList = [] #Mode Change row ModeSetRow = MelHSingleStretchLayout(parent,ut='cgmUISubTemplate') self.BakeModeRadioCollection = MelRadioCollection() self.BakeModeChoiceList = [] MelSpacer(ModeSetRow,w=2) self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[0], onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[0],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True))) ModeSetRow.setStretchWidget( MelSpacer(ModeSetRow) ) self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[1], onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[1],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True))) ModeSetRow.layout() #>>> self.ContainerList.append( self.buildPlaceHolder(parent) ) self.ContainerList.append( self.buildTimeSubMenu( parent) ) mc.radioCollection(self.BakeModeRadioCollection,edit=True, sl=self.BakeModeChoiceList[mc.optionVar(q=cgmVar_Name)]) #>>> mc.setParent(parent) guiFactory.doButton2(parent,'Do it!', lambda *a: locinatorLib.doUpdateLoc(self), 'Update a locator at a particular frame or through a timeline') guiFactory.lineSubBreak() #>>> Loc Me Section guiFactory.lineBreak() guiFactory.lineSubBreak() guiFactory.doButton2(parent,'Just Loc Selected', lambda *a: locinatorLib.doLocMe(self), 'Create an updateable locator based off the selection and options')
def Match_buildLayout(self,parent): mc.setParent(parent) guiFactory.header('Update') #>>>Match Mode self.MatchModeCollection = MelRadioCollection() self.MatchModeCollectionChoices = [] if not mc.optionVar( ex='cgmVar_AnimToolsMatchMode' ): mc.optionVar( iv=('cgmVar_AnimToolsMatchMode', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsMatchMode') #MatchModeFlagsRow = MelHLayout(parent,ut='cgmUISubTemplate',padding = 2) MatchModeFlagsRow = MelHSingleStretchLayout(parent,ut='cgmUIReservedTemplate',padding = 2) MelSpacer(MatchModeFlagsRow,w=2) self.MatchModeOptions = ['parent','point','orient'] for item in self.MatchModeOptions: cnt = self.MatchModeOptions.index(item) self.MatchModeCollectionChoices.append(self.MatchModeCollection.createButton(MatchModeFlagsRow,label=self.MatchModeOptions[cnt], onCommand = Callback(guiFactory.toggleOptionVarState,self.MatchModeOptions[cnt],self.MatchModeOptions,'cgmVar_AnimToolsMatchMode',True))) MelSpacer(MatchModeFlagsRow,w=3) MatchModeFlagsRow.setStretchWidget( self.MatchModeCollectionChoices[-1] ) MelSpacer(MatchModeFlagsRow,w=2) MatchModeFlagsRow.layout() mc.radioCollection(self.MatchModeCollection ,edit=True,sl= (self.MatchModeCollectionChoices[ (mc.optionVar(q='cgmVar_AnimToolsMatchMode')) ])) #>>>Time Section UpdateOptionRadioCollection = MelRadioCollection() #>>> Time Menu Container self.BakeModeOptionList = ['Current Frame','Bake'] cgmVar_Name = 'cgmVar_AnimToolsBakeState' if not mc.optionVar( ex=cgmVar_Name ): mc.optionVar( iv=(cgmVar_Name, 0) ) EveryFrameOption = mc.optionVar( q='cgmVar_AnimToolsBakeState' ) guiFactory.appendOptionVarList(self,'cgmVar_AnimToolsBakeState') #build our sub section options self.ContainerList = [] #Mode Change row ModeSetRow = MelHSingleStretchLayout(parent,ut='cgmUISubTemplate') self.BakeModeRadioCollection = MelRadioCollection() self.BakeModeChoiceList = [] MelSpacer(ModeSetRow,w=2) self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[0], onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[0],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True))) ModeSetRow.setStretchWidget( MelSpacer(ModeSetRow) ) self.BakeModeChoiceList.append(self.BakeModeRadioCollection.createButton(ModeSetRow,label=self.BakeModeOptionList[1], onCommand = Callback(guiFactory.toggleModeState,self.BakeModeOptionList[1],self.BakeModeOptionList,cgmVar_Name,self.ContainerList,True))) ModeSetRow.layout() #>>> self.ContainerList.append( self.buildPlaceHolder(parent) ) self.ContainerList.append( self.buildTimeSubMenu( parent) ) mc.radioCollection(self.BakeModeRadioCollection,edit=True, sl=self.BakeModeChoiceList[mc.optionVar(q=cgmVar_Name)]) #>>> mc.setParent(parent) guiFactory.doButton2(parent,'Do it!', lambda *a: locinatorLib.doUpdateLoc(self), 'Update an obj or locator at a particular frame or through a timeline') guiFactory.lineSubBreak() #>>> Loc Me Section guiFactory.lineBreak() guiFactory.lineSubBreak() guiFactory.doButton2(parent,'Just Loc Selected', lambda *a: locinatorLib.doLocMe(self), 'Create an updateable locator based off the selection and options') #>>> Tag Section guiFactory.lineSubBreak() guiFactory.doButton2(parent,'Tag it', lambda *a: locinatorLib.doTagObjects(self), "Tag the selected objects to the first locator in the selection set. After this relationship is set up, you can match objects to that locator.")
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
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