def __init__( self): self.toolName = 'cgm.bufferTools' self.description = 'This is a series of tools for working with cgm Buffers' self.author = 'Josh Burton' self.owner = 'CG Monks' self.website = 'www.cgmonks.com' self.version = __version__ self.optionVars = [] self.activeObjectBuffersOptionVar = OptionVarFactory('cgmVar_activeObjectBuffers','string') guiFactory.appendOptionVarList(self,'cgmVar_activeObjectBuffers') self.showHelp = False self.helpBlurbs = [] self.oldGenBlurbs = [] self.objectBuffers = [] bufferToolsLib.updateObjectBuffers(self) #Menu self.setupVariables self.UI_OptionsMenu = MelMenu( l='Options', pmc=self.buildOptionsMenu) self.UI_HelpMenu = MelMenu( l='Help', pmc=self.buildHelpMenu) self.ShowHelpOption = mc.optionVar( q='cgmVar_AnimToolsShowHelp' ) #GUI self.Main_buildLayout(self) self.show()
def __init__(self): """ Initializes the pop up menu class call """ self.optionVars = [] self.toolName = 'cgm.snapMM' IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked', 'int') mmActionOptionVar = OptionVarFactory('cgmVar_mmAction', 'int') surfaceSnapAimModeVar = OptionVarFactory('cgmVar_SurfaceSnapAimMode', 'int') UpdateRotateOrderOnTagVar = OptionVarFactory('cgmVar_TaggingUpdateRO', 'int') self.LocinatorUpdateObjectsBufferOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = ['']) self.LocinatorUpdateObjectsOptionVar = OptionVarFactory('cgmVar_SnapMMUpdateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsOptionVar.name) self.SnapModeOptionVar = OptionVarFactory('cgmVar_SnapMatchMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.SnapModeOptionVar.name) panel = mc.getPanel(up = True) sel = search.selectCheck() IsClickedOptionVar.set(0) mmActionOptionVar.set(0) if mc.popupMenu('cgmMM',ex = True): mc.deleteUI('cgmMM') if panel: if mc.control(panel, ex = True): mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = 'viewPanes', pmc = lambda *a: self.createUI('cgmMM'))
def setupVariables(self): self.LocinatorUpdateObjectsOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,'cgmVar_LocinatorUpdateMode') self.LocinatorUpdateObjectsBufferOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = ['']) guiFactory.appendOptionVarList(self,'cgmVar_LocinatorUpdateObjectsBuffer') self.DebugModeOptionVar = OptionVarFactory('cgmVar_LocinatorDebug',defaultValue=0) guiFactory.appendOptionVarList(self,self.DebugModeOptionVar.name) self.SnapModeOptionVar = OptionVarFactory('cgmVar_SnapMatchMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.SnapModeOptionVar.name) #Old method...clean up at some point if not mc.optionVar( ex='cgmVar_ForceBoundingBoxState' ): mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0) ) if not mc.optionVar( ex='cgmVar_LocinatorShowHelp' ): mc.optionVar( iv=('cgmVar_LocinatorShowHelp', 0) ) if not mc.optionVar( ex='cgmVar_LocinatorCurrentFrameOnly' ): mc.optionVar( iv=('cgmVar_LocinatorCurrentFrameOnly', 0) ) if not mc.optionVar( ex='cgmVar_LocinatorBakingMode' ): mc.optionVar( iv=('cgmVar_LocinatorBakingMode', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_LocinatorShowHelp')
def setupVariables(self): self.KeyTypeOptionVar = OptionVarFactory('cgmVar_KeyType', defaultValue = 0) guiFactory.appendOptionVarList(self,self.KeyTypeOptionVar.name) self.KeyModeOptionVar = OptionVarFactory('cgmVar_KeyMode', defaultValue = 0) guiFactory.appendOptionVarList(self,self.KeyModeOptionVar.name) self.mmActionOptionVar = OptionVarFactory('cgmVar_mmAction')
def buildOptionsMenu( self, *a ): self.UI_OptionsMenu.clear() # Placement Menu PlacementMenu = MelMenuItem( self.UI_OptionsMenu, l='Placement', subMenu=True) PlacementMenuCollection = MelRadioMenuCollection() if mc.optionVar( q='cgmVar_ForceBoundingBoxState' ) == 0: cgmOption = False pivotOption = True else: cgmOption = True pivotOption = False PlacementMenuCollection.createButton(PlacementMenu,l='Bounding Box Center', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 1)), rb=cgmOption ) PlacementMenuCollection.createButton(PlacementMenu,l='Pivot', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0)), rb=pivotOption ) # Tagging options AutoloadMenu = MelMenuItem( self.UI_OptionsMenu, l='Tagging', subMenu=True) if not mc.optionVar( ex='cgmVar_TaggingUpdateRO' ): mc.optionVar( iv=('cgmVar_TaggingUpdateRO', 1) ) guiFactory.appendOptionVarList(self,'cgmVar_TaggingUpdateRO') RenameOnUpdateState = mc.optionVar( q='cgmVar_TaggingUpdateRO' ) MelMenuItem( AutoloadMenu, l="Update Rotation Order", cb= mc.optionVar( q='cgmVar_TaggingUpdateRO' ), c= lambda *a: guiFactory.doToggleIntOptionVariable('cgmVar_TaggingUpdateRO')) # Update Mode UpdateMenu = MelMenuItem( self.UI_OptionsMenu, l='Update Mode', subMenu=True) UpdateMenuCollection = MelRadioMenuCollection() if self.LocinatorUpdateObjectsOptionVar.value == 0: slMode = True bufferMode = False else: slMode = False bufferMode = True UpdateMenuCollection.createButton(UpdateMenu,l='Selected', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(0), rb=slMode ) UpdateMenuCollection.createButton(UpdateMenu,l='Buffer', c=lambda *a:self.LocinatorUpdateObjectsOptionVar.set(1), rb=bufferMode ) MelMenuItemDiv( self.UI_OptionsMenu ) MelMenuItem( self.UI_OptionsMenu, l="Reset", c=lambda *a: guiFactory.resetGuiInstanceOptionVars(self.optionVars,run))
def setupVariables(): if not mc.optionVar( ex='cgmVar_ForceBoundingBoxState' ): mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0) ) if not mc.optionVar( ex='cgmVar_ForceEveryFrame' ): mc.optionVar( iv=('cgmVar_ForceEveryFrame', 0) ) if not mc.optionVar( ex='cgmVar_bufferToolsShowHelp' ): mc.optionVar( iv=('cgmVar_bufferToolsShowHelp', 0) ) if not mc.optionVar( ex='cgmVar_CurrentFrameOnly' ): mc.optionVar( iv=('cgmVar_CurrentFrameOnly', 0) ) if not mc.optionVar( ex='cgmVar_bufferToolsShowHelp' ): mc.optionVar( iv=('cgmVar_bufferToolsShowHelp', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_bufferToolsShowHelp')
def setupVariables(self): self.KeyTypeOptionVar = cgmMeta.cgmOptionVar('cgmVar_KeyType', defaultValue = 0) guiFactory.appendOptionVarList(self,self.KeyTypeOptionVar.name) self.KeyModeOptionVar = cgmMeta.cgmOptionVar('cgmVar_KeyMode', defaultValue = 0) guiFactory.appendOptionVarList(self,self.KeyModeOptionVar.name) self.mmActionOptionVar = cgmMeta.cgmOptionVar('cgmVar_mmAction') self.BuildModuleOptionVar = cgmMeta.cgmOptionVar('cgmVar_PuppetKeyBuildModule', defaultValue = 1) guiFactory.appendOptionVarList(self,self.BuildModuleOptionVar.name) self.BuildPuppetOptionVar = cgmMeta.cgmOptionVar('cgmVar_PuppetKeyBuildPuppet', defaultValue = 1) guiFactory.appendOptionVarList(self,self.BuildPuppetOptionVar.name) self.ResetModeOptionVar = cgmMeta.cgmOptionVar('cgmVar_ChannelResetMode', defaultValue = 0) guiFactory.appendOptionVarList(self,self.ResetModeOptionVar.name)
def __init__(self): """ Initializes the pop up menu class call """ self._str_MM = 'snapMarkingMenu' self.optionVars = [] self.toolName = 'cgm.snapMM' IsClickedOptionVar = cgmMeta.cgmOptionVar('cgmVar_IsClicked', 'int') mmActionOptionVar = cgmMeta.cgmOptionVar('cgmVar_mmAction', 'int') surfaceSnapAimModeVar = cgmMeta.cgmOptionVar('cgmVar_SurfaceSnapAimMode', 'int') UpdateRotateOrderOnTagVar = cgmMeta.cgmOptionVar('cgmVar_TaggingUpdateRO', 'int') self.LocinatorUpdateObjectsBufferOptionVar = cgmMeta.cgmOptionVar('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = ['']) self.LocinatorUpdateObjectsOptionVar = cgmMeta.cgmOptionVar('cgmVar_SnapMMUpdateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsOptionVar.name) self.SnapModeOptionVar = cgmMeta.cgmOptionVar('cgmVar_SnapMatchMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.SnapModeOptionVar.name) IsClickedOptionVar.setValue(0) mmActionOptionVar.setValue(0) #if mc.popupMenu('cgmMM',ex = True): #mc.deleteUI('cgmMM')#...deleting ui elements seems to be hard crashing maya 2017 _p = mc.getPanel(up = True) if _p is None: log.error("No panel detected...") return if _p: log.info("{0} panel under pointer {1}...".format(self._str_MM, _p)) _parentPanel = mc.panel(_p,q = True,ctl = True) log.info("{0} panel under pointer {1} | parent: {2}...".format(self._str_MM, _p,_parentPanel)) if 'MayaWindow' in _parentPanel: _p = 'viewPanes' if not mc.control(_p, ex = True): raise ValueError,"{0} doesn't exist!".format(_p) #_p = panel if not mc.popupMenu('cgmMM',ex = True): mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = _p, pmc = lambda *a: self.createUI('cgmMM'), postMenuCommandOnce = True) else: mc.popupMenu('cgmMM', edit = True, ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = _p, pmc = lambda *a: self.createUI('cgmMM'), postMenuCommandOnce = True)
def buildAttrConversionRow(self,parent): #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Attr type row #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> self.attrConvertTypes = ['string','float','int','bool','enum','message'] self.attrConvertShortTypes = ['str','float','int','bool','enum','msg'] self.ConvertAttrTypeRadioCollection = MelRadioCollection() self.ConvertAttrTypeRadioCollectionChoices = [] self.ConvertAttrTypeOptionVar = OptionVarFactory('cgmVar_ActiveAttrConversionState','int') guiFactory.appendOptionVarList(self,self.ConvertAttrTypeOptionVar.name) self.ConvertAttrTypeOptionVar.set(0) #build our sub section options self.AttrConvertRow = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 5) for cnt,item in enumerate(self.attrConvertTypes): self.ConvertAttrTypeRadioCollectionChoices.append(self.ConvertAttrTypeRadioCollection.createButton(self.AttrConvertRow,label=self.attrConvertShortTypes[cnt], onCommand = Callback(attrToolsLib.uiConvertLoadedAttr,self,item))) MelSpacer(self.AttrConvertRow,w=2) self.AttrConvertRow.layout()
def buildOptionsMenu( self, *a ): self.UI_OptionsMenu.clear() # Placement Menu PlacementMenu = MelMenuItem( self.UI_OptionsMenu, l='Placement', subMenu=True) PlacementMenuCollection = MelRadioMenuCollection() if mc.optionVar( q='cgmVar_ForceBoundingBoxState' ) == 0: cgmOption = False pivotOption = True else: cgmOption = True pivotOption = False PlacementMenuCollection.createButton(PlacementMenu,l='Bounding Box Center', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 1)), rb=cgmOption ) PlacementMenuCollection.createButton(PlacementMenu,l='Pivot', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0)), rb=pivotOption ) # Tagging options AutoloadMenu = MelMenuItem( self.UI_OptionsMenu, l='Tagging', subMenu=True) if not mc.optionVar( ex='cgmVar_TaggingUpdateRO' ): mc.optionVar( iv=('cgmVar_TaggingUpdateRO', 1) ) guiFactory.appendOptionVarList(self,'cgmVar_TaggingUpdateRO') RenameOnUpdateState = mc.optionVar( q='cgmVar_TaggingUpdateRO' ) MelMenuItem( AutoloadMenu, l="Update Rotation Order", cb= mc.optionVar( q='cgmVar_TaggingUpdateRO' ), c= lambda *a: guiFactory.doToggleIntOptionVariable('cgmVar_TaggingUpdateRO')) MelMenuItemDiv( self.UI_OptionsMenu ) MelMenuItem( self.UI_OptionsMenu, l="Reset", c=lambda *a: self.reset())
def setupVariables(self): self.LocinatorUpdateObjectsOptionVar = OptionVarFactory('cgmVar_AnimToolsUpdateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsOptionVar.name) self.LocinatorUpdateObjectsBufferOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = ['']) guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsBufferOptionVar.name) if not mc.optionVar( ex='cgmVar_ForceBoundingBoxState' ): mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0) ) if not mc.optionVar( ex='cgmVar_ForceEveryFrame' ): mc.optionVar( iv=('cgmVar_ForceEveryFrame', 0) ) if not mc.optionVar( ex='cgmVar_animToolsShowHelp' ): mc.optionVar( iv=('cgmVar_animToolsShowHelp', 0) ) if not mc.optionVar( ex='cgmVar_CurrentFrameOnly' ): mc.optionVar( iv=('cgmVar_CurrentFrameOnly', 0) ) if not mc.optionVar( ex='cgmVar_animToolsShowHelp' ): mc.optionVar( iv=('cgmVar_animToolsShowHelp', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_animToolsShowHelp')
def buildOptionsMenu(self, *a): self.UI_OptionsMenu.clear() #>>>Match Mode MatchModeMenu = MelMenuItem(self.UI_OptionsMenu, l='Match Mode', subMenu=True) self.MatchModeOptions = ['parent', 'point', 'orient'] self.MatchModeCollection = MelRadioMenuCollection() self.MatchModeCollectionChoices = [] self.SnapModeOptionVar.update() #Incase another tool changed self.matchMode = self.SnapModeOptionVar.value for c, item in enumerate(self.MatchModeOptions): if self.matchMode == c: rbValue = True else: rbValue = False self.MatchModeCollectionChoices.append( self.MatchModeCollection.createButton( MatchModeMenu, label=item, rb=rbValue, command=Callback(self.SnapModeOptionVar.set, c))) # Placement Menu PlacementMenu = MelMenuItem(self.UI_OptionsMenu, l='Placement', subMenu=True) PlacementMenuCollection = MelRadioMenuCollection() if mc.optionVar(q='cgmVar_ForceBoundingBoxState') == 0: cgmOption = False pivotOption = True else: cgmOption = True pivotOption = False PlacementMenuCollection.createButton( PlacementMenu, l='Bounding Box Center', c=lambda *a: mc.optionVar(iv=('cgmVar_ForceBoundingBoxState', 1)), rb=cgmOption) PlacementMenuCollection.createButton( PlacementMenu, l='Pivot', c=lambda *a: mc.optionVar(iv=('cgmVar_ForceBoundingBoxState', 0)), rb=pivotOption) # Tagging options AutoloadMenu = MelMenuItem(self.UI_OptionsMenu, l='Tagging', subMenu=True) if not mc.optionVar(ex='cgmVar_TaggingUpdateRO'): mc.optionVar(iv=('cgmVar_TaggingUpdateRO', 1)) guiFactory.appendOptionVarList(self, 'cgmVar_TaggingUpdateRO') RenameOnUpdateState = mc.optionVar(q='cgmVar_TaggingUpdateRO') MelMenuItem(AutoloadMenu, l="Update Rotation Order", cb=mc.optionVar(q='cgmVar_TaggingUpdateRO'), c=lambda *a: guiFactory.doToggleIntOptionVariable( 'cgmVar_TaggingUpdateRO')) # Update Mode UpdateMenu = MelMenuItem(self.UI_OptionsMenu, l='Update Mode', subMenu=True) UpdateMenuCollection = MelRadioMenuCollection() if self.LocinatorUpdateObjectsOptionVar.value == 0: slMode = True bufferMode = False else: slMode = False bufferMode = True UpdateMenuCollection.createButton( UpdateMenu, l='Selected', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(0), rb=slMode) UpdateMenuCollection.createButton( UpdateMenu, l='Buffer', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(1), rb=bufferMode) MelMenuItemDiv(self.UI_OptionsMenu) MelMenuItem(self.UI_OptionsMenu, l="Reset", c=lambda *a: self.reset())
def setupVariables(self): self.ActiveObjectSetsOptionVar = OptionVarFactory('cgmVar_activeObjectSets',defaultValue = ['']) self.ActiveRefsOptionVar = OptionVarFactory('cgmVar_activeRefs',defaultValue = ['']) self.ActiveTypesOptionVar = OptionVarFactory('cgmVar_activeTypes',defaultValue = ['']) self.KeyTypeOptionVar = OptionVarFactory('cgmVar_KeyType', defaultValue = 0) self.HideSetGroupOptionVar = OptionVarFactory('cgmVar_HideSetGroups', defaultValue = 1) self.HideNonQssOptionVar = OptionVarFactory('cgmVar_HideNonQss', defaultValue = 1) self.HideAnimLayerSetsOptionVar = OptionVarFactory('cgmVar_HideAnimLayerSets', defaultValue = 1) self.HideMayaSetsOptionVar = OptionVarFactory('cgmVar_HideMayaSets', defaultValue = 1) guiFactory.appendOptionVarList(self,self.ActiveObjectSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveRefsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveTypesOptionVar.name) guiFactory.appendOptionVarList(self,self.KeyTypeOptionVar.name) guiFactory.appendOptionVarList(self,self.HideSetGroupOptionVar.name) guiFactory.appendOptionVarList(self,self.HideNonQssOptionVar.name) guiFactory.appendOptionVarList(self,self.HideAnimLayerSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.HideMayaSetsOptionVar.name)
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 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 buildTimeSubMenu(self,parent): self.containerName = MelColumnLayout(parent,ut='cgmUISubTemplate') # Time Submenu mc.setParent(self.containerName) self.helpBlurbs.extend(guiFactory.instructions(" Set your time range",vis = self.ShowHelpOption)) timelineInfo = search.returnTimelineInfo() # TimeInput Row TimeInputRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate') self.timeSubMenu.append( TimeInputRow ) MelSpacer(TimeInputRow) MelLabel(TimeInputRow,l='start') self.startFrameField = MelIntField(TimeInputRow,'cgmLocWinStartFrameField', width = 40, value= timelineInfo['rangeStart']) TimeInputRow.setStretchWidget( MelSpacer(TimeInputRow) ) MelLabel(TimeInputRow,l='end') self.endFrameField = MelIntField(TimeInputRow,'cgmLocWinEndFrameField', width = 40, value= timelineInfo['rangeEnd']) MelSpacer(TimeInputRow) TimeInputRow.layout() MelSeparator(self.containerName,ut = 'cgmUISubTemplate',style='none',height = 5) # Button Row TimeButtonRow = MelHSingleStretchLayout(self.containerName,padding = 1, ut='cgmUISubTemplate') MelSpacer(TimeButtonRow,w=2) currentRangeButton = guiFactory.doButton2(TimeButtonRow,'Current Range', lambda *a: locinatorLib.setGUITimeRangeToCurrent(self), 'Sets the time range to the current slider range') TimeButtonRow.setStretchWidget( MelSpacer(TimeButtonRow,w=2) ) sceneRangeButton = guiFactory.doButton2(TimeButtonRow,'Scene Range', lambda *a: locinatorLib.setGUITimeRangeToScene(self), 'Sets the time range to the current slider range') MelSpacer(TimeButtonRow,w=2) TimeButtonRow.layout() #>>> Base Settings Flags self.KeyingModeCollection = MelRadioCollection() self.KeyingModeCollectionChoices = [] if not mc.optionVar( ex='cgmVar_LocinatorKeyingMode' ): mc.optionVar( iv=('cgmVar_LocinatorKeyingMode', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_LocinatorKeyingMode') KeysSettingsFlagsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 2) MelSpacer(KeysSettingsFlagsRow,w=2) KeysSettingsFlagsRow.setStretchWidget( MelLabel(KeysSettingsFlagsRow,l='Anim Option: ',align='right') ) self.keyingOptions = ['Keys','All'] for item in self.keyingOptions: cnt = self.keyingOptions.index(item) self.KeyingModeCollectionChoices.append(self.KeyingModeCollection.createButton(KeysSettingsFlagsRow,label=self.keyingOptions[cnt], onCommand = Callback(guiFactory.toggleOptionVarState,self.keyingOptions[cnt],self.keyingOptions,'cgmVar_LocinatorKeyingMode',True))) MelSpacer(KeysSettingsFlagsRow,w=5) mc.radioCollection(self.KeyingModeCollection ,edit=True,sl= (self.KeyingModeCollectionChoices[ (mc.optionVar(q='cgmVar_LocinatorKeyingMode')) ])) KeysSettingsFlagsRow.layout() #>>> Base Settings Flags self.KeyingTargetCollection = MelRadioCollection() self.KeyingTargetCollectionChoices = [] if not mc.optionVar( ex='cgmVar_LocinatorKeyingTarget' ): mc.optionVar( iv=('cgmVar_LocinatorKeyingTarget', 0) ) guiFactory.appendOptionVarList(self,'cgmVar_LocinatorKeyingTarget') BakeSettingsFlagsRow = MelHSingleStretchLayout(self.containerName,ut='cgmUISubTemplate',padding = 2) MelSpacer(BakeSettingsFlagsRow,w=2) BakeSettingsFlagsRow.setStretchWidget( MelLabel(BakeSettingsFlagsRow,l='From: ',align='right') ) MelSpacer(BakeSettingsFlagsRow) self.keyTargetOptions = ['source','self'] for item in self.keyTargetOptions: cnt = self.keyTargetOptions.index(item) self.KeyingTargetCollectionChoices.append(self.KeyingTargetCollection.createButton(BakeSettingsFlagsRow,label=self.keyTargetOptions[cnt], onCommand = Callback(guiFactory.toggleOptionVarState,self.keyTargetOptions[cnt],self.keyTargetOptions,'cgmVar_LocinatorKeyingTarget',True))) MelSpacer(BakeSettingsFlagsRow,w=5) mc.radioCollection(self.KeyingTargetCollection ,edit=True,sl= (self.KeyingTargetCollectionChoices[ (mc.optionVar(q='cgmVar_LocinatorKeyingTarget')) ])) BakeSettingsFlagsRow.layout() return self.containerName
def buildOptionsMenu( self, *a ): self.UI_OptionsMenu.clear() #>>>Match Mode MatchModeMenu = MelMenuItem( self.UI_OptionsMenu, l='Match Mode', subMenu=True) self.MatchModeOptions = ['parent','point','orient'] self.MatchModeCollection = MelRadioMenuCollection() self.MatchModeCollectionChoices = [] self.SnapModeOptionVar.update()#Incase another tool changed self.matchMode = self.SnapModeOptionVar.value for c,item in enumerate(self.MatchModeOptions): if self.matchMode == c: rbValue = True else: rbValue = False self.MatchModeCollectionChoices.append(self.MatchModeCollection.createButton(MatchModeMenu,label=item, rb = rbValue, command = Callback(self.SnapModeOptionVar.set,c))) # Placement Menu PlacementMenu = MelMenuItem( self.UI_OptionsMenu, l='Placement', subMenu=True) PlacementMenuCollection = MelRadioMenuCollection() if mc.optionVar( q='cgmVar_ForceBoundingBoxState' ) == 0: cgmOption = False pivotOption = True else: cgmOption = True pivotOption = False PlacementMenuCollection.createButton(PlacementMenu,l='Bounding Box Center', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 1)), rb=cgmOption ) PlacementMenuCollection.createButton(PlacementMenu,l='Pivot', c=lambda *a: mc.optionVar( iv=('cgmVar_ForceBoundingBoxState', 0)), rb=pivotOption ) # Tagging options AutoloadMenu = MelMenuItem( self.UI_OptionsMenu, l='Tagging', subMenu=True) if not mc.optionVar( ex='cgmVar_TaggingUpdateRO' ): mc.optionVar( iv=('cgmVar_TaggingUpdateRO', 1) ) guiFactory.appendOptionVarList(self,'cgmVar_TaggingUpdateRO') RenameOnUpdateState = mc.optionVar( q='cgmVar_TaggingUpdateRO' ) MelMenuItem( AutoloadMenu, l="Update Rotation Order", cb= mc.optionVar( q='cgmVar_TaggingUpdateRO' ), c= lambda *a: guiFactory.doToggleIntOptionVariable('cgmVar_TaggingUpdateRO')) # Update Mode UpdateMenu = MelMenuItem( self.UI_OptionsMenu, l='Update Mode', subMenu=True) UpdateMenuCollection = MelRadioMenuCollection() if self.LocinatorUpdateObjectsOptionVar.value == 0: slMode = True bufferMode = False else: slMode = False bufferMode = True UpdateMenuCollection.createButton(UpdateMenu,l='Selected', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(0), rb=slMode ) UpdateMenuCollection.createButton(UpdateMenu,l='Buffer', c=lambda *a:self.LocinatorUpdateObjectsOptionVar.set(1), rb=bufferMode ) MelMenuItemDiv( self.UI_OptionsMenu ) MelMenuItem( self.UI_OptionsMenu, l="Reset", c=lambda *a: self.reset())
def __init__(self): """ Initializes the pop up menu class call """ self._str_MM = 'snapMarkingMenu' self.optionVars = [] self.toolName = 'cgm.snapMM' IsClickedOptionVar = cgmMeta.cgmOptionVar('cgmVar_IsClicked', 'int') mmActionOptionVar = cgmMeta.cgmOptionVar('cgmVar_mmAction', 'int') surfaceSnapAimModeVar = cgmMeta.cgmOptionVar( 'cgmVar_SurfaceSnapAimMode', 'int') UpdateRotateOrderOnTagVar = cgmMeta.cgmOptionVar( 'cgmVar_TaggingUpdateRO', 'int') self.LocinatorUpdateObjectsBufferOptionVar = cgmMeta.cgmOptionVar( 'cgmVar_LocinatorUpdateObjectsBuffer', defaultValue=['']) self.LocinatorUpdateObjectsOptionVar = cgmMeta.cgmOptionVar( 'cgmVar_SnapMMUpdateMode', defaultValue=0) guiFactory.appendOptionVarList( self, self.LocinatorUpdateObjectsOptionVar.name) self.SnapModeOptionVar = cgmMeta.cgmOptionVar('cgmVar_SnapMatchMode', defaultValue=0) guiFactory.appendOptionVarList(self, self.SnapModeOptionVar.name) IsClickedOptionVar.setValue(0) mmActionOptionVar.setValue(0) #if mc.popupMenu('cgmMM',ex = True): #mc.deleteUI('cgmMM')#...deleting ui elements seems to be hard crashing maya 2017 _p = mc.getPanel(up=True) if _p is None: log.error("No panel detected...") return if _p: log.info("{0} panel under pointer {1}...".format(self._str_MM, _p)) _parentPanel = mc.panel(_p, q=True, ctl=True) log.info("{0} panel under pointer {1} | parent: {2}...".format( self._str_MM, _p, _parentPanel)) if 'MayaWindow' in _parentPanel: _p = 'viewPanes' if not mc.control(_p, ex=True): raise ValueError, "{0} doesn't exist!".format(_p) #_p = panel if not mc.popupMenu('cgmMM', ex=True): mc.popupMenu('cgmMM', ctl=0, alt=0, sh=0, mm=1, b=1, aob=1, p=_p, pmc=lambda *a: self.createUI('cgmMM'), postMenuCommandOnce=True) else: mc.popupMenu('cgmMM', edit=True, ctl=0, alt=0, sh=0, mm=1, b=1, aob=1, p=_p, pmc=lambda *a: self.createUI('cgmMM'), postMenuCommandOnce=True)
def setupVariables(self): self.PuppetModeOptionVar = OptionVarFactory('cgmVar_PuppetCreateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.PuppetModeOptionVar.name) self.PuppetAimOptionVar = OptionVarFactory('cgmVar_PuppetAimAxis',defaultValue = 2) guiFactory.appendOptionVarList(self,self.PuppetAimOptionVar.name) self.PuppetUpOptionVar = OptionVarFactory('cgmVar_PuppetUpAxis',defaultValue = 1) guiFactory.appendOptionVarList(self,self.PuppetUpOptionVar.name) self.PuppetOutOptionVar = OptionVarFactory('cgmVar_PuppetOutAxis',defaultValue = 0) guiFactory.appendOptionVarList(self,self.PuppetOutOptionVar.name) self.ActiveObjectSetsOptionVar = OptionVarFactory('cgmVar_activeObjectSets',defaultValue = ['']) self.ActiveRefsOptionVar = OptionVarFactory('cgmVar_activeRefs',defaultValue = ['']) self.ActiveTypesOptionVar = OptionVarFactory('cgmVar_activeTypes',defaultValue = ['']) self.SetToolsModeOptionVar = OptionVarFactory('cgmVar_puppetBoxMode', defaultValue = 0) self.KeyTypeOptionVar = OptionVarFactory('cgmVar_KeyType', defaultValue = 0) self.ShowHelpOptionVar = OptionVarFactory('cgmVar_puppetBoxShowHelp', defaultValue = 0) self.MaintainLocalSetGroupOptionVar = OptionVarFactory('cgmVar_MaintainLocalSetGroup', defaultValue = 1) self.HideSetGroupOptionVar = OptionVarFactory('cgmVar_HideSetGroups', defaultValue = 1) self.HideAnimLayerSetsOptionVar = OptionVarFactory('cgmVar_HideAnimLayerSets', defaultValue = 1) self.HideMayaSetsOptionVar = OptionVarFactory('cgmVar_HideMayaSets', defaultValue = 1) guiFactory.appendOptionVarList(self,self.ActiveObjectSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveRefsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveTypesOptionVar.name) guiFactory.appendOptionVarList(self,self.SetToolsModeOptionVar.name) guiFactory.appendOptionVarList(self,self.ShowHelpOptionVar.name) guiFactory.appendOptionVarList(self,self.KeyTypeOptionVar.name) guiFactory.appendOptionVarList(self,self.HideSetGroupOptionVar.name) guiFactory.appendOptionVarList(self,self.MaintainLocalSetGroupOptionVar.name) guiFactory.appendOptionVarList(self,self.HideAnimLayerSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.HideMayaSetsOptionVar.name)
def buildOptionsMenu(self, *a): self.UI_OptionsMenu.clear() # Placement Menu PlacementMenu = MelMenuItem(self.UI_OptionsMenu, l='Placement', subMenu=True) PlacementMenuCollection = MelRadioMenuCollection() if mc.optionVar(q='cgmVar_ForceBoundingBoxState') == 0: cgmOption = False pivotOption = True else: cgmOption = True pivotOption = False PlacementMenuCollection.createButton( PlacementMenu, l='Bounding Box Center', c=lambda *a: mc.optionVar(iv=('cgmVar_ForceBoundingBoxState', 1)), rb=cgmOption) PlacementMenuCollection.createButton( PlacementMenu, l='Pivot', c=lambda *a: mc.optionVar(iv=('cgmVar_ForceBoundingBoxState', 0)), rb=pivotOption) # Tagging options AutoloadMenu = MelMenuItem(self.UI_OptionsMenu, l='Tagging', subMenu=True) if not mc.optionVar(ex='cgmVar_TaggingUpdateRO'): mc.optionVar(iv=('cgmVar_TaggingUpdateRO', 1)) guiFactory.appendOptionVarList(self, 'cgmVar_TaggingUpdateRO') RenameOnUpdateState = mc.optionVar(q='cgmVar_TaggingUpdateRO') MelMenuItem(AutoloadMenu, l="Update Rotation Order", cb=mc.optionVar(q='cgmVar_TaggingUpdateRO'), c=lambda *a: guiFactory.doToggleIntOptionVariable( 'cgmVar_TaggingUpdateRO')) # Update Mode UpdateMenu = MelMenuItem(self.UI_OptionsMenu, l='Update Mode', subMenu=True) UpdateMenuCollection = MelRadioMenuCollection() if self.LocinatorUpdateObjectsOptionVar.value == 0: slMode = True bufferMode = False else: slMode = False bufferMode = True UpdateMenuCollection.createButton( UpdateMenu, l='Selected', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(0), rb=slMode) UpdateMenuCollection.createButton( UpdateMenu, l='Buffer', c=lambda *a: self.LocinatorUpdateObjectsOptionVar.set(1), rb=bufferMode) MelMenuItemDiv(self.UI_OptionsMenu) MelMenuItem(self.UI_OptionsMenu, l="Reset", c=lambda *a: self.reset())
def setupVariables(self): self.SortModifyOptionVar = OptionVarFactory( 'cgmVar_attrToolsSortModfiy', defaultValue=0) guiFactory.appendOptionVarList(self, self.SortModifyOptionVar.name) self.HideTransformsOptionVar = OptionVarFactory( 'cgmVar_attrToolsHideTransform', defaultValue=0) guiFactory.appendOptionVarList(self, self.HideTransformsOptionVar.name) self.HideUserDefinedOptionVar = OptionVarFactory( 'cgmVar_attrToolsHideUserDefined', defaultValue=0) guiFactory.appendOptionVarList(self, self.HideUserDefinedOptionVar.name) self.HideParentAttrsOptionVar = OptionVarFactory( 'cgmVar_attrToolsHideParentAttrs', defaultValue=0) guiFactory.appendOptionVarList(self, self.HideParentAttrsOptionVar.name) self.HideCGMAttrsOptionVar = OptionVarFactory( 'cgmVar_attrToolsHideCGMAttrs', defaultValue=1) guiFactory.appendOptionVarList(self, self.HideCGMAttrsOptionVar.name) self.HideNonstandardOptionVar = OptionVarFactory( 'cgmVar_attrToolsHideNonStandard', defaultValue=1) guiFactory.appendOptionVarList(self, self.HideNonstandardOptionVar.name) self.ShowHelpOptionVar = OptionVarFactory('cgmVar_attrToolsShowHelp', defaultValue=0) guiFactory.appendOptionVarList(self, self.ShowHelpOptionVar.name) self.SourceObjectOptionVar = OptionVarFactory( 'cgmVar_AttributeSourceObject', defaultValue='') guiFactory.appendOptionVarList(self, self.SourceObjectOptionVar.name) self.CopyAttrModeOptionVar = OptionVarFactory( 'cgmVar_CopyAttributeMode', defaultValue=0) guiFactory.appendOptionVarList(self, self.CopyAttrModeOptionVar.name) self.CopyAttrOptionsOptionVar = OptionVarFactory( 'cgmVar_CopyAttributeOptions', defaultValue=1) guiFactory.appendOptionVarList(self, self.CopyAttrOptionsOptionVar.name) self.TransferValueOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferValueState', defaultValue=1) guiFactory.appendOptionVarList(self, self.TransferValueOptionVar.name) self.TransferIncomingOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferInConnectionState', defaultValue=1) guiFactory.appendOptionVarList(self, self.TransferIncomingOptionVar.name) self.TransferOutgoingOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferOutConnectionState', defaultValue=1) guiFactory.appendOptionVarList(self, self.TransferOutgoingOptionVar.name) self.TransferKeepSourceOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferKeepSourceState', defaultValue=1) guiFactory.appendOptionVarList(self, self.TransferKeepSourceOptionVar.name) self.TransferConvertStateOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferConvertState', defaultValue=1) guiFactory.appendOptionVarList(self, self.TransferConvertStateOptionVar.name) self.TransferDriveSourceStateOptionVar = OptionVarFactory( 'cgmVar_AttributeTransferConnectToSourceState', defaultValue=0) guiFactory.appendOptionVarList( self, self.TransferDriveSourceStateOptionVar.name) self.CreateAttrTypeOptionVar = OptionVarFactory( 'cgmVar_AttrCreateType', defaultValue='') guiFactory.appendOptionVarList(self, self.CreateAttrTypeOptionVar.name)
def setupVariables(self): self.ActiveObjectSetsOptionVar = OptionVarFactory("cgmVar_activeObjectSets", defaultValue=[""]) self.ActiveRefsOptionVar = OptionVarFactory("cgmVar_activeRefs", defaultValue=[""]) self.ActiveTypesOptionVar = OptionVarFactory("cgmVar_activeTypes", defaultValue=[""]) self.KeyTypeOptionVar = OptionVarFactory("cgmVar_KeyType", defaultValue=0) self.HideSetGroupOptionVar = OptionVarFactory("cgmVar_HideSetGroups", defaultValue=1) self.HideNonQssOptionVar = OptionVarFactory("cgmVar_HideNonQss", defaultValue=1) self.HideAnimLayerSetsOptionVar = OptionVarFactory("cgmVar_HideAnimLayerSets", defaultValue=1) self.HideMayaSetsOptionVar = OptionVarFactory("cgmVar_HideMayaSets", defaultValue=1) guiFactory.appendOptionVarList(self, self.ActiveObjectSetsOptionVar.name) guiFactory.appendOptionVarList(self, self.ActiveRefsOptionVar.name) guiFactory.appendOptionVarList(self, self.ActiveTypesOptionVar.name) guiFactory.appendOptionVarList(self, self.KeyTypeOptionVar.name) guiFactory.appendOptionVarList(self, self.HideSetGroupOptionVar.name) guiFactory.appendOptionVarList(self, self.HideNonQssOptionVar.name) guiFactory.appendOptionVarList(self, self.HideAnimLayerSetsOptionVar.name) guiFactory.appendOptionVarList(self, self.HideMayaSetsOptionVar.name)
def buildTimeSubMenu(self, parent): self.containerName = MelColumnLayout(parent, ut='cgmUISubTemplate') # Time Submenu mc.setParent(self.containerName) self.helpBlurbs.extend( guiFactory.instructions(" Set your time range", vis=self.ShowHelpOption)) timelineInfo = search.returnTimelineInfo() # TimeInput Row TimeInputRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate') self.timeSubMenu.append(TimeInputRow) MelSpacer(TimeInputRow) MelLabel(TimeInputRow, l='start') self.startFrameField = MelIntField(TimeInputRow, 'cgmLocWinStartFrameField', width=40, value=timelineInfo['rangeStart']) TimeInputRow.setStretchWidget(MelSpacer(TimeInputRow)) MelLabel(TimeInputRow, l='end') self.endFrameField = MelIntField(TimeInputRow, 'cgmLocWinEndFrameField', width=40, value=timelineInfo['rangeEnd']) MelSpacer(TimeInputRow) TimeInputRow.layout() MelSeparator(self.containerName, ut='cgmUISubTemplate', style='none', height=5) # Button Row TimeButtonRow = MelHSingleStretchLayout(self.containerName, padding=1, ut='cgmUISubTemplate') MelSpacer(TimeButtonRow, w=2) currentRangeButton = guiFactory.doButton2( TimeButtonRow, 'Current Range', lambda *a: locinatorLib.setGUITimeRangeToCurrent(self), 'Sets the time range to the current slider range') TimeButtonRow.setStretchWidget(MelSpacer(TimeButtonRow, w=2)) sceneRangeButton = guiFactory.doButton2( TimeButtonRow, 'Scene Range', lambda *a: locinatorLib.setGUITimeRangeToScene(self), 'Sets the time range to the current slider range') MelSpacer(TimeButtonRow, w=2) TimeButtonRow.layout() #>>> Base Settings Flags self.KeyingModeCollection = MelRadioCollection() self.KeyingModeCollectionChoices = [] if not mc.optionVar(ex='cgmVar_LocinatorKeyingMode'): mc.optionVar(iv=('cgmVar_LocinatorKeyingMode', 0)) guiFactory.appendOptionVarList(self, 'cgmVar_LocinatorKeyingMode') KeysSettingsFlagsRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=2) MelSpacer(KeysSettingsFlagsRow, w=2) KeysSettingsFlagsRow.setStretchWidget( MelLabel(KeysSettingsFlagsRow, l='Anim Option: ', align='right')) self.keyingOptions = ['Keys', 'All'] for item in self.keyingOptions: cnt = self.keyingOptions.index(item) self.KeyingModeCollectionChoices.append( self.KeyingModeCollection.createButton( KeysSettingsFlagsRow, label=self.keyingOptions[cnt], onCommand=Callback(guiFactory.toggleOptionVarState, self.keyingOptions[cnt], self.keyingOptions, 'cgmVar_LocinatorKeyingMode', True))) MelSpacer(KeysSettingsFlagsRow, w=5) mc.radioCollection(self.KeyingModeCollection, edit=True, sl=(self.KeyingModeCollectionChoices[(mc.optionVar( q='cgmVar_LocinatorKeyingMode'))])) KeysSettingsFlagsRow.layout() #>>> Base Settings Flags self.KeyingTargetCollection = MelRadioCollection() self.KeyingTargetCollectionChoices = [] if not mc.optionVar(ex='cgmVar_LocinatorKeyingTarget'): mc.optionVar(iv=('cgmVar_LocinatorKeyingTarget', 0)) guiFactory.appendOptionVarList(self, 'cgmVar_LocinatorKeyingTarget') BakeSettingsFlagsRow = MelHSingleStretchLayout(self.containerName, ut='cgmUISubTemplate', padding=2) MelSpacer(BakeSettingsFlagsRow, w=2) BakeSettingsFlagsRow.setStretchWidget( MelLabel(BakeSettingsFlagsRow, l='From: ', align='right')) MelSpacer(BakeSettingsFlagsRow) self.keyTargetOptions = ['source', 'self'] for item in self.keyTargetOptions: cnt = self.keyTargetOptions.index(item) self.KeyingTargetCollectionChoices.append( self.KeyingTargetCollection.createButton( BakeSettingsFlagsRow, label=self.keyTargetOptions[cnt], onCommand=Callback(guiFactory.toggleOptionVarState, self.keyTargetOptions[cnt], self.keyTargetOptions, 'cgmVar_LocinatorKeyingTarget', True))) MelSpacer(BakeSettingsFlagsRow, w=5) mc.radioCollection( self.KeyingTargetCollection, edit=True, sl=(self.KeyingTargetCollectionChoices[(mc.optionVar( q='cgmVar_LocinatorKeyingTarget'))])) BakeSettingsFlagsRow.layout() return self.containerName
def setupVariables(self): self.PuppetModeOptionVar = OptionVarFactory('cgmVar_PuppetCreateMode',defaultValue = 0) guiFactory.appendOptionVarList(self,self.PuppetModeOptionVar.name) self.PuppetAimOptionVar = OptionVarFactory('cgmVar_PuppetAimAxis',defaultValue = 2) guiFactory.appendOptionVarList(self,self.PuppetAimOptionVar.name) self.PuppetUpOptionVar = OptionVarFactory('cgmVar_PuppetUpAxis',defaultValue = 1) guiFactory.appendOptionVarList(self,self.PuppetUpOptionVar.name) self.PuppetOutOptionVar = OptionVarFactory('cgmVar_PuppetOutAxis',defaultValue = 0) guiFactory.appendOptionVarList(self,self.PuppetOutOptionVar.name) self.ActiveObjectSetsOptionVar = OptionVarFactory('cgmVar_activeObjectSets',defaultValue = ['']) self.ActiveRefsOptionVar = OptionVarFactory('cgmVar_activeRefs',defaultValue = ['']) self.ActiveTypesOptionVar = OptionVarFactory('cgmVar_activeTypes',defaultValue = ['']) self.SetToolsModeOptionVar = OptionVarFactory('cgmVar_puppetBoxMode', defaultValue = 0) self.KeyTypeOptionVar = OptionVarFactory('cgmVar_KeyType', defaultValue = 0) self.ShowHelpOptionVar = OptionVarFactory('cgmVar_puppetBoxShowHelp', defaultValue = 0) self.MaintainLocalSetGroupOptionVar = OptionVarFactory('cgmVar_MaintainLocalSetGroup', defaultValue = 1) self.HideSetGroupOptionVar = OptionVarFactory('cgmVar_HideSetGroups', defaultValue = 1) self.HideAnimLayerSetsOptionVar = OptionVarFactory('cgmVar_HideAnimLayerSets', defaultValue = 1) self.HideMayaSetsOptionVar = OptionVarFactory('cgmVar_HideMayaSets', defaultValue = 1) self.dockOptionVar = OptionVarFactory('cgmVar_PuppetBoxDock', defaultValue = 1) guiFactory.appendOptionVarList(self,self.ActiveObjectSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveRefsOptionVar.name) guiFactory.appendOptionVarList(self,self.ActiveTypesOptionVar.name) guiFactory.appendOptionVarList(self,self.SetToolsModeOptionVar.name) guiFactory.appendOptionVarList(self,self.ShowHelpOptionVar.name) guiFactory.appendOptionVarList(self,self.KeyTypeOptionVar.name) guiFactory.appendOptionVarList(self,self.HideSetGroupOptionVar.name) guiFactory.appendOptionVarList(self,self.MaintainLocalSetGroupOptionVar.name) guiFactory.appendOptionVarList(self,self.HideAnimLayerSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.HideMayaSetsOptionVar.name) guiFactory.appendOptionVarList(self,self.dockOptionVar.name) self.DebugModeOptionVar = OptionVarFactory('cgmVar_PuppetBoxDebug',defaultValue=0) guiFactory.appendOptionVarList(self,self.DebugModeOptionVar.name)
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 setupVariables(self): self.SortModifyOptionVar = OptionVarFactory('cgmVar_attrToolsSortModfiy', defaultValue = 0) guiFactory.appendOptionVarList(self,self.SortModifyOptionVar.name) self.HideTransformsOptionVar = OptionVarFactory('cgmVar_attrToolsHideTransform', defaultValue = 0) guiFactory.appendOptionVarList(self,self.HideTransformsOptionVar.name) self.HideUserDefinedOptionVar = OptionVarFactory('cgmVar_attrToolsHideUserDefined', defaultValue = 0) guiFactory.appendOptionVarList(self,self.HideUserDefinedOptionVar.name) self.HideParentAttrsOptionVar = OptionVarFactory('cgmVar_attrToolsHideParentAttrs', defaultValue = 0) guiFactory.appendOptionVarList(self,self.HideParentAttrsOptionVar.name) self.HideCGMAttrsOptionVar = OptionVarFactory('cgmVar_attrToolsHideCGMAttrs', defaultValue = 1) guiFactory.appendOptionVarList(self,self.HideCGMAttrsOptionVar.name) self.HideNonstandardOptionVar = OptionVarFactory('cgmVar_attrToolsHideNonStandard', defaultValue = 1) guiFactory.appendOptionVarList(self,self.HideNonstandardOptionVar.name) self.ShowHelpOptionVar = OptionVarFactory('cgmVar_attrToolsShowHelp', defaultValue = 0) guiFactory.appendOptionVarList(self,self.ShowHelpOptionVar.name) self.SourceObjectOptionVar = OptionVarFactory('cgmVar_AttributeSourceObject', defaultValue= '') guiFactory.appendOptionVarList(self,self.SourceObjectOptionVar.name) self.CopyAttrModeOptionVar = OptionVarFactory('cgmVar_CopyAttributeMode', defaultValue = 0) guiFactory.appendOptionVarList(self,self.CopyAttrModeOptionVar.name) self.CopyAttrOptionsOptionVar = OptionVarFactory('cgmVar_CopyAttributeOptions', defaultValue = 1) guiFactory.appendOptionVarList(self,self.CopyAttrOptionsOptionVar.name) self.TransferValueOptionVar = OptionVarFactory('cgmVar_AttributeTransferValueState', defaultValue = 1) guiFactory.appendOptionVarList(self,self.TransferValueOptionVar.name) self.TransferIncomingOptionVar = OptionVarFactory('cgmVar_AttributeTransferInConnectionState', defaultValue = 1) guiFactory.appendOptionVarList(self,self.TransferIncomingOptionVar.name) self.TransferOutgoingOptionVar = OptionVarFactory('cgmVar_AttributeTransferOutConnectionState', defaultValue = 1) guiFactory.appendOptionVarList(self,self.TransferOutgoingOptionVar.name) self.TransferKeepSourceOptionVar = OptionVarFactory('cgmVar_AttributeTransferKeepSourceState', defaultValue = 1) guiFactory.appendOptionVarList(self,self.TransferKeepSourceOptionVar.name) self.TransferConvertStateOptionVar = OptionVarFactory('cgmVar_AttributeTransferConvertState', defaultValue = 1) guiFactory.appendOptionVarList(self,self.TransferConvertStateOptionVar.name) self.TransferDriveSourceStateOptionVar = OptionVarFactory('cgmVar_AttributeTransferConnectToSourceState', defaultValue = 0) guiFactory.appendOptionVarList(self,self.TransferDriveSourceStateOptionVar.name) self.CreateAttrTypeOptionVar = OptionVarFactory('cgmVar_AttrCreateType',defaultValue='') guiFactory.appendOptionVarList(self,self.CreateAttrTypeOptionVar.name) self.DebugModeOptionVar = OptionVarFactory('cgmVar_AttrToolsDebug',defaultValue=0) guiFactory.appendOptionVarList(self,self.DebugModeOptionVar.name)