1
$\begingroup$

enter image description here

This is the hair guide I begin with.After simulation,it looks like this in object mode.

enter image description here

But when I switch back to particle edit mode,it is still picture one.

What should I do to get simulated hair guides ? I accidentally saw the hair guides after the simulation a few times.What I want to achieve is to convert certain frame to hair guides in particle edit mode and make that frame 0.

$\endgroup$

1 Answer 1

3
$\begingroup$

It seems like it is not natively possible for now, but here is a Heveti's script

  • switch to Particle Edit - move at least one hair a bit to initiate hair editing
  • enable Hair Dynamics and Play animation to simulate hairs
  • move to frame where dynamics should be applied lt- copy&paste script into blender's Text Editor and Run Alt+P script

Now when you switch to Particle Edit, hairs are at a position of your choice so you can continue with editing. Or enable Hair Dynamics again, move on start at Timeline and run simulation agin from this point of state.

enter image description here

enter image description here

enter image description here

    import bpy

# How to use:
# 1. edit hair system (important, move at least one hair, at least a bit to initiate hair editing)
# 2. run hair dynamics
# 3. move to frame where dynamics should be applied
# 4. run script
# 5. if happy, delete cache
# 6. keep editing hair

# get the depsgraph and the evaluated object   
deps_graph = bpy.context.evaluated_depsgraph_get()
evaluated_object = bpy.context.object.evaluated_get(deps_graph)
# assume context object has a particle system (warning, no check), use active
particle_system = evaluated_object.particle_systems.active

# Variable to hold hair-verticies-coordinats
hairs = []

# At current frame
# For each particle (hair)
#   For each vertex
#     Store XYZ coordinates
for p in particle_system.particles:
    hair = []
    for v in p.hair_keys:
        hair.append([v.co[0], v.co[1], v.co[2]])
    hairs.append(hair)

# Deactivate hair dynamics
particle_system.use_hair_dynamics = False

# On static hair system
# For each particle (hair)
#   For each vertex
#     Overwrite XYZ coordinates
for p,hair in zip(particle_system.particles,hairs):
    for v,h in zip(p.hair_keys,hair):
        #print(v.co, h)
        v.co[0] = h[0]
        v.co[1] = h[1]
        v.co[2] = h[2]
        #print(v.co, h)

# Update view and UI
bpy.context.scene.frame_set(bpy.context.scene.frame_current)

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .