diff options
author | Sergey Sharybin <sergey@blender.org> | 2020-09-09 16:54:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2020-09-11 12:49:34 +0300 |
commit | 55efa1795f62bb99dcf4becc046269117032015e (patch) | |
tree | d4d198fd3ef0b0265d733841afaff3500c700e07 /source/blender/windowmanager | |
parent | 218e9e76a8b7a737ac9277e54de009461b43ecf8 (diff) |
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
Diffstat (limited to 'source/blender/windowmanager')
0 files changed, 0 insertions, 0 deletions