1
$\begingroup$

I'd like to work on an Addon project to build facades from imported Curves.

How can I dynamically display in the UI e.g. the spline's number of a curve and how many points it contains?
I've tried with an update selected_object method inside and outside the drawing function of my class but I'm not sure at all about that...

Spline selection

To me, it's a far fetch, I'm not looking for solutions, more for directions. Ultimately, I'd like to be able to select and sort for example "window" type splines and "wall" type splines before generating a meshed solid with window frames out of it.

$\endgroup$
2
  • 1
    $\begingroup$ The number of points (verts) and how many are selected is shown in the info area above the 3D View in Edit-mode. Not sure how you define "number of a curve"? Spline index? It's not really useful, is it?! $\endgroup$
    – CodeManX
    Commented Jan 9, 2014 at 20:26
  • $\begingroup$ It was a combination of modal Operators and RNA properties I wanted to find, really, but I have a lot to read in before I can handle those smoothly. Thanks to you all anyway. $\endgroup$
    – jimflim
    Commented Jan 10, 2014 at 9:10

1 Answer 1

2
$\begingroup$

Assuming you are already in the panels draw function and you have curve assigned.

tot_splines = len(curve.splines)
layout.label(text="Number of curves %d" % tot_splines)

tot_points = sum(len(s.bezier_points) (if s.type == 'BEZIER') else len(s.points)
                 for s in C.object.data.splines)
layout.label(text="Number of points %d" % tot_points)

However I'm not sure why you would want this, seeing as how the info window shows this already.

$\endgroup$
1
  • $\begingroup$ Sorry, I wasn't clear enough. What's most important to me is not the information about the spline itself, but that its property shows upon selection of the active spline while the addon is running... $\endgroup$
    – jimflim
    Commented Jan 10, 2014 at 8:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .