def on_buildRig( self, e=None ): autoFinalize = True curScene = Path( cmd.file( q=True, sn=True ) ) referenceModel = self.UI_reference.getValue() if referenceModel: if not curScene: api.doConfirm( t='Scene not saved!', m="Looks like your current scene isn't saved\n\nPlease save it first so I know where to save the rig. thanks!", b=('OK',), db='OK' ) return rigPrimitives.buildRigForModel( None, autoFinalize, referenceModel )
def on_buildRig( self, e=None ): curScene = Path( cmd.file( q=True, sn=True ) ) referenceModel = self.UI_reference.getValue() if referenceModel: if not curScene: api.doConfirm( t='Scene not saved!', m="Looks like your current scene isn't saved\n\nPlease save it first so I know where to save the rig. thanks!", b=('OK',), db='OK' ) return deletePlacers = self.UI_deletePlacers.getValue() rigPrimitives.buildRigForModel( referenceModel=referenceModel, deletePlacers=deletePlacers ) for partUI in self.UI_partForms: partUI.updateBuildRigButton()
def on_buildRig( self, e=None ): curScene = Path( cmd.file( q=True, sn=True ) ) referenceModel = self.UI_reference.getValue() if referenceModel: if not curScene: api.doConfirm( t='Scene not saved!', m="Looks like your current scene isn't saved\n\nPlease save it first so I know where to save the rig. thanks!", b=('OK',), db='OK' ) return rigPrimitives.buildRigForModel( referenceModel=referenceModel, deletePlacers=False ) #if the model is being referenced run populate to update the rig part instances - container names will have changed because they're now referenced if referenceModel: self.populate() #if we're not referencing the model however, its safe to just run the updateBuildRigButton method on all rig part UI instances else: for partUI in self.UI_partForms: partUI.updateBuildRigButton()
def on_buildRig(self, e=None): curScene = Path(cmd.file(q=True, sn=True)) referenceModel = self.UI_reference.getValue() if referenceModel: if not curScene: api.doConfirm( t='Scene not saved!', m= "Looks like your current scene isn't saved\n\nPlease save it first so I know where to save the rig. thanks!", b=('OK', ), db='OK') return deletePlacers = self.UI_deletePlacers.getValue() rigPrimitives.buildRigForModel(referenceModel=referenceModel, deletePlacers=deletePlacers) for partUI in self.UI_partForms: partUI.updateBuildRigButton()
def promptForSubmit( self, files ): ''' handles asking the user whether they want to submit changes - called after any file operation that happens in the global locale ''' ans = api.doConfirm(t='submit files?', m='do you want to submit the files?', b=api.ui_QUESTION, db=api.YES) p4 = P4File() change = p4.getChangeNumFromDesc('presetManager auto submit') for f in files: p4.setChange(change, f) if ans == api.YES: print 'submitting change', change p4.submit(change)
jScale = skinCluster.getJointScale(j) ctrl = mel.zooBuildControl('%s_control' % j, '-axis %s -scale %s -type sphere -colour orange 0.7 -orient 1 -place %s -align %s -constrain 1 -parent %s' % (kFWD_AXIS, jScale, j, j, world)) cmd.sets(ctrl, add=qss) ctrlSpace = cmd.listRelatives(ctrl, p=True, pa=True)[0] jointControls[j] = ctrlSpace #now parent the controls to mirror the heirarchy of the joints they control for j, ctrl in jointControls.iteritems(): #does teh joint have a parent? if so, parent the control to control controlling the joint's parent. make sense? 8-o try: jParent = cmd.listRelatives(j, p=True, pa=True)[0] except TypeError: continue try: cmd.parent(ctrl, jointControls[jParent]) except KeyError: pass rigFile = curFile.up() / ('%s_rig.ma' % propName) cmd.file(rename=str(rigFile)) cmd.file(save=True, f=True) rigFileP4 = rigFile.asP4() rigFileP4.add() rigFileP4.setChange( curFile.asP4().getChange() ) print 'change is:', rigFileP4.getChange(), curFile.asP4().getChange() api.doConfirm(t="rig created!", m="a rig has been created for this prop!\n\nfeel free to add/modify this rig as you see fit. If the controls are too\nbig/small, select the verts for the controls and scale them accordingly", b=('THANKS!',)) #end
#now parent the controls to mirror the heirarchy of the joints they control for j, ctrl in jointControls.iteritems(): #does teh joint have a parent? if so, parent the control to control controlling the joint's parent. make sense? 8-o try: jParent = cmd.listRelatives(j, p=True, pa=True)[0] except TypeError: continue try: cmd.parent(ctrl, jointControls[jParent]) except KeyError: pass rigFile = curFile.up() / ('%s_rig.ma' % propName) cmd.file(rename=str(rigFile)) cmd.file(save=True, f=True) rigFileP4 = rigFile.asP4() rigFileP4.add() rigFileP4.setChange(curFile.asP4().getChange()) print 'change is:', rigFileP4.getChange(), curFile.asP4().getChange() api.doConfirm( t="rig created!", m= "a rig has been created for this prop!\n\nfeel free to add/modify this rig as you see fit. If the controls are too\nbig/small, select the verts for the controls and scale them accordingly", b=('THANKS!', )) #end