[Bf-committers] Reading custom normals from python

Vicente vicentecarro at gmail.com
Tue May 12 02:25:29 CEST 2015


Wait wait...
I think I found something weird here.
http://i.imgur.com/QNpVtIP.png
It kind of works, but there are issues, as seen in the picture. I just 
compiled the last git version to make sure it wasn't a punctual problem.

To test it I created an array of 24 vectors (0,1,0.5). Then I apply 
those as custom normals set and then something is not right.
That's why I thought I was not reading the values but in the 3D view you 
also can see the normals are not right.

This is what I tried:

 >>> kk3=[(0.0000,1.00000,0.50000)]*24
 >>> bpy.data.meshes['Cube'].normals_split_custom_set(kk3)
 >>> me=bpy.data.meshes['Cube']
 >>> me.loops[0].normal
Vector((0.0, 0.0, 0.0))
 >>> me.calc_normals_split()
 >>> e.loops[0].normal
Vector((-4.137025825912133e-05, 0.8660094738006592, 0.5000275373458862))

 >>> me.loops[1].normal
Vector((1.204538335741745e-08, 0.8660094738006592, 0.5000275373458862))

 >>> me.loops[2].normal
Vector((2.0647271981033555e-07, 0.8660094738006592, 0.5000275373458862))

 >>> me.loops[3].normal
Vector((4.174706555204466e-05, 0.8660094738006592, 0.5000275373458862))

 >>> me.loops[4].normal
Vector((-4.121712481719442e-05, 0.8660334348678589, 0.4999861419200897))

 >>> me.loops[5].normal
Vector((4.156697104917839e-05, 0.8660333752632141, 0.4999862313270569))

 >>> me.loops[6].normal
Vector((4.3818505446324707e-07, 0.8660333752632141, 0.4999862313270569))

 >>> me.loops[7].normal
Vector((5.052871188127028e-07, 0.8660334348678589, 0.4999861419200897))

 >>> me.loops[8].normal
Vector((7.353197588599869e-07, 0.8944002389907837, 0.4472675025463104))

 >>> me.loops[9].normal
Vector((-3.555569350055521e-08, 0.8944430947303772, 0.44718173146247864))

 >>> me.loops[10].normal
Vector((7.353280579991406e-07, 0.8944218754768372, 0.44722428917884827))

 >>> me.loops[11].normal
Vector((-3.556400329784992e-08, 0.8944216966629028, 0.44722458720207214))

 >>> me.loops[12].normal
Vector((2.8310643074291875e-07, 1.0, 4.794995402335189e-05))

 >>> me.loops[13].normal
Vector((2.808291981182265e-07, 1.0, 4.794995402335189e-05))

 >>> me.loops[14].normal
Vector((2.8542120844576857e-07, 1.0, 4.842679118155502e-05))

 >>> me.loops[15].normal
Vector((2.831226595390035e-07, 1.0, 4.794995402335189e-05))

 >>> me.loops[16].normal
Vector((1.9698066466844466e-07, 0.8944217562675476, 0.4472244381904602))

 >>> me.loops[17].normal
Vector((7.777137511766341e-08, 0.8944216966629028, 0.44722455739974976))

 >>> me.loops[18].normal
Vector((1.969914507071735e-07, 0.8944430351257324, 0.44718191027641296))

 >>> me.loops[19].normal
Vector((1.9696969388860452e-07, 0.8944000601768494, 0.4472678303718567))

 >>> me.loops[20].normal
Vector((2.384185791015625e-07, 1.0, 1.6391278734317893e-07))

 >>> me.loops[21].normal
Vector((2.384185791015625e-07, 1.0, 1.6391278734317893e-07))

 >>> me.loops[22].normal
Vector((2.384185791015625e-07, 1.0, 1.6391278734317893e-07))

 >>> me.loops[23].normal
Vector((2.384185791015625e-07, 1.0, 1.6391278734317893e-07))

Something is not right, it's like it rounding some internal value. But 
you can also see that the error becomes greater as the vertex count 
increases.

Is this a bug?

Regards


On 05/11/2015 05:07 PM, Bastien Montagne wrote:
> I do not see the problem? Just compute, read, modify, set custom
> normals, compute, read, modify, set, etc.
>
> Le 11/05/2015 18:19, Vicente Carro a écrit :
>> Hi,
>>
>> Thanks for the answer but I'm not sure if that helps me (anyway I'll try it
>> later at home).
>> My script should read the custom normals and modify them, and repeat that
>> process until the user gets the desired result. So calculating stuff
>> doesn't sound what I need. What I mean is, the custom normals shuld not be
>> reset/calculated each time the user uses my script, it should rely on the
>> previous custom normals.
>>
>> Thanks
>>
>> Vicente
>>
>>
>> On 11 May 2015 at 16:01, Bastien Montagne <montagne29 at wanadoo.fr> wrote:
>>
>>> All you have to do is compute loop (split) normals
>>> (me.calc_normals_split()), and then read loops' normal member…
>>>
>>>
>>> Le 11/05/2015 17:38, Vicente Carro a écrit :
>>>> Hi,
>>>>
>>>> I've checked all the custom-normals related functions that I found but I
>>>> can not find one for simply reading the custom normals of an mesh and I
>>>> need it for an script I'm doing to precisely modify the custom normals
>>>> (based on their previous values).
>>>> Are there python function/s to read the custom normals? Else, how can I
>>>> read them?
>>>>
>>>>
>>>> Thanks
>>>> _______________________________________________
>>>> Bf-committers mailing list
>>>> Bf-committers at blender.org
>>>> http://lists.blender.org/mailman/listinfo/bf-committers
>>>>
>>> _______________________________________________
>>> Bf-committers mailing list
>>> Bf-committers at blender.org
>>> http://lists.blender.org/mailman/listinfo/bf-committers
>>>
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



More information about the Bf-committers mailing list