[Bf-committers] New BMesh API to set normals

Bastien Montagne montagne29 at wanadoo.fr
Wed Jun 8 09:11:03 CEST 2016


Yes, in custom-normals-bmesh branch (don’t think it’s ready yet for 
master, needs at least a bit more testing ;) ).

Le 08/06/2016 03:17, Howard Trickey a écrit :
> Bastien, was your BMesh custom normal addition committed? I can't seem to
> find it.
>
> On Tue, Jun 7, 2016 at 4:31 PM Howard Trickey <howard.trickey at gmail.com>
> wrote:
>
>> Wonderful! Thanks for the very quick work, Bastien.
>>
>> On Tue, Jun 7, 2016, 4:17 PM Bastien Montagne <montagne29 at wanadoo.fr>
>> wrote:
>>
>>> Hi devs,
>>>
>>> Today Howard requested the ability to set custom normals in BMesh (Edit
>>> mode tools). While we are far from ready to have a real normal editing
>>> feature/mode/whatever in Edit mode currently, I made a quick port of
>>> BKE_mesh_evaluate code to set normals, in the new `custom-normals-bmesh`
>>> branch for now.
>>>
>>> As with non-bmesh code, currently you can only set all normals (either
>>> per-loop or per-vertex) at once, since this is not a cheap operation.
>>>
>>> Also added a python bmesh.utils.custom_normals_set() api func, at least
>>> to allow easy testing of the feature, e.g. with default cube in Edit mode:
>>>
>>>   >>> import bmesh
>>>   >>> bm = bmesh.from_edit_mesh(C.edit_object.data)
>>>   >>> nors = sum(zip(((0, 0, 1),) * 4, (None,) * 4), ())  # Produces an
>>> 8-items tuples of Z-up vectors and None's
>>>   >>> # Set those vertex custom normals into bm, 'None' ones keeping
>>> default auto-computed normals.
>>>   >>> bmesh.utils.custom_normals_set(bm, nors)
>>> ((0.0, 0.0, 1.0), (0.5773502588272095, -0.577350378036499,
>>> -0.5773503184318542), (0.0, 0.0, 1.0), (-0.5773501396179199,
>>> 0.5773504972457886, -0.5773503184318542), (0.0, 0.0, 1.0),
>>> (0.5773500204086304, -0.5773505568504333, 0.5773503184318542), (0.0,
>>> 0.0, 1.0), (-0.5773501992225647, 0.5773503184318542, 0.5773503184318542))
>>>
>>> Testing and feedback is most welcome!
>>>
>>> Cheers,
>>> Bastien
>>> _______________________________________________
>>> Bf-committers mailing list
>>> Bf-committers at blender.org
>>> https://lists.blender.org/mailman/listinfo/bf-committers
>>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> https://lists.blender.org/mailman/listinfo/bf-committers
>



More information about the Bf-committers mailing list