[Bf-python] Vertex normal bug?
Ryan Southall
R.Southall at brighton.ac.uk
Wed Feb 27 19:06:23 CET 2013
Yep. That got it. Thanks both.
Ryan
CoDEmanX <codemanx at gmx.de> wrote:
Brecht is right, face normals update automatically, but vertex normals
don't. Here's some code for the proof (run it on an object which you
rotated):
import bpy
from bpy import context as C
me1=C.object.to_mesh(C.scene, True, 'PREVIEW', False)
me2=C.object.to_mesh(C.scene, True, 'PREVIEW', False)
me1.transform(C.object.matrix_world)
print("Normal updated?", me1.vertices[0].normal != me2.vertices[0].normal)
me1.update()
print("Normal updated?", me1.vertices[0].normal != me2.vertices[0].normal)
Am 27.02.2013 16:53, schrieb Brecht Van Lommel:
> On Tue, Feb 26, 2013 at 11:25 PM, Ryan Southall
> <R.Southall at brighton.ac.uk> wrote:
>> I have a script that uses
>> Code:
>> mesh = obj.to_mesh(bpy.context.scene, True, 'PREVIEW', calc_tessface=False)
>> mesh.transform(obj.matrix_world)
>>
>> to give me world data for an object obj. This correctly returns world space
>> face normals & position, and vertex position, but incorrect vertex normals.
>> I have to accept first any rotation of the object to get correct vertex
>> normals.
>
> I think you have to call mesh.update() to recalculate the vertex
> normals. This is not done on every operation for performance reasons.
> The face normals are computed on the fly from vertex positions so
> those would be up to date automatically.
>
> Brecht.
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
_______________________________________________
Bf-python mailing list
Bf-python at blender.org
http://lists.blender.org/mailman/listinfo/bf-python
___________________________________________________________
This email has been scanned by MessageLabs' Email Security
System on behalf of the University of Brighton.
For more information see http://www.brighton.ac.uk/is/spam/
___________________________________________________________
___________________________________________________________
This email has been scanned by MessageLabs' Email Security
System on behalf of the University of Brighton.
For more information see http://www.brighton.ac.uk/is/spam/
___________________________________________________________
More information about the Bf-python
mailing list