Exemple #1
0
	def importRefSkeleton( self, *a ):
		main = getMain()
		assert cmd.objExists( main ), "Cannot find the main control.  Please load the rig file."

		if cmd.objExists( '%s.smdModelSourceLocation' % main ):
			smdRef = Path( cmd.getAttr( '%s.smdModelSourceLocation' % main ) )
		else:
			try:
				smdRef = cmd.fileDialog( directoryMask=Path( '%VCONTENT%/%VMOD%/models/*.smd' ), mode=0, title="Browse to the Smd Reference File" )
				smdRef = Path( smdRef )
				if not smdRef.exists:
					raise Exception

				if not cmd.objExists( '%s.smdModelSourceLocation' % main ):
					cmd.addAttr( main, longName='smdModelSourceLocation', dt='string' )

				cmd.setAttr( '%s.smdModelSourceLocation' % main, smdRef << '%VCONTENT%', typ='string' )
			except Exception:
				api.melPrint( "no smd source file located - may not have been defined?" )
				return

		if not smdRef.exists:
			P4File( smdRef ).toDepotPath().sync( force=True )

		if not smdRef.exists:
			api.melPrint( "can't find reference file - tried syncing but it still doesn't exist..." )
			return

		api.importFile( smdRef )
	def on_import( self, theFile ):
		api.importFile( theFile )