From 0a3de0305c35f3dbe472b87d4e8f98ff117aa3ad Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 14 Jan 2022 12:53:19 +0100 Subject: [PATCH] Cleanup: move attribute operators to c++ --- .../blender/editors/geometry/CMakeLists.txt | 6 ++--- ...ry_attributes.c => geometry_attributes.cc} | 22 +++++++++---------- .../{geometry_intern.h => geometry_intern.hh} | 2 +- .../{geometry_ops.c => geometry_ops.cc} | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) rename source/blender/editors/geometry/{geometry_attributes.c => geometry_attributes.cc} (91%) rename source/blender/editors/geometry/{geometry_intern.h => geometry_intern.hh} (96%) rename source/blender/editors/geometry/{geometry_ops.c => geometry_ops.cc} (97%) diff --git a/source/blender/editors/geometry/CMakeLists.txt b/source/blender/editors/geometry/CMakeLists.txt index 75b334b9ec6..65b9633da98 100644 --- a/source/blender/editors/geometry/CMakeLists.txt +++ b/source/blender/editors/geometry/CMakeLists.txt @@ -29,10 +29,10 @@ set(INC_SYS ) set(SRC - geometry_attributes.c - geometry_ops.c + geometry_attributes.cc + geometry_ops.cc - geometry_intern.h + geometry_intern.hh ) set(LIB diff --git a/source/blender/editors/geometry/geometry_attributes.c b/source/blender/editors/geometry/geometry_attributes.cc similarity index 91% rename from source/blender/editors/geometry/geometry_attributes.c rename to source/blender/editors/geometry/geometry_attributes.cc index 5cb491f116a..9c0f6728701 100644 --- a/source/blender/editors/geometry/geometry_attributes.c +++ b/source/blender/editors/geometry/geometry_attributes.cc @@ -35,14 +35,14 @@ #include "ED_object.h" -#include "geometry_intern.h" +#include "geometry_intern.hh" /*********************** Attribute Operators ************************/ static bool geometry_attributes_poll(bContext *C) { Object *ob = ED_object_context(C); - ID *data = (ob) ? ob->data : NULL; + ID *data = (ob) ? static_cast(ob->data) : nullptr; return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data)) && BKE_id_attributes_supported(data); } @@ -54,8 +54,8 @@ static bool geometry_attributes_remove_poll(bContext *C) } Object *ob = ED_object_context(C); - ID *data = (ob) ? ob->data : NULL; - if (BKE_id_attributes_active_get(data) != NULL) { + ID *data = (ob) ? static_cast(ob->data) : nullptr; + if (BKE_id_attributes_active_get(data) != nullptr) { return true; } @@ -67,22 +67,22 @@ static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C, PropertyRNA *UNUSED(prop), bool *r_free) { - if (C == NULL) { + if (C == nullptr) { return DummyRNA_NULL_items; } Object *ob = ED_object_context(C); - if (ob == NULL) { + if (ob == nullptr) { return DummyRNA_NULL_items; } - return rna_enum_attribute_domain_itemf(ob->data, r_free); + return rna_enum_attribute_domain_itemf(static_cast(ob->data), r_free); } static int geometry_attribute_add_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); - ID *id = ob->data; + ID *id = static_cast(ob->data); char name[MAX_NAME]; RNA_string_get(op->ptr, "name", name); @@ -90,7 +90,7 @@ static int geometry_attribute_add_exec(bContext *C, wmOperator *op) AttributeDomain domain = (AttributeDomain)RNA_enum_get(op->ptr, "domain"); CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, op->reports); - if (layer == NULL) { + if (layer == nullptr) { return OPERATOR_CANCELLED; } @@ -144,10 +144,10 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot) static int geometry_attribute_remove_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); - ID *id = ob->data; + ID *id = static_cast(ob->data); CustomDataLayer *layer = BKE_id_attributes_active_get(id); - if (layer == NULL) { + if (layer == nullptr) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/geometry/geometry_intern.h b/source/blender/editors/geometry/geometry_intern.hh similarity index 96% rename from source/blender/editors/geometry/geometry_intern.h rename to source/blender/editors/geometry/geometry_intern.hh index 8a0f9294722..14992476edd 100644 --- a/source/blender/editors/geometry/geometry_intern.h +++ b/source/blender/editors/geometry/geometry_intern.hh @@ -25,6 +25,6 @@ struct wmOperatorType; -/* *** geometry_attributes.c *** */ +/* *** geometry_attributes.cc *** */ void GEOMETRY_OT_attribute_add(struct wmOperatorType *ot); void GEOMETRY_OT_attribute_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/geometry/geometry_ops.c b/source/blender/editors/geometry/geometry_ops.cc similarity index 97% rename from source/blender/editors/geometry/geometry_ops.c rename to source/blender/editors/geometry/geometry_ops.cc index ed0aeda731b..ba8afe0e62f 100644 --- a/source/blender/editors/geometry/geometry_ops.c +++ b/source/blender/editors/geometry/geometry_ops.cc @@ -25,7 +25,7 @@ #include "ED_geometry.h" -#include "geometry_intern.h" +#include "geometry_intern.hh" /**************************** registration **********************************/