diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-07-03 16:30:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-09-09 18:01:17 +0300 |
commit | 565510bd7fd87ae146cabafb27f1dfd550450f58 (patch) | |
tree | 57ff84b2aa4ba7e5c1dc0511be858d6b3bf156e6 /source/blender/blenkernel/BKE_attribute.h | |
parent | a5db981b0ea044313239c3cc2ee92d19a8f682ea (diff) |
Geometry: add .attributes in the Python API for Mesh, Hair and Point Cloud
This puts all generic float/int/vector/color/string geometry attributes in a new
.attributes property. For meshes it provides a more general API for existing
attributes, for point clouds attributes will be used as an essential part of
particle nodes.
This patch was implemented by @lichtwerk, with further changes by me. It's
still a work in progress, but posting here to show what is going on and for
early feedback.
Ref T76659
Differential Revision: https://developer.blender.org/D8200
Diffstat (limited to 'source/blender/blenkernel/BKE_attribute.h')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h new file mode 100644 index 00000000000..9eba13ef7c4 --- /dev/null +++ b/source/blender/blenkernel/BKE_attribute.h @@ -0,0 +1,82 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup bke + * \brief Generic geometry attributes built on CustomData. + */ + +#pragma once + +#include "BLI_sys_types.h" + +#include "BKE_customdata.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct CustomData; +struct CustomDataLayer; +struct ID; +struct PointerRNA; +struct ReportList; + +/* Attribute.domain */ +typedef enum AttributeDomain { + ATTR_DOMAIN_VERTEX = 0, /* Mesh Vertex */ + ATTR_DOMAIN_EDGE = 1, /* Mesh Edge */ + ATTR_DOMAIN_CORNER = 2, /* Mesh Corner */ + ATTR_DOMAIN_POLYGON = 3, /* Mesh Polygon */ + + ATTR_DOMAIN_POINT = 4, /* Hair or PointCloud Point */ + ATTR_DOMAIN_CURVE = 5, /* Hair Curve */ + + ATTR_DOMAIN_NUM +} AttributeDomain; + +/* Attributes */ + +struct CustomDataLayer *BKE_id_attribute_new(struct ID *id, + const char *name, + const int type, + const AttributeDomain domain, + struct ReportList *reports); +void BKE_id_attribute_remove(struct ID *id, + struct CustomDataLayer *layer, + struct ReportList *reports); + +AttributeDomain BKE_id_attribute_domain(struct ID *id, struct CustomDataLayer *layer); +int BKE_id_attribute_data_length(struct ID *id, struct CustomDataLayer *layer); +bool BKE_id_attribute_rename(struct ID *id, + struct CustomDataLayer *layer, + const char *new_name, + struct ReportList *reports); + +int BKE_id_attributes_length(struct ID *id, const CustomDataMask mask); + +struct CustomDataLayer *BKE_id_attributes_active_get(struct ID *id); +void BKE_id_attributes_active_set(struct ID *id, struct CustomDataLayer *layer); +int *BKE_id_attributes_active_index_p(struct ID *id); + +CustomData *BKE_id_attributes_iterator_next_domain(struct ID *id, struct CustomDataLayer *layers); + +#ifdef __cplusplus +} +#endif |