Beispiel #1
0
	def __init__( self):	

		# Basic variables
		self.window = ''
		self.activeTab = ''
		self.toolName = 'attrTools'
		self.module = 'tdTools'
		self.winName = 'attrToolsWin'
		self.optionVars = []

		self.showHelp = False
		self.helpBlurbs = []
		self.oldGenBlurbs = []

		self.showTimeSubMenu = False
		self.timeSubMenu = []
		
		self.setupVariables()
		self.loadAttrs = []

		# About Window
		self.description = 'Tools for working with attributes'
		self.author = 'Josh Burton'
		self.owner = 'CG Monks'
		self.website = 'www.cgmonks.com'
		self.version = __version__

		# About Window

		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
		# Build
		#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

		#Menu
		self.UI_OptionsMenu = MelMenu( l='Options', pmc=self.buildOptionsMenu)
		self.UI_HelpMenu = MelMenu( l='Help', pmc=self.buildHelpMenu)
		

		WindowForm = MelColumnLayout(self)
		           
		self.buildAttributeTool(WindowForm)
		
		if mc.ls(sl=True):
			attrToolsLib.uiLoadSourceObject(self)
		
		self.show()
Beispiel #2
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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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