Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-02-18 18:50:29 +0300
committerHans Goudey <h.goudey@me.com>2022-02-18 18:50:29 +0300
commitddf189892c596d939228cc531b775bfd6708bb2d (patch)
treecb3b28527696ef5a6a3eec581a55e6141c2e686d /source/blender/editors/object
parent48b17da1d9fe4d559c5b0fa58029df05a45d3960 (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')
-rw-r--r--source/blender/editors/object/object_add.c32
-rw-r--r--source/blender/editors/object/object_bake_api.c2
-rw-r--r--source/blender/editors/object/object_constraint.c5
-rw-r--r--source/blender/editors/object/object_data_transform.c10
-rw-r--r--source/blender/editors/object/object_edit.c8
-rw-r--r--source/blender/editors/object/object_hook.c4
-rw-r--r--source/blender/editors/object/object_modes.c2
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_relations.c14
-rw-r--r--source/blender/editors/object/object_transform.c12
-rw-r--r--source/blender/editors/object/object_utils.c2
11 files changed, 50 insertions, 45 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) {
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 30e3f2b0c69..8cbe1cf5595 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -605,7 +605,7 @@ static bool bake_objects_check(Main *bmain,
continue;
}
- if (ELEM(ob_iter->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL) == false) {
+ if (ELEM(ob_iter->type, OB_MESH, OB_FONT, OB_CURVES_LEGACY, OB_SURF, OB_MBALL) == false) {
BKE_reportf(reports,
RPT_ERROR,
"Object \"%s\" is not a mesh or can't be converted to a mesh (Curve, Text, "
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 4ccd35b512b..d717271b9cb 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -511,7 +511,7 @@ static void test_constraint(
*
* In other cases it should be impossible to have a type mismatch.
*/
- if (ct->tar->type != OB_CURVE) {
+ if (ct->tar->type != OB_CURVES_LEGACY) {
con->flag |= CONSTRAINT_DISABLE;
}
else {
@@ -2275,7 +2275,8 @@ static bool get_new_constraint_target(
break;
}
- if (((!only_curve) || (ob->type == OB_CURVE)) && ((!only_mesh) || (ob->type == OB_MESH))) {
+ if (((!only_curve) || (ob->type == OB_CURVES_LEGACY)) &&
+ ((!only_mesh) || (ob->type == OB_MESH))) {
/* set target */
*tar_ob = ob;
found = true;
diff --git a/source/blender/editors/object/object_data_transform.c b/source/blender/editors/object/object_data_transform.c
index f74556e3639..63513eac965 100644
--- a/source/blender/editors/object/object_data_transform.c
+++ b/source/blender/editors/object/object_data_transform.c
@@ -382,7 +382,7 @@ struct XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode
break;
}
- case ID_CU: {
+ case ID_CU_LEGACY: {
Curve *cu = (Curve *)id;
struct Key *key = cu->key;
@@ -505,7 +505,7 @@ void ED_object_data_xform_destroy(struct XFormObjectData *xod_base)
}
break;
}
- case ID_CU: {
+ case ID_CU_LEGACY: {
struct XFormObjectData_Curve *xod = (struct XFormObjectData_Curve *)xod_base;
if (xod->key_data != NULL) {
MEM_freeN(xod->key_data);
@@ -565,7 +565,7 @@ void ED_object_data_xform_by_mat4(struct XFormObjectData *xod_base, const float
break;
}
- case ID_CU: {
+ case ID_CU_LEGACY: {
BLI_assert(xod_base->is_edit_mode == false); /* Not used currently. */
Curve *cu = (Curve *)xod_base->id;
@@ -670,7 +670,7 @@ void ED_object_data_xform_restore(struct XFormObjectData *xod_base)
break;
}
- case ID_CU: {
+ case ID_CU_LEGACY: {
Curve *cu = (Curve *)xod_base->id;
struct Key *key = cu->key;
@@ -745,7 +745,7 @@ void ED_object_data_xform_tag_update(struct XFormObjectData *xod_base)
DEG_id_tag_update(&lt->id, ID_RECALC_GEOMETRY);
break;
}
- case ID_CU: {
+ case ID_CU_LEGACY: {
/* Generic update. */
Curve *cu = (Curve *)xod_base->id;
DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index e4a026d3205..58594affc05 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -568,7 +568,7 @@ static bool ED_object_editmode_load_free_ex(Main *bmain,
*/
DEG_relations_tag_update(bmain);
}
- else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) {
const Curve *cu = obedit->data;
if (cu->editnurb == NULL) {
return false;
@@ -799,7 +799,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_LATTICE, scene);
}
- else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
+ else if (ELEM(ob->type, OB_SURF, OB_CURVES_LEGACY)) {
ok = true;
ED_curve_editnurb_make(ob);
@@ -1023,7 +1023,7 @@ void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)
if (!md) {
if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) &&
!ELEM(pd->forcefield, 0, PFIELD_GUIDE, PFIELD_TEXTURE)) {
- if (ELEM(object->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) {
+ if (ELEM(object->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVES_LEGACY)) {
ED_object_modifier_add(NULL, bmain, scene, object, NULL, eModifierType_Surface);
}
}
@@ -1552,7 +1552,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
changed = true;
}
- else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
+ else if (ELEM(ob->type, OB_SURF, OB_CURVES_LEGACY)) {
BKE_curve_smooth_flag_set(ob->data, use_smooth);
changed = true;
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 338307dc8ca..dffbb3bedd5 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -342,7 +342,7 @@ static bool object_hook_index_array(Main *bmain,
}
return true;
}
- case OB_CURVE:
+ case OB_CURVES_LEGACY:
case OB_SURF:
ED_curve_editnurb_load(bmain, obedit);
ED_curve_editnurb_make(obedit);
@@ -447,7 +447,7 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
else if (ob->type == OB_LATTICE) {
select_editlattice_hook(ob, hmd);
}
- else if (ob->type == OB_CURVE) {
+ else if (ob->type == OB_CURVES_LEGACY) {
select_editcurve_hook(ob, hmd);
}
else if (ob->type == OB_SURF) {
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index b12dd00c658..8e9e8558016 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -118,7 +118,7 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode)
}
}
break;
- case OB_CURVE:
+ case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT:
case OB_MBALL:
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 38a955dca0a..e0d25baec16 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -110,7 +110,7 @@ static void object_force_modifier_update_for_bind(Depsgraph *depsgraph, Object *
else if (ob->type == OB_MBALL) {
BKE_displist_make_mball(depsgraph, scene_eval, ob_eval);
}
- else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+ else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF, OB_FONT)) {
BKE_displist_make_curveTypes(depsgraph, scene_eval, ob_eval, false);
}
else if (ob->type == OB_GPENCIL) {
@@ -757,7 +757,7 @@ static bool modifier_apply_obdata(
}
}
}
- else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
Curve *curve = ob->data;
Curve *curve_eval = (Curve *)object_eval->data;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 8834941d083..1204a57d59f 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -169,7 +169,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
}
- else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
+ else if (ELEM(obedit->type, OB_SURF, OB_CURVES_LEGACY)) {
ListBase *editnurb = object_editcurve_get(obedit);
for (Nurb *nu = editnurb->first; nu != NULL; nu = nu->next) {
@@ -341,7 +341,7 @@ EnumPropertyItem prop_clear_parent_types[] = {
/* Helper for ED_object_parent_clear() - Remove deform-modifiers associated with parent */
static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
{
- if (ELEM(par->type, OB_ARMATURE, OB_LATTICE, OB_CURVE)) {
+ if (ELEM(par->type, OB_ARMATURE, OB_LATTICE, OB_CURVES_LEGACY)) {
ModifierData *md, *mdn;
/* assume that we only need to remove the first instance of matching deform modifier here */
@@ -363,7 +363,7 @@ static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
free = true;
}
}
- else if ((md->type == eModifierType_Curve) && (par->type == OB_CURVE)) {
+ else if ((md->type == eModifierType_Curve) && (par->type == OB_CURVES_LEGACY)) {
CurveModifierData *cmd = (CurveModifierData *)md;
if (cmd->object == par) {
free = true;
@@ -531,7 +531,7 @@ bool ED_object_parent_set(ReportList *reports,
switch (partype) {
case PAR_FOLLOW:
case PAR_PATH_CONST: {
- if (par->type != OB_CURVE) {
+ if (par->type != OB_CURVES_LEGACY) {
return false;
}
Curve *cu = par->data;
@@ -626,7 +626,7 @@ bool ED_object_parent_set(ReportList *reports,
*/
/* XXX currently this should only happen for meshes, curves, surfaces,
* and lattices - this stuff isn't available for meta-balls yet. */
- if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+ if (ELEM(ob->type, OB_MESH, OB_CURVES_LEGACY, OB_SURF, OB_FONT, OB_LATTICE)) {
ModifierData *md;
switch (partype) {
@@ -968,7 +968,7 @@ static int parent_set_invoke_menu(bContext *C, wmOperatorType *ot)
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
- else if (parent->type == OB_CURVE) {
+ else if (parent->type == OB_CURVES_LEGACY) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_PATH_CONST);
@@ -1820,7 +1820,7 @@ static void single_obdata_users(
ob->data,
BKE_id_copy_ex(bmain, ob->data, NULL, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS));
break;
- case OB_CURVE:
+ case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT:
ob->data = cu = ID_NEW_SET(
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index f017fea7cdf..94aa7d59f9d 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -613,7 +613,7 @@ static int apply_objects_internal(bContext *C,
OB_ARMATURE,
OB_LATTICE,
OB_MBALL,
- OB_CURVE,
+ OB_CURVES_LEGACY,
OB_SURF,
OB_FONT,
OB_GPENCIL)) {
@@ -639,13 +639,13 @@ static int apply_objects_internal(bContext *C,
}
}
- if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
ID *obdata = ob->data;
Curve *cu;
cu = ob->data;
- if (((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) && (apply_rot || apply_loc)) {
+ if (((ob->type == OB_CURVES_LEGACY) && !(cu->flag & CU_3D)) && (apply_rot || apply_loc)) {
BKE_reportf(
reports,
RPT_ERROR,
@@ -811,7 +811,7 @@ static int apply_objects_internal(bContext *C,
MetaBall *mb = ob->data;
BKE_mball_transform(mb, mat, do_props);
}
- else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
Curve *cu = ob->data;
scale = mat3_to_scale(rsmat);
BKE_curve_transform_ex(cu, mat, true, do_props, scale);
@@ -1209,7 +1209,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
do_inverse_offset = true;
}
}
- else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
Curve *cu = ob->data;
if (centermode == ORIGIN_TO_CURSOR) {
@@ -1223,7 +1223,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
/* don't allow Z change if curve is 2D */
- if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) {
+ if ((ob->type == OB_CURVES_LEGACY) && !(cu->flag & CU_3D)) {
cent[2] = 0.0;
}
diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c
index 19940fbb0fc..cb9c8a92abe 100644
--- a/source/blender/editors/object/object_utils.c
+++ b/source/blender/editors/object/object_utils.c
@@ -64,7 +64,7 @@ bool ED_object_calc_active_center_for_editmode(Object *obedit,
break;
}
- case OB_CURVE:
+ case OB_CURVES_LEGACY:
case OB_SURF: {
Curve *cu = obedit->data;