def uiFunc_build_controller_connection_column(self, parent, connection): mc.setParent(parent) cgmUI.add_LineSubBreak() # Connection Column # connectionColumn = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') for label in self.connectionDict[connection]: add_connection_row(self, connectionColumn, connection, label, self.connectionDict[connection][label]) # # End Connection Column _row = mUI.MelHLayout(parent,ut='cgmUISubTemplate',padding = _padding) btn = cgmUI.add_Button(_row,'Add Connection', cgmGEN.Callback(add_connection,self, connectionColumn, connection), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Add Connection Button',h=25) btn = cgmUI.add_Button(_row,'Clear All', cgmGEN.Callback(uiFunc_clear_connections,self, connectionColumn, connection), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Clear Connections Button',h=25) _row.layout() mc.setParent(parent) cgmUI.add_LineSubBreak()
def build_layoutWrapper(self,parent): MainForm = zooUI.MelColumnLayout(parent) SetHeader = cgmUI.add_Header('HI') #self.l_helpElements.extend(add_InstructionBlock(MainForm,"Purge all traces of cgmThinga tools from the object and so and so forth forever, amen.",vis = self.var_ShowHelp.value)) cgmUI.add_Button(MainForm) cgmUI.add_Button(MainForm,'Debug test', lambda *a: self.do_DebugEchoTest()) cgmUI.add_MelLabel(MainForm,'asdfasdfasdf')
def uiFunc_make_display_line(parent, label="", text="", button=False, buttonLabel = ">>", buttonCommand=None, buttonInfo="", presetOptions=False, presetObj=None): _row = mUI.MelHSingleStretchLayout(parent,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row, l=label) uiTF = mUI.MelLabel(_row,ut='cgmUIInstructionsTemplate',l=text, en=True) if button: cgmUI.add_Button(_row,buttonLabel, buttonCommand, buttonInfo) _row.setStretchWidget(uiTF) if presetOptions: presetMenu = mUI.MelOptionMenu(_row,useTemplate = 'cgmUITemplate') presetMenu.append("Load Preset") for a in mc.nodePreset( list=presetObj ): presetMenu.append(a) presetMenu.append("---") presetMenu.append("Save Preset") presetMenu(edit=True, value = "Load Preset", cc = cgmGEN.Callback(uiFunc_process_preset_change, presetObj, presetMenu) ) mUI.MelSpacer(_row,w=_padding) _row.layout() return uiTF
def add_connection_row(self, parent, connection, label, connectionInfo): # Add Connection # _row = mUI.MelHSingleStretchLayout(parent,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Target:') conLabel = mUI.MelLabel(_row,ut='cgmUIInstructionsTemplate',l=label,en=False) _row.setStretchWidget( conLabel ) mUI.MelLabel(_row,l='Min:') ff_min = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w= 50, precision = 2, v=connectionInfo['min']) mUI.MelLabel(_row,l='Max:') ff_max = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w= 50, precision = 2, v=connectionInfo['max']) mUI.MelLabel(_row,l='Damp:') ff_damp = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w= 50, precision = 2, v=connectionInfo['damp']) ff_min(edit=True, cc=cgmGEN.Callback(uiFunc_change_connection,self,connection, label, ff_min, ff_max, ff_damp)) ff_max(edit=True, cc=cgmGEN.Callback(uiFunc_change_connection,self,connection, label, ff_min, ff_max, ff_damp)) ff_damp(edit=True, cc=cgmGEN.Callback(uiFunc_change_connection,self,connection, label, ff_min, ff_max, ff_damp)) cgmUI.add_Button(_row,'X', cgmGEN.Callback(uiFunc_remove_connection,self,_row, connection, label), "Remove connection.") mUI.MelSpacer(_row,w=_padding) _row.layout()
def buildSection_objDefaults(self,parent,frame=True): try:self.var_objDefaultAimAxis except:self.var_objDefaultAimAxis = cgmMeta.cgmOptionVar('cgmVar_objDefaultAimAxis', defaultValue = 2) try:self.var_objDefaultUpAxis except:self.var_objDefaultUpAxis = cgmMeta.cgmOptionVar('cgmVar_objDefaultUpAxis', defaultValue = 1) try:self.var_objDefaultOutAxis except:self.var_objDefaultOutAxis = cgmMeta.cgmOptionVar('cgmVar_objDefaultOutAxis', defaultValue = 3) if frame: _frame = mUI.MelFrameLayout(parent,label = 'Obj Defaults',vis=True, collapse=self.var_objectDefaultsFrameCollapse.value, collapsable=True, enable=True, useTemplate = 'cgmUIHeaderTemplate', expandCommand = lambda:self.var_objectDefaultsFrameCollapse.setValue(0), collapseCommand = lambda:self.var_objectDefaultsFrameCollapse.setValue(1) ) _inside = mUI.MelColumnLayout(_frame,useTemplate = 'cgmUISubTemplate') else: _inside = parent #>>>Aim defaults mode ------------------------------------------------------------------------------------- _d = {'aim':self.var_objDefaultAimAxis, 'up':self.var_objDefaultUpAxis, 'out':self.var_objDefaultOutAxis} for k in _d.keys(): _var = _d[k] _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=5) mUI.MelLabel(_row,l='Obj {0}:'.format(k)) _row.setStretchWidget( mUI.MelSeparator(_row) ) uiRC = mUI.MelRadioCollection() _on = _var.value for i,item in enumerate(SHARED._l_axis_by_string): if i == _on: _rb = True else:_rb = False uiRC.createButton(_row,label=item,sl=_rb, onCommand = cgmGEN.Callback(_var.setValue,i)) mUI.MelSpacer(_row,w=2) _row.layout() #>>>Buttons ------------------------------------------------------------------------------------- _row_defaults = mUI.MelHLayout(_inside,ut='cgmUISubTemplate',padding = 5, ) cgmUI.add_Button(_row_defaults,'Tag selected for aim', lambda *a:MMCONTEXT.func_process(SNAP.verify_aimAttrs, mc.ls(sl=True),'each','Verify aim attributes',True,**{}),) _row_defaults.layout()
def build_layoutWrapper(self, parent): uiColumn_main = zooUI.MelColumnLayout(parent) cgmUI.add_Header('Setup Hotkey') cgmUI.add_TextBlock(self.mi_cgmHotkeyer._d_kws['name']) #>>>Modifier row ------------------------------------------------------------------------------------ self.uiRow_Modifier = zooUI.MelHSingleStretchLayout( uiColumn_main, ut='cgmUISubTemplate', padding=2) #zooUI.MelSpacer(self.uiRow_Modifier,w=5) #zooUI.MelLabel(self.uiRow_Modifier, label = 'Modifier: ',align='right') self.uiRow_Modifier.setStretchWidget( zooUI.MelSeparator(self.uiRow_Modifier)) self.uiRow_Modifier.layout() self.uiRadioCollection_modifier = zooUI.MelRadioCollection() self.uiOptions_modifier = [] for i, item in enumerate(cgmHotkeyer._l_modifierOptions): self.uiOptions_modifier.append( self.uiRadioCollection_modifier.createButton( self.uiRow_Modifier, label=item)) self.uiRow_Modifier.layout() mc.radioCollection(self.uiRadioCollection_modifier, edit=True, sl=self.uiOptions_modifier[0]) #>>>Text row ------------------------------------------------------------------------------------ uiRow_key = zooUI.MelHLayout(uiColumn_main, ut='cgmUISubTemplate', padding=15) self.uiText_key = zooUI.MelTextField( uiRow_key, backgroundColor=[1, 1, 1], h=20, text=self.mi_cgmHotkeyer._defaultKey, ut='cgmUITemplate', #ec = lambda *a:self._UTILS.puppet_doChangeName(self), annotation="Hotkey to use") uiRow_key.layout() #>>> Button row mc.setParent(uiColumn_main) cgmUI.add_LineSubBreak() uiRow_buttons = zooUI.MelHLayout(uiColumn_main, ut='cgmUISubTemplate', padding=5) cgmUI.add_Button(uiRow_buttons, 'Go', commandText=lambda *a: self.buttonPress_go(), annotationText="Set it up") cgmUI.add_Button( uiRow_buttons, 'Reset', commandText=lambda *a: self.buttonPress_reset(), en=False, annotationText="Reset given key to the default maya setting") uiRow_buttons.layout()
def buildRow_commitButtons(self, parent): #>>>Match mode ------------------------------------------------------------------------------------- _row = mUI.MelHLayout(parent, ut='cgmUISubTemplate', padding=5) cgmUI.add_Button(_row, 'Check for updates', lambda *a: (self.uiFunc_checkForUpdates()), "Check your last branch pull for updates") cgmUI.add_Button( _row, 'Get Selected', lambda *a: (self.uiFunc_updateMyStuff()), ) _row.layout() return _row
def build_layoutWrapper(self,parent): uiColumn_main = zooUI.MelColumnLayout(parent) cgmUI.add_Header('Setup Hotkey') cgmUI.add_TextBlock(self.mi_cgmHotkeyer._d_kws['name']) #>>>Modifier row ------------------------------------------------------------------------------------ self.uiRow_Modifier = zooUI.MelHSingleStretchLayout(uiColumn_main,ut='cgmUISubTemplate',padding = 2) #zooUI.MelSpacer(self.uiRow_Modifier,w=5) #zooUI.MelLabel(self.uiRow_Modifier, label = 'Modifier: ',align='right') self.uiRow_Modifier.setStretchWidget( zooUI.MelSeparator(self.uiRow_Modifier) ) self.uiRow_Modifier.layout() self.uiRadioCollection_modifier = zooUI.MelRadioCollection() self.uiOptions_modifier = [] for i,item in enumerate(cgmHotkeyer._l_modifierOptions): self.uiOptions_modifier.append(self.uiRadioCollection_modifier.createButton(self.uiRow_Modifier,label=item)) self.uiRow_Modifier.layout() mc.radioCollection(self.uiRadioCollection_modifier,edit=True, sl=self.uiOptions_modifier[0]) #>>>Text row ------------------------------------------------------------------------------------ uiRow_key = zooUI.MelHLayout(uiColumn_main,ut='cgmUISubTemplate',padding = 15) self.uiText_key = zooUI.MelTextField(uiRow_key,backgroundColor = [1,1,1],h=20, text = self.mi_cgmHotkeyer._defaultKey, ut = 'cgmUITemplate', #ec = lambda *a:self._UTILS.puppet_doChangeName(self), annotation = "Hotkey to use") uiRow_key.layout() #>>> Button row mc.setParent(uiColumn_main) cgmUI.add_LineSubBreak() uiRow_buttons = zooUI.MelHLayout(uiColumn_main,ut='cgmUISubTemplate',padding = 5) cgmUI.add_Button(uiRow_buttons,'Go',commandText = lambda *a:self.buttonPress_go(), annotationText="Set it up") cgmUI.add_Button(uiRow_buttons,'Reset',commandText = lambda *a:self.buttonPress_reset(),en = False, annotationText="Reset given key to the default maya setting") uiRow_buttons.layout()
def buildColumn_main(self,parent, asScroll = False): """ Trying to put all this in here so it's insertable in other uis """ if asScroll: _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') else: _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- _row_objLoad = mUI.MelHSingleStretchLayout(_inside,ut='cgmUITemplate',padding = 5) mUI.MelSpacer(_row_objLoad,w=10) mUI.MelLabel(_row_objLoad, l='Source:') uiTF_objLoad = mUI.MelLabel(_row_objLoad,ut='cgmUITemplate',l='', en=True) self.uiTF_objLoad = uiTF_objLoad cgmUI.add_Button(_row_objLoad,'<<', cgmGEN.Callback(uiFunc_load_selected,self), "Load first selected object.") _row_objLoad.setStretchWidget(uiTF_objLoad) mUI.MelSpacer(_row_objLoad,w=10) """ _row_objLoad.layout() #>>>Report --------------------------------------------------------------------------------------- _row_report = mUI.MelHLayout(_inside ,ut='cgmUIInstructionsTemplate',h=20) self.uiField_report = mUI.MelLabel(_row_report, bgc = SHARED._d_gui_state_colors.get('help'), label = '...', h=20) _row_report.layout() """ _row_objLoad.layout() uiFunc_load_selected(self) return _inside
def buildScrollForm(self, parent, hasHeader = False, buttonArgs = [], headerText = 'Header', allowMultiSelection=True, buttonCommand=None, doubleClickCommand=None, selectCommand=None): main_form = mUI.MelFormLayout(parent,ut='cgmUITemplate') header = None if(hasHeader): header = cgmUI.add_Header(headerText, overrideUpper = True) scroll_list = mUI.MelObjectScrollList( main_form, ut='cgmUITemplate', allowMultiSelection=allowMultiSelection, doubleClickCommand=cgmGEN.Callback(doubleClickCommand,self), selectCommand=cgmGEN.Callback(selectCommand,self) ) buttonLayout = None buttons = [] hasButton = len(buttonArgs) > 0 if(hasButton): #buttonLayout = mUI.MelColumnLayout(main_form,useTemplate = 'cgmUISubTemplate') buttonLayout = mUI.MelHLayout(main_form,ut='cgmUISubTemplate',padding = 1,bgc=_subLineBGC) for btn in buttonArgs: button = cgmUI.add_Button(buttonLayout,btn['label'], cgmGEN.Callback(btn['command'],self), btn['annotation'], bgc=_buttonBGC) buttons.append(button) buttonLayout.layout() af = [(scroll_list,"left",0), (scroll_list,"right",0)] ac = [] attachNone = [] if(hasHeader): af += [ (header,"top",0), (header,"left",0), (header,"right",0) ] ac += [(scroll_list,"top",0,header)] attachNone += [(header,"bottom")] else: af += [ (scroll_list,"top",0) ] if(hasButton): af += [ (buttonLayout,"bottom",0), (buttonLayout,"left",0), (buttonLayout,"right",0)] ac += [(scroll_list,"bottom",0,buttonLayout)] attachNone += [(buttonLayout,"top")] else: af += [ (scroll_list,"bottom",0) ] main_form(edit=True, af = af, ac = ac, attachNone = attachNone) return [main_form, scroll_list, header, buttons]
def uiFunc_update_details(self): if not self._mDynFK: return self.detailsFrame.clear() dat = self._mDynFK.get_dat() self.detailsFrame(edit=True, collapse=False) _details = mUI.MelColumnLayout(self.detailsFrame, useTemplate='cgmUIHeaderTemplate') cgmUI.add_LineSubBreak() # Base Name uiFunc_make_display_line(_details, label='Base Name:', text=self._mDynFK.baseName, button=False) # Direction Info _row = mUI.MelHSingleStretchLayout(_details, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l="Direction:") _row.setStretchWidget(mUI.MelSeparator(_row)) mUI.MelLabel(_row, l="Fwd:") uiTF = mUI.MelLabel(_row, ut='cgmUISubTemplate', l=self._mDynFK.fwd, en=True) mUI.MelLabel(_row, l="Up:") uiTF = mUI.MelLabel(_row, ut='cgmUISubTemplate', l=self._mDynFK.up, en=True) mUI.MelSpacer(_row, w=10) _row.layout() # Nucleus uiFunc_make_display_line(_details, label='Nucleus:', text=self._mDynFK.mNucleus[0], button=True, buttonLabel=">>", buttonCommand=cgmGEN.Callback( uiFunc_select_item, self._mDynFK.mNucleus[0]), buttonInfo="Select nucleus transform.", presetOptions=True, presetObj=self._mDynFK.mNucleus[0]) uiFunc_make_display_line(_details, label='Hair System:', text=dat['mHairSysShape'].p_nameBase, button=True, buttonLabel=">>", buttonCommand=cgmGEN.Callback( uiFunc_select_item, dat['mHairSysShape'].p_nameBase), buttonInfo="Select hair system transform.", presetOptions=True, presetObj=dat['mHairSysShape'].p_nameBase) _row = mUI.MelHSingleStretchLayout(_details, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Enabled:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.nucleusEnabledCB = mUI.MelCheckBox(_row, en=True, v=True, label='', ann='Enable Nucleus') self.nucleusEnabledCB(edit=True, changeCommand=cgmGEN.Callback( uiFunc_set_nucleus_enabled, self)) mUI.MelSpacer(_row, w=_padding) _row.layout() # Start Times _row = mUI.MelHSingleStretchLayout(_details, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Start Time:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.startTimeIF = mUI.MelIntField(_row, v=dat['mNucleus'].startFrame) self.startTimeIF(edit=True, changeCommand=cgmGEN.Callback(uiFunc_set_start_time, self, mode='refresh')) cgmUI.add_Button( _row, '<<', cgmGEN.Callback(uiFunc_set_start_time, self, mode='beginning'), "Set Start To Beginning of Slider.") mUI.MelSpacer(_row, w=_padding) _row.layout() # TimeInput Row ---------------------------------------------------------------------------------- _row = mUI.MelHSingleStretchLayout(_details, ut='cgmUISubTemplate') mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Bake Time:') _row.setStretchWidget(mUI.MelSeparator(_row)) mUI.MelLabel(_row, l='Start:') self.uiFieldInt_start = mUI.MelIntField(_row, 'cgmLocWinStartFrameField', width=40) mUI.MelLabel(_row, l='End:') self.uiFieldInt_end = mUI.MelIntField(_row, 'cgmLocWinEndFrameField', width=40) cgmUI.add_Button(_row, '<<', cgmGEN.Callback(uiFunc_updateTimeRange, self, 'min'), "Set Start To Beginning of Slider.") cgmUI.add_Button(_row, '[ ]', cgmGEN.Callback(uiFunc_updateTimeRange, self, 'slider'), "Set Time to Slider.") cgmUI.add_Button(_row, '>>', cgmGEN.Callback(uiFunc_updateTimeRange, self, 'max'), "Set End To End of Slider.") uiFunc_updateTimeRange(self, mode='slider') mUI.MelSpacer(_row, w=_padding) _row.layout() mc.setParent(_details) cgmUI.add_LineSubBreak() allChains = [] for idx in dat['chains']: allChains += dat['chains'][idx]['mObjJointChain'] allTargets = [] for idx in dat['chains']: allTargets += dat['chains'][idx]['mTargets'] _row = mUI.MelHLayout(_details, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Bake All Joints', cgmGEN.Callback(uiFunc_bake, self, 'chain', allChains), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake All Joints') cgmUI.add_Button(_row, 'Bake All Targets', cgmGEN.Callback(uiFunc_bake, self, 'target', allTargets), 'Bake All Targets') _row.layout() _row = mUI.MelHLayout(_details, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Connect All Targets', cgmGEN.Callback(uiFunc_connect_targets, self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Connect All Targets') cgmUI.add_Button(_row, 'Disconnect All Targets', cgmGEN.Callback(uiFunc_disconnect_targets, self), 'Disconnect All Targets') _row.layout() # Chains for i, chain in enumerate(self._mDynFK.msgList_get('chain')): _row = mUI.MelHSingleStretchLayout(_details, ut='cgmUISubTemplate', padding=_padding) mUI.MelSpacer(_row, w=_padding) _subChainColumn = mUI.MelColumnLayout( _row, useTemplate='cgmUIHeaderTemplate') chainFrame = mUI.MelFrameLayout(_subChainColumn, label=chain.p_nameBase, collapsable=True, collapse=True, useTemplate='cgmUIHeaderTemplate') _chainColumn = mUI.MelColumnLayout(chainFrame, useTemplate='cgmUIHeaderTemplate') _row.setStretchWidget(_subChainColumn) #mUI.MelSpacer(_row,w=_padding) _row.layout() mc.setParent(_chainColumn) cgmUI.add_LineSubBreak() uiFunc_make_display_line( _chainColumn, label='Follicle:', text=cgmMeta.asMeta(chain.mFollicle[0]).p_nameBase, button=True, buttonLabel=">>", buttonCommand=cgmGEN.Callback(uiFunc_select_item, chain.mFollicle[0]), buttonInfo="Select follicle transform.", presetOptions=True, presetObj=chain.mFollicle[0]) mc.setParent(_chainColumn) cgmUI.add_LineSubBreak() uiFunc_make_display_line(_chainColumn, label='Group:', text=chain.p_nameShort, button=True, buttonLabel=">>", buttonCommand=cgmGEN.Callback( uiFunc_select_item, chain.p_nameBase), buttonInfo="Select group transform.") mc.setParent(_chainColumn) cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_chainColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Orient Up:') _row.setStretchWidget(mUI.MelSeparator(_row)) chainDirections = [] for dir in ['x+', 'x-', 'y+', 'y-', 'z+', 'z-']: if chain.fwd[0] != dir[0]: chainDirections.append(dir) chainDirections.append('None') upMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate') for dir in chainDirections: upMenu.append(dir) upMenu.setValue(chain.up) upMenu(edit=True, changeCommand=cgmGEN.Callback(uiFunc_set_chain_up, self, i, upMenu)) mUI.MelSpacer(_row, w=_padding) _row.layout() _row = mUI.MelHLayout(_chainColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Bake Joints', cgmGEN.Callback(uiFunc_bake, self, 'chain', chain.msgList_get('mObjJointChain')), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake All Joints') cgmUI.add_Button( _row, 'Bake Targets', cgmGEN.Callback(uiFunc_bake, self, 'target', chain.msgList_get('mTargets')), 'Bake All Targets') _row.layout() _row = mUI.MelHLayout(_chainColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Connect Targets', cgmGEN.Callback(uiFunc_connect_targets, self, i), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Connect All Targets') cgmUI.add_Button(_row, 'Disconnect Targets', cgmGEN.Callback(uiFunc_disconnect_targets, self, i), 'Disconnect All Targets') _row.layout() _row = mUI.MelHLayout(_chainColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Delete Chain', cgmGEN.Callback(uiFunc_delete_chain, self, i), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake All Joints') _row.layout() frameDat = [['Targets', 'mTargets'], ['Locators', 'mLocs'], ['Joint Chain', 'mObjJointChain'], ['Aims', 'mAims'], ['Parents', 'mParents']] for dat in frameDat: frame = mUI.MelFrameLayout(_chainColumn, label=dat[0], collapsable=True, collapse=True, useTemplate='cgmUIHeaderTemplate') column = mUI.MelColumnLayout(frame, useTemplate='cgmUITemplate', height=75) row = mUI.MelHSingleStretchLayout(column, ut='cgmUIHeaderTemplate', padding=_padding) mUI.MelSpacer(row, w=_padding) itemList = uiFunc_create_selection_list( row, [x.p_nameShort for x in chain.msgList_get(dat[1])]) mUI.MelSpacer(row, w=_padding) row.setStretchWidget(itemList) row.layout() # End Chains mc.setParent(_details) cgmUI.add_LineSubBreak()
def buildColumn_main(self, parent, asScroll=False): """ Trying to put all this in here so it's insertable in other uis """ if asScroll: _inside = mUI.MelScrollLayout(parent, useTemplate='cgmUIHeaderTemplate') else: _inside = mUI.MelColumnLayout(parent, useTemplate='cgmUIHeaderTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- mUI.MelSeparator(_inside, ut='cgmUISubTemplate', h=3) _row = mUI.MelHSingleStretchLayout(_inside, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Dynamic Chain System:') uiTF_objLoad = mUI.MelLabel(_row, ut='cgmUIInstructionsTemplate', l='', en=True) self.uiTF_objLoad = uiTF_objLoad cgmUI.add_Button(_row, '<<', cgmGEN.Callback(uiFunc_load_selected, self), "Load first selected object.") _row.setStretchWidget(uiTF_objLoad) mUI.MelSpacer(_row, w=_padding) _row.layout() mc.setParent(_inside) cgmUI.add_LineSubBreak() self.detailsFrame = mUI.MelFrameLayout(_inside, label="Details", collapsable=True, collapse=True, useTemplate='cgmUIHeaderTemplate') uiFunc_update_details(self) # Create Frame self.createFrame = mUI.MelFrameLayout(_inside, label="Create", collapsable=True, collapse=False, useTemplate='cgmUIHeaderTemplate') _create = mUI.MelColumnLayout(self.createFrame, useTemplate='cgmUIHeaderTemplate') cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_create, ut='cgmUISubTemplate', padding=_padding) mUI.MelSpacer(_row, w=_padding) _subRow = mUI.MelColumnLayout(_row, useTemplate='cgmUIHeaderTemplate') self.itemList = cgmUI.cgmScrollList(_subRow, numberOfRows=8, height=100) self.itemList(edit=True, allowMultiSelection=True) mUI.MelSpacer(_row, w=_padding) _row.setStretchWidget(_subRow) _row.layout() mUI.MelSeparator(_create, ut='cgmUISubTemplate', h=5) _row = mUI.MelHSingleStretchLayout(_create, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) addBtn = cgmUI.add_Button( _row, 'Add Selected', cgmGEN.Callback(uiFunc_list_function, self.itemList, 'add selected'), "Load selected objects.") cgmUI.add_Button( _row, 'Remove Selected', cgmGEN.Callback(uiFunc_list_function, self.itemList, 'remove selected'), "Remove selected objects.") cgmUI.add_Button( _row, 'Clear', cgmGEN.Callback(uiFunc_list_function, self.itemList, 'clear'), "Clear all objects.") _row.setStretchWidget(addBtn) mUI.MelSpacer(_row, w=_padding) _row.layout() cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_create, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) _row.setStretchWidget( cgmUI.add_Button(_row, 'Make Dynamic Chain', cgmGEN.Callback(uiFunc_make_dynamic_chain, self), "Make Dynamic Chain.")) mUI.MelSpacer(_row, w=_padding) _row.layout() cgmUI.add_LineSubBreak() self.optionsFrame = mUI.MelFrameLayout(_create, label="Options", collapsable=True, collapse=True, useTemplate='cgmUIHeaderTemplate') _options = mUI.MelColumnLayout(self.optionsFrame, useTemplate='cgmUISubTemplate') mUI.MelSeparator(_options, ut='cgmUISubTemplate', h=5) _row = mUI.MelHSingleStretchLayout(_options, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Base Name: ') self.options_baseName = mUI.MelTextField(_row, ann='Name', text='DynamicChain') _row.setStretchWidget(self.options_baseName) mUI.MelSpacer(_row, w=_padding) _row.layout() _row = mUI.MelHSingleStretchLayout(_options, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Name: ') self.options_name = mUI.MelTextField(_row, ann='Name', text='') _row.setStretchWidget(self.options_name) mUI.MelSpacer(_row, w=_padding) _row.layout() mUI.MelSeparator(_options, ut='cgmUISubTemplate', h=5) _row = mUI.MelHSingleStretchLayout(_options, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Direction:') _row.setStretchWidget(mUI.MelSeparator(_row)) directions = ['x+', 'x-', 'y+', 'y-', 'z+', 'z-'] mUI.MelLabel(_row, l='Fwd:') self.fwdMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate') for dir in directions: self.fwdMenu.append(dir) self.fwdMenu.setValue('z+') mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Up:') self.upMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate') for dir in directions: self.upMenu.append(dir) self.upMenu.setValue('y+') mUI.MelSpacer(_row, w=_padding) _row.layout() """ _row.layout() #>>>Report --------------------------------------------------------------------------------------- _row_report = mUI.MelHLayout(_inside ,ut='cgmUIInstructionsTemplate',h=20) self.uiField_report = mUI.MelLabel(_row_report, bgc = SHARED._d_gui_state_colors.get('help'), label = '...', h=20) _row_report.layout() """ return _inside
def buildColumn_main(self,parent,asScroll=False): """ Trying to put all this in here so it's insertable in other uis """ self._d_transformAttrFields = {} self._d_transformRows = {} self._d_transformCBs = {} self._mTransformTarget = False if asScroll: _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') else: _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- _row_objLoad = mUI.MelHSingleStretchLayout(_inside,ut='cgmUITemplate',padding = 5) mUI.MelSpacer(_row_objLoad,w=10) mUI.MelLabel(_row_objLoad, l='Source:') uiTF_objLoad = mUI.MelLabel(_row_objLoad,ut='cgmUITemplate',l='', en=True) #self.uiPopUpMenu_dynChild = mUI.MelPopupMenu(_utf_objLoad,button = 1) #mc.menuItem(self.uiPopUpMenu_dynChild,l='Select',c=lambda *a:(self._mNode.select())) self.uiTF_objLoad = uiTF_objLoad cgmUI.add_Button(_row_objLoad,'<<', cgmGEN.Callback(uiFunc_load_selected,self), "Load first selected object.") cgmUI.add_Button(_row_objLoad,'Update', cgmGEN.Callback(uiFunc_updateFields,self), "Update with current values.") cgmUI.add_Button(_row_objLoad,'Ctxt', cgmGEN.Callback(uiFunc_getTargets,self), "Get Targets") _row_objLoad.setStretchWidget(uiTF_objLoad) mUI.MelSpacer(_row_objLoad,w=10) """ _row_objLoad.layout() #>>>Report --------------------------------------------------------------------------------------- _row_report = mUI.MelHLayout(_inside ,ut='cgmUIInstructionsTemplate',h=20) self.uiField_report = mUI.MelLabel(_row_report, bgc = SHARED._d_gui_state_colors.get('help'), label = '...', h=20) _row_report.layout() """ #buildRow_space(self,_inside,'source',__l_spaceModes) #buildRow_space(self,_inside,'targets',__l_spaceModes) buildRow_lockSource(self,_inside) buildRow_tweak(self, _inside) mc.setParent(_inside) cgmUI.add_SectionBreak() mc.setParent(_inside) mc.text('VALUES',align = 'center',bgc = cgmUI.guiBackgroundColor) #cgmUI.add_Header('Values') cgmUI.add_SectionBreak() buildRow_vector(self,_inside,'translate') buildRow_vector(self,_inside,'position') buildRow_vector(self,_inside,'rotate') buildRow_vector(self,_inside,'orient') buildRow_vector(self,_inside,'rotateAxis') buildRow_vector(self,_inside,'jointOrient') buildRow_vector(self,_inside,'scale') buildRow_vector(self,_inside,'scaleLossy',tweak=False) buildRow_vector(self,_inside,'scalePivot',tweak=False) uiFunc_load_selected(self) return _inside
def buildOptions(self,parent, asScroll = False): if asScroll: _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') else: _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- mc.setParent(_inside) cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC) mUI.MelSpacer(_row,w=5) mUI.MelLabel(_row,l='Auto Link by') _row.setStretchWidget( mUI.MelSeparator(_row) ) cgmUI.add_Button(_row,'Name', cgmGEN.Callback(self.uiFunc_link_by_name,self), _d_annotations.get('linkName','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'Distance', cgmGEN.Callback(self.uiFunc_link_by_distance,self), _d_annotations.get('linkDistance','fix'), bgc=_buttonBGC) mUI.MelSpacer(_row,w=5) _row.layout() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 1,bgc=_subLineBGC) mUI.MelSpacer(_row,w=9) mUI.MelLabel(_row,l='Set Target Constraint to') _row.setStretchWidget( mUI.MelSeparator(_row) ) cgmUI.add_Button(_row,'Point/Orient', cgmGEN.Callback(self.uiFunc_set_constraint_type,1,True,self), _d_annotations.get('setPointOrient','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'A', cgmGEN.Callback(self.uiFunc_set_constraint_type,1,False,self), _d_annotations.get('setPointOrientAll','fix'), bgc=_buttonBGC) mUI.MelSpacer(_row,w=4) cgmUI.add_Button(_row,'Orient', cgmGEN.Callback(self.uiFunc_set_constraint_type,0,True,self), _d_annotations.get('setOrient','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'A', cgmGEN.Callback(self.uiFunc_set_constraint_type,1,False,self), _d_annotations.get('setOrientAll','fix'), bgc=_buttonBGC) mUI.MelSpacer(_row,w=9) _row.layout() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC) mUI.MelSpacer(_row,w=5) mUI.MelLabel(_row,l='Set Connection Pose') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.cb_set_connection_at_bake = mUI.MelCheckBox(_row, v = self.var_mocap_set_connection_at_bake.value, onCommand = lambda *a: self.var_mocap_set_connection_at_bake.setValue(1), offCommand = lambda *a: self.var_mocap_set_connection_at_bake.setValue(0), label="Set On Bake") cgmUI.add_Button(_row,'Manual Set', cgmGEN.Callback(self.uiFunc_set_connection_pose,1,self), _d_annotations.get('setConnectionPose','fix'), bgc = [.5,.2,0.2]) mUI.MelSpacer(_row,w=5) _row.layout() # Bake Options timelineInfo = SEARCH.get_time('slider') mc.setParent(_inside) cgmUI.add_Header("Bake Options", overrideUpper = True) cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC) #self.timeSubMenu.append( _row ) mUI.MelSpacer(_row,w=5) mUI.MelLabel(_row,l='Set Timeline Range') _row.setStretchWidget( mUI.MelSeparator(_row) ) cgmUI.add_Button(_row,'Slider', cgmGEN.Callback(self.uiFunc_updateTimeRange,'slider'), _d_annotations.get('sliderRange','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'Sel', cgmGEN.Callback(self.uiFunc_updateTimeRange,'selected'), _d_annotations.get('selectedRange','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'Scene', cgmGEN.Callback(self.uiFunc_updateTimeRange,'scene'), _d_annotations.get('sceneRange','fix'), bgc=_buttonBGC) mUI.MelSpacer(_row,w=5) _row.layout() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate', padding=5,bgc=_subLineBGC) mUI.MelSpacer(_row,w=5) mUI.MelLabel(_row,l='Bake Range') _row.setStretchWidget( mUI.MelSeparator(_row) ) mUI.MelLabel(_row,l='start') self.startFrameField = mUI.MelIntField(_row,'cgmLocWinStartFrameField', width = 40, value= timelineInfo[0]) mUI.MelLabel(_row,l='end') self.endFrameField = mUI.MelIntField(_row,'cgmLocWinEndFrameField', width = 40, value= timelineInfo[1]) cgmUI.add_Button(_row,' <<', cgmGEN.Callback(self.uiFunc_bake,'back'), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), _d_annotations.get('<<<','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'Bake', cgmGEN.Callback(self.uiFunc_bake,'all'), _d_annotations.get('All','fix'), bgc=_buttonBGC) cgmUI.add_Button(_row,'>>', cgmGEN.Callback(self.uiFunc_bake,'forward'), _d_annotations.get('>>>','fix'), bgc=_buttonBGC) mUI.MelSpacer(_row,w=5) _row.layout() mc.setParent(_inside) cgmUI.add_LineSubBreak() return _inside
def uiFunc_build_post_keyframe_to_motion_curve_column(self): parentColumn = self._postProcessOptionsColumn parentColumn.clear() # Debug # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Additional Options:') _row.setStretchWidget(mUI.MelSeparator(_row)) mUI.MelLabel(_row, l='Debug:') self.uiCB_post_debug = mUI.MelCheckBox( _row, en=True, v=False, label='', ann='Debug locators will not be deleted so you could see what happened' ) mUI.MelLabel(_row, l='Show Bake:') self.uiCB_post_show_bake = mUI.MelCheckBox(_row, en=True, v=False, label='', ann='Show the bake process') mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Debug # Bake Trajectory Aim Button # _row = mUI.MelHLayout(parentColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Bake Keyframes to Motion Curve', cgmGEN.Callback(uiFunc_bake_keyframe_to_motion_curve, self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake Keyframes to Motion Curve', h=30) _row.layout() # # End Bake Dragger Button mc.setParent(parentColumn) cgmUI.add_LineSubBreak()
def uiFunc_build_post_trajectory_aim_column(self): parentColumn = self._postProcessOptionsColumn parentColumn.clear() # Aim # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) self._post_row_aimDirection = _row mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Aim:') _row.setStretchWidget(mUI.MelSeparator(_row)) directions = ['x+', 'x-', 'y+', 'y-', 'z+', 'z-'] mUI.MelLabel(_row, l='Fwd:') self.post_fwdMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate', changeCommand=cgmGEN.Callback( uiFunc_setPostAim, self)) for dir in directions: self.post_fwdMenu.append(dir) self.post_fwdMenu.setValue(self._optionDict['aimFwd']) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Up:') self.post_upMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate', changeCommand=cgmGEN.Callback( uiFunc_setPostAim, self)) for dir in directions: self.post_upMenu.append(dir) self.post_upMenu.setValue(self._optionDict['aimUp']) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Aim # Post Damp # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Damp:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_damp = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=15) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Damp mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Debug # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Show Bake:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiCB_post_show_bake = mUI.MelCheckBox(_row, en=True, v=False, label='', ann='Show the bake process') mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Debug # Bake Trajectory Aim Button # _row = mUI.MelHLayout(parentColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Bake Trajectory Aim', cgmGEN.Callback(uiFunc_bake_trajectory_aim, self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake Trajectory Aim', h=30) _row.layout() # # End Bake Dragger Button mc.setParent(parentColumn) cgmUI.add_LineSubBreak()
def uiFunc_build_options_column(self): mc.setParent(self._optionColumn) cgmUI.add_LineSubBreak() # Mode # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Mode:') _row.setStretchWidget( mUI.MelSeparator(_row) ) uiRC = mUI.MelRadioCollection() _on = self._optionDict['mode'] for i,item in enumerate(['position','aim']): if item == _on: _rb = True else:_rb = False uiRC.createButton(_row,label=item,sl=_rb, onCommand = cgmGEN.Callback(uiFunc_setModeOption,self,'mode', item)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Mode mc.setParent(self._optionColumn) cgmUI.add_LineSubBreak() # Plane # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Plane:') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.planeMenu = mUI.MelOptionMenu(_row,useTemplate = 'cgmUITemplate') for option in _planeOptionsPosition: self.planeMenu.append(option) self.planeMenu.setValue( self._optionDict['plane'] ) self.planeMenu(edit=True, changeCommand=cgmGEN.Callback(uiFunc_set_plane,self)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Plane # Aim # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5, vis=False) self._row_aimDirection = _row mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Aim:') _row.setStretchWidget( mUI.MelSeparator(_row) ) directions = ['x+', 'x-', 'y+', 'y-', 'z+', 'z-'] mUI.MelLabel(_row,l='Fwd:') self.fwdMenu = mUI.MelOptionMenu(_row,useTemplate = 'cgmUITemplate', changeCommand=cgmGEN.Callback(uiFunc_setAim,self)) for dir in directions: self.fwdMenu.append(dir) self.fwdMenu.setValue(self._optionDict['aimFwd']) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Up:') self.upMenu = mUI.MelOptionMenu(_row,useTemplate = 'cgmUITemplate', changeCommand=cgmGEN.Callback(uiFunc_setAim,self)) for dir in directions: self.upMenu.append(dir) self.upMenu.setValue(self._optionDict['aimUp']) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Aim # mc.setParent(self._optionColumn) # cgmUI.add_LineSubBreak() # Plane Object # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) self._row_planeObject = _row mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Plane Object:') self.uiTF_planeObject = mUI.MelLabel(_row,ut='cgmUIInstructionsTemplate',l='',en=False) _row.setStretchWidget( self.uiTF_planeObject ) cgmUI.add_Button(_row,'<<', cgmGEN.Callback(uiFunc_load_planeObject,self), "Load first selected object.") cgmUI.add_Button(_row,'Create', cgmGEN.Callback(uiFunc_create_planeObject,self), "Load first selected object.") mUI.MelSpacer(_row,w=_padding) _row.layout() self._row_planeObject(edit=True, vis=False) # # End Plane Object # Record Mode # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Record Mode:') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.recordMenu = mUI.MelOptionMenu(_row,useTemplate = 'cgmUITemplate') for option in ['replace', 'combine']: self.recordMenu.append(option) self.recordMenu.setValue( self._optionDict['recordMode'] ) self.recordMenu(edit=True, changeCommand=cgmGEN.Callback(uiFunc_set_record_mode,self)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Record Mode # Loop Time # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Loop Time:') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.uiCB_loopTime = mUI.MelCheckBox(_row,en=True, v = self._optionDict['loopTime'], label = '', ann='Should time loop to start after reaching the end', cc=cgmGEN.Callback(uiFunc_set_loop_time,self)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Loop Time # Post Blend Frames # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Post Blend Frames:') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.uiIF_postBlendFrames = mUI.MelIntField(_row, ut='cgmUISubTemplate', w= 50, v=self._optionDict['postBlendFrames'], cc=cgmGEN.Callback(uiFunc_set_post_blend_frames,self)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Post Blend Frames # Debug # _row = mUI.MelHSingleStretchLayout(self._optionColumn,ut='cgmUISubTemplate',padding = 5) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Debug:') _row.setStretchWidget( mUI.MelSeparator(_row) ) self.uiCB_debug = mUI.MelCheckBox(_row,en=True, v = self._optionDict['loopTime'], label = '', ann='Various debug junk might stick around after recording', cc=cgmGEN.Callback(uiFunc_set_debug,self)) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Debug mc.setParent(self._optionColumn) cgmUI.add_LineSubBreak()
def build_layoutWrapper(self,parent): _str_func = 'build_layoutWrapper' #self._d_uiCheckBoxes = {} #_MainForm = mUI.MelFormLayout(parent,ut='cgmUISubTemplate') _MainForm = mUI.MelFormLayout(self,ut='cgmUITemplate') _mainScroll = mUI.MelScrollLayout(_MainForm,useTemplate = 'cgmUIHeaderTemplate') _mappingFrame = mUI.MelFrameLayout(_mainScroll, label='Create Mapping', collapsable=True, collapse=False,useTemplate = 'cgmUIHeaderTemplate') self.mappingColumn = mUI.MelColumnLayout(_mappingFrame,useTemplate = 'cgmUISubTemplate') buildColumn_create_mapping(self) _loadMappingFrame = mUI.MelFrameLayout(_mainScroll, label='Load Mappings', collapsable=True, collapse=False,useTemplate = 'cgmUIHeaderTemplate') self.loadMappingColumn = mUI.MelColumnLayout(_loadMappingFrame,useTemplate = 'cgmUISubTemplate') _row = mUI.MelHSingleStretchLayout(self.loadMappingColumn,ut='cgmUISubTemplate',padding = _padding, height=75+_padding) mUI.MelSpacer(_row,w=_padding) _colorColumn = mUI.MelColumnLayout(_row,useTemplate = 'cgmUIHeaderTemplate', height=75 ) self.mappingListTSL = cgmUI.cgmScrollList(_colorColumn, numberOfRows = 4, height=75) mUI.MelSpacer(_row,w=_padding) _row.setStretchWidget(_colorColumn) _row.layout() mc.setParent(self.loadMappingColumn) cgmUI.add_LineSubBreak() _row = mUI.MelHLayout(self.loadMappingColumn,ut='cgmUISubTemplate',padding = _padding*2) cgmUI.add_Button(_row,'Load From File', cgmGEN.Callback(uiFunc_load,self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Load a mapping from file',h=30) cgmUI.add_Button(_row,'Remove Mapping', cgmGEN.Callback(uiFunc_remove_mapping,self), 'Remove selected mapping',h=30) _row.layout() mc.setParent(self.loadMappingColumn) cgmUI.add_LineSubBreak() # Start GamePad Button # #_row = mUI.MelHLayout(_mainScroll,ut='cgmUISubTemplate',padding = _padding*2) self.animDrawBtn = cgmUI.add_Button(_mainScroll,'Start GamePad', cgmGEN.Callback(start_controller,self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Start Gamepad Button',h=50) #_row.layout() # # End Recording Button _row_cgm = cgmUI.add_cgmFooter(_MainForm) _MainForm(edit = True, af = [(_mainScroll,"top",0), (_mainScroll,"left",0), (_mainScroll,"right",0), (_row_cgm,"left",0), (_row_cgm,"right",0), (_row_cgm,"bottom",0), ], ac = [(_mainScroll,"bottom",2,_row_cgm), ], attachNone = [(_row_cgm,"top")])
def buildColumn_create_mapping(self): """ Trying to put all this in here so it's insertable in other uis """ self.mappingColumn.clear() # if asScroll: # _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') # else: # _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- _inside = self.mappingColumn mc.setParent(_inside) cgmUI.add_LineSubBreak() _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row,w=_padding) mUI.MelLabel(_row,l='Name:') self.nameTF = mUI.MelTextField(_row, text=self.connectionDict['name'], editable = True, bgc=[0,0,0], cc=cgmGEN.Callback(uiFunc_update_connectionDict_name,self)) _row.setStretchWidget(self.nameTF) mUI.MelSpacer(_row,w=_padding) _row.layout() mc.setParent(_inside) cgmUI.add_LineSubBreak() controllerConnections = [ ['Left Stick Horizontal', 'LStickHorizontal'], ['Left Stick Vertical', 'LStickVertical'], ['Right Stick Horizontal', 'RStickHorizontal'], ['Right Stick Vertical', 'RStickVertical'], ['Left Trigger', 'LTrigger'], ['Right Trigger', 'RTrigger'] ] for con in controllerConnections: _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row,w=_padding) _subColumn = mUI.MelColumnLayout(_row,useTemplate = 'cgmUIHeaderTemplate') _conFrame = mUI.MelFrameLayout(_subColumn, label=con[0], collapsable=True, collapse=True,useTemplate = 'cgmUIHeaderTemplate') _conColumn = mUI.MelColumnLayout(_conFrame,useTemplate = 'cgmUIHeaderTemplate') uiFunc_build_controller_connection_column(self, _conColumn, con[1]) _row.setStretchWidget(_subColumn) mUI.MelSpacer(_row,w=_padding) _row.layout() mc.setParent(_inside) cgmUI.add_LineSubBreak() # Add/Clear Mapping Buttons # _row = mUI.MelHLayout(_inside,ut='cgmUISubTemplate',padding = _padding*2) cgmUI.add_Button(_row,'Add Mapping', cgmGEN.Callback(uiFunc_add_mapping_to_list,self), 'Add Mapping Button',h=30) cgmUI.add_Button(_row,'Clear Mapping', cgmGEN.Callback(uiFunc_clear_connection_dict,self), 'Add Mapping Button',h=30) _row.layout() # # End Add/Clear Mapping Buttons mc.setParent(_inside) cgmUI.add_LineSubBreak() return _inside
def uiFunc_build_post_spring_column(self): parentColumn = self._postProcessOptionsColumn parentColumn.clear() # Aim # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) self._post_row_aimDirection = _row mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Aim:') _row.setStretchWidget(mUI.MelSeparator(_row)) directions = ['x+', 'x-', 'y+', 'y-', 'z+', 'z-'] mUI.MelLabel(_row, l='Fwd:') self.post_fwdMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate', changeCommand=cgmGEN.Callback( uiFunc_setPostAim, self)) for dir in directions: self.post_fwdMenu.append(dir) self.post_fwdMenu.setValue(self._optionDict['aimFwd']) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Up:') self.post_upMenu = mUI.MelOptionMenu(_row, useTemplate='cgmUITemplate', changeCommand=cgmGEN.Callback( uiFunc_setPostAim, self)) for dir in directions: self.post_upMenu.append(dir) self.post_upMenu.setValue(self._optionDict['aimUp']) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Aim # Spring # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Spring Force:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_spring = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=1.0) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Spring mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Post Damp # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Damp:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_damp = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=.1) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Damp # Spring # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Angular Spring Force:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_angularSpring = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=1.0) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Spring mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Post Damp # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Angular Damp:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_angularDamp = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=.1) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Damp mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Post Object Scale # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Object Scale:') _row.setStretchWidget(mUI.MelSeparator(_row)) self.uiFF_post_object_scale = mUI.MelFloatField(_row, ut='cgmUISubTemplate', w=50, v=10.0) mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Object Scale mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Debug # _row = mUI.MelHSingleStretchLayout(parentColumn, ut='cgmUISubTemplate', padding=5) mUI.MelSpacer(_row, w=_padding) mUI.MelLabel(_row, l='Additional Options:') _row.setStretchWidget(mUI.MelSeparator(_row)) mUI.MelLabel(_row, l='Debug:') self.uiCB_post_debug = mUI.MelCheckBox( _row, en=True, v=False, label='', ann='Debug locators will not be deleted so you could see what happened' ) mUI.MelLabel(_row, l='Show Bake:') self.uiCB_post_show_bake = mUI.MelCheckBox(_row, en=True, v=False, label='', ann='Show the bake process') mUI.MelSpacer(_row, w=_padding) _row.layout() # # End Debug mc.setParent(parentColumn) cgmUI.add_LineSubBreak() # Bake Spring Button # _row = mUI.MelHLayout(parentColumn, ut='cgmUISubTemplate', padding=_padding * 2) cgmUI.add_Button( _row, 'Bake Spring', cgmGEN.Callback(uiFunc_bake_spring, self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Bake Spring', h=30) _row.layout() # # End Bake Spring Button mc.setParent(parentColumn) cgmUI.add_LineSubBreak()
def buildColumn_main(self,parent, asScroll = False): """ Trying to put all this in here so it's insertable in other uis """ if asScroll: _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') else: _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') #>>>Objects Load Row --------------------------------------------------------------------------------------- _row_objLoad = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row_objLoad,w=_padding) mUI.MelLabel(_row_objLoad, l='Target:') self.uiTF_objLoad = mUI.MelLabel(_row_objLoad,ut='cgmUIInstructionsTemplate',l='',en=True) _row_objLoad.setStretchWidget(self.uiTF_objLoad) mUI.MelSpacer(_row_objLoad,w=_padding) _row_objLoad.layout() mc.setParent(_inside) cgmUI.add_LineSubBreak() # Options Frame # _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row,w=_padding) _subColumn = mUI.MelColumnLayout(_row,useTemplate = 'cgmUIHeaderTemplate') _optionFrame = mUI.MelFrameLayout(_subColumn, label='Options', collapsable=True, collapse=True,useTemplate = 'cgmUIHeaderTemplate') self._optionColumn = mUI.MelColumnLayout(_optionFrame,useTemplate = 'cgmUIHeaderTemplate') uiFunc_build_options_column(self) _row.setStretchWidget(_subColumn) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Options Frame mc.setParent(_inside) cgmUI.add_LineSubBreak() # Recording Button # _row = mUI.MelHLayout(_inside,ut='cgmUISubTemplate',padding = _padding*2) self.animDrawBtn = cgmUI.add_Button(_row,'Start Recording Context', cgmGEN.Callback(uiFunc_toggleContext,self), #lambda *a: attrToolsLib.doAddAttributesToSelected(self), 'Start Live Record',h=50) _row.layout() # # End Recording Button mc.setParent(_inside) cgmUI.add_LineSubBreak() # Instructions Label # _row = mUI.MelHLayout(_inside,ut='cgmUISubTemplate',padding = _padding*2) self._infoLayout = _row self._infoLayout(edit=True, vis=False) mUI.MelLabel(_row,ut='cgmUIInstructionsTemplate',l='Left Drag: Draw - Ctrl Left Drag: Reposition - Right Click: Cache Data',en=True) _row.layout() # # End Instructions # Post Process Frame # _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = _padding) mUI.MelSpacer(_row,w=_padding) _subColumn = mUI.MelColumnLayout(_row,useTemplate = 'cgmUIHeaderTemplate') _postProcessFrame = mUI.MelFrameLayout(_subColumn, label='Post Process Animation', collapsable=True, collapse=True,useTemplate = 'cgmUIHeaderTemplate') self._postProcessColumn = mUI.MelColumnLayout(_postProcessFrame,useTemplate = 'cgmUIHeaderTemplate') AFT.uiFunc_build_post_process_column(self, self._postProcessColumn) _row.setStretchWidget(_subColumn) mUI.MelSpacer(_row,w=_padding) _row.layout() # # End Post Process Frame return _inside