Skip to content

Instantly share code, notes, and snippets.

@mclavan
Last active September 17, 2021 18:58
Show Gist options
  • Save mclavan/26a081bb4008601965374e5cfd272f9f to your computer and use it in GitHub Desktop.
Save mclavan/26a081bb4008601965374e5cfd272f9f to your computer and use it in GitHub Desktop.
import pymel.core as pm
class Hair_System:
'''
This is where helpfull info goes.
'''
def __init__(self):
'''
This creates a hair system.
'''
print("Hi")
self.nucleus_node = None
self.hair_follicles = []
self.hair_follicle_grp = []
self.output_curve_grp = None
self.output_curves = []
self.hair_object = None
self.hair_system = None
pm.mel.createHair(7, 1, 10, 0, 0, 1, 0, 5, 0, 2, 1, 1)
self.hair_system = pm.ls(sl=True)[0]
self.hair_object = self.hair_system.getParent()
self.nucleus_node = self.hair_system.startFrame.connections()[0]
self.hair_follicles = self.hair_system.outputHair.connections()
self.hair_follicle_grp = self.hair_follicles[0].getParent()
self.output_curve_grp = self.hair_follicles[0].getShape().outCurve.connections()[0].getParent()
self.output_curves = self.output_curve_grp.getChildren()
def ribbon_prep(self):
pm.delete(self.nucleus_node, self.output_curve_grp, self.hair_object)
for current_follicle in self.hair_follicles:
pm.delete(current_follicle.getChildren(type='transform'))
def __str__(self):
str_line = '''Output Information:
nucleus_node = {0}
hair_follicles = {1}
hair_follicle_grp = {2}
output_curve_grp = {3}
output_curves = {4}
hair_object = {5}
hair_system = {6}'''.format(self.nucleus_node, self.hair_follicles,
self.hair_follicle_grp, self.output_curve_grp,
self.output_curves, self.hair_object, self.hair_system)
return str_line
hair1 = Hair_System()
#hair1.ribbon_prep()
print(hair1)
'''
help(hair1)
hair1.hair_system
hair2.hair_system
hair1.hair_object
dir(hair1)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment