Blender Git Commit Log

Git Commits -> Revision 55efa17

Revision 55efa17 by Sergey Sharybin (master)
September 11, 2020, 09:49 (GMT)
Particles: Allow python to write hair keys

Add a function HairKey.co_object_set() which can be used to modify hair
keys positions in a way that hair strands respects the new coordinates,
without doing extra trickery with edit mode toggle. The naming comes
from existing HairKey.co_object().

The usage is a bit tricky:

- The function is to be called on the hair key from an original object.
- The arguments are to be passed from evaluated object.

Basically:

hair_key_orig.co_object_set(object_eval, modifier_eval, particle_eval)

This is required because coordinate space conversion needs to know
evaluated state of the hair system in order to access hair space
matrix. It is a deliberate choice to not pass dependency graph and not
to do lookup of evaluated ID on every call of co_object_set() to keep
performance on a manageable levels.

One requirement is that the hair strands are to be calculated once, by,
for example, toggling particle edit mode. Without this there will be no
`particles` to access hair keys from in the original object.

Such functionality is something what got lost during 2.80 development
and is something what is needed here at the studio.

Below is the file with more complete example: convert strands from mesh
edges to actual particle system hair strands. The viewport refresh is
sometimes missing, and this does not seem to be related to this specific
change.

{F8858104}

Differential Revision: https://developer.blender.org/D8849

Commit Details:

Full Hash: 55efa1795f62bb99dcf4becc046269117032015e
Parent Commit: 218e9e7
Lines Changed: +109, -19

1 Modified Path:

/source/blender/makesrna/intern/rna_particle.c (+109, -19) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021