#NEWLINE# def auto_rivet( ) : #NEWLINE# #INDENT# 'creates hair follicles around selection\n    ' #NEWLINE# sel_list = pm . ls ( sl = 1 ) #NEWLINE# objects = sel_list [ : ( - 1 ) ] #NEWLINE# geo = sel_list [ ( - 1 ) ] #NEWLINE# geo_shape = geo . getShape ( ) #NEWLINE# follicles = [ ] #NEWLINE# for obj in objects : #NEWLINE# #INDENT# pivot = obj . getRotatePivot ( space = 'world' ) #NEWLINE# uv = geo_shape . getUVAtPoint ( pivot , space = 'world' ) #NEWLINE# follicle = pm . nt . Follicle ( ) #NEWLINE# follicles . append ( follicle ) #NEWLINE# follicle . simulationMethod . set ( 0 ) #NEWLINE# ( geo_shape . worldMatrix >> follicle . inputWorldMatrix ) #NEWLINE# ( geo_shape . outMesh >> follicle . inputMesh ) #NEWLINE# follicle . parameterU . set ( uv [ 0 ] ) #NEWLINE# follicle . parameterV . set ( uv [ 1 ] ) #NEWLINE# follicle_transform = follicle . getParent ( ) #NEWLINE# ( follicle . outTranslate >> follicle_transform . translate ) #NEWLINE# ( follicle . outRotate >> follicle_transform . rotate ) #NEWLINE# pm . parent ( obj , follicle_transform ) #NEWLINE# #UNINDENT# return follicles