[Bf-blender-cvs] [ddf189892c5] master: Cleanup: Rename original curve object type enum

Hans Goudey noreply at git.blender.org
Fri Feb 18 16:50:39 CET 2022


Commit: ddf189892c596d939228cc531b775bfd6708bb2d
Author: Hans Goudey
Date:   Fri Feb 18 09:50:29 2022 -0600
Branches: master
https://developer.blender.org/rBddf189892c596d939228cc531b775bfd6708bb2d

Cleanup: Rename original curve object type enum

This commit renames enums related the "Curve" object type and ID type
to add `_LEGACY` to the end. The idea is to make our aspirations clearer
in the code and to avoid ambiguities between `CURVE` and `CURVES`.

Ref T95355

To summarize for the record, the plans are:
- In the short/medium term, replace the `Curve` object data type with
 `Curves`
- In the longer term (no immediate plans), use a proper data block for
  3D text and surfaces.

Differential Revision: https://developer.blender.org/D14114

===================================================================

M	source/blender/blenkernel/BKE_idtype.h
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/anim_path.c
M	source/blender/blenkernel/intern/armature_update.c
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/curve.cc
M	source/blender/blenkernel/intern/curve_bevel.c
M	source/blender/blenkernel/intern/curve_convert.c
M	source/blender/blenkernel/intern/curve_deform.c
M	source/blender/blenkernel/intern/displist.cc
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenkernel/intern/geometry_component_curve.cc
M	source/blender/blenkernel/intern/geometry_set.cc
M	source/blender/blenkernel/intern/idtype.c
M	source/blender/blenkernel/intern/ipo.c
M	source/blender/blenkernel/intern/key.c
M	source/blender/blenkernel/intern/lib_query.c
M	source/blender/blenkernel/intern/lib_remap.c
M	source/blender/blenkernel/intern/main.c
M	source/blender/blenkernel/intern/material.c
M	source/blender/blenkernel/intern/mesh_convert.cc
M	source/blender/blenkernel/intern/modifier.c
M	source/blender/blenkernel/intern/object.cc
M	source/blender/blenkernel/intern/object_dupli.cc
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/blenkernel/intern/softbody.c
M	source/blender/blenkernel/intern/vfont.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/blentranslation/BLT_translation.h
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc
M	source/blender/draw/engines/overlay/overlay_engine.c
M	source/blender/draw/engines/overlay/overlay_extra.c
M	source/blender/draw/engines/overlay/overlay_wireframe.c
M	source/blender/draw/engines/select/select_draw_utils.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache_impl_curve.cc
M	source/blender/draw/intern/draw_common.c
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/curve/editcurve_add.c
M	source/blender/editors/curve/editcurve_undo.c
M	source/blender/editors/gpencil/gpencil_convert.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_knife_project.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_bake_api.c
M	source/blender/editors/object/object_constraint.c
M	source/blender/editors/object/object_data_transform.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_hook.c
M	source/blender/editors/object/object_modes.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/object/object_utils.c
M	source/blender/editors/render/render_internal.cc
M	source/blender/editors/render/render_opengl.cc
M	source/blender/editors/render/render_shading.cc
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/sculpt_paint/paint_utils.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_info/info_stats.cc
M	source/blender/editors/space_node/node_context_path.cc
M	source/blender/editors/space_outliner/outliner_draw.cc
M	source/blender/editors/space_outliner/outliner_intern.hh
M	source/blender/editors/space_outliner/outliner_select.cc
M	source/blender/editors/space_outliner/outliner_tools.cc
M	source/blender/editors/space_outliner/outliner_tree.cc
M	source/blender/editors/space_outliner/tree/tree_element_id.cc
M	source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M	source/blender/editors/space_view3d/view3d_buttons.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_convert.c
M	source/blender/editors/transform/transform_convert_object_texspace.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_gizmo_3d.c
M	source/blender/editors/transform/transform_gizmo_extrude_3d.c
M	source/blender/editors/transform/transform_mode.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/editors/transform/transform_orientations.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap_object.c
M	source/blender/editors/util/ed_transverts.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc
M	source/blender/io/alembic/exporter/abc_writer_nurbs.cc
M	source/blender/io/alembic/intern/abc_reader_curves.cc
M	source/blender/io/alembic/intern/abc_reader_nurbs.cc
M	source/blender/io/usd/intern/usd_hierarchy_iterator.cc
M	source/blender/io/usd/intern/usd_reader_curve.cc
M	source/blender/io/usd/intern/usd_reader_nurbs.cc
M	source/blender/io/wavefront_obj/exporter/obj_exporter.cc
M	source/blender/io/wavefront_obj/exporter/obj_exporter.hh
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesdna/DNA_ID_enums.h
M	source/blender/makesdna/DNA_ipo_types.h
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_curve.c
M	source/blender/makesrna/intern/rna_gpencil_modifier.c
M	source/blender/makesrna/intern/rna_key.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_mask.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_object_api.c
M	source/blender/makesrna/intern/rna_object_force.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_curve.c
M	source/blender/modifiers/intern/MOD_ui_common.c
M	source/blender/modifiers/intern/MOD_util.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index e9abbb4575e..bd64b03cc7d 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -230,7 +230,7 @@ extern IDTypeInfo IDType_ID_SCE;
 extern IDTypeInfo IDType_ID_LI;
 extern IDTypeInfo IDType_ID_OB;
 extern IDTypeInfo IDType_ID_ME;
-extern IDTypeInfo IDType_ID_CU;
+extern IDTypeInfo IDType_ID_CU_LEGACY;
 extern IDTypeInfo IDType_ID_MB;
 extern IDTypeInfo IDType_ID_MA;
 extern IDTypeInfo IDType_ID_TE;
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 6a999cde6eb..55aba1d22c3 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1244,7 +1244,7 @@ void BKE_pose_update_constraint_flags(bPose *pose)
         /* if we have a valid target, make sure that this will get updated on frame-change
          * (needed for when there is no anim-data for this pose)
          */
-        if ((data->tar) && (data->tar->type == OB_CURVE)) {
+        if ((data->tar) && (data->tar->type == OB_CURVES_LEGACY)) {
           pose->flag |= POSE_CONSTRAINTS_TIMEDEPEND;
         }
       }
diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c
index 57f64d7a0f8..1f8c6df6147 100644
--- a/source/blender/blenkernel/intern/anim_path.c
+++ b/source/blender/blenkernel/intern/anim_path.c
@@ -55,7 +55,7 @@ float BKE_anim_path_get_length(const CurveCache *curve_cache)
 
 void BKE_anim_path_calc_data(Object *ob)
 {
-  if (ob == NULL || ob->type != OB_CURVE) {
+  if (ob == NULL || ob->type != OB_CURVES_LEGACY) {
     return;
   }
   if (ob->runtime.curve_cache == NULL) {
@@ -222,7 +222,7 @@ bool BKE_where_on_path(const Object *ob,
                        float *r_radius,
                        float *r_weight)
 {
-  if (ob == NULL || ob->type != OB_CURVE) {
+  if (ob == NULL || ob->type != OB_CURVES_LEGACY) {
     return false;
   }
   Curve *cu = ob->data;
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 099588a0e14..361ab176abd 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -70,7 +70,7 @@ static void splineik_init_tree_from_pchan(Scene *UNUSED(scene),
       ik_data = con->data;
 
       /* Target can only be a curve. */
-      if ((ik_data->tar == NULL) || (ik_data->tar->type != OB_CURVE)) {
+      if ((ik_data->tar == NULL) || (ik_data->tar->type != OB_CURVES_LEGACY)) {
         continue;
       }
       /* Skip if disabled. */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 69002a71f1d..47669387fd1 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1493,7 +1493,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
 {
   bFollowPathConstraint *data = con->data;
 
-  if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) {
+  if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVES_LEGACY)) {
     Curve *cu = ct->tar->data;
     float vec[4], dir[3], radius;
     float curvetime;
@@ -2479,7 +2479,7 @@ static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
 #endif
 
   if (VALID_CONS_TARGET(ct)) {
-    if (ct->tar->type == OB_CURVE && ct->tar->runtime.curve_cache == NULL) {
+    if (ct->tar->type == OB_CURVES_LEGACY && ct->tar->runtime.curve_cache == NULL) {
       unit_m4(ct->matrix);
       return;
     }
@@ -3867,7 +3867,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
   bConstraintTarget *ct = targets->first;
 
   /* only evaluate if there is a target and it is a curve */
-  if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) {
+  if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVES_LEGACY)) {
     float obmat[4][4], ownLoc[3];
     float curveMin[3], curveMax[3];
     float targetMatrix[4][4];
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 7fcbbfd316f..28bcd961e26 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1148,7 +1148,7 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit,
     switch (obedit->type) {
       case OB_MESH:
         return CTX_MODE_EDIT_MESH;
-      case OB_CURVE:
+      case OB_CURVES_LEGACY:
         return CTX_MODE_EDIT_CURVE;
       case OB_SURF:
         return CTX_MODE_EDIT_SURFACE;
diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc
index c6c0111780e..b0f58dd4ec9 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -293,14 +293,14 @@ static void curve_blend_read_expand(BlendExpander *expander, ID *id)
   BLO_expand(expander, cu->textoncurve);
 }
 
-IDTypeInfo IDType_ID_CU = {
-    /* id_code */ ID_CU,
-    /* id_filter */ FILTER_ID_CU,
-    /* main_listbase_index */ INDEX_ID_CU,
+IDTypeInfo IDType_ID_CU_LEGACY = {
+    /* id_code */ ID_CU_LEGACY,
+    /* id_filter */ FILTER_ID_CU_LEGACY,
+    /* main_listbase_index */ INDEX_ID_CU_LEGACY,
     /* struct_size */ sizeof(Curve),
     /* name */ "Curve",
     /* name_plural */ "curves",
-    /* translation_context */ BLT_I18NCONTEXT_ID_CURVE,
+    /* translation_context */ BLT_I18NCONTEXT_ID_CURVE_LEGACY,
     /* flags */ IDTYPE_FLAGS_APPEND_IS_REUSABLE,
     /* asset_type_info */ nullptr,
 
@@ -406,7 +406,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
   Curve *cu;
 
   /* We cannot use #BKE_id_new here as we need some custom initialization code. */
-  cu = (Curve *)BKE_libblock_alloc(bmain, ID_CU, name, 0);
+  cu = (Curve *)BKE_libblock_alloc(bmain, ID_CU_LEGACY, name, 0);
 
   BKE_curve_init(cu, type);
 
@@ -440,7 +440,7 @@ short BKE_curve_type_get(const Curve *cu)
   }
 
   if (!cu->type) {
-    type = OB_CURVE;
+    type = OB_CURVES_LEGACY;
 
     LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
       if (nu->pntsv > 1) {
@@ -473,7 +473,7 @@ void BKE_curve_type_test(Object *ob)
 {
   ob->type = BKE_curve_type_get((Curve *)ob->data);
 
-  if (ob->type == OB_CURVE) {
+  if (ob->type == OB_CURVES_LEGACY) {
     Curve *cu = (Curve *)ob->data;
     if (CU_IS_2D(cu)) {
       BKE_curve_dimension_update(cu);
diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c
index ffef22fb498..6f32f0f5e6f 100644
--- a/source/blender/blenkernel/intern/curve_bevel.c
+++ b/source/blender/blenkernel/intern/curve_bevel.c
@@ -228,7 +228,7 @@ static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp)
   if (cu->bevobj == NULL) {
     return;
   }
-  if (cu->bevobj->type != OB_CURVE) {
+  if (cu->bevobj->type != OB_CURVES_LEGACY) {
     return;
   }
 
diff --git a/source/blender/blenkernel/intern/curve_convert.c b/source/blender/blenkernel/intern/curve_convert.c
index 285e6978522..129e930a21e 100644
--- a/source/blender/blenkernel/intern/curve_convert.c
+++ b/source/blender/blenkernel/intern/curve_convert.c
@@ -27,7 +27,7 @@ static Curve *curve_from_font_object(Object *object, Depsgraph *depsgraph)
   Object *evaluated_object = DEG_get_evaluated_object(depsgraph, object);
   BKE_vfont_to_curve_nubase(evaluated_object, FO_EDIT, &new_curve->nurb);
 
-  new_curve->type = OB_CURVE;
+  new_curve->type = OB_CURVES_LEGACY;
 
   new_curve->flag &= ~CU_3D;
   BKE_curve_dimension_update(new_curve);
@@ -55,7 +55,7 @@ static Curve *curve_from_curve_object(Object *object, Depsgraph *depsgraph, bool
 
 Curve *BKE_curve_new_from_object(Object *object, Depsgraph *depsgraph, bool apply_modifiers)
 {
-  if (!ELEM(object->type, OB_FONT, OB_CURVE)) {
+  if (!ELEM(object->type, OB_FONT, OB_CURVES_LEGACY)) {
     return NULL;
   }
 
diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c
index f76e4202994..fb082fccc0b 100644
--- a/source/blender/blenkernel/intern/curve_deform.c
+++ b/source/blender/blenkernel/intern/curve_deform.c
@@ -211,7 +211,7 @@ static void curve_deform_coords_impl(const Object *ob_curve,
   bool use_dverts = false;
   int cd_dvert_offset;
 
-  if (ob_curve->type != OB_CURVE) {
+  if (ob_curve->type != OB_CURVES_LEGACY) {
     return;
   }
 
@@ -404,7 +404,7 @@ void BKE_curve_deform_co(const Object *ob_curve,
   CurveDeform cd;
   float quat[4];
 
-  if (ob_curve->type != OB_CURVE) {
+  if (ob_curve->type != OB_CURVES_LEGACY) {
     unit_m3(r_mat);
     return;
   }
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 793af80ec74..5c761e94bb9 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -590,7 +590,7 @@ static float displist_calc_taper(Depsgraph *depsgraph,
                                  Object *taperobj,
                                  float fac)
 {
-  if (taperobj == nullptr || taperobj->type != OB_CURVE) {
+  if (taperobj == nullptr || taperobj->type != OB_CURVES_LEGACY) {
     return 1.0;
   }
 
@@ -1263,7 +1263,7 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph,
                                               const bool for_render,
                                               ListBase *r_dispbase)
 {
-  BLI_assert(ELEM(ob->type, OB_CURVE, OB_FONT));
+  BLI_assert(ELEM(ob->type, OB_CURVES_LEGACY, OB_FONT));
   const Curve *cu = (const Curve *)ob->data;
 
   ListBase *deformed_nurbs = &ob->runtime.curve_cache->deformed_nurbs;
@@ -1473,7 +1473,7 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
                                   Object *ob,
                                   const bool for_render)
 {
-  BLI_assert(ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT));
+  BLI_assert(ELEM(ob->type, OB_SURF, OB_CURVES_LEGACY, OB_FONT));
   Curve &cow_curve = *(Curve *)ob->data;
 
   BKE_object_free_derived_caches(ob);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 2f760597e1a..f2915a97746 100644
--- a

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list