Patch by Kévin Dietrich. Reviewed by: dingto Differential Revision: https://developer.blender.org/D378