[Bf-blender-cvs] [0a3de0305c3] master: Cleanup: move attribute operators to c++

Jacques Lucke noreply at git.blender.org
Fri Jan 14 12:53:26 CET 2022


Commit: 0a3de0305c35f3dbe472b87d4e8f98ff117aa3ad
Author: Jacques Lucke
Date:   Fri Jan 14 12:53:19 2022 +0100
Branches: master
https://developer.blender.org/rB0a3de0305c35f3dbe472b87d4e8f98ff117aa3ad

Cleanup: move attribute operators to c++

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

M	source/blender/editors/geometry/CMakeLists.txt
R091	source/blender/editors/geometry/geometry_attributes.c	source/blender/editors/geometry/geometry_attributes.cc
R096	source/blender/editors/geometry/geometry_intern.h	source/blender/editors/geometry/geometry_intern.hh
R097	source/blender/editors/geometry/geometry_ops.c	source/blender/editors/geometry/geometry_ops.cc

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

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<ID *>(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<ID *>(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<ID *>(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<ID *>(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<ID *>(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 **********************************/



More information about the Bf-blender-cvs mailing list