[Bf-blender-cvs] [a4ff106c586] master: Cleanup: Remove more unused CustomData API functions

Hans Goudey noreply at git.blender.org
Thu Sep 29 06:16:48 CEST 2022


Commit: a4ff106c5864343dd40cc945a5bdc74ed22d4274
Author: Hans Goudey
Date:   Wed Sep 28 23:07:19 2022 -0500
Branches: master
https://developer.blender.org/rBa4ff106c5864343dd40cc945a5bdc74ed22d4274

Cleanup: Remove more unused CustomData API functions

Due to increased usage of typed arrays in C++ and name/offset based
access for BMesh, these are unlikely to be used again, and haven't been
used in many years.

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

M	source/blender/blenkernel/BKE_customdata.h
M	source/blender/blenkernel/intern/customdata.cc

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

diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 3b31183f2c4..61f3a0e1d5e 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -464,18 +464,6 @@ void CustomData_bmesh_set(const struct CustomData *data,
 
 void CustomData_bmesh_set_n(
     struct CustomData *data, void *block, int type, int n, const void *source);
-/**
- * Sets the data of the block at physical layer n.
- * no real type checking is performed.
- */
-void CustomData_bmesh_set_layer_n(struct CustomData *data, void *block, int n, const void *source);
-
-/**
- * Set the pointer of to the first layer of type. the old data is not freed.
- * returns the value of `ptr` if the layer is found, NULL otherwise.
- */
-void *CustomData_set_layer(const struct CustomData *data, int type, void *ptr);
-void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, void *ptr);
 
 /**
  * Sets the nth layer of type as active.
@@ -584,7 +572,6 @@ void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, char htype
  * \return True if some errors were found.
  */
 bool CustomData_layer_validate(struct CustomDataLayer *layer, uint totitems, bool do_fixes);
-void CustomData_layers__print(struct CustomData *data);
 
 /* External file storage */
 
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index c79f874b69b..4bbb9b62549 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -3611,31 +3611,6 @@ const char *CustomData_get_layer_name(const CustomData *data, const int type, co
   return (layer_index == -1) ? nullptr : data->layers[layer_index].name;
 }
 
-void *CustomData_set_layer(const CustomData *data, const int type, void *ptr)
-{
-  int layer_index = CustomData_get_active_layer_index(data, type);
-
-  if (layer_index == -1) {
-    return nullptr;
-  }
-
-  data->layers[layer_index].data = ptr;
-
-  return ptr;
-}
-
-void *CustomData_set_layer_n(const CustomData *data, const int type, const int n, void *ptr)
-{
-  int layer_index = CustomData_get_layer_index_n(data, type, n);
-  if (layer_index == -1) {
-    return nullptr;
-  }
-
-  data->layers[layer_index].data = ptr;
-
-  return ptr;
-}
-
 /* BMesh functions */
 
 void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *ldata)
@@ -4183,23 +4158,6 @@ void CustomData_bmesh_set_n(
   }
 }
 
-void CustomData_bmesh_set_layer_n(CustomData *data, void *block, const int n, const void *source)
-{
-  void *dest = CustomData_bmesh_get_layer_n(data, block, n);
-  const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[n].type);
-
-  if (!dest) {
-    return;
-  }
-
-  if (typeInfo->copy) {
-    typeInfo->copy(source, dest, 1);
-  }
-  else {
-    memcpy(dest, source, typeInfo->size);
-  }
-}
-
 void CustomData_bmesh_interp_n(CustomData *data,
                                const void **src_blocks_ofs,
                                const float *weights,
@@ -4622,30 +4580,6 @@ bool CustomData_layer_validate(CustomDataLayer *layer, const uint totitems, cons
   return false;
 }
 
-void CustomData_layers__print(CustomData *data)
-{
-  printf("{\n");
-
-  int i;
-  const CustomDataLayer *layer;
-  for (i = 0, layer = data->layers; i < data->totlayer; i++, layer++) {
-    const char *name = CustomData_layertype_name(layer->type);
-    const int size = CustomData_sizeof(layer->type);
-    const char *structname;
-    int structnum;
-    CustomData_file_write_info(layer->type, &structname, &structnum);
-    printf("        dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
-           name,
-           structname,
-           layer->type,
-           (const void *)layer->data,
-           size,
-           (int)(MEM_allocN_len(layer->data) / size));
-  }
-
-  printf("}\n");
-}
-
 /** \} */
 
 /* -------------------------------------------------------------------- */



More information about the Bf-blender-cvs mailing list