Distinguishing between a NURB and a Bezier curve

Given an Object pointer which I know is of some curve, how do I query whether it refers to a NURB or a Bezier curve?

Seems to be OB_SURF, OB_CURVE. and later, Nurb *nu; nu->type == CU_BEZIER vs CU_NURBS or CU_NURBS_CYCLIC. haven’t looked at their differences though.

See under

 else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { /* OB_FONT has no cu->editnurb */

https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_info/info_stats.c$263

and under

static void curve_select_less(Object *obedit)

https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/curve/editcurve_select.c$1008

1 Like

Thanks, @ankitm!
Did you just pull this info out of the hat or is there a way to systematically find it? I’m not used to working on such large codebases, so get lost at times…

I had seen OB_MESH while working on my own thing. so I figured there will be more.

Many ways to search though:

  • Regex: I only know one & it helps a lot: abc.*xyz: matches abc_random_word_xyz.
  • Guess which features should be using such information. Modifiers are full of mesh related modifications. Similarly, exporters will be going over the whole scene, so they need to filter out unrelated things. So search only those folders.
  • Brute force search: go over all the results (IDE should facilitate it)
  • Reduce the size of the code base you’re working on. I had seen you asked about make debug developer. That is not useful for the task you claimed (I receive emails). make lite is best for many purposes.
  • See the commit too that broke it. https://developer.blender.org/rBfe0036c586d334a17a0b6bc008790749f58273be That itself has what you were searching for.

The more you search, the better you know the code.

1 Like

Thank you very much @ankitm for your advice.
Using make lite has really sped up things for me.
While trying to fix the bug, I did look through the commit you mentioned, which pin-pointed the source of trouble. But I didn’t search for other info in the file as you pointed out, and I guess this would help me further.
Thank you, once again!