Page MenuHome

Patch implementing python function 'makeCyclic()' (CurNurb, Blender Python API)
Closed, ResolvedPublicPATCH

Description

Hi,

I was asked to put the patch from my email
'[Bf-committers] help needed to cleanup bezier code "makeCyclic()"'
( http://lists.blender.org/pipermail/bf-committers/2008-June/021302.html )
on the patch tracker ... so here it is :)

Please read the email before considering to apply the patch!

Todo:

- clean up 'makecyclicNurb2()'
from code not needed in the python implementation of 'makeCyclic()'

or even better - for avoiding code duplication:

- generalise the original code of 'makecyclicNurb()'
in file 'source/blender/src/editcurve.c'
and use the generalised code in the implementation of 'CurNurb_makeCyclic()'

I appended two files:

- the path itself: make-cyclic-patch.txt
- an example script using the patch: make-cyclic-example.py

Thanks :)

Dietrich


Here a protocol with the patch applied:

blender -P make-cyclic-example.py

[...]

>>> b.data[0].isCyclic(): False
>>> b.data[0].makeCyclic()
>>> b.data[0].isCyclic(): True

Note that the bezier handles of the point where the bezier
was closed have to be adjusted after making it cyclic.

Event Timeline

This works in our new api.

context.object.data.splines[0].use_cyclic_u = True

closing.

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.May 26 2012, 1:37 PM