Slower than C++ for sure, but depending on your needs it might still be
fine. I often set normals on meshes up to about 100k verts using Python.
To create your MVector array (in Python API 2.0), something like this will
do it in less than a millisecond:
normals = [om.MVector(0,0,1)]*100000
Creating your id list takes about a millisecond too:
ids = range(100000)
Then, like Christopher said:
mesh.setVertexNormals(normals, ids)
Trying it on a sphere with 40,000 normals, I can create and set all the
normals in 0.03 seconds.
On Saturday, 25 February 2017 20:49:10 UTC+11, Justin Israel wrote:
>
>
>
> On Sat, Feb 25, 2017, 10:12 PM justin hidair <[email protected]
> <javascript:>> wrote:
>
>>
>>
>> Le samedi 25 février 2017 01:03:25 UTC-8, Justin Israel a écrit :
>>>
>>> I don't have much to offer in terms of specifics to the right api calls,
>>> but I can imagine 10k python functions calls is insanely slower than 10k
>>> C++ calls.
>>>
>>>
>> What you just said hurt my feelings lol I don't like that
>>
>
> Hah. I'm sorry to be the bearer of bad news. But that benefit you gain in
> fast prototyping and expressiveness in the dynamic python language is
> always going to come at a cost. If you are comparing many of thousands of
> functions calls, attribute accesses, etc, of a dynamically typed
> interpreted language to a compiled statically typed language, you will find
> a wide gap.
>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/ec357991-0a0d-4895-8be1-729b501f0588%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/python_inside_maya/ec357991-0a0d-4895-8be1-729b501f0588%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/011ed685-02f5-4098-b9a8-2eb1d8087c6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.