diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-18 18:50:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-18 18:50:29 +0300 |
commit | ddf189892c596d939228cc531b775bfd6708bb2d (patch) | |
tree | cb3b28527696ef5a6a3eec581a55e6141c2e686d /source/blender/editors/object/object_add.c | |
parent | 48b17da1d9fe4d559c5b0fa58029df05a45d3960 (diff) |
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
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r-- | source/blender/editors/object/object_add.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c2d811f56dc..7771012f2a1 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -841,7 +841,7 @@ static int effector_add_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Curve *cu; ob = ED_object_add_type( - C, OB_CURVE, get_effector_defname(type), loc, rot, false, local_view_bits); + C, OB_CURVES_LEGACY, get_effector_defname(type), loc, rot, false, local_view_bits); cu = ob->data; cu->flag |= CU_PATH | CU_3D; @@ -2525,7 +2525,11 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot) * \{ */ static const EnumPropertyItem convert_target_items[] = { - {OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve", "Curve from Mesh or Text objects"}, + {OB_CURVES_LEGACY, + "CURVE", + ICON_OUTLINER_OB_CURVE, + "Curve", + "Curve from Mesh or Text objects"}, {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, @@ -2558,7 +2562,7 @@ static void object_data_convert_ensure_curve_cache(Depsgraph *depsgraph, Scene * * Also happens in case we are working on a copy of the object * (all its caches have been nuked then). */ - if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) { + if (ELEM(ob->type, OB_SURF, OB_CURVES_LEGACY, OB_FONT)) { /* We need 'for render' ON here, to enable computing bevel dipslist if needed. * Also makes sense anyway, we would not want e.g. to lose hidden parts etc. */ BKE_displist_make_curveTypes(depsgraph, scene, ob, true); @@ -2773,7 +2777,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) } } } - else if (ob->type == OB_MESH && target == OB_CURVE) { + else if (ob->type == OB_MESH && target == OB_CURVES_LEGACY) { ob->flag |= OB_DONE; if (keep_original) { @@ -2793,7 +2797,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) BKE_mesh_to_curve(bmain, depsgraph, scene, newob); - if (newob->type == OB_CURVE) { + if (newob->type == OB_CURVES_LEGACY) { BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */ if (newob->rigidbody_object != NULL) { ED_rigidbody_object_remove(bmain, scene, newob); @@ -2930,8 +2934,8 @@ static int object_convert_exec(bContext *C, wmOperator *op) Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); BKE_vfont_to_curve_ex(ob_eval, ob_eval->data, FO_EDIT, &cu->nurb, NULL, NULL, NULL, NULL); - newob->type = OB_CURVE; - cu->type = OB_CURVE; + newob->type = OB_CURVES_LEGACY; + cu->type = OB_CURVES_LEGACY; if (cu->vfont) { id_us_min(&cu->vfont->id); @@ -2955,7 +2959,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) if (ID_REAL_USERS(&cu->id) > 1) { for (ob1 = bmain->objects.first; ob1; ob1 = ob1->id.next) { if (ob1->data == ob->data) { - ob1->type = OB_CURVE; + ob1->type = OB_CURVES_LEGACY; DEG_id_tag_update(&ob1->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); } @@ -2988,7 +2992,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = NULL; } } - else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { + else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) { ob->flag |= OB_DONE; if (target == OB_MESH) { @@ -3013,7 +3017,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) BKE_object_free_curve_cache(newob); } else if (target == OB_GPENCIL) { - if (ob->type != OB_CURVE) { + if (ob->type != OB_CURVES_LEGACY) { ob->flag &= ~OB_DONE; BKE_report(op->reports, RPT_ERROR, "Convert Surfaces to Grease Pencil is not supported"); } @@ -3159,7 +3163,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) /* Remove curves and meshes converted to Grease Pencil object. */ if (gpencilConverted) { FOREACH_SCENE_OBJECT_BEGIN (scene, ob_delete) { - if (ELEM(ob_delete->type, OB_CURVE, OB_MESH)) { + if (ELEM(ob_delete->type, OB_CURVES_LEGACY, OB_MESH)) { if (ob_delete->flag & OB_DONE) { ED_object_base_free_and_unlink(bmain, scene, ob_delete); } @@ -3172,7 +3176,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) /* Remove Text curves converted to Grease Pencil object to avoid duplicated curves. */ if (gpencilCurveConverted) { FOREACH_SCENE_OBJECT_BEGIN (scene, ob_delete) { - if (ELEM(ob_delete->type, OB_CURVE) && (ob_delete->flag & OB_DONE)) { + if (ELEM(ob_delete->type, OB_CURVES_LEGACY) && (ob_delete->flag & OB_DONE)) { ED_object_base_free_and_unlink(bmain, scene, ob_delete); } } @@ -3701,7 +3705,7 @@ static bool object_join_poll(bContext *C) return false; } - if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_ARMATURE, OB_GPENCIL)) { + if (ELEM(ob->type, OB_MESH, OB_CURVES_LEGACY, OB_SURF, OB_ARMATURE, OB_GPENCIL)) { return ED_operator_screenactive(C); } return false; @@ -3740,7 +3744,7 @@ static int object_join_exec(bContext *C, wmOperator *op) if (ob->type == OB_MESH) { ret = ED_mesh_join_objects_exec(C, op); } - else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { + else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) { ret = ED_curve_join_objects_exec(C, op); } else if (ob->type == OB_ARMATURE) { |