Example #1
0
	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")
Example #2
0
    def buildLoadObjectTargetTool(self, parent, baseNameField=True):
        # clear our variables
        if not mc.optionVar(ex="cgmVar_SourceObject"):
            mc.optionVar(sv=("cgmVar_SourceObject", ""))
        if not mc.optionVar(ex="cgmVar_TargetObjects"):
            mc.optionVar(sv=("cgmVar_TargetObjects", ""))

        LoadObjectTargetUtilityRow = MelHSingleStretchLayout(parent, ut="cgmUISubTemplate", padding=5)

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        if baseNameField:
            MelLabel(LoadObjectTargetUtilityRow, l="Base Name:", align="right")
            self.BaseNameField = MelTextField(
                LoadObjectTargetUtilityRow,
                backgroundColor=[1, 1, 1],
                w=60,
                annotation="Base name for our various tools to use",
            )

        MelLabel(LoadObjectTargetUtilityRow, l="Source:", align="right")

        self.SourceObjectField = MelTextField(
            LoadObjectTargetUtilityRow, w=125, ut="cgmUIReservedTemplate", editable=False
        )
        if mc.optionVar(q="cgmVar_SourceObject"):
            self.SourceObjectField(edit=True, text=mc.optionVar(q="cgmVar_SourceObject"))

        guiFactory.doButton2(
            LoadObjectTargetUtilityRow,
            "<<",
            "guiFactory.doLoadSingleObjectToTextField(cgmTDToolsWin.SourceObjectField,'cgmVar_SourceObject')",
            "Load to field",
        )

        MelLabel(LoadObjectTargetUtilityRow, l="Target:", align="right")
        self.TargetObjectField = MelTextField(
            LoadObjectTargetUtilityRow, w=125, ut="cgmUIReservedTemplate", editable=False
        )

        LoadObjectTargetUtilityRow.setStretchWidget(self.BaseNameField)

        guiFactory.doButton2(
            LoadObjectTargetUtilityRow,
            "<<",
            "guiFactory.doLoadMultipleObjectsToTextField(cgmTDToolsWin.TargetObjectField,False,'cgmVar_TargetObjects')",
            "Load to field",
        )

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        LoadObjectTargetUtilityRow.layout()

        mc.setParent(parent)
        guiFactory.lineSubBreak()
Example #3
0
    def buildLoadObjectTargetTool(self, parent, baseNameField=True):
        #clear our variables
        if not mc.optionVar(ex='cgmVar_SourceObject'):
            mc.optionVar(sv=('cgmVar_SourceObject', ''))
        if not mc.optionVar(ex='cgmVar_TargetObjects'):
            mc.optionVar(sv=('cgmVar_TargetObjects', ''))

        LoadObjectTargetUtilityRow = MelHSingleStretchLayout(
            parent, ut='cgmUISubTemplate', padding=5)

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        if baseNameField:
            MelLabel(LoadObjectTargetUtilityRow, l='Base Name:', align='right')
            self.BaseNameField = MelTextField(
                LoadObjectTargetUtilityRow,
                backgroundColor=[1, 1, 1],
                w=60,
                annotation="Base name for our various tools to use")

        MelLabel(LoadObjectTargetUtilityRow, l='Source:', align='right')

        self.SourceObjectField = MelTextField(LoadObjectTargetUtilityRow,
                                              w=125,
                                              ut='cgmUIReservedTemplate',
                                              editable=False)
        if mc.optionVar(q='cgmVar_SourceObject'):
            self.SourceObjectField(edit=True,
                                   text=mc.optionVar(q='cgmVar_SourceObject'))

        guiFactory.doButton2(
            LoadObjectTargetUtilityRow, '<<',
            "guiFactory.doLoadSingleObjectToTextField(cgmTDToolsWin.SourceObjectField,'cgmVar_SourceObject')",
            'Load to field')

        MelLabel(LoadObjectTargetUtilityRow, l='Target:', align='right')
        self.TargetObjectField = MelTextField(LoadObjectTargetUtilityRow,
                                              w=125,
                                              ut='cgmUIReservedTemplate',
                                              editable=False)

        LoadObjectTargetUtilityRow.setStretchWidget(self.BaseNameField)

        guiFactory.doButton2(
            LoadObjectTargetUtilityRow, '<<',
            "guiFactory.doLoadMultipleObjectsToTextField(cgmTDToolsWin.TargetObjectField,False,'cgmVar_TargetObjects')",
            'Load to field')

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        LoadObjectTargetUtilityRow.layout()

        mc.setParent(parent)
        guiFactory.lineSubBreak()
Example #4
0
    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
Example #5
0
	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")
Example #6
0
    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")
Example #7
0
	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
Example #8
0
	def buildPolyUniteTool(self,parent):
		#Options
		#clear our variables
		if not mc.optionVar( ex='cgmVar_SourceObject' ):
			mc.optionVar( sv=('cgmVar_SourceObject', '') )

		mc.setParent(parent)
		guiFactory.header('PolyUnite')

		PolyUniteColumn = MelColumn(parent)
		
		LoadObjectUtilityRow = MelHSingleStretchLayout(PolyUniteColumn,ut='cgmUISubTemplate',padding = 5)
		MelSpacer(LoadObjectUtilityRow)
		MelLabel(LoadObjectUtilityRow,l='Base Name:',align='right')
		self.BaseNameField = MelTextField(LoadObjectUtilityRow,backgroundColor = [1,1,1],w=60,
	                                      annotation = "Base name for our various tools to use")
		LoadObjectUtilityRow.setStretchWidget(self.BaseNameField )
		MelSpacer(LoadObjectUtilityRow,w=5)

		LoadObjectUtilityRow.layout()
		
		mc.setParent(PolyUniteColumn)
		guiFactory.lineSubBreak()
		
		#Start LoadToField
		LoadObjectTargetUtilityRow = MelHSingleStretchLayout(PolyUniteColumn,ut='cgmUISubTemplate',padding = 5)

		MelSpacer(LoadObjectTargetUtilityRow,w=5)


		MelLabel(LoadObjectTargetUtilityRow,l='Source:',align='right')

		self.SourceObjectField = MelTextField(LoadObjectTargetUtilityRow, w= 125, ut = 'cgmUIReservedTemplate', editable = False)

		MelSpacer(LoadObjectTargetUtilityRow,w=5)

		LoadObjectTargetUtilityRow.layout()


		mc.setParent(PolyUniteColumn)
		guiFactory.lineSubBreak()
		
		
		# Buttons
		guiFactory.doButton2(PolyUniteColumn,'Load to Source',
		                     lambda *a:tdToolsLib.doLoadPolyUnite(self),
				             "Attempts to load polyUnite and select the source shapes")
		guiFactory.doButton2(PolyUniteColumn,'Build polyUnite',
		                     lambda *a:tdToolsLib.doBuildPolyUnite(self),
				             "Builds a poly unite geo node from or \n selected objects (checks for mesh types)")
		guiFactory.doButton2(PolyUniteColumn,'Remove polyUnite node',
		                     lambda *a:tdToolsLib.doDeletePolyUniteNode(self),
				             "If a polyUnite node is loaded \n removes the polyUnite node but leaves \n the united geo")
Example #9
0
	def Snap_buildLayout(self,parent):

		SnapColumn = MelColumnLayout(parent)

		#>>>  Snap Section
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Parent Snap',
		                     lambda *a: tdToolsLib.doParentSnap(),
				             "Basic Parent Snap")
		
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Point Snap',
		                     lambda *a: tdToolsLib.doPointSnap(),
				             "Basic Point Snap")
		
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Orient Snap',
		                     lambda *a: tdToolsLib.doOrientSnap(),
				             "Basic Orient Snap")
Example #10
0
	def Snap_buildLayout(self,parent):

		SnapColumn = MelColumnLayout(parent)

		#>>>  Snap Section
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Parent Snap',
		                     lambda *a: tdToolsLib.doParentSnap(),
				             "Basic Parent Snap")
		
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Point Snap',
		                     lambda *a: tdToolsLib.doPointSnap(),
				             "Basic Point Snap")
		
		guiFactory.lineSubBreak()
		guiFactory.doButton2(SnapColumn,'Orient Snap',
		                     lambda *a: tdToolsLib.doOrientSnap(),
				             "Basic Orient Snap")
Example #11
0
	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')
Example #12
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')
Example #13
0
	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
Example #14
0
	def Main_buildLayout(self,parent):
		def modeSet( item ):
			i =  self.setModes.index(item)
			self.SetToolsModeOptionVar.set( i )
			self.setMode = i
		
		MainForm = MelFormLayout(parent)
		TopSection = MelColumnLayout(MainForm)	
		SetHeader = guiFactory.header('Puppet')
		
		#>>>  Top Section
		#Report
		self.puppetReport = MelLabel(TopSection,
				                     bgc = dictionary.returnStateColor('help'),
				                     align = 'center',
				                     label = '...',
				                     h=20)
		MelSeparator(TopSection,ut='cgmUITemplate',h=5)
		
		#Edit name and state mode buttons
		MasterPuppetRow = MelHSingleStretchLayout(TopSection,padding = 5)
		MelSpacer(MasterPuppetRow,w=5)
		self.MasterPuppetTF = MelTextField(MasterPuppetRow,
		                                   bgc = [1,1,1],
		                                   ec = lambda *a:puppetBoxLib.updatePuppetName(self))
		MasterPuppetRow.setStretchWidget(self.MasterPuppetTF)
		
		self.puppetStateButtonsDict = {}
		for i,s in enumerate(self.puppetStateOptions):
			self.puppetStateButtonsDict[i] = guiFactory.doButton2(MasterPuppetRow,s.capitalize(),
			                                                      "print '%s'"%s,
			                                                      enable = False)
		MelSpacer(MasterPuppetRow,w=20)
		
		MasterPuppetRow.layout()
		#MelSeparator(TopSection,ut='cgmUITemplate',h=2)
		
		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
		# Define State Rows
		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>		
		#Initial State Mode Row
		self.PuppetModeCollection = MelRadioCollection()
		self.PuppetModeCollectionChoices = []			
		
		self.InitialStateModeRow = MelHSingleStretchLayout(TopSection,padding = 2,vis=False)	
		MelSpacer(self.InitialStateModeRow,w=5)				
		MelLabel(self.InitialStateModeRow,l='Template Modes')
		Spacer = MelSeparator(self.InitialStateModeRow,w=10)						
		for i,item in enumerate(CharacterTypes):
			self.PuppetModeCollectionChoices.append(self.PuppetModeCollection.createButton(self.InitialStateModeRow,label=item,
			                                                                               onCommand = Callback(puppetBoxLib.setPuppetBaseMode,self,i)))
			MelSpacer(self.InitialStateModeRow,w=3)
		self.InitialStateModeRow.setStretchWidget( Spacer )
		MelSpacer(self.InitialStateModeRow,w=2)		
		self.InitialStateModeRow.layout()	
		
		mc.radioCollection(self.PuppetModeCollection ,edit=True,sl= (self.PuppetModeCollectionChoices[ (self.PuppetModeOptionVar.value) ]))
		self.UI_StateRows['define'].append(self.InitialStateModeRow)
		
		
		self.AxisFrame = MelFrameLayout(TopSection,label = 'Axis',vis=False,
		                                collapse=True,
		                                collapsable=True,
		                                ut = 'cgmUIHeaderTemplate')
		self.UI_StateRows['define'].append(self.AxisFrame)
		MelSeparator(TopSection,style='none',h=5)						
		
		#Aim Axis Mode Row
		self.AimAxisCollection = MelRadioCollection()
		self.AimAxisCollectionChoices = []			
		
		self.AimAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
		MelSpacer(self.AimAxisRow,w=5)				
		MelLabel(self.AimAxisRow,l='Aim ')
		Spacer = MelSeparator(self.AimAxisRow,w=10)						
		for i,item in enumerate(axisDirectionsByString):
			self.AimAxisCollectionChoices.append(self.AimAxisCollection.createButton(self.AimAxisRow,label=item,
			                                                                         onCommand = Callback(puppetBoxLib.setPuppetAxisAim,self,i)))
			MelSpacer(self.AimAxisRow,w=3)
		self.AimAxisRow.setStretchWidget( Spacer )
		MelSpacer(self.AimAxisRow,w=2)		
		self.AimAxisRow.layout()	
		
		
		#Up Axis Mode Row
		self.UpAxisCollection = MelRadioCollection()
		self.UpAxisCollectionChoices = []			
		
		self.UpAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
		MelSpacer(self.UpAxisRow,w=5)				
		MelLabel(self.UpAxisRow,l='Up ')
		Spacer = MelSeparator(self.UpAxisRow,w=10)						
		for i,item in enumerate(axisDirectionsByString):
			self.UpAxisCollectionChoices.append(self.UpAxisCollection.createButton(self.UpAxisRow,label=item,
			                                                                         onCommand = Callback(puppetBoxLib.setPuppetAxisUp,self,i)))
			MelSpacer(self.UpAxisRow,w=3)
		self.UpAxisRow.setStretchWidget( Spacer )
		MelSpacer(self.UpAxisRow,w=2)		
		self.UpAxisRow.layout()	
		
		
		#Out Axis Mode Row
		self.OutAxisCollection = MelRadioCollection()
		self.OutAxisCollectionChoices = []			
		
		self.OutAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
		MelSpacer(self.OutAxisRow,w=5)				
		MelLabel(self.OutAxisRow,l='Out ')
		Spacer = MelSeparator(self.OutAxisRow,w=10)	
		for i,item in enumerate(axisDirectionsByString):
			self.OutAxisCollectionChoices.append(self.OutAxisCollection.createButton(self.OutAxisRow,label=item,
			                                                                         onCommand = Callback(puppetBoxLib.setPuppetAxisOut,self,i)))
			MelSpacer(self.OutAxisRow,w=3)
		self.OutAxisRow.setStretchWidget( Spacer )
		MelSpacer(self.OutAxisRow,w=2)		
		self.OutAxisRow.layout()	
		
		#Set toggles on menu
		mc.radioCollection(self.AimAxisCollection ,edit=True,sl= (self.AimAxisCollectionChoices[ (self.PuppetAimOptionVar.value) ]))		
		mc.radioCollection(self.UpAxisCollection ,edit=True,sl= (self.UpAxisCollectionChoices[ (self.PuppetUpOptionVar.value) ]))		
		mc.radioCollection(self.OutAxisCollection ,edit=True,sl= (self.OutAxisCollectionChoices[ (self.PuppetOutOptionVar.value) ]))
		
		
		#Initial State Button Row
		self.InitialStateButtonRow = MelHLayout(TopSection, h = 20,vis=False,padding = 5)
		guiFactory.doButton2(self.InitialStateButtonRow,'Add Geo',
		                     lambda *a:puppetBoxLib.doAddGeo(self))
		guiFactory.doButton2(self.InitialStateButtonRow,'Build Size Template',
		                     lambda *a:puppetBoxLib.doBuildSizeTemplate(self))
		
		self.InitialStateButtonRow.layout()
		self.UI_StateRows['define'].append(self.InitialStateButtonRow)
		
		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
		# Multi Module
		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

		#>>>  All Sets menu
		AllModulesRow = MelFormLayout(MainForm,height = 20)
		activeState = True
		i = 1
			
		tmpActive = MelCheckBox(AllModulesRow,
	                            annotation = 'Sets all sets active',
	                            value = activeState,
	                            onCommand =  Callback(puppetBoxLib.doSetAllSetsAsActive,self),
	                            offCommand = Callback(puppetBoxLib.doSetAllSetsAsInactive,self))
		
		tmpSel = guiFactory.doButton2(AllModulesRow,
		                              ' s ',
		                              'Select All Loaded/Active Sets')
						
		# Mode toggle box
		self.ModuleModeOptionMenu = MelOptionMenu(AllModulesRow,
		                                       cc = modeSet)
			
			
		tmpKey = guiFactory.doButton2(AllModulesRow,
	                                  ' k ',
		                              'Key All Sets')
		tmpDeleteKey = guiFactory.doButton2(AllModulesRow,
	                                    ' d ',
	                                    'Delete All Set Keys')	
		tmpReset = guiFactory.doButton2(AllModulesRow,
	                                    ' r ',
	                                    'Reset All Set Keys')	
		
		mc.formLayout(AllModulesRow, edit = True,
	                  af = [(tmpActive, "left", 10),
	                        (tmpReset,"right",10)],
	                  ac = [(tmpSel,"left",0,tmpActive),
	                        (self.ModuleModeOptionMenu,"left",4,tmpSel),
	                        (self.ModuleModeOptionMenu,"right",4,tmpKey),
	                        (tmpKey,"right",2,tmpDeleteKey),
		                    (tmpDeleteKey,"right",2,tmpReset)
		                    ])
		
		#>>> Sets building section
		allPopUpMenu = MelPopupMenu(self.ModuleModeOptionMenu ,button = 3)
		
		allCategoryMenu = MelMenuItem(allPopUpMenu,
	                               label = 'Make Type:',
	                               sm = True)

			
		
		
		#>>> Sets building section
		ModuleListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate')
		ModuleMasterForm = MelFormLayout(ModuleListScroll)
		self.ModuleListColumn = MelColumnLayout(ModuleMasterForm,ut = 'cgmUIInstructionsTemplate', adj = True, rowSpacing = 2)
		
		
		
		self.helpInfo = MelLabel(MainForm,
		                         h=20,
		                         l = "Add a Puppet",
		                         ut = 'cgmUIInstructionsTemplate',
		                         al = 'center',
		                         ww = True,vis = self.ShowHelpOptionVar.value)
		self.helpBlurbs.extend([self.helpInfo ])
		
		VerifyRow = guiFactory.doButton2(MainForm,
		                                'Check Puppet',
		                                'Create new buffer from selected buffer')	
			
		ModuleMasterForm(edit = True,
		                 af = [(self.ModuleListColumn,"top",0),
		                       (self.ModuleListColumn,"left",0),
		                       (self.ModuleListColumn,"right",0),
		                       (self.ModuleListColumn,"bottom",0)])
		
		
		MainForm(edit = True,
		         af = [(TopSection,"top",0),	
		               (TopSection,"left",0),
		               (TopSection,"right",0),		               
		               (AllModulesRow,"left",0),
		               (AllModulesRow,"right",0),
		               (ModuleListScroll,"left",0),
		               (ModuleListScroll,"right",0),
		               (ModuleListScroll,"left",0),
		               (ModuleListScroll,"right",0),				       
		               (self.helpInfo,"left",8),
		               (self.helpInfo,"right",8),
		               (VerifyRow,"left",4),
		               (VerifyRow,"right",4),		               
		               (VerifyRow,"bottom",4)],
		         ac = [(AllModulesRow,"top",2,TopSection),
		               (ModuleListScroll,"top",2,AllModulesRow),
		               (ModuleListScroll,"bottom",0,self.helpInfo),
		               (self.helpInfo,"bottom",0,VerifyRow)],
		         attachNone = [(VerifyRow,"top")])	
Example #15
0
	def buildAutoNameTool(self,parent, vis=True):
		containerName = 'AutoNameContainer'
		self.containerName = MelColumn(parent,vis=vis)
		
		#>>> Begin the section
		mc.setParent(self.containerName )
		guiFactory.header('Tag and Release')
		guiFactory.lineSubBreak()
		
		#>>> Guessed Name
		GenratedNameRow = MelHLayout(self.containerName ,ut='cgmUIInstructionsTemplate')
		self.GeneratedNameField = MelLabel(GenratedNameRow,
	                                       bgc = dictionary.returnStateColor('help'),
	                                       align = 'center',
	                                       label = 'Name will preview here...')
		
		GenratedNameRow.layout()
		mc.setParent(self.containerName )
		guiFactory.lineSubBreak()
		guiFactory.lineSubBreak()
	
		#>>> Load To Field
		#clear our variables
		if not mc.optionVar( ex='cgmVar_AutoNameObject' ):
			mc.optionVar( sv=('cgmVar_AutoNameObject', '') )
	
		LoadAutoNameObjectRow = MelHSingleStretchLayout(self.containerName ,ut='cgmUISubTemplate',padding = 5)
	
		MelSpacer(LoadAutoNameObjectRow,w=5)
	
		MelLabel(LoadAutoNameObjectRow,l='Object:',align='right')
	
		self.AutoNameObjectField = MelTextField(LoadAutoNameObjectRow, w= 125, ut = 'cgmUIReservedTemplate', editable = False)
		if mc.optionVar( q = 'cgmVar_AutoNameObject'):
			self.AutoNameObjectField(edit=True,text = mc.optionVar( q = 'cgmVar_AutoNameObject'))
	
		guiFactory.doButton2(LoadAutoNameObjectRow,'<<',
	                        'tdToolsLib.uiLoadAutoNameObject(cgmTDToolsWin)',
	                         'Load to field')
	
		LoadAutoNameObjectRow.setStretchWidget(self.AutoNameObjectField  )
	
		guiFactory.doButton2(LoadAutoNameObjectRow,'Up',
	                         lambda *a:tdToolsLib.uiAutoNameWalkUp(self),
	                         'Load to field')
		
		guiFactory.doButton2(LoadAutoNameObjectRow,'Down',
	                         lambda *a:tdToolsLib.uiAutoNameWalkDown(self),
	                         'Load to field')
	
		guiFactory.doButton2(LoadAutoNameObjectRow,'Name it',
	                         lambda *a:tdToolsLib.uiNameLoadedAutoNameObject(self),
	                         'Load to field')
		guiFactory.doButton2(LoadAutoNameObjectRow,'Name Children',
	                         lambda *a:tdToolsLib.uiNameLoadedAutoNameObjectChildren(self),
	                         'Load to field')
	
		MelSpacer(LoadAutoNameObjectRow,w=5)
	
		LoadAutoNameObjectRow.layout()
	
	
		mc.setParent(self.containerName )
		guiFactory.lineSubBreak()
		
		#>>> Tag Labels
		TagLabelsRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2)
		MelLabel(TagLabelsRow,label = 'Position')
		MelLabel(TagLabelsRow,label = 'Direction')
		MelLabel(TagLabelsRow,label = 'Name')
		MelLabel(TagLabelsRow,label = 'Type')
	
		TagLabelsRow.layout()
		
		#>>> Tags
		mc.setParent(self.containerName )
		TagsRow = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 3)
		self.PositionTagField = MelTextField(TagsRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmPosition'),
	                                     w = 75)
		self.DirectionTagField = MelTextField(TagsRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmDirection'),
	                                     w = 75)
		self.NameTagField = MelTextField(TagsRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmName'),
	                                     w = 75)
		"""
		self.NameTagFieldPopUp = MelPopupMenu(self.NameTagField,button = 3)
		self.NameTagLoadParentPopUp = MelMenuItem(self.NameTagFieldPopUp ,
												  label = 'Select parent name object',
												  enable = False)
		"""
		self.ObjectTypeTagField = MelTextField(TagsRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmType'),
	                                     w = 75)
		
		TagsRow.layout()
		mc.setParent(self.containerName )
		guiFactory.lineSubBreak()
		
		#>>> ModifierTags
		mc.setParent(self.containerName )
		TagModifiersRow = MelHLayout(self.containerName,ut='cgmUISubTemplate',padding = 3)
		MelLabel(TagModifiersRow,align = 'right', label = 'Modifiers ------->',w = 75)
		self.DirectionModifierTagField = MelTextField(TagModifiersRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmDirectionModifier'),
	                                     w = 75)
		self.NameModifierTagField = MelTextField(TagModifiersRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmNameModifier'),
	                                     w = 75)
		self.ObjectTypeModifierTagField = MelTextField(TagModifiersRow,
	                                     enable = False,
	                                     bgc = dictionary.returnStateColor('normal'),
	                                     ec = lambda *a: tdToolsLib.uiUpdateAutoNameTag(self,'cgmTypeModifier'),
	                                     w = 75)
		
		TagModifiersRow.layout()
		
		
		
		mc.setParent(self.containerName )
		guiFactory.lineSubBreak()
		guiFactory.lineBreak()
		
		#>>> Basic
		mc.setParent(self.containerName )
		guiFactory.header('On Selection')
		guiFactory.lineSubBreak()
	
		BasicRow = MelHLayout(self.containerName ,ut='cgmUISubTemplate',padding = 2)
		guiFactory.doButton2(BasicRow,'Name Object',
	                         'tdToolsLib.uiNameObject(cgmTDToolsWin)',
	                         "Attempts to name an object")
		guiFactory.doButton2(BasicRow,'Update Name',
	                         'tdToolsLib.doUpdateObjectName(cgmTDToolsWin)',
	                         "Takes the name you've manually changed the object to, \n stores that to the cgmName tag then \n renames the object")
		guiFactory.doButton2(BasicRow,'Name Heirarchy',
	                         'tdToolsLib.doNameHeirarchy(cgmTDToolsWin)',
	                         "Attempts to intelligently name a  \n heirarchy of objects")
	
		BasicRow.layout()
		
		
		mc.setParent(self.containerName )
		guiFactory.lineSubBreak()
		guiFactory.lineBreak()
	
	
		return self.containerName
	def Main_buildLayout(self,parent):
		MainForm = MelFormLayout(parent)

		#>>>  Snap Section
		BufferHeader = guiFactory.header('Buffers')
		HelpInfo = MelLabel(MainForm,
		                    l = " Set buffer options: Set active, select, change name,add,remove,key,purge",
		                    ut = 'cgmUIInstructionsTemplate',
		                    al = 'center',
		                    ww = True,vis = self.ShowHelpOption)
		self.helpBlurbs.extend([HelpInfo])
		
		BufferListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate')
		BufferMasterForm = MelFormLayout(BufferListScroll)
		BufferListColumn = MelColumnLayout(BufferMasterForm, adj = True, rowSpacing = 3)
		
		for i,b in enumerate(self.objectBuffers):
			tmpSetRow = MelFormLayout(BufferListColumn,height = 20)
			
			#Get check box state
			activeState = False
			if b in self.activeObjectBuffersOptionVar.value:
				activeState = True
			
			tmpActive = MelCheckBox(tmpSetRow,
			                        annotation = 'Set buffer set as active',
			                        value = activeState,
			                        onCommand =  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.setBufferAsActive('cgmVar_activeObjectBuffers','",b,"')"),
			                        offCommand = "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.setBufferAsInactive('cgmVar_activeObjectBuffers','",b,"')"))
			tmpSel = guiFactory.doButton2(tmpSetRow,
			                              's->',
										  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.selectBufferObjects('",b,"')"),
			                              'Select the buffer objects')
			
			tmpName = MelTextField(tmpSetRow, w = 100,ut = 'cgmUIReservedTemplate', text = b)
			bField = "%s"%tmpName
			bName = "%s"%b
			tmpName(edit = True,
			        ec = lambda *a:bufferToolsLib.updateBufferName(self,bField,bName))
			
			"""
			tmpName(edit = True,
			        ec = "%s%s%s%s%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.updateBufferName('",self,"','",tmpName,"','",b,"')"))
			"""
			tmpAdd = guiFactory.doButton2(tmpSetRow,
			                               '+',
										   "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.addSelected('",b,"')"),
			                               'Add selected  to the buffer')
			tmpRem= guiFactory.doButton2(tmpSetRow,
			                             '-',
										 "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.removeSelected('",b,"')"),
			                             'Remove selected  to the buffer')
			tmpKey = guiFactory.doButton2(tmpSetRow,
			                              'k',
										  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.keyBuffer('",b,"')"),
			                              'Key buffer')
			tmpPurge = guiFactory.doButton2(tmpSetRow,
			                                'p',
											"%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.purgeBuffer('",b,"')"),
			                                'Purge buffer')	
			mc.formLayout(tmpSetRow, edit = True,
			              af = [(tmpActive, "left", 2),
			                    (tmpPurge,"right",0)],
			              ac = [(tmpSel,"left",0,tmpActive),
			                    (tmpName,"left",2,tmpSel),
			                    (tmpName,"right",2,tmpAdd),
			                    (tmpAdd,"right",2,tmpRem),
			                    (tmpRem,"right",2,tmpKey),
			                    (tmpKey,"right",2,tmpPurge)])
			
			MelSpacer(tmpSetRow, w = 2)
		
		
		
			
		
		NewBufferRow = guiFactory.doButton2(MainForm,
		                                    'Create Buffer',
		                                    lambda *a:bufferToolsLib.createBuffer(self),
		                                    'Create new buffer from selected buffer')	
			
		BufferMasterForm(edit = True,
		                 af = [(BufferListColumn,"top",0),
		                       (BufferListColumn,"left",0),
		                       (BufferListColumn,"right",0),
		                       (BufferListColumn,"bottom",0)])
		                 
		MainForm(edit = True,
		         af = [(BufferHeader,"top",0),
		               (BufferHeader,"left",0),
		               (BufferHeader,"right",0),
		               (HelpInfo,"left",0),
		               (HelpInfo,"right",0),
		               (BufferListScroll,"left",0),
		               (BufferListScroll,"right",0),
		               (NewBufferRow,"left",4),
		               (NewBufferRow,"right",4),
		               (NewBufferRow,"bottom",4)],
		         ac = [(HelpInfo,"top",0,BufferHeader),
		               (BufferListScroll,"top",0,HelpInfo),
		               (BufferListScroll,"bottom",0,NewBufferRow)],
		         attachNone = [(NewBufferRow,"top")])


		"""
Example #17
0
	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
Example #18
0
    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
Example #19
0
	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.")
Example #20
0
    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
Example #21
0
    def Main_buildLayout(self, parent):
        def modeSet(item):
            i = self.setModes.index(item)
            self.SetToolsModeOptionVar.set(i)
            self.setMode = i

        MainForm = MelFormLayout(parent)

        #>>>  Snap Section
        SetHeader = guiFactory.header('Sets')
        HelpInfo = MelLabel(
            MainForm,
            l=
            " Set buffer options: Set active, select, change name,add,remove,key,purge",
            ut='cgmUIInstructionsTemplate',
            al='center',
            ww=True,
            vis=self.ShowHelpOption)
        self.helpBlurbs.extend([HelpInfo])

        #>>>  All Sets menu
        AllSetsRow = MelFormLayout(MainForm, height=20)
        activeState = True
        i = 1
        if self.objectSets:
            for b in self.objectSets:
                if b not in self.ActiveObjectSetsOptionVar.value:
                    activeState = False
        else:
            activeState = False

        tmpActive = MelCheckBox(
            AllSetsRow,
            annotation='Sets all sets active',
            value=activeState,
            onCommand=Callback(setToolsLib.doSetAllSetsAsActive, self),
            offCommand=Callback(setToolsLib.doSetAllSetsAsInactive, self))

        tmpSel = guiFactory.doButton2(
            AllSetsRow, ' s ', lambda *a: setToolsLib.doSelectMultiSets(
                self, self.SetToolsModeOptionVar.value),
            'Select All Loaded/Active Sets')

        # Mode toggle box
        self.SetModeOptionMenu = MelOptionMenu(AllSetsRow, cc=modeSet)
        for m in self.setModes:
            self.SetModeOptionMenu.append(m)

        self.SetModeOptionMenu.selectByIdx(self.setMode, False)

        tmpKey = guiFactory.doButton2(
            AllSetsRow, ' k ', lambda *a: setToolsLib.doKeyMultiSets(
                self, self.SetToolsModeOptionVar.value), 'Key All Sets')
        tmpDeleteKey = guiFactory.doButton2(
            AllSetsRow, ' d ', lambda *a: setToolsLib.doDeleteMultiCurrentKeys(
                self, self.SetToolsModeOptionVar.value), 'Delete All Set Keys')
        tmpReset = guiFactory.doButton2(
            AllSetsRow, ' r ', lambda *a: setToolsLib.doResetMultiSets(
                self, self.SetToolsModeOptionVar.value), 'Reset All Set Keys')

        mc.formLayout(AllSetsRow,
                      edit=True,
                      af=[(tmpActive, "left", 10), (tmpReset, "right", 10)],
                      ac=[(tmpSel, "left", 0, tmpActive),
                          (self.SetModeOptionMenu, "left", 4, tmpSel),
                          (self.SetModeOptionMenu, "right", 4, tmpKey),
                          (tmpKey, "right", 2, tmpDeleteKey),
                          (tmpDeleteKey, "right", 2, tmpReset)])

        #>>> Sets building section
        allPopUpMenu = MelPopupMenu(self.SetModeOptionMenu, button=3)

        allCategoryMenu = MelMenuItem(allPopUpMenu,
                                      label='Make Type:',
                                      sm=True)

        multiMakeQssMenu = MelMenuItem(allPopUpMenu,
                                       label='Make Qss',
                                       c=Callback(setToolsLib.doMultiSetQss,
                                                  self, True))
        multiMakeNotQssMenu = MelMenuItem(allPopUpMenu,
                                          label='Clear Qss State',
                                          c=Callback(setToolsLib.doMultiSetQss,
                                                     self, False))
        #Mulit set type
        for n in self.setTypes:
            MelMenuItem(allCategoryMenu,
                        label=n,
                        c=Callback(setToolsLib.doMultiSetType, self,
                                   self.SetToolsModeOptionVar.value, n))

        #>>> Sets building section
        SetListScroll = MelScrollLayout(MainForm, cr=1, ut='cgmUISubTemplate')
        SetMasterForm = MelFormLayout(SetListScroll)
        SetListColumn = MelColumnLayout(SetMasterForm, adj=True, rowSpacing=3)

        self.objectSetsDict = {}
        self.activeSetsCBDict = {}

        for b in self.objectSets:
            #Store the info to a dict
            try:
                i = self.setInstancesFastIndex[b]  # get the index
                sInstance = self.setInstances[i]  # fast link to the instance
            except:
                raise StandardError("'%s' failed to query an active instance" %
                                    b)

            #see if the no no fields are enabled
            enabledMenuLogic = True
            if sInstance.mayaSetState or sInstance.refState:
                enabledMenuLogic = False

            tmpSetRow = MelFormLayout(SetListColumn, height=20)

            #Get check box state
            activeState = False
            if sInstance.nameShort in self.ActiveObjectSetsOptionVar.value:
                activeState = True
            tmpActive = MelCheckBox(
                tmpSetRow,
                annotation='make set as active',
                value=activeState,
                onCommand=Callback(setToolsLib.doSetSetAsActive, self, i),
                offCommand=Callback(setToolsLib.doSetSetAsInactive, self, i))

            self.activeSetsCBDict[i] = tmpActive

            tmpSel = guiFactory.doButton2(
                tmpSetRow, ' s ',
                Callback(setToolsLib.doSelectSetObjects, self, i),
                'Select the set objects')

            tmpName = MelTextField(tmpSetRow,
                                   w=100,
                                   ut='cgmUIReservedTemplate',
                                   text=sInstance.nameShort,
                                   editable=enabledMenuLogic)

            tmpName(edit=True,
                    ec=Callback(setToolsLib.doUpdateSetName, self, tmpName, i))

            tmpAdd = guiFactory.doButton2(tmpSetRow,
                                          '+',
                                          Callback(setToolsLib.doAddSelected,
                                                   self, i),
                                          'Add selected  to the set',
                                          en=not sInstance.refState)
            tmpRem = guiFactory.doButton2(tmpSetRow,
                                          '-',
                                          Callback(
                                              setToolsLib.doRemoveSelected,
                                              self, i),
                                          'Remove selected  to the set',
                                          en=not sInstance.refState)
            tmpKey = guiFactory.doButton2(
                tmpSetRow, 'k', Callback(setToolsLib.doKeySet, self, i),
                'Key set')
            tmpDeleteKey = guiFactory.doButton2(
                tmpSetRow, 'd',
                Callback(setToolsLib.doDeleteCurrentSetKey, self, i),
                'delete set key')

            tmpReset = guiFactory.doButton2(
                tmpSetRow, 'r', Callback(setToolsLib.doResetSet, self, i),
                'Reset Set')
            mc.formLayout(tmpSetRow,
                          edit=True,
                          af=[(tmpActive, "left", 4), (tmpReset, "right", 2)],
                          ac=[(tmpSel, "left", 0, tmpActive),
                              (tmpName, "left", 2, tmpSel),
                              (tmpName, "right", 4, tmpAdd),
                              (tmpAdd, "right", 2, tmpRem),
                              (tmpRem, "right", 2, tmpKey),
                              (tmpKey, "right", 2, tmpDeleteKey),
                              (tmpDeleteKey, "right", 2, tmpReset)])

            MelSpacer(tmpSetRow, w=2)

            #Build pop up for text field
            popUpMenu = MelPopupMenu(tmpName, button=3)
            MelMenuItem(popUpMenu, label="<<<%s>>>" % b, enable=False)

            if not enabledMenuLogic:
                if sInstance.mayaSetState:
                    MelMenuItem(popUpMenu,
                                label="<Maya Default Set>",
                                enable=False)
                if sInstance.refState:
                    MelMenuItem(popUpMenu, label="<Referenced>", enable=False)

            qssState = sInstance.qssState
            qssMenu = MelMenuItem(popUpMenu,
                                  label='Qss',
                                  cb=qssState,
                                  en=enabledMenuLogic,
                                  c=Callback(self.setInstances[i].isQss,
                                             not qssState))

            categoryMenu = MelMenuItem(popUpMenu,
                                       label='Make Type:',
                                       sm=True,
                                       en=enabledMenuLogic)

            for n in self.setTypes:
                MelMenuItem(categoryMenu,
                            label=n,
                            c=Callback(setToolsLib.guiDoSetType, self, i, n))

            MelMenuItem(popUpMenu,
                        label='Copy Set',
                        c=Callback(setToolsLib.doCopySet, self, i))

            MelMenuItem(popUpMenu,
                        label='Purge',
                        en=enabledMenuLogic,
                        c=Callback(setToolsLib.doPurgeSet, self, i))

            MelMenuItemDiv(popUpMenu)
            MelMenuItem(popUpMenu,
                        label='Delete',
                        en=enabledMenuLogic,
                        c=Callback(setToolsLib.doDeleteSet, self, i))

        NewSetRow = guiFactory.doButton2(
            MainForm, 'Create Set', lambda *a: setToolsLib.doCreateSet(self),
            'Create new buffer from selected buffer')

        SetMasterForm(edit=True,
                      af=[(SetListColumn, "top", 0),
                          (SetListColumn, "left", 0),
                          (SetListColumn, "right", 0),
                          (SetListColumn, "bottom", 0)])

        MainForm(edit=True,
                 af=[(SetHeader, "top", 0), (SetHeader, "left", 0),
                     (SetHeader, "right", 0), (HelpInfo, "left", 0),
                     (HelpInfo, "right", 0), (AllSetsRow, "left", 0),
                     (AllSetsRow, "right", 0), (SetListScroll, "left", 0),
                     (SetListScroll, "right", 0), (NewSetRow, "left", 4),
                     (NewSetRow, "right", 4), (NewSetRow, "bottom", 4)],
                 ac=[(HelpInfo, "top", 0, SetHeader),
                     (AllSetsRow, "top", 2, HelpInfo),
                     (SetListScroll, "top", 2, AllSetsRow),
                     (SetListScroll, "bottom", 0, NewSetRow)],
                 attachNone=[(NewSetRow, "top")])
Example #22
0
	def buildAttributeManagerTool(self,parent, vis=True):
		self.ManageForm = MelFormLayout(self.Get(),ut='cgmUITemplate')
		
		ManageHeader = guiFactory.header('Manage Attributes')

		#>>> Manager load frow
		ManagerLoadObjectRow = MelHSingleStretchLayout(self.ManageForm ,padding = 5)
	
		MelSpacer(ManagerLoadObjectRow,w=5)
		
		guiFactory.doButton2(ManagerLoadObjectRow,'>>',
	                        lambda *a:attrToolsLib.uiLoadSourceObject(self),
	                         'Load to field')
		
		self.ManagerSourceObjectField = MelTextField(ManagerLoadObjectRow, w= 125, h=20, ut = 'cgmUIReservedTemplate', editable = False)
	
		ManagerLoadObjectRow.setStretchWidget(self.ManagerSourceObjectField  )
		
	
		MelSpacer(ManagerLoadObjectRow,w=5)
	
		ManagerLoadObjectRow.layout()


		#>>> Attribute List
		self.ManageAttrList = MelObjectScrollList(self.ManageForm, allowMultiSelection=True )
		
		#>>> Reorder Button
		ReorderButtonsRow = MelHLayout(self.ManageForm,padding = 5)
		guiFactory.doButton2(ReorderButtonsRow,
		                     'Move Up',
		                     lambda *a: attrToolsLib.uiReorderAttributes(self,0),
		                     'Create new buffer from selected buffer')	
		guiFactory.doButton2(ReorderButtonsRow,
		                     'Move Down',
		                     lambda *a: attrToolsLib.uiReorderAttributes(self,1),
		                     'Create new buffer from selected buffer')	
		ReorderButtonsRow.layout()





		#>>>Transfer Options
		self.TransferModeCollection = MelRadioCollection()
		self.TransferModeCollectionChoices = []	
		
		TransferModeFlagsRow = MelHSingleStretchLayout(self.ManageForm,padding = 2)	
		MelLabel(TransferModeFlagsRow,l='Modes')
		Spacer = MelSeparator(TransferModeFlagsRow,w=10)						
		self.TransferModeOptions = ['Connect','Copy','Transfer']
		for i,item in enumerate(self.TransferModeOptions):
			self.TransferModeCollectionChoices.append(self.TransferModeCollection.createButton(TransferModeFlagsRow,label=item,
			                                                                             onCommand = Callback(self.CopyAttrModeOptionVar.set,i)))
			MelSpacer(TransferModeFlagsRow,w=3)
		TransferModeFlagsRow.setStretchWidget( Spacer )
		MelSpacer(TransferModeFlagsRow,w=2)		
		TransferModeFlagsRow.layout()	
		
		mc.radioCollection(self.TransferModeCollection ,edit=True,sl= (self.TransferModeCollectionChoices[ (self.CopyAttrModeOptionVar.value) ]))
		
		
		#>>>Transfer Options
		self.TransferOptionsCollection = MelRadioCollection()
		self.TransferOptionsCollectionChoices = []	
		
		TransferOptionsFlagsRow = MelHSingleStretchLayout(self.ManageForm,padding = 0)	
		Spacer = MelSpacer(TransferOptionsFlagsRow)						
		TransferOptionsFlagsRow.setStretchWidget( Spacer )
		
		self.ConvertCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Convert',
				                           annotation = "Converts if necessary to finish the copy process",		                           
				                           value = self.TransferConvertStateOptionVar.value,
				                           onCommand = Callback(self.TransferConvertStateOptionVar.set,1),
				                           offCommand = Callback(self.TransferConvertStateOptionVar.set,0))

		self.ValueCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Value',
		                           annotation = "Copy values",		                           
		                           value = self.TransferValueOptionVar.value,
		                           onCommand = Callback(self.TransferValueOptionVar.set,1),
		                           offCommand = Callback(self.TransferValueOptionVar.set,0))
		
		self.IncomingCB = MelCheckBox(TransferOptionsFlagsRow,label = 'In',
				                      annotation = "Copy or transfer incoming connections",		                              
		                              value = self.TransferIncomingOptionVar.value,
		                              onCommand = Callback(self.TransferIncomingOptionVar.set,1),
		                              offCommand = Callback(self.TransferIncomingOptionVar.set,0))

		self.OutgoingCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Out',
		                              annotation = "Copy or transfer incoming connections",		                              
		                              value = self.TransferOutgoingOptionVar.value,
		                              onCommand = Callback(self.TransferOutgoingOptionVar.set,1),
		                              offCommand = Callback(self.TransferOutgoingOptionVar.set,0))	

		self.KeepSourceCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Keep',
		                                annotation = "Keep source connections when copying",		                                
		                                value = self.TransferKeepSourceOptionVar.value,
		                                onCommand = Callback(self.TransferKeepSourceOptionVar.set,1),
		                                offCommand = Callback(self.TransferKeepSourceOptionVar.set,0))
		
		self.DriveSourceCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Drive',
		                                annotation = "Connect the source attr \nto selected or created attribute",		                                
		                                value = self.TransferDriveSourceStateOptionVar.value,
		                                onCommand = Callback(self.TransferDriveSourceStateOptionVar.set,1),
		                                offCommand = Callback(self.TransferDriveSourceStateOptionVar.set,0))
		
		self.AttrOptionsCB = MelCheckBox(TransferOptionsFlagsRow,label = 'Options',
		                                annotation = "Copies the attributes basic flags\n(locked,keyable,hidden)",		                                
		                                value = self.CopyAttrOptionsOptionVar.value,
		                                onCommand = Callback(self.CopyAttrOptionsOptionVar.set,1),
		                                offCommand = Callback(self.TransferDriveSourceStateOptionVar.set,0))
		
		TransferOptionsFlagsRow.layout()	


		BottomButtonRow = guiFactory.doButton2(self.ManageForm,
		                                       'Connect/Copy/Transfer',
		                                       lambda *a: attrToolsLib.uiTransferAttributes(self),
		                                       'Create new buffer from selected buffer')	

		self.ManageForm(edit = True,
		         af = [(ManageHeader,"top",0),
		               (ManageHeader,"left",0),
		               (ManageHeader,"right",0),
		               (self.ManageAttrList,"left",0),
		               (self.ManageAttrList,"right",0),
		               (ManagerLoadObjectRow,"left",5),
		               (ManagerLoadObjectRow,"right",5),
		               (ReorderButtonsRow,"left",0),
		               (ReorderButtonsRow,"right",0),	
		               (TransferModeFlagsRow,"left",5),
		               (TransferModeFlagsRow,"right",5),
		               (BottomButtonRow,"left",5),
		               (BottomButtonRow,"right",5),		               
		               (TransferOptionsFlagsRow,"left",2),
		               (TransferOptionsFlagsRow,"right",2),
		               (TransferOptionsFlagsRow,"bottom",4)],
		         ac = [(ManagerLoadObjectRow,"top",5,ManageHeader),
		               (self.ManageAttrList,"top",5,ManagerLoadObjectRow),
		               (self.ManageAttrList,"bottom",5,ReorderButtonsRow),
		               (ReorderButtonsRow,"bottom",5,BottomButtonRow),		               
		               (BottomButtonRow,"bottom",5,TransferModeFlagsRow),
		               (TransferModeFlagsRow,"bottom",5,TransferOptionsFlagsRow)],
		         attachNone = [(TransferOptionsFlagsRow,"top")])	
		



		#Build pop up for attribute list field
		popUpMenu = MelPopupMenu(self.ManageAttrList,button = 3)
				
			
		MelMenuItem(popUpMenu ,
	                label = 'Make Keyable',
	                c = lambda *a: attrToolsLib.uiManageAttrsKeyable(self))
		
		MelMenuItem(popUpMenu ,
	                label = 'Make Unkeyable',
		            c = lambda *a: attrToolsLib.uiManageAttrsUnkeyable(self))
		
		MelMenuItemDiv(popUpMenu)
		
		MelMenuItem(popUpMenu ,
	                label = 'Hide',
		            c = lambda *a: attrToolsLib.uiManageAttrsHide(self))
		
		MelMenuItem(popUpMenu ,
	                label = 'Unhide',
		            c = lambda *a: attrToolsLib.uiManageAttrsUnhide(self))
		
		MelMenuItemDiv(popUpMenu)
		MelMenuItem(popUpMenu ,
	                label = 'Lock',
		            c = lambda *a: attrToolsLib.uiManageAttrsLocked(self))
		
		MelMenuItem(popUpMenu ,
	                label = 'Unlock',
		            c = lambda *a: attrToolsLib.uiManageAttrsUnlocked(self))
		
		MelMenuItemDiv(popUpMenu)
		MelMenuItem(popUpMenu ,
	                label = 'Delete',
		            c = lambda *a: attrToolsLib.uiManageAttrsDelete(self))


		return self.ManageForm
	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])
			
			
		
		"""
		"""
Example #24
0
	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')
Example #25
0
    def buildPolyUniteTool(self, parent):
        # Options
        # clear our variables
        if not mc.optionVar(ex="cgmVar_SourceObject"):
            mc.optionVar(sv=("cgmVar_SourceObject", ""))

        mc.setParent(parent)
        guiFactory.header("PolyUnite")

        PolyUniteColumn = MelColumn(parent)

        LoadObjectUtilityRow = MelHSingleStretchLayout(PolyUniteColumn, ut="cgmUISubTemplate", padding=5)
        MelSpacer(LoadObjectUtilityRow)
        MelLabel(LoadObjectUtilityRow, l="Base Name:", align="right")
        self.BaseNameField = MelTextField(
            LoadObjectUtilityRow, backgroundColor=[1, 1, 1], w=60, annotation="Base name for our various tools to use"
        )
        LoadObjectUtilityRow.setStretchWidget(self.BaseNameField)
        MelSpacer(LoadObjectUtilityRow, w=5)

        LoadObjectUtilityRow.layout()

        mc.setParent(PolyUniteColumn)
        guiFactory.lineSubBreak()

        # Start LoadToField
        LoadObjectTargetUtilityRow = MelHSingleStretchLayout(PolyUniteColumn, ut="cgmUISubTemplate", padding=5)

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        MelLabel(LoadObjectTargetUtilityRow, l="Source:", align="right")

        self.SourceObjectField = MelTextField(
            LoadObjectTargetUtilityRow, w=125, ut="cgmUIReservedTemplate", editable=False
        )

        MelSpacer(LoadObjectTargetUtilityRow, w=5)

        LoadObjectTargetUtilityRow.layout()

        mc.setParent(PolyUniteColumn)
        guiFactory.lineSubBreak()

        # Buttons
        guiFactory.doButton2(
            PolyUniteColumn,
            "Load to Source",
            lambda *a: tdToolsLib.doLoadPolyUnite(self),
            "Attempts to load polyUnite and select the source shapes",
        )
        guiFactory.doButton2(
            PolyUniteColumn,
            "Build polyUnite",
            lambda *a: tdToolsLib.doBuildPolyUnite(self),
            "Builds a poly unite geo node from or \n selected objects (checks for mesh types)",
        )
        guiFactory.doButton2(
            PolyUniteColumn,
            "Remove polyUnite node",
            lambda *a: tdToolsLib.doDeletePolyUniteNode(self),
            "If a polyUnite node is loaded \n removes the polyUnite node but leaves \n the united geo",
        )
Example #26
0
    def Main_buildLayout(self,parent):
        def modeSet( item ):
            i =  self.setModes.index(item)
            self.SetToolsModeOptionVar.set( i )
            self.setMode = i

        MainForm = MelFormLayout(parent)
        TopSection = MelColumnLayout(MainForm)	
        SetHeader = guiFactory.header('Puppet')

        #>>>  Top Section
        #Report
        self.puppetReport = MelLabel(TopSection,
                                     bgc = dictionary.returnStateColor('help'),
                                     align = 'center',
                                     label = '...',
                                     h=20)
        MelSeparator(TopSection,ut='cgmUITemplate',h=5)

        #Edit name and state mode buttons
        MasterPuppetRow = MelHSingleStretchLayout(TopSection,padding = 5)
        MelSpacer(MasterPuppetRow,w=5)
        self.MasterPuppetTF = MelTextField(MasterPuppetRow,
                                           bgc = [1,1,1],
                                           ec = lambda *a:puppetBoxLib.updatePuppetName(self))
        MasterPuppetRow.setStretchWidget(self.MasterPuppetTF)

        self.puppetStateButtonsDict = {}
        for i,s in enumerate(self.puppetStateOptions):
            self.puppetStateButtonsDict[i] = guiFactory.doButton2(MasterPuppetRow,s.capitalize(),
                                                                  "print '%s'"%s,
                                                                  enable = False)
        MelSpacer(MasterPuppetRow,w=20)

        MasterPuppetRow.layout()
        #MelSeparator(TopSection,ut='cgmUITemplate',h=2)

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Define State Rows
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>		
        #Initial State Mode Row
        self.PuppetModeCollection = MelRadioCollection()
        self.PuppetModeCollectionChoices = []			

        self.InitialStateModeRow = MelHSingleStretchLayout(TopSection,padding = 2,vis=False)	
        MelSpacer(self.InitialStateModeRow,w=5)				
        MelLabel(self.InitialStateModeRow,l='Template Modes')
        Spacer = MelSeparator(self.InitialStateModeRow,w=10)						
        for i,item in enumerate(CharacterTypes):
            self.PuppetModeCollectionChoices.append(self.PuppetModeCollection.createButton(self.InitialStateModeRow,label=item,
                                                                                           onCommand = Callback(puppetBoxLib.setPuppetBaseMode,self,i)))
            MelSpacer(self.InitialStateModeRow,w=3)
        self.InitialStateModeRow.setStretchWidget( Spacer )
        MelSpacer(self.InitialStateModeRow,w=2)		
        self.InitialStateModeRow.layout()	

        mc.radioCollection(self.PuppetModeCollection ,edit=True,sl= (self.PuppetModeCollectionChoices[ (self.PuppetModeOptionVar.value) ]))
        self.UI_StateRows['define'].append(self.InitialStateModeRow)


        self.AxisFrame = MelFrameLayout(TopSection,label = 'Axis',vis=False,
                                        collapse=True,
                                        collapsable=True,
                                        ut = 'cgmUIHeaderTemplate')
        self.UI_StateRows['define'].append(self.AxisFrame)
        MelSeparator(TopSection,style='none',h=5)						

        #Aim Axis Mode Row
        self.AimAxisCollection = MelRadioCollection()
        self.AimAxisCollectionChoices = []			

        self.AimAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
        MelSpacer(self.AimAxisRow,w=5)				
        MelLabel(self.AimAxisRow,l='Aim ')
        Spacer = MelSeparator(self.AimAxisRow,w=10)						
        for i,item in enumerate(axisDirectionsByString):
            self.AimAxisCollectionChoices.append(self.AimAxisCollection.createButton(self.AimAxisRow,label=item,
                                                                                     onCommand = Callback(puppetBoxLib.setPuppetAxisAim,self,i)))
            MelSpacer(self.AimAxisRow,w=3)
        self.AimAxisRow.setStretchWidget( Spacer )
        MelSpacer(self.AimAxisRow,w=2)		
        self.AimAxisRow.layout()	


        #Up Axis Mode Row
        self.UpAxisCollection = MelRadioCollection()
        self.UpAxisCollectionChoices = []			

        self.UpAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
        MelSpacer(self.UpAxisRow,w=5)				
        MelLabel(self.UpAxisRow,l='Up ')
        Spacer = MelSeparator(self.UpAxisRow,w=10)						
        for i,item in enumerate(axisDirectionsByString):
            self.UpAxisCollectionChoices.append(self.UpAxisCollection.createButton(self.UpAxisRow,label=item,
                                                                                   onCommand = Callback(puppetBoxLib.setPuppetAxisUp,self,i)))
            MelSpacer(self.UpAxisRow,w=3)
        self.UpAxisRow.setStretchWidget( Spacer )
        MelSpacer(self.UpAxisRow,w=2)		
        self.UpAxisRow.layout()	


        #Out Axis Mode Row
        self.OutAxisCollection = MelRadioCollection()
        self.OutAxisCollectionChoices = []			

        self.OutAxisRow = MelHSingleStretchLayout(self.AxisFrame,padding = 2,vis=False)	
        MelSpacer(self.OutAxisRow,w=5)				
        MelLabel(self.OutAxisRow,l='Out ')
        Spacer = MelSeparator(self.OutAxisRow,w=10)	
        for i,item in enumerate(axisDirectionsByString):
            self.OutAxisCollectionChoices.append(self.OutAxisCollection.createButton(self.OutAxisRow,label=item,
                                                                                     onCommand = Callback(puppetBoxLib.setPuppetAxisOut,self,i)))
            MelSpacer(self.OutAxisRow,w=3)
        self.OutAxisRow.setStretchWidget( Spacer )
        MelSpacer(self.OutAxisRow,w=2)		
        self.OutAxisRow.layout()	

        #Set toggles on menu
        mc.radioCollection(self.AimAxisCollection ,edit=True,sl= (self.AimAxisCollectionChoices[ (self.PuppetAimOptionVar.value) ]))		
        mc.radioCollection(self.UpAxisCollection ,edit=True,sl= (self.UpAxisCollectionChoices[ (self.PuppetUpOptionVar.value) ]))		
        mc.radioCollection(self.OutAxisCollection ,edit=True,sl= (self.OutAxisCollectionChoices[ (self.PuppetOutOptionVar.value) ]))


        #Initial State Button Row
        self.InitialStateButtonRow = MelHLayout(TopSection, h = 20,vis=False,padding = 5)
        guiFactory.doButton2(self.InitialStateButtonRow,'Add Geo',
                             lambda *a:puppetBoxLib.doAddGeo(self))
        guiFactory.doButton2(self.InitialStateButtonRow,'Build Size Template',
                             lambda *a:puppetBoxLib.doBuildSizeTemplate(self))

        self.InitialStateButtonRow.layout()
        self.UI_StateRows['define'].append(self.InitialStateButtonRow)

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Multi Module
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

        #>>>  All Sets menu
        AllModulesRow = MelFormLayout(MainForm,height = 20)
        activeState = True
        i = 1

        tmpActive = MelCheckBox(AllModulesRow,
                                annotation = 'Sets all sets active',
                                value = activeState,
                                onCommand =  Callback(puppetBoxLib.doSetAllSetsAsActive,self),
                                offCommand = Callback(puppetBoxLib.doSetAllSetsAsInactive,self))

        tmpSel = guiFactory.doButton2(AllModulesRow,
                                      ' s ',
                                      'Select All Loaded/Active Sets')

        # Mode toggle box
        self.ModuleModeOptionMenu = MelOptionMenu(AllModulesRow,
                                                  cc = modeSet)


        tmpKey = guiFactory.doButton2(AllModulesRow,
                                      ' k ',
                                      'Key All Sets')
        tmpDeleteKey = guiFactory.doButton2(AllModulesRow,
                                            ' d ',
                                            'Delete All Set Keys')	
        tmpReset = guiFactory.doButton2(AllModulesRow,
                                        ' r ',
                                        'Reset All Set Keys')	

        mc.formLayout(AllModulesRow, edit = True,
                      af = [(tmpActive, "left", 10),
                            (tmpReset,"right",10)],
                      ac = [(tmpSel,"left",0,tmpActive),
                            (self.ModuleModeOptionMenu,"left",4,tmpSel),
                            (self.ModuleModeOptionMenu,"right",4,tmpKey),
                            (tmpKey,"right",2,tmpDeleteKey),
                            (tmpDeleteKey,"right",2,tmpReset)
                            ])

        #>>> Sets building section
        allPopUpMenu = MelPopupMenu(self.ModuleModeOptionMenu ,button = 3)

        allCategoryMenu = MelMenuItem(allPopUpMenu,
                                      label = 'Make Type:',
                                      sm = True)




        #>>> Sets building section
        ModuleListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate')
        ModuleMasterForm = MelFormLayout(ModuleListScroll)
        self.ModuleListColumn = MelColumnLayout(ModuleMasterForm,ut = 'cgmUIInstructionsTemplate', adj = True, rowSpacing = 2)



        self.helpInfo = MelLabel(MainForm,
                                 h=20,
                                 l = "Add a Puppet",
                                 ut = 'cgmUIInstructionsTemplate',
                                 al = 'center',
                                 ww = True,vis = self.ShowHelpOptionVar.value)
        self.helpBlurbs.extend([self.helpInfo ])

        VerifyRow = guiFactory.doButton2(MainForm,
                                         'Check Puppet',
                                         'Create new buffer from selected buffer')	

        ModuleMasterForm(edit = True,
                         af = [(self.ModuleListColumn,"top",0),
                               (self.ModuleListColumn,"left",0),
                               (self.ModuleListColumn,"right",0),
                               (self.ModuleListColumn,"bottom",0)])


        MainForm(edit = True,
                 af = [(TopSection,"top",0),	
                       (TopSection,"left",0),
                       (TopSection,"right",0),		               
                       (AllModulesRow,"left",0),
                       (AllModulesRow,"right",0),
                       (ModuleListScroll,"left",0),
                       (ModuleListScroll,"right",0),
                       (ModuleListScroll,"left",0),
                       (ModuleListScroll,"right",0),				       
                       (self.helpInfo,"left",8),
                       (self.helpInfo,"right",8),
                       (VerifyRow,"left",4),
                       (VerifyRow,"right",4),		               
                       (VerifyRow,"bottom",4)],
                 ac = [(AllModulesRow,"top",2,TopSection),
                       (ModuleListScroll,"top",2,AllModulesRow),
                       (ModuleListScroll,"bottom",0,self.helpInfo),
                       (self.helpInfo,"bottom",0,VerifyRow)],
                 attachNone = [(VerifyRow,"top")])	
Example #27
0
    def buildAttributeManagerTool(self, parent, vis=True):
        self.ManageForm = MelFormLayout(self.Get(), ut='cgmUITemplate')

        ManageHeader = guiFactory.header('Manage Attributes')

        #>>> Manager load frow
        ManagerLoadObjectRow = MelHSingleStretchLayout(self.ManageForm,
                                                       padding=5)

        MelSpacer(ManagerLoadObjectRow, w=5)

        guiFactory.doButton2(ManagerLoadObjectRow, '>>',
                             lambda *a: attrToolsLib.uiLoadSourceObject(self),
                             'Load to field')

        self.ManagerSourceObjectField = MelTextField(
            ManagerLoadObjectRow,
            w=125,
            h=20,
            ut='cgmUIReservedTemplate',
            editable=False)

        ManagerLoadObjectRow.setStretchWidget(self.ManagerSourceObjectField)

        MelSpacer(ManagerLoadObjectRow, w=5)

        ManagerLoadObjectRow.layout()

        #>>> Attribute List
        self.ManageAttrList = MelObjectScrollList(self.ManageForm,
                                                  allowMultiSelection=True)

        #>>> Reorder Button
        ReorderButtonsRow = MelHLayout(self.ManageForm, padding=5)
        guiFactory.doButton2(
            ReorderButtonsRow, 'Move Up',
            lambda *a: attrToolsLib.uiReorderAttributes(self, 0),
            'Create new buffer from selected buffer')
        guiFactory.doButton2(
            ReorderButtonsRow, 'Move Down',
            lambda *a: attrToolsLib.uiReorderAttributes(self, 1),
            'Create new buffer from selected buffer')
        ReorderButtonsRow.layout()

        #>>>Transfer Options
        self.TransferModeCollection = MelRadioCollection()
        self.TransferModeCollectionChoices = []

        TransferModeFlagsRow = MelHSingleStretchLayout(self.ManageForm,
                                                       padding=2)
        MelLabel(TransferModeFlagsRow, l='Modes')
        Spacer = MelSeparator(TransferModeFlagsRow, w=10)
        self.TransferModeOptions = ['Connect', 'Copy', 'Transfer']
        for i, item in enumerate(self.TransferModeOptions):
            self.TransferModeCollectionChoices.append(
                self.TransferModeCollection.createButton(
                    TransferModeFlagsRow,
                    label=item,
                    onCommand=Callback(self.CopyAttrModeOptionVar.set, i)))
            MelSpacer(TransferModeFlagsRow, w=3)
        TransferModeFlagsRow.setStretchWidget(Spacer)
        MelSpacer(TransferModeFlagsRow, w=2)
        TransferModeFlagsRow.layout()

        mc.radioCollection(self.TransferModeCollection,
                           edit=True,
                           sl=(self.TransferModeCollectionChoices[(
                               self.CopyAttrModeOptionVar.value)]))

        #>>>Transfer Options
        self.TransferOptionsCollection = MelRadioCollection()
        self.TransferOptionsCollectionChoices = []

        TransferOptionsFlagsRow = MelHSingleStretchLayout(self.ManageForm,
                                                          padding=0)
        Spacer = MelSpacer(TransferOptionsFlagsRow)
        TransferOptionsFlagsRow.setStretchWidget(Spacer)

        self.ConvertCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Convert',
            annotation="Converts if necessary to finish the copy process",
            value=self.TransferConvertStateOptionVar.value,
            onCommand=Callback(self.TransferConvertStateOptionVar.set, 1),
            offCommand=Callback(self.TransferConvertStateOptionVar.set, 0))

        self.ValueCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Value',
            annotation="Copy values",
            value=self.TransferValueOptionVar.value,
            onCommand=Callback(self.TransferValueOptionVar.set, 1),
            offCommand=Callback(self.TransferValueOptionVar.set, 0))

        self.IncomingCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='In',
            annotation="Copy or transfer incoming connections",
            value=self.TransferIncomingOptionVar.value,
            onCommand=Callback(self.TransferIncomingOptionVar.set, 1),
            offCommand=Callback(self.TransferIncomingOptionVar.set, 0))

        self.OutgoingCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Out',
            annotation="Copy or transfer incoming connections",
            value=self.TransferOutgoingOptionVar.value,
            onCommand=Callback(self.TransferOutgoingOptionVar.set, 1),
            offCommand=Callback(self.TransferOutgoingOptionVar.set, 0))

        self.KeepSourceCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Keep',
            annotation="Keep source connections when copying",
            value=self.TransferKeepSourceOptionVar.value,
            onCommand=Callback(self.TransferKeepSourceOptionVar.set, 1),
            offCommand=Callback(self.TransferKeepSourceOptionVar.set, 0))

        self.DriveSourceCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Drive',
            annotation=
            "Connect the source attr \nto selected or created attribute",
            value=self.TransferDriveSourceStateOptionVar.value,
            onCommand=Callback(self.TransferDriveSourceStateOptionVar.set, 1),
            offCommand=Callback(self.TransferDriveSourceStateOptionVar.set, 0))

        self.AttrOptionsCB = MelCheckBox(
            TransferOptionsFlagsRow,
            label='Options',
            annotation=
            "Copies the attributes basic flags\n(locked,keyable,hidden)",
            value=self.CopyAttrOptionsOptionVar.value,
            onCommand=Callback(self.CopyAttrOptionsOptionVar.set, 1),
            offCommand=Callback(self.TransferDriveSourceStateOptionVar.set, 0))

        TransferOptionsFlagsRow.layout()

        BottomButtonRow = guiFactory.doButton2(
            self.ManageForm, 'Connect/Copy/Transfer',
            lambda *a: attrToolsLib.uiTransferAttributes(self),
            'Create new buffer from selected buffer')

        self.ManageForm(
            edit=True,
            af=[(ManageHeader, "top", 0), (ManageHeader, "left", 0),
                (ManageHeader, "right", 0), (self.ManageAttrList, "left", 0),
                (self.ManageAttrList, "right", 0),
                (ManagerLoadObjectRow, "left", 5),
                (ManagerLoadObjectRow, "right", 5),
                (ReorderButtonsRow, "left", 0),
                (ReorderButtonsRow, "right", 0),
                (TransferModeFlagsRow, "left", 5),
                (TransferModeFlagsRow, "right", 5),
                (BottomButtonRow, "left", 5), (BottomButtonRow, "right", 5),
                (TransferOptionsFlagsRow, "left", 2),
                (TransferOptionsFlagsRow, "right", 2),
                (TransferOptionsFlagsRow, "bottom", 4)],
            ac=[(ManagerLoadObjectRow, "top", 5, ManageHeader),
                (self.ManageAttrList, "top", 5, ManagerLoadObjectRow),
                (self.ManageAttrList, "bottom", 5, ReorderButtonsRow),
                (ReorderButtonsRow, "bottom", 5, BottomButtonRow),
                (BottomButtonRow, "bottom", 5, TransferModeFlagsRow),
                (TransferModeFlagsRow, "bottom", 5, TransferOptionsFlagsRow)],
            attachNone=[(TransferOptionsFlagsRow, "top")])

        #Build pop up for attribute list field
        popUpMenu = MelPopupMenu(self.ManageAttrList, button=3)

        MelMenuItem(popUpMenu,
                    label='Make Keyable',
                    c=lambda *a: attrToolsLib.uiManageAttrsKeyable(self))

        MelMenuItem(popUpMenu,
                    label='Make Unkeyable',
                    c=lambda *a: attrToolsLib.uiManageAttrsUnkeyable(self))

        MelMenuItemDiv(popUpMenu)

        MelMenuItem(popUpMenu,
                    label='Hide',
                    c=lambda *a: attrToolsLib.uiManageAttrsHide(self))

        MelMenuItem(popUpMenu,
                    label='Unhide',
                    c=lambda *a: attrToolsLib.uiManageAttrsUnhide(self))

        MelMenuItemDiv(popUpMenu)
        MelMenuItem(popUpMenu,
                    label='Lock',
                    c=lambda *a: attrToolsLib.uiManageAttrsLocked(self))

        MelMenuItem(popUpMenu,
                    label='Unlock',
                    c=lambda *a: attrToolsLib.uiManageAttrsUnlocked(self))

        MelMenuItemDiv(popUpMenu)
        MelMenuItem(popUpMenu,
                    label='Delete',
                    c=lambda *a: attrToolsLib.uiManageAttrsDelete(self))

        return self.ManageForm
Example #28
0
	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])
			
			
		
		"""
		"""
Example #29
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')
Example #30
0
	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 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
Example #32
0
	def Main_buildLayout(self,parent):
		MainForm = MelFormLayout(parent)

		#>>>  Snap Section
		BufferHeader = guiFactory.header('Buffers')
		HelpInfo = MelLabel(MainForm,
		                    l = " Set buffer options: Set active, select, change name,add,remove,key,purge",
		                    ut = 'cgmUIInstructionsTemplate',
		                    al = 'center',
		                    ww = True,vis = self.ShowHelpOption)
		self.helpBlurbs.extend([HelpInfo])
		
		BufferListScroll = MelScrollLayout(MainForm,cr = 1, ut = 'cgmUISubTemplate')
		BufferMasterForm = MelFormLayout(BufferListScroll)
		BufferListColumn = MelColumnLayout(BufferMasterForm, adj = True, rowSpacing = 3)
		
		for i,b in enumerate(self.objectBuffers):
			tmpSetRow = MelFormLayout(BufferListColumn,height = 20)
			
			#Get check box state
			activeState = False
			if b in self.activeObjectBuffersOptionVar.value:
				activeState = True
			
			tmpActive = MelCheckBox(tmpSetRow,
			                        annotation = 'Set buffer set as active',
			                        value = activeState,
			                        onCommand =  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.setBufferAsActive('cgmVar_activeObjectBuffers','",b,"')"),
			                        offCommand = "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.setBufferAsInactive('cgmVar_activeObjectBuffers','",b,"')"))
			tmpSel = guiFactory.doButton2(tmpSetRow,
			                              's->',
										  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.selectBufferObjects('",b,"')"),
			                              'Select the buffer objects')
			
			tmpName = MelTextField(tmpSetRow, w = 100,ut = 'cgmUIReservedTemplate', text = b)
			bField = "%s"%tmpName
			bName = "%s"%b
			tmpName(edit = True,
			        ec = lambda *a:bufferToolsLib.updateBufferName(self,bField,bName))
			
			"""
			tmpName(edit = True,
			        ec = "%s%s%s%s%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.updateBufferName('",self,"','",tmpName,"','",b,"')"))
			"""
			tmpAdd = guiFactory.doButton2(tmpSetRow,
			                               '+',
										   "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.addSelected('",b,"')"),
			                               'Add selected  to the buffer')
			tmpRem= guiFactory.doButton2(tmpSetRow,
			                             '-',
										 "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.removeSelected('",b,"')"),
			                             'Remove selected  to the buffer')
			tmpKey = guiFactory.doButton2(tmpSetRow,
			                              'k',
										  "%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.keyBuffer('",b,"')"),
			                              'Key buffer')
			tmpPurge = guiFactory.doButton2(tmpSetRow,
			                                'p',
											"%s%s%s"%("from cgm.tools.lib import bufferToolsLib;bufferToolsLib.purgeBuffer('",b,"')"),
			                                'Purge buffer')	
			mc.formLayout(tmpSetRow, edit = True,
			              af = [(tmpActive, "left", 2),
			                    (tmpPurge,"right",0)],
			              ac = [(tmpSel,"left",0,tmpActive),
			                    (tmpName,"left",2,tmpSel),
			                    (tmpName,"right",2,tmpAdd),
			                    (tmpAdd,"right",2,tmpRem),
			                    (tmpRem,"right",2,tmpKey),
			                    (tmpKey,"right",2,tmpPurge)])
			
			MelSpacer(tmpSetRow, w = 2)
		
		
		
			
		
		NewBufferRow = guiFactory.doButton2(MainForm,
		                                    'Create Buffer',
		                                    lambda *a:bufferToolsLib.createBuffer(self),
		                                    'Create new buffer from selected buffer')	
			
		BufferMasterForm(edit = True,
		                 af = [(BufferListColumn,"top",0),
		                       (BufferListColumn,"left",0),
		                       (BufferListColumn,"right",0),
		                       (BufferListColumn,"bottom",0)])
		                 
		MainForm(edit = True,
		         af = [(BufferHeader,"top",0),
		               (BufferHeader,"left",0),
		               (BufferHeader,"right",0),
		               (HelpInfo,"left",0),
		               (HelpInfo,"right",0),
		               (BufferListScroll,"left",0),
		               (BufferListScroll,"right",0),
		               (NewBufferRow,"left",4),
		               (NewBufferRow,"right",4),
		               (NewBufferRow,"bottom",4)],
		         ac = [(HelpInfo,"top",0,BufferHeader),
		               (BufferListScroll,"top",0,HelpInfo),
		               (BufferListScroll,"bottom",0,NewBufferRow)],
		         attachNone = [(NewBufferRow,"top")])


		"""