[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56560] trunk/blender/source/blender/ blenkernel: use bool for customdata functions.
Campbell Barton
ideasman42 at gmail.com
Wed May 8 14:57:18 CEST 2013
Revision: 56560
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56560
Author: campbellbarton
Date: 2013-05-08 12:57:18 +0000 (Wed, 08 May 2013)
Log Message:
-----------
use bool for customdata functions.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_customdata.h
trunk/blender/source/blender/blenkernel/intern/customdata.c
Modified: trunk/blender/source/blender/blenkernel/BKE_customdata.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_customdata.h 2013-05-08 12:57:07 UTC (rev 56559)
+++ trunk/blender/source/blender/blenkernel/BKE_customdata.h 2013-05-08 12:57:18 UTC (rev 56560)
@@ -80,14 +80,14 @@
* Checks if the layer at physical offset \a layer_n (in data->layers) support math
* the below operations.
*/
-int CustomData_layer_has_math(struct CustomData *data, int layer_n);
-int CustomData_layer_has_interp(struct CustomData *data, int layer_n);
+bool CustomData_layer_has_math(struct CustomData *data, int layer_n);
+bool CustomData_layer_has_interp(struct CustomData *data, int layer_n);
/**
* Checks if any of the customdata layers has math.
*/
-int CustomData_has_math(struct CustomData *data);
-int CustomData_has_interp(struct CustomData *data);
+bool CustomData_has_math(struct CustomData *data);
+bool CustomData_has_interp(struct CustomData *data);
/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
* another, while not overwriting anything else (e.g. flags). probably only
@@ -97,7 +97,7 @@
/* compares if data1 is equal to data2. type is a valid CustomData type
* enum (e.g. CD_MLOOPUV). the layer type's equal function is used to compare
* the data, if it exists, otherwise memcmp is used.*/
-int CustomData_data_equals(int type, void *data1, void *data2);
+bool CustomData_data_equals(int type, void *data1, void *data2);
void CustomData_data_initminmax(int type, void *min, void *max);
void CustomData_data_dominmax(int type, void *data, void *min, void *max);
void CustomData_data_multiply(int type, void *data, float fac);
@@ -149,20 +149,20 @@
*
* in editmode, use EDBM_data_layer_free instead of this function
*/
-int CustomData_free_layer(struct CustomData *data, int type, int totelem, int index);
+bool CustomData_free_layer(struct CustomData *data, int type, int totelem, int index);
/* frees the layer index with the give type.
* returns 1 on succes, 0 if no layer with the given type is found
*
* in editmode, use EDBM_data_layer_free instead of this function
*/
-int CustomData_free_layer_active(struct CustomData *data, int type, int totelem);
+bool CustomData_free_layer_active(struct CustomData *data, int type, int totelem);
/* same as above, but free all layers with type */
void CustomData_free_layers(struct CustomData *data, int type, int totelem);
/* returns 1 if a layer with the specified type exists */
-int CustomData_has_layer(const struct CustomData *data, int type);
+bool CustomData_has_layer(const struct CustomData *data, int type);
/* returns the number of layers with this type */
int CustomData_number_of_layers(const struct CustomData *data, int type);
@@ -172,7 +172,7 @@
void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int type, const int totelem);
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
const int type, const char *name, const int totelem);
-int CustomData_is_referenced_layer(struct CustomData *data, int type);
+bool CustomData_is_referenced_layer(struct CustomData *data, int type);
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
* zero for the layer type, so only layer types specified by the mask
@@ -240,7 +240,7 @@
*/
void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n);
-int CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name);
+bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name);
/* gets a pointer to the active or first layer of type
* returns NULL if there is no layer of type
@@ -321,7 +321,7 @@
/* get the name of a layer type */
const char *CustomData_layertype_name(int type);
-int CustomData_layertype_is_singleton(int type);
+bool CustomData_layertype_is_singleton(int type);
/* make sure the name of layer at index is unique */
void CustomData_set_layer_unique_name(struct CustomData *data, int index);
@@ -330,7 +330,7 @@
/* for file reading compatibility, returns false if the layer was freed,
* only after this test passes, layer->data should be assigned */
-int CustomData_verify_versions(struct CustomData *data, int index);
+bool CustomData_verify_versions(struct CustomData *data, int index);
/*BMesh specific customdata stuff*/
void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata,
@@ -346,7 +346,7 @@
struct ID *id, int type, int totelem, const char *filename);
void CustomData_external_remove(struct CustomData *data,
struct ID *id, int type, int totelem);
-int CustomData_external_test(struct CustomData *data, int type);
+bool CustomData_external_test(struct CustomData *data, int type);
void CustomData_external_write(struct CustomData *data,
struct ID *id, CustomDataMask mask, int totelem, int free);
Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c 2013-05-08 12:57:07 UTC (rev 56559)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c 2013-05-08 12:57:18 UTC (rev 56560)
@@ -130,7 +130,7 @@
void (*set_default)(void *data, int count);
/** functions necessary for geometry collapse */
- int (*equal)(void *data1, void *data2);
+ bool (*equal)(void *data1, void *data2);
void (*multiply)(void *data, float fac);
void (*initminmax)(void *min, void *max);
void (*add)(void *data1, void *data2);
@@ -608,7 +608,7 @@
m2->a = m1->a;
}
-static int layerEqual_mloopcol(void *data1, void *data2)
+static bool layerEqual_mloopcol(void *data1, void *data2)
{
MLoopCol *m1 = data1, *m2 = data2;
float r, g, b, a;
@@ -736,7 +736,7 @@
copy_v2_v2(luv2->uv, luv1->uv);
}
-static int layerEqual_mloopuv(void *data1, void *data2)
+static bool layerEqual_mloopuv(void *data1, void *data2)
{
MLoopUV *luv1 = data1, *luv2 = data2;
@@ -808,7 +808,7 @@
copy_v2_v2(luv2->uv, luv1->uv);
}
-static int layerEqual_mloop_origspace(void *data1, void *data2)
+static bool layerEqual_mloop_origspace(void *data1, void *data2)
{
OrigSpaceLoop *luv1 = data1, *luv2 = data2;
@@ -1714,7 +1714,7 @@
}
-int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
+bool CustomData_free_layer(CustomData *data, int type, int totelem, int index)
{
int i;
@@ -1748,7 +1748,7 @@
return 1;
}
-int CustomData_free_layer_active(CustomData *data, int type, int totelem)
+bool CustomData_free_layer_active(CustomData *data, int type, int totelem)
{
int index = 0;
index = CustomData_get_active_layer_index(data, type);
@@ -1763,7 +1763,7 @@
CustomData_free_layer_active(data, type, totelem);
}
-int CustomData_has_layer(const CustomData *data, int type)
+bool CustomData_has_layer(const CustomData *data, int type)
{
return (CustomData_get_layer_index(data, type) != -1);
}
@@ -1844,7 +1844,7 @@
return layer->data;
}
-int CustomData_is_referenced_layer(struct CustomData *data, int type)
+bool CustomData_is_referenced_layer(struct CustomData *data, int type)
{
CustomDataLayer *layer;
int layer_index;
@@ -2129,17 +2129,17 @@
return data->layers[layer_index].offset;
}
-int CustomData_set_layer_name(const CustomData *data, int type, int n, const char *name)
+bool CustomData_set_layer_name(const CustomData *data, int type, int n, const char *name)
{
/* get the layer index of the first layer of type */
int layer_index = CustomData_get_layer_index_n(data, type, n);
- if (layer_index < 0) return 0;
- if (!name) return 0;
+ if (layer_index < 0) return false;
+ if (!name) return false;
BLI_strncpy(data->layers[layer_index].name, name, sizeof(data->layers[layer_index].name));
- return 1;
+ return true;
}
void *CustomData_set_layer(const CustomData *data, int type, void *ptr)
@@ -2514,56 +2514,56 @@
return (char *)block + data->layers[n].offset;
}
-int CustomData_layer_has_math(struct CustomData *data, int layer_n)
+bool CustomData_layer_has_math(struct CustomData *data, int layer_n)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
if (typeInfo->equal && typeInfo->add && typeInfo->multiply &&
typeInfo->initminmax && typeInfo->dominmax)
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-int CustomData_layer_has_interp(struct CustomData *data, int layer_n)
+bool CustomData_layer_has_interp(struct CustomData *data, int layer_n)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
if (typeInfo->interp) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-int CustomData_has_math(struct CustomData *data)
+bool CustomData_has_math(struct CustomData *data)
{
int i;
/* interpolates a layer at a time */
for (i = 0; i < data->totlayer; ++i) {
if (CustomData_layer_has_math(data, i)) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-int CustomData_has_interp(struct CustomData *data)
+bool CustomData_has_interp(struct CustomData *data)
{
int i;
/* interpolates a layer at a time */
for (i = 0; i < data->totlayer; ++i) {
if (CustomData_layer_has_interp(data, i)) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
@@ -2580,7 +2580,7 @@
memcpy(dest, source, typeInfo->size);
}
-int CustomData_data_equals(int type, void *data1, void *data2)
+bool CustomData_data_equals(int type, void *data1, void *data2)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
@@ -2861,17 +2861,17 @@
/**
* Can only ever be one of these.
*/
-int CustomData_layertype_is_singleton(int type)
+bool CustomData_layertype_is_singleton(int type)
{
const LayerTypeInfo *typeInfo = layerType_getInfo(type);
return typeInfo->defaultname == NULL;
}
-static int CustomData_is_property_layer(int type)
+static bool CustomData_is_property_layer(int type)
{
if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
- return 1;
- return 0;
+ return true;
+ return false;
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list