Fix #106155 : Hair dynamics not working well when converted from curves

In particular, the root was not sticking to mesh with hair dynamics.
Reason for this is missing HairKey weight upon conversion (everything
had zero weight). This then can not be corrected (since weight tool does
not allow to paint on roots).

So now, give the hair a default 1.0 to 0.0 weight gradient upon
conversion [which is in line with the default weight distribution for a
hair particle system].

Pull Request: https://projects.blender.org/blender/blender/pulls/108651
This commit is contained in:
Philipp Oeser
2023-06-07 14:49:20 +02:00
committed by Philipp Oeser
parent 8c340a8bc7
commit 7b8bbabece

View File

@@ -372,7 +372,9 @@ static void try_convert_single_object(Object &curves_ob,
HairKey &key = hair_keys[key_i];
copy_v3_v3(key.co, key_pos_ha);
key.time = 100.0f * key_i / float(hair_keys.size() - 1);
const float key_fac = key_i / float(hair_keys.size() - 1);
key.time = 100.0f * key_fac;
key.weight = 1.0f - key_fac;
}
}