[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61071] trunk/blender/source/blender/ freestyle/intern/python/BPy_Freestyle.cpp: Minor code improvements: avoid unnecessary Python object allocations in Freestyle color blending.

Tamito KAJIYAMA rd6t-kjym at asahi-net.or.jp
Tue Nov 5 01:53:43 CET 2013


Suggested changes committed in trunk revision 61106.
Thanks for the advice!

-- 
KAJIYAMA, Tamito <rd6t-kjym at asahi-net.or.jp>


On 04/11/2013 00:35, Campbell Barton wrote:
> Reducing allocations in more places can be done by changing now
> Vec2f_ptr_from_PyObject, Vec2f_ptr_from_Vector,
> Vec3f_ptr_from_PyObject, Vec3r_ptr_from_PyObject ... etc work.
>
> Just change them to accept the vector as an arg
>
> Vec3r *Vec3r_ptr_from_PyObject(PyObject *obj)
> ... to ...
> bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r *vec)
> {
>     /* set vec->x,y */
>     return success;  /* false == py-exception */
> }
>
> this way the caller can choose to use vectors on the stack (which is
> fine in most cases), and only use the heap when its needed.


More information about the Bf-committers mailing list