Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-02-26 00:58:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-02-26 00:58:03 +0400
commit98aececc8e61e7d6d9225e59ab10d27da9498953 (patch)
treecee5dfeb04d4c0016dadaeabcfad5428ac7e692c /source/blender/bmesh/intern/bmesh_operators.c
parent4f4bba39fb0da31bb4adad7e5110f98f85e59ebe (diff)
bmesh code cleanup
* change BMO_elem_flag_* defines to inline functions. * BMO_slot_map_insert() is too big for an inline function - un-inline it. * remove redundant casts.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_operators.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index f26dd7bbe6f..f0898734d4c 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -534,6 +534,34 @@ int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
return slot->data.ghash ? BLI_ghash_size(slot->data.ghash) : 0;
}
+/* inserts a key/value mapping into a mapping slot. note that it copies the
+ * value, it doesn't store a reference to it. */
+
+void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
+ void *element, void *data, int len)
+{
+ BMOElemMapping *mapping;
+ BMOpSlot *slot = BMO_slot_get(op, slotname);
+
+ /*sanity check*/
+ if (slot->slottype != BMO_OP_SLOT_MAPPING) {
+ return;
+ }
+
+ mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
+
+ mapping->element = (BMHeader *) element;
+ mapping->len = len;
+ memcpy(mapping + 1, data, len);
+
+ if (!slot->data.ghash) {
+ slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash,
+ BLI_ghashutil_ptrcmp, "bmesh op");
+ }
+
+ BLI_ghash_insert(slot->data.ghash, element, mapping);
+}
+
#if 0
void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
{