Page MenuHome

Curves: Rename "Hair" types, variables, and functions to "Curves"
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Feb 3 2022, 8:23 PM.

Details

Summary

Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced,
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".

This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.

The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptible, especially given the
non-permanent nature of the somewhat common conflict.

Some points of interest:

  • All DNA compatibility is lost, just like rBf59767ff9729.
  • I renamed ID_HA to ID_CV so there is no complete mismatch.
  • hair_curves is used where necessary to distinguish from the existing "curves" plural.
  • I didn't rename any of the cycles/rendering code function names, since that is also used by the old hair particle system.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Feb 3 2022, 8:23 PM
Hans Goudey (HooglyBoogly) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Feb 4 2022, 11:11 AM

Looks mostly good, but I have a few notes:

  • It's unfortunate that bpy.data.curves is used already. Not sure what's the best way to handle that without using bpy.data.hair_curves. Same with Main.hair_curves. Is it ok to use the name hair_curves in the long term here?
  • hair.cc still exists and still mentions "hair" in a few places.
  • USER_DUP_HAIR has to be renamed as well.
  • Wonder if functions like DRW_cache_hair_surface_get should be renamed as well.
source/blender/editors/animation/anim_channels_defines.c
2816

Removes the ds prefix.

In the future we can replace bpy.data.curves and leave whatever temporary name we come up with now as an alias for a while.

I guess using bpy.data.hair_curves is ok for that, I can't really think of anything better. curve_geometries, geometry_curves, new_curves, .. doesn't seem better.

Hans Goudey (HooglyBoogly) marked an inline comment as done.Feb 4 2022, 3:18 PM
  • Remove mentions of hair in curves.cc
  • Rename functions like DRW_cache_hair_surface_get
  • Rename USER_DUP_HAIR
  • Rename draw_cache_impl_hair.cc
  • Rename hair.cc, reorder files in CMakeLists
  • Merge branch 'master' into curves-hair-rename

Should I do anything to the patch based on the discussion about the hair_curves names?
I also don't really like it, but also wasn't sure something else would be better. hair_geometries sounds like a fine option, though when I used the word "geometries" in the manual some people did get annoyed at me.

Jacques Lucke (JacquesLucke) requested changes to this revision.Feb 4 2022, 5:40 PM

Should I do anything to the patch based on the discussion about the hair_curves names?

I think you could add comment in BKE_main.h and rna_main.c about that.

I get a crash when adding a hair curves object now. Might be caused by rBf75449b5f2b04b7928781316bf4255676b47150a.

source/blender/makesdna/DNA_ID_enums.h
93

Update ('H', 'A').

This revision now requires changes to proceed.Feb 4 2022, 5:40 PM
Hans Goudey (HooglyBoogly) updated this revision to Diff 47981.EditedFeb 4 2022, 6:25 PM
  • Add commentes about "hair_curves" main name
  • Correct 'H' 'A' to 'C' 'V'
Hans Goudey (HooglyBoogly) marked an inline comment as done.Feb 4 2022, 6:25 PM

Looks good to me now.

This revision is now accepted and ready to land.Feb 7 2022, 3:15 PM