diff options
128 files changed, 734 insertions, 1461 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ae39f7ce5b3..fab87c04ef9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,11 +254,14 @@ if(APPLE) "Choose the minimum OSX version required: 10.4 or 10.5" FORCE) endif() - if(${CMAKE_GENERATOR} MATCHES "Xcode" AND (${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4)) - # Xcode 4 defaults to the Apple LLVM Compiler. - # Override the default compiler selection because Blender only compiles with gcc - set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42") - message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION}) + MESSAGE(STATUS ${CMAKE_GENERATOR}) + if(${CMAKE_GENERATOR} MATCHES "Xcode") + if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4) + # Xcode 4 defaults to the Apple LLVM Compiler. + # Override the default compiler selection because Blender only compiles with gcc + set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42") + message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION}) + endif() endif() option(WITH_COCOA "Use Cocoa framework instead of deprecated Carbon" ON) option(USE_QTKIT "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF) diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 9a55f957895..c2eee04f3fe 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -165,7 +165,7 @@ public: return; } - ciErr = clGetPlatformIDs(num_platforms, &cpPlatform, NULL); + ciErr = clGetPlatformIDs(1, &cpPlatform, NULL); if(opencl_error(ciErr)) return; @@ -709,7 +709,7 @@ void device_opencl_info(vector<DeviceInfo>& devices) if(clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS || num_platforms == 0) return; - if(clGetPlatformIDs(num_platforms, &platform_id, NULL) != CL_SUCCESS) + if(clGetPlatformIDs(1, &platform_id, NULL) != CL_SUCCESS) return; if(clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, 0, NULL, &num_devices) != CL_SUCCESS) diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 601ffae4796..e93036ee9bb 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -140,8 +140,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): edges = {} for f in faces: -# if len(f) == 4: - if f.vertices_raw[3] != 0: + if len(f.vertices) == 4: edge_keys = f.edge_keys for i, edkey in enumerate(f.edge_keys): edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]]) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index f4e5c27b90a..f3e4942f732 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -46,11 +46,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): # the mt.type enum is (ab)used for a lookup on function names # ...to avoid lengthy if statements # so each type must have a function here. - - def NGONINTERP(self, layout, ob, md): - split = layout.split() - split.prop(md, "resolution") - + def ARMATURE(self, layout, ob, md): split = layout.split() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 2efeff0e079..9d947f6fb40 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -899,6 +899,7 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel): sub1.prop(inputs, "use_mouse_emulate_3_button") sub.prop(inputs, "use_mouse_continuous") sub.prop(inputs, "drag_threshold") + sub.prop(inputs, "tweak_threshold") sub.label(text="Select With:") sub.row().prop(inputs, "select_mouse", expand=True) @@ -936,8 +937,6 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel): sub.label(text="NDOF Device:") sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity") - col.prop(inputs, "tweak_threshold") - row.separator() def draw(self, context): diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 36760d387a1..06b4df8b05c 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -41,7 +41,6 @@ #include "BLI_mempool.h" #include "BLI_memarena.h" #include "DNA_image_types.h" -#include "BLI_editVert.h" #include "BKE_DerivedMesh.h" //XXX #include "transform.h" #include "bmesh.h" @@ -250,9 +249,4 @@ void BME_free_transdata(struct BME_TransData_Head *td); float *BME_bevel_calc_polynormal(struct BME_Poly *f, struct BME_TransData_Head *td); struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd); -/*CONVERSION FUNCTIONS*/ -struct BME_Mesh *BME_editmesh_to_bmesh(EditMesh *em); -void BME_bmesh_to_editmesh(struct BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em); -struct BME_Mesh *BME_derivedmesh_to_bmesh(struct DerivedMesh *dm); -struct DerivedMesh *BME_bmesh_to_derivedmesh(struct BME_Mesh *bm, struct DerivedMesh *dm); #endif diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index 053749148a0..5fda391cd80 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -39,7 +39,6 @@ struct DerivedMesh; struct BMEditMesh; -struct EditMesh; struct Mesh; struct Object; diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 78354cd4713..c4f860e820f 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -39,7 +39,6 @@ extern "C" { struct ARegion; struct bScreen; -struct EditMesh; struct ListBase; struct Main; struct Object; diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 6159240f92d..e5e172accca 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -178,13 +178,9 @@ void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count); void CustomData_copy_elements(int type, void *source, void *dest, int count); -void CustomData_em_copy_data(const struct CustomData *source, - struct CustomData *dest, void *src_block, - void **dest_block); void CustomData_bmesh_copy_data(const struct CustomData *source, struct CustomData *dest, void *src_block, void **dest_block); -void CustomData_em_validate_data(struct CustomData *data, void *block, int sub_elements); /* frees data in a CustomData object * return 1 on success, 0 on failure @@ -208,9 +204,6 @@ void CustomData_free_elem(struct CustomData *data, int index, int count); void CustomData_interp(const struct CustomData *source, struct CustomData *dest, int *src_indices, float *weights, float *sub_weights, int count, int dest_index); -void CustomData_em_interp(struct CustomData *data, void **src_blocks, - float *weights, float *sub_weights, int count, - void *dest_block); void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks, float *weights, float *sub_weights, int count, void *dest_block); @@ -226,8 +219,6 @@ void CustomData_swap(struct CustomData *data, int index, const int *corner_indic */ void *CustomData_get(const struct CustomData *data, int index, int type); void *CustomData_get_n(const struct CustomData *data, int type, int index, int n); -void *CustomData_em_get(const struct CustomData *data, void *block, int type); -void *CustomData_em_get_n(const struct CustomData *data, void *block, int type, int n); void *CustomData_bmesh_get(const struct CustomData *data, void *block, int type); void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n); @@ -263,10 +254,6 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type); */ void CustomData_set(const struct CustomData *data, int index, int type, void *source); -void CustomData_em_set(struct CustomData *data, void *block, int type, - void *source); -void CustomData_em_set_n(struct CustomData *data, void *block, int type, int n, - void *source); void CustomData_bmesh_set(const struct CustomData *data, void *block, int type, void *source); @@ -300,10 +287,6 @@ void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n /* adds flag to the layer flags */ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag); -/* alloc/free a block of custom data attached to one element in editmode */ -void CustomData_em_set_default(struct CustomData *data, void **block); -void CustomData_em_free_block(struct CustomData *data, void **block); - void CustomData_bmesh_set_default(struct CustomData *data, void **block); void CustomData_bmesh_free_block(struct CustomData *data, void **block); diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index f43ec749a69..5a36add2834 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -63,7 +63,6 @@ struct ListBase; struct Material; struct Bone; struct Mesh; -struct EditMesh; struct DerivedMesh; /* used for curves, nurbs, mball, importing */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index f3307b73187..de4f0a7eac6 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -35,7 +35,6 @@ #include "BKE_customdata.h" struct ID; -struct EditMesh; struct DerivedMesh; struct DagForest; struct DagNode; diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index cf77ea85c15..35de1c21a54 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -34,7 +34,6 @@ struct DMGridAdjacency; struct DMGridData; struct DerivedMesh; -struct EditMesh; struct IndexNode; struct ListBase; struct Mesh; diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 573edb78687..7e491ff5f7c 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -37,13 +37,13 @@ #include "DNA_cloth_types.h" #include "DNA_key_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" // N_T #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_memarena.h" #include "BLI_array.h" @@ -761,7 +761,7 @@ static float *get_editbmesh_orco_verts(BMEditMesh *em) totvert= em->bm->totvert; - orco = MEM_mallocN(sizeof(float)*3*totvert, "EditMesh Orco"); + orco = MEM_mallocN(sizeof(float)*3*totvert, "BMEditMesh Orco"); eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); for (a=0; eve; eve=BM_iter_step(&iter), a+=3) { diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 11700d7f072..bfafd96b95e 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -37,7 +37,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_utildefines.h" @@ -46,6 +45,7 @@ #include "DNA_armature_types.h" #include "DNA_group_types.h" #include "DNA_key_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" #include "DNA_vfont_types.h" diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 5c50c14f1a8..f4416b8f5d6 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -36,7 +36,6 @@ #include "DNA_meshdata_types.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BLI_linklist.h" diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 47492dbed37..9f3c9fc8b78 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -43,12 +43,10 @@ #include "BKE_utildefines.h" #include "BKE_tessmesh.h" -#include "BLI_editVert.h" #include "BLI_scanfill.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_pbvh.h" #include "BLI_array.h" @@ -61,6 +59,7 @@ #include "BKE_paint.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_curve_types.h" /* for Curve */ @@ -1793,105 +1792,6 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob)) return dm; } -static DerivedMesh *UNUSED_FUNCTION(CDDM_from_editmesh)(EditMesh *em, Mesh *UNUSED(me)) -{ - DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts), - BLI_countlist(&em->edges), - BLI_countlist(&em->faces), 0, 0); - CDDerivedMesh *cddm = (CDDerivedMesh*)dm; - EditVert *eve; - EditEdge *eed; - EditFace *efa; - MVert *mvert = cddm->mvert; - MEdge *medge = cddm->medge; - MFace *mface = cddm->mface; - int i, *index; - - dm->deformedOnly = 1; - - CustomData_merge(&em->vdata, &dm->vertData, CD_MASK_DERIVEDMESH, - CD_CALLOC, dm->numVertData); - /* CustomData_merge(&em->edata, &dm->edgeData, CD_MASK_DERIVEDMESH, - CD_CALLOC, dm->numEdgeData); */ - CustomData_merge(&em->fdata, &dm->faceData, CD_MASK_DERIVEDMESH, - CD_CALLOC, dm->numTessFaceData); - CustomData_merge(&em->fdata, &dm->faceData, CD_MASK_DERIVEDMESH, - CD_CALLOC, dm->numTessFaceData); - - /* set eve->hash to vert index */ - for(i = 0, eve = em->verts.first; eve; eve = eve->next, ++i) - eve->tmp.l = i; - - /* Need to be able to mark loose edges */ - for(eed = em->edges.first; eed; eed = eed->next) { - eed->f2 = 0; - } - for(efa = em->faces.first; efa; efa = efa->next) { - efa->e1->f2 = 1; - efa->e2->f2 = 1; - efa->e3->f2 = 1; - if(efa->e4) efa->e4->f2 = 1; - } - - index = dm->getVertDataArray(dm, CD_ORIGINDEX); - for(i = 0, eve = em->verts.first; i < dm->numVertData; - i++, eve = eve->next, index++) { - MVert *mv = &mvert[i]; - - copy_v3_v3(mv->co, eve->co); - - normal_float_to_short_v3(mv->no, eve->no); - mv->bweight = (unsigned char) (eve->bweight * 255.0f); - - mv->flag = 0; - - *index = i; - - CustomData_from_em_block(&em->vdata, &dm->vertData, eve->data, i); - } - - index = dm->getEdgeDataArray(dm, CD_ORIGINDEX); - for(i = 0, eed = em->edges.first; i < dm->numEdgeData; - i++, eed = eed->next, index++) { - MEdge *med = &medge[i]; - - med->v1 = eed->v1->tmp.l; - med->v2 = eed->v2->tmp.l; - med->crease = (unsigned char) (eed->crease * 255.0f); - med->bweight = (unsigned char) (eed->bweight * 255.0f); - med->flag = ME_EDGEDRAW|ME_EDGERENDER; - - if(eed->seam) med->flag |= ME_SEAM; - if(eed->sharp) med->flag |= ME_SHARP; - if(eed->freestyle) med->flag |= ME_FREESTYLE_EDGE; - if(!eed->f2) med->flag |= ME_LOOSEEDGE; - - *index = i; - - /* CustomData_from_em_block(&em->edata, &dm->edgeData, eed->data, i); */ - } - - index = dm->getTessFaceDataArray(dm, CD_POLYINDEX); - for(i = 0, efa = em->faces.first; i < dm->numTessFaceData; - i++, efa = efa->next, index++) { - MFace *mf = &mface[i]; - - mf->v1 = efa->v1->tmp.l; - mf->v2 = efa->v2->tmp.l; - mf->v3 = efa->v3->tmp.l; - mf->v4 = efa->v4 ? efa->v4->tmp.l : 0; - mf->mat_nr = efa->mat_nr; - mf->flag = efa->flag; - - *index = i; - - CustomData_from_em_block(&em->fdata, &dm->faceData, efa->data, i); - test_index_face(mf, &dm->faceData, i, efa->v4?4:3); - } - - return dm; -} - DerivedMesh *CDDM_from_curve(Object *ob) { return CDDM_from_curve_customDB(ob, &ob->disp); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 4f3fc40616b..833f14ff074 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -40,7 +40,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_kdopbvh.h" #include "BLI_utildefines.h" diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index a4c1fd87009..6cb8b65dbaf 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2154,287 +2154,6 @@ void CustomData_set(const CustomData *data, int index, int type, void *source) memcpy(dest, source, typeInfo->size); } -/* EditMesh functions */ - -void CustomData_em_free_block(CustomData *data, void **block) -{ - const LayerTypeInfo *typeInfo; - int i; - - if(!*block) return; - - for(i = 0; i < data->totlayer; ++i) { - if(!(data->layers[i].flag & CD_FLAG_NOFREE)) { - typeInfo = layerType_getInfo(data->layers[i].type); - - if(typeInfo->free) { - int offset = data->layers[i].offset; - typeInfo->free((char*)*block + offset, 1, typeInfo->size); - } - } - } - - MEM_freeN(*block); - *block = NULL; -} - -static void CustomData_em_alloc_block(CustomData *data, void **block) -{ - /* TODO: optimize free/alloc */ - - if (*block) - CustomData_em_free_block(data, block); - - if (data->totsize > 0) - *block = MEM_callocN(data->totsize, "CustomData EM block"); - else - *block = NULL; -} - -void CustomData_em_copy_data(const CustomData *source, CustomData *dest, - void *src_block, void **dest_block) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i; - - if (!*dest_block) - CustomData_em_alloc_block(dest, dest_block); - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type && - strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) { - char *src_data = (char*)src_block + source->layers[src_i].offset; - char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset; - - typeInfo = layerType_getInfo(source->layers[src_i].type); - - if(typeInfo->copy) - typeInfo->copy(src_data, dest_data, 1); - else - memcpy(dest_data, src_data, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } -} - -void CustomData_em_validate_data(CustomData *data, void *block, int sub_elements) -{ - int i; - for(i = 0; i < data->totlayer; i++) { - const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[i].type); - char *leayer_data = (char*)block + data->layers[i].offset; - - if(typeInfo->validate) - typeInfo->validate(leayer_data, sub_elements); - } -} - -void *CustomData_em_get(const CustomData *data, void *block, int type) -{ - int layer_index; - - /* get the layer index of the first layer of type */ - layer_index = CustomData_get_active_layer_index(data, type); - if(layer_index < 0) return NULL; - - return (char *)block + data->layers[layer_index].offset; -} - -void *CustomData_em_get_n(const CustomData *data, void *block, int type, int n) -{ - int layer_index; - - /* get the layer index of the first layer of type */ - layer_index = CustomData_get_layer_index_n(data, type, n); - if(layer_index < 0) return NULL; - - return (char *)block + data->layers[layer_index].offset; -} - -void CustomData_em_set(CustomData *data, void *block, int type, void *source) -{ - void *dest = CustomData_em_get(data, block, type); - const LayerTypeInfo *typeInfo = layerType_getInfo(type); - - if(!dest) return; - - if(typeInfo->copy) - typeInfo->copy(source, dest, 1); - else - memcpy(dest, source, typeInfo->size); -} - -void CustomData_em_set_n(CustomData *data, void *block, int type, int n, void *source) -{ - void *dest = CustomData_em_get_n(data, block, type, n); - const LayerTypeInfo *typeInfo = layerType_getInfo(type); - - if(!dest) return; - - if(typeInfo->copy) - typeInfo->copy(source, dest, 1); - else - memcpy(dest, source, typeInfo->size); -} - -void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights, - float *sub_weights, int count, void *dest_block) -{ - int i, j; - void *source_buf[SOURCE_BUF_SIZE]; - void **sources = source_buf; - - /* slow fallback in case we're interpolating a ridiculous number of - * elements - */ - if(count > SOURCE_BUF_SIZE) - sources = MEM_callocN(sizeof(*sources) * count, - "CustomData_interp sources"); - - /* interpolates a layer at a time */ - for(i = 0; i < data->totlayer; ++i) { - CustomDataLayer *layer = &data->layers[i]; - const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type); - - if(typeInfo->interp) { - for(j = 0; j < count; ++j) - sources[j] = (char *)src_blocks[j] + layer->offset; - - typeInfo->interp(sources, weights, sub_weights, count, - (char *)dest_block + layer->offset); - } - } - - if(count > SOURCE_BUF_SIZE) MEM_freeN(sources); -} - -void CustomData_em_set_default(CustomData *data, void **block) -{ - const LayerTypeInfo *typeInfo; - int i; - - if (!*block) - CustomData_em_alloc_block(data, block); - - for(i = 0; i < data->totlayer; ++i) { - int offset = data->layers[i].offset; - - typeInfo = layerType_getInfo(data->layers[i].type); - - if(typeInfo->set_default) - typeInfo->set_default((char*)*block + offset, 1); - } -} - -void CustomData_to_em_block(const CustomData *source, CustomData *dest, - int src_index, void **dest_block) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i, src_offset; - - if (!*dest_block) - CustomData_em_alloc_block(dest, dest_block); - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type) { - int offset = dest->layers[dest_i].offset; - char *src_data = source->layers[src_i].data; - char *dest_data = (char*)*dest_block + offset; - - typeInfo = layerType_getInfo(dest->layers[dest_i].type); - src_offset = src_index * typeInfo->size; - - if(typeInfo->copy) - typeInfo->copy(src_data + src_offset, dest_data, 1); - else - memcpy(dest_data, src_data + src_offset, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } -} - -void CustomData_from_em_block(const CustomData *source, CustomData *dest, - void *src_block, int dest_index) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i, dest_offset; - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type) { - int offset = source->layers[src_i].offset; - char *src_data = (char*)src_block + offset; - char *dest_data = dest->layers[dest_i].data; - - typeInfo = layerType_getInfo(dest->layers[dest_i].type); - dest_offset = dest_index * typeInfo->size; - - if(typeInfo->copy) - typeInfo->copy(src_data, dest_data + dest_offset, 1); - else - memcpy(dest_data + dest_offset, src_data, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } - -} - /*Bmesh functions*/ /*needed to convert to/from different face reps*/ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 2a971c45232..3a67c66165a 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_scanfill.h" #include "BLI_utildefines.h" @@ -417,8 +416,8 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) { - EditVert *eve, *v1, *vlast; - EditFace *efa; + ScanFillVert *eve, *v1, *vlast; + ScanFillFace *efa; DispList *dlnew=NULL, *dl; float *f1; int colnr=0, charidx=0, cont=1, tot, a, *index, nextcol= 0; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index ee06600dab6..766febc0603 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -38,7 +38,6 @@ #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_pbvh.h" @@ -191,9 +190,9 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) #endif /* USE_TESSFACE_SPEEDUP */ else { - EditVert *v, *lastv=NULL, *firstv=NULL; - EditEdge *e; - EditFace *efa; + ScanFillVert *v, *lastv=NULL, *firstv=NULL; + ScanFillEdge *e; + ScanFillFace *efa; int totfilltri; BLI_begin_edgefill(); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 84af6200f94..1b678225135 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -37,13 +37,13 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_math_vector.h" #include "BLI_utildefines.h" #include "DNA_anim_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 05c90bf4d0c..6ebfa9a1172 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -39,6 +39,7 @@ #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_key_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_ipo_types.h" #include "DNA_customdata_types.h" @@ -46,7 +47,6 @@ #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_bpath.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_scanfill.h" @@ -71,7 +71,6 @@ #include "BLI_edgehash.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_array.h" #include "BLI_edgehash.h" @@ -461,7 +460,7 @@ Mesh *add_mesh(const char *name) me->size[0]= me->size[1]= me->size[2]= 1.0; me->smoothresh= 30; - me->texflag= AUTOSPACE; + me->texflag= ME_AUTOSPACE; me->flag= ME_TWOSIDED; me->bb= unit_boundbox(); me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES; @@ -529,7 +528,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob) bm = BM_mesh_create(ob, bm_mesh_allocsize_default); - BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 1); + BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", me, ob, TRUE); return bm; } @@ -658,7 +657,7 @@ void tex_space_mesh(Mesh *me) boundbox_mesh(me, loc, size); - if(me->texflag & AUTOSPACE) { + if (me->texflag & ME_AUTOSPACE) { for (a=0; a<3; a++) { if(size[a]==0.0f) size[a]= 1.0f; else if(size[a]>0.0f && size[a]<0.00001f) size[a]= 0.00001f; @@ -2252,8 +2251,8 @@ int mesh_recalcTesselation(CustomData *fdata, MLoop *ml, *mloop; MFace *mface = NULL, *mf; BLI_array_declare(mface); - EditVert *v, *lastv, *firstv; - EditFace *f; + ScanFillVert *v, *lastv, *firstv; + ScanFillFace *f; int *mface_orig_index = NULL; BLI_array_declare(mface_orig_index); int *mface_to_poly_map = NULL; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 1f154e17492..e7320ddf5dc 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -43,7 +43,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_pbvh.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index aacc30094d0..23479f386d9 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -45,6 +45,7 @@ #include "DNA_lattice_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" @@ -58,7 +59,6 @@ #include "BLI_blenlib.h" #include "BLI_bpath.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_pbvh.h" #include "BLI_utildefines.h" diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 53c7656663a..84513f83204 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -43,7 +43,6 @@ #include "DNA_mesh_types.h" #include "DNA_scene_types.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_utildefines.h" diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 890a8c8247d..1f0e455fa45 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -42,17 +42,46 @@ extern struct ListBase fillvertbase; extern struct ListBase filledgebase; extern struct ListBase fillfacebase; -struct EditVert; +struct ScanFillVert; #ifdef __cplusplus extern "C" { #endif +/* note; changing this also might affect the undo copy in editmesh.c */ +typedef struct ScanFillVert +{ + struct ScanFillVert *next, *prev; + union { + struct ScanFillVert *v; + void *p; + intptr_t l; + } tmp; + float co[3]; /*vertex location */ + int keyindex; /* original index #, for restoring key information */ + short poly_nr; + unsigned char f, h; +} ScanFillVert; + +typedef struct ScanFillEdge +{ + struct ScanFillEdge *next, *prev; + struct ScanFillVert *v1, *v2; + short poly_nr; + unsigned char f; +} ScanFillEdge; + +typedef struct ScanFillFace +{ + struct ScanFillFace *next, *prev; + struct ScanFillVert *v1, *v2, *v3; +} ScanFillFace; + /* scanfill.c: used in displist only... */ -struct EditVert *BLI_addfillvert(float *vec); -struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); +struct ScanFillVert *BLI_addfillvert(const float vec[3]); +struct ScanFillEdge *BLI_addfilledge(struct ScanFillVert *v1, struct ScanFillVert *v2); -/* Optionally set EditEdge f to this to mark original boundary edges. +/* Optionally set ScanFillEdge f to this to mark original boundary edges. Only needed if there are internal diagonal edges pased to BLI_edgefill. */ #define FILLBOUNDARY 1 @@ -80,6 +109,8 @@ void BLI_setErrorCallBack(void (*f)(const char*)); */ void BLI_setInterruptCallBack(int (*f)(void)); +void BLI_scanfill_free(void); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index ff0833448c9..f4fc8cd69a8 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -103,7 +103,6 @@ set(SRC BLI_dynlib.h BLI_dynstr.h BLI_edgehash.h - BLI_editVert.h BLI_fileops.h BLI_fileops_types.h BLI_fnmatch.h diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index f8b986e799b..cd1c0470ae2 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -179,7 +179,7 @@ MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]) { - float alpha, inv_alpha; + float fsrgb[4]; int i; if(srgb[3] == 255 || srgb[3] == 0) { @@ -187,13 +187,10 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned return; } - alpha = srgb[3] * (1.0f/255.0f); - inv_alpha = 1.0f/alpha; - - for(i=0; i<3; ++i) - linear[i] = linearrgb_to_srgb(srgb[i] * inv_alpha) * alpha; + for (i=0; i<4; i++) + fsrgb[i] = srgb[i] * (1.0f/255.0f); - linear[3] = alpha; + srgb_to_linearrgb_predivide_v4(linear, fsrgb); } #endif /* BLI_MATH_COLOR_INLINE_H */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 7652cc4f4af..1e25d74cfb6 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -38,7 +38,6 @@ #include "MEM_guardedalloc.h" #include "BLI_callbacks.h" -#include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_scanfill.h" @@ -86,17 +85,17 @@ typedef struct PolyFill { short f,nr; } PolyFill; -typedef struct ScFillVert { - EditVert *v1; - EditEdge *first,*last; -} ScFillVert; +typedef struct ScanFillVertLink { + ScanFillVert *v1; + ScanFillEdge *first, *last; +} ScanFillVertLink; /* local funcs */ #define COMPLIMIT 0.00003 -static ScFillVert *scdata; +static ScanFillVertLink *scdata; ListBase fillvertbase = {NULL, NULL}; ListBase filledgebase = {NULL, NULL}; @@ -109,7 +108,7 @@ static int cox, coy; static int vergscdata(const void *a1, const void *a2) { - const ScFillVert *x1=a1,*x2=a2; + const ScanFillVertLink *x1=a1,*x2=a2; if( x1->v1->co[coy] < x2->v1->co[coy] ) return 1; else if( x1->v1->co[coy] > x2->v1->co[coy]) return -1; @@ -144,7 +143,7 @@ struct mem_elements { free in the end, with argument '-1' */ #define MEM_ELEM_BLOCKSIZE 16384 -static struct mem_elements * melem__cur= 0; +static struct mem_elements * melem__cur= NULL; static int melem__offs= 0; /* the current free address */ static ListBase melem__lb= {NULL, NULL}; @@ -168,13 +167,14 @@ static void *mem_element_new(int size) return melem__cur->data; } } -static void mem_element_reset(void) +static void mem_element_reset(int keep_first) { struct mem_elements *first; - /*BMESH_TODO: keep the first block, gives memory leak on exit with 'newmem' */ if((first= melem__lb.first)) { /* can be false if first fill fails */ - BLI_remlink(&melem__lb, first); + if (keep_first) { + BLI_remlink(&melem__lb, first); + } melem__cur= melem__lb.first; while(melem__cur) { @@ -184,8 +184,14 @@ static void mem_element_reset(void) BLI_freelistN(&melem__lb); /*reset the block we're keeping*/ - BLI_addtail(&melem__lb, first); - memset(first->data, 0, MEM_ELEM_BLOCKSIZE); + if (keep_first) { + BLI_addtail(&melem__lb, first); + memset(first->data, 0, MEM_ELEM_BLOCKSIZE); + } + else { + first = NULL; + + } } melem__cur= first; @@ -194,7 +200,7 @@ static void mem_element_reset(void) void BLI_end_edgefill(void) { - mem_element_reset(); + mem_element_reset(TRUE); fillvertbase.first= fillvertbase.last= 0; filledgebase.first= filledgebase.last= 0; @@ -203,13 +209,18 @@ void BLI_end_edgefill(void) BLI_unlock_thread(LOCK_SCANFILL); } +void BLI_scanfill_free(void) +{ + mem_element_reset(FALSE); +} + /* **** FILL ROUTINES *************************** */ -EditVert *BLI_addfillvert(float *vec) +ScanFillVert *BLI_addfillvert(const float vec[3]) { - EditVert *eve; + ScanFillVert *eve; - eve= mem_element_new(sizeof(EditVert)); + eve= mem_element_new(sizeof(ScanFillVert)); BLI_addtail(&fillvertbase, eve); eve->co[0] = vec[0]; @@ -219,11 +230,11 @@ EditVert *BLI_addfillvert(float *vec) return eve; } -EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2) +ScanFillEdge *BLI_addfilledge(ScanFillVert *v1, ScanFillVert *v2) { - EditEdge *newed; + ScanFillEdge *newed; - newed= mem_element_new(sizeof(EditEdge)); + newed= mem_element_new(sizeof(ScanFillEdge)); BLI_addtail(&filledgebase, newed); newed->v1= v1; @@ -232,19 +243,17 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2) return newed; } -static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr) +static void addfillface(ScanFillVert *v1, ScanFillVert *v2, ScanFillVert *v3) { /* does not make edges */ - EditFace *evl; + ScanFillFace *evl; - evl= mem_element_new(sizeof(EditFace)); + evl= mem_element_new(sizeof(ScanFillFace)); BLI_addtail(&fillfacebase, evl); evl->v1= v1; evl->v2= v2; evl->v3= v3; - evl->f= 2; - evl->mat_nr= mat_nr; } static int boundisect(PolyFill *pf2, PolyFill *pf1) @@ -273,18 +282,18 @@ static int boundisect(PolyFill *pf2, PolyFill *pf1) static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */ { - EditVert *eve; - EditEdge *eed; + ScanFillVert *eve; + ScanFillEdge *eed; /* replace old poly numbers */ eve= fillvertbase.first; while(eve) { - if(eve->xs== pf2->nr) eve->xs= pf1->nr; + if(eve->poly_nr == pf2->nr) eve->poly_nr = pf1->nr; eve= eve->next; } eed= filledgebase.first; while(eed) { - if(eed->f1== pf2->nr) eed->f1= pf1->nr; + if (eed->poly_nr == pf2->nr) eed->poly_nr = pf1->nr; eed= eed->next; } @@ -310,10 +319,10 @@ static short testedgeside(float *v1, float *v2, float *v3) return 1; } -static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) +static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed) { /* find first edge to the right of eed, and insert eed before that */ - EditEdge *ed; + ScanFillEdge *ed; float fac,fac1,x,y; if(sc->first==0) { @@ -354,12 +363,12 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) } -static ScFillVert *addedgetoscanlist(EditEdge *eed, int len) +static ScanFillVertLink *addedgetoscanlist(ScanFillEdge *eed, int len) { - /* inserts edge at correct location in ScFillVert list */ + /* inserts edge at correct location in ScanFillVertLink list */ /* returns sc when edge already exists */ - ScFillVert *sc,scsearch; - EditVert *eve; + ScanFillVertLink *sc,scsearch; + ScanFillVert *eve; /* which vert is left-top? */ if(eed->v1->co[coy] == eed->v2->co[coy]) { @@ -376,8 +385,8 @@ static ScFillVert *addedgetoscanlist(EditEdge *eed, int len) } /* find location in list */ scsearch.v1= eed->v1; - sc= (ScFillVert *)bsearch(&scsearch,scdata,len, - sizeof(ScFillVert), vergscdata); + sc= (ScanFillVertLink *)bsearch(&scsearch,scdata,len, + sizeof(ScanFillVertLink), vergscdata); if(sc==0) printf("Error in search edge: %p\n", (void *)eed); else if(addedgetoscanvert(sc,eed)==0) return sc; @@ -385,7 +394,7 @@ static ScFillVert *addedgetoscanlist(EditEdge *eed, int len) return 0; } -static short boundinsideEV(EditEdge *eed, EditVert *eve) +static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve) /* is eve inside boundbox eed */ { float minx,maxx,miny,maxy; @@ -416,8 +425,8 @@ static void testvertexnearedge(void) /* only vertices with ->h==1 are being tested for being close to an edge, if true insert */ - EditVert *eve; - EditEdge *eed,*ed1; + ScanFillVert *eve; + ScanFillEdge *eed,*ed1; float dist,vec1[2],vec2[2],vec3[2]; eve= fillvertbase.first; @@ -437,7 +446,7 @@ static void testvertexnearedge(void) } eed= filledgebase.first; while(eed) { - if(eve!=eed->v1 && eve!=eed->v2 && eve->xs==eed->f1) { + if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) { if(compare_v3v3(eve->co,eed->v1->co, COMPLIMIT)) { ed1->v2= eed->v1; eed->v1->h++; @@ -462,8 +471,8 @@ static void testvertexnearedge(void) ed1= BLI_addfilledge(eed->v1, eve); /* printf("fill: vertex near edge %x\n",eve); */ - ed1->f= ed1->h= 0; - ed1->f1= eed->f1; + ed1->f= 0; + ed1->poly_nr = eed->poly_nr; eed->v1= eve; eve->h= 3; break; @@ -481,8 +490,8 @@ static void testvertexnearedge(void) static void splitlist(ListBase *tempve, ListBase *temped, short nr) { /* everything is in templist, write only poly nr to fillist */ - EditVert *eve,*nextve; - EditEdge *eed,*nexted; + ScanFillVert *eve,*nextve; + ScanFillEdge *eed,*nexted; BLI_movelisttolist(tempve,&fillvertbase); BLI_movelisttolist(temped,&filledgebase); @@ -490,7 +499,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) eve= tempve->first; while(eve) { nextve= eve->next; - if(eve->xs==nr) { + if (eve->poly_nr == nr) { BLI_remlink(tempve,eve); BLI_addtail(&fillvertbase,eve); } @@ -499,7 +508,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) eed= temped->first; while(eed) { nexted= eed->next; - if(eed->f1==nr) { + if(eed->poly_nr==nr) { BLI_remlink(temped,eed); BLI_addtail(&filledgebase,eed); } @@ -508,11 +517,11 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) } -static int scanfill(PolyFill *pf, short mat_nr) +static int scanfill(PolyFill *pf) { - ScFillVert *sc = NULL, *sc1; - EditVert *eve,*v1,*v2,*v3; - EditEdge *eed,*nexted,*ed1,*ed2,*ed3; + ScanFillVertLink *sc = NULL, *sc1; + ScanFillVert *eve,*v1,*v2,*v3; + ScanFillEdge *eed,*nexted,*ed1,*ed2,*ed3; float miny = 0.0; int a,b,verts, maxface, totface; short nr, test, twoconnected=0; @@ -558,14 +567,14 @@ static int scanfill(PolyFill *pf, short mat_nr) } /* STEP 1: make using FillVert and FillEdge lists a sorted - ScFillVert list + ScanFillVertLink list */ - sc= scdata= (ScFillVert *)MEM_callocN(pf->verts*sizeof(ScFillVert),"Scanfill1"); + sc= scdata= (ScanFillVertLink *)MEM_callocN(pf->verts*sizeof(ScanFillVertLink),"Scanfill1"); eve= fillvertbase.first; verts= 0; while(eve) { - if(eve->xs==nr) { - if(eve->f!= 255) { + if (eve->poly_nr == nr) { + if (eve->f != 255) { verts++; eve->f= 0; /* flag for connectedges later on */ sc->v1= eve; @@ -575,7 +584,7 @@ static int scanfill(PolyFill *pf, short mat_nr) eve= eve->next; } - qsort(scdata, verts, sizeof(ScFillVert), vergscdata); + qsort(scdata, verts, sizeof(ScanFillVertLink), vergscdata); eed= filledgebase.first; while(eed) { @@ -698,7 +707,7 @@ static int scanfill(PolyFill *pf, short mat_nr) else { /* new triangle */ /* printf("add face %x %x %x\n",v1,v2,v3); */ - addfillface(v1, v2, v3, mat_nr); + addfillface(v1, v2, v3); totface++; BLI_remlink((ListBase *)&(sc->first),ed1); BLI_addtail(&filledgebase,ed1); @@ -787,8 +796,8 @@ int BLI_edgefill(short mat_nr) - returns number of triangle faces added. */ ListBase tempve, temped; - EditVert *eve; - EditEdge *eed,*nexted; + ScanFillVert *eve; + ScanFillEdge *eed,*nexted; PolyFill *pflist,*pf; float limit, *minp, *maxp, *v1, *v2, norm[3], len; short a,c,poly=0,ok=0,toggle=0; @@ -799,7 +808,7 @@ int BLI_edgefill(short mat_nr) a = 0; while(eve) { eve->f= 0; - eve->xs= 0; + eve->poly_nr= 0; eve->h= 0; eve= eve->next; a += 1; @@ -808,7 +817,7 @@ int BLI_edgefill(short mat_nr) if (a == 3 && (mat_nr & 2)) { eve = fillvertbase.first; - addfillface(eve, eve->next, eve->next->next, 0); + addfillface(eve, eve->next, eve->next->next); return 1; } else if (a == 4 && (mat_nr & 2)) { float vec1[3], vec2[3]; @@ -821,15 +830,15 @@ int BLI_edgefill(short mat_nr) sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co); if (INPR(vec1, vec1) < INPR(vec2, vec2)) { - addfillface(eve, eve->next, eve->next->next, 0); - addfillface(eve->next->next, eve->next->next->next, eve, 0); + addfillface(eve, eve->next, eve->next->next); + addfillface(eve->next->next, eve->next->next->next, eve); } else{ - addfillface(eve->next, eve->next->next, eve->next->next->next, 0); - addfillface(eve->next->next->next, eve, eve->next, 0); + addfillface(eve->next, eve->next->next, eve->next->next->next); + addfillface(eve->next->next->next, eve, eve->next); } } else { - addfillface(eve, eve->next, eve->next->next, 0); - addfillface(eve->next->next, eve->next->next->next, eve, 0); + addfillface(eve, eve->next, eve->next->next); + addfillface(eve->next->next, eve->next->next->next, eve); } return 2; } @@ -838,7 +847,7 @@ int BLI_edgefill(short mat_nr) /* including resetting of flags */ eed= filledgebase.first; while(eed) { - eed->f1= eed->h= 0; + eed->poly_nr= 0; eed->v1->f= 1; eed->v2->f= 1; @@ -895,11 +904,11 @@ int BLI_edgefill(short mat_nr) eve= fillvertbase.first; while(eve) { /* get first vertex with no poly number */ - if(eve->xs==0) { + if (eve->poly_nr==0) { poly++; /* now a sortof select connected */ ok= 1; - eve->xs= poly; + eve->poly_nr = poly; while(ok) { @@ -909,19 +918,19 @@ int BLI_edgefill(short mat_nr) else eed= filledgebase.last; while(eed) { - if(eed->v1->xs==0 && eed->v2->xs==poly) { - eed->v1->xs= poly; - eed->f1= poly; + if (eed->v1->poly_nr == 0 && eed->v2->poly_nr == poly) { + eed->v1->poly_nr = poly; + eed->poly_nr= poly; ok= 1; } - else if(eed->v2->xs==0 && eed->v1->xs==poly) { - eed->v2->xs= poly; - eed->f1= poly; + else if (eed->v2->poly_nr == 0 && eed->v1->poly_nr == poly) { + eed->v2->poly_nr = poly; + eed->poly_nr= poly; ok= 1; } - else if(eed->f1==0) { - if(eed->v1->xs==poly && eed->v2->xs==poly) { - eed->f1= poly; + else if (eed->poly_nr == 0) { + if (eed->v1->poly_nr == poly && eed->v2->poly_nr == poly) { + eed->poly_nr= poly; ok= 1; } } @@ -1002,21 +1011,21 @@ int BLI_edgefill(short mat_nr) } eed= filledgebase.first; while(eed) { - pflist[eed->f1-1].edges++; + pflist[eed->poly_nr-1].edges++; eed= eed->next; } eve= fillvertbase.first; while(eve) { - pflist[eve->xs-1].verts++; - minp= pflist[eve->xs-1].min; - maxp= pflist[eve->xs-1].max; + pflist[eve->poly_nr-1].verts++; + minp= pflist[eve->poly_nr-1].min; + maxp= pflist[eve->poly_nr-1].max; minp[cox]= (minp[cox])<(eve->co[cox]) ? (minp[cox]) : (eve->co[cox]); minp[coy]= (minp[coy])<(eve->co[coy]) ? (minp[coy]) : (eve->co[coy]); maxp[cox]= (maxp[cox])>(eve->co[cox]) ? (maxp[cox]) : (eve->co[cox]); maxp[coy]= (maxp[coy])>(eve->co[coy]) ? (maxp[coy]) : (eve->co[coy]); - if(eve->h>2) pflist[eve->xs-1].f= 1; + if(eve->h > 2) pflist[eve->poly_nr-1].f = 1; eve= eve->next; } @@ -1083,7 +1092,7 @@ int BLI_edgefill(short mat_nr) for(a=0;a<poly;a++) { if(pf->edges>1) { splitlist(&tempve,&temped,pf->nr); - totfaces += scanfill(pf, mat_nr); + totfaces += scanfill(pf); } pf++; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 82381f99ddc..675dad4aa01 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3704,7 +3704,11 @@ static void lib_link_mesh(FileData *fd, Main *main) * waiting until edit mode has been entered/exited, making it easier * to recognize problems that would otherwise only show up after edits). */ +#ifdef USE_TESSFACE_DEFAULT BKE_mesh_tessface_calc(me); +#else + BKE_mesh_tessface_clear(me); +#endif me->id.flag -= LIB_NEEDLINK; } diff --git a/source/blender/bmesh/bmesh_iterators.h b/source/blender/bmesh/bmesh_iterators.h index 51df9460e8b..45cb1ed0923 100644 --- a/source/blender/bmesh/bmesh_iterators.h +++ b/source/blender/bmesh/bmesh_iterators.h @@ -102,8 +102,8 @@ typedef struct BMIter { char itype; } BMIter; -void *BM_iter_at_index(struct BMesh *bm, const char htype, void *data, int index); -int BM_iter_as_array(struct BMesh *bm, const char htype, void *data, void **array, const int len); +void *BM_iter_at_index(struct BMesh *bm, const char itype, void *data, int index); +int BM_iter_as_array(struct BMesh *bm, const char itype, void *data, void **array, const int len); /* private for bmesh_iterators_inline.c */ void bmiter__vert_of_mesh_begin(struct BMIter *iter); diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h index 7bbb579685d..804515f96bf 100644 --- a/source/blender/bmesh/bmesh_operator_api.h +++ b/source/blender/bmesh/bmesh_operator_api.h @@ -78,11 +78,12 @@ struct GHashIterator; /* slot type arrays are terminated by the last member * having a slot type of 0.*/ #define BMO_OP_SLOT_SENTINEL 0 -#define BMO_OP_SLOT_INT 1 -#define BMO_OP_SLOT_FLT 2 -#define BMO_OP_SLOT_PNT 3 -#define BMO_OP_SLOT_MAT 4 -#define BMO_OP_SLOT_VEC 7 +#define BMO_OP_SLOT_BOOL 1 +#define BMO_OP_SLOT_INT 2 +#define BMO_OP_SLOT_FLT 3 +#define BMO_OP_SLOT_PNT 4 +#define BMO_OP_SLOT_MAT 5 +#define BMO_OP_SLOT_VEC 8 /* after BMO_OP_SLOT_VEC, everything is @@ -91,9 +92,9 @@ struct GHashIterator; * for future growth. */ //it's very important this remain a power of two -#define BMO_OP_SLOT_ELEMENT_BUF 8 -#define BMO_OP_SLOT_MAPPING 9 -/* #define BMO_OP_SLOT_TOTAL_TYPES 10 */ /* not used yet */ +#define BMO_OP_SLOT_ELEMENT_BUF 9 +#define BMO_OP_SLOT_MAPPING 10 +#define BMO_OP_SLOT_TOTAL_TYPES 11 /* please ignore all these structures, don't touch them in tool code, except * for when your defining an operator with BMOpDefine.*/ @@ -199,7 +200,7 @@ int BMO_mesh_flag_count(struct BMesh *bm, const short oflag, const char htype); * this system is used to execute or initialize an operator, * using a formatted-string system. * - * for example, BMO_op_callf(bm, "del geom=%hf context=%d", BM_ELEM_SELECT, DEL_FACES); + * for example, BMO_op_callf(bm, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES); * . . .will execute the delete operator, feeding in selected faces, deleting them. * * the basic format for the format string is: @@ -271,7 +272,7 @@ enum { DEL_ONLYFACES, DEL_EDGESFACES, DEL_FACES, - DEL_ALL , + DEL_ALL, DEL_ONLYTAGGED }; @@ -282,6 +283,8 @@ void BMO_slot_float_set(struct BMOperator *op, const char *slotname, const floa float BMO_slot_float_get(BMOperator *op, const char *slotname); void BMO_slot_int_set(struct BMOperator *op, const char *slotname, const int i); int BMO_slot_int_get(BMOperator *op, const char *slotname); +void BMO_slot_bool_set(struct BMOperator *op, const char *slotname, const int i); +int BMO_slot_bool_get(BMOperator *op, const char *slotname); /* don't pass in arrays that are supposed to map to elements this way. * @@ -310,10 +313,10 @@ void BMO_slot_from_flag(struct BMesh *bm, struct BMOperator *op, const char *slo /* tool-flags all elements inside an element slot array with flag flag. */ void BMO_slot_buffer_flag_enable(struct BMesh *bm, struct BMOperator *op, const char *slotname, - const short oflag, const char htype); + const short oflag, const char htype); /* clears tool-flag flag from all elements inside a slot array. */ void BMO_slot_buffer_flag_disable(struct BMesh *bm, struct BMOperator *op, const char *slotname, - const short oflag, const char htype); + const short oflag, const char htype); /* tool-flags all elements inside an element slot array with flag flag. */ void BMO_slot_buffer_hflag_enable(struct BMesh *bm, struct BMOperator *op, const char *slotname, @@ -448,7 +451,7 @@ typedef struct BMOElemMapping { int len; } BMOElemMapping; -extern const int BMO_OPSLOT_TYPEINFO[]; +extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES]; BM_INLINE void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element, void *data, int len) diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.c b/source/blender/bmesh/intern/bmesh_iterators_inline.c index ef644f96ce0..bd2242c262b 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.c +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.c @@ -52,11 +52,10 @@ BM_INLINE void *BM_iter_step(BMIter *iter) * * Takes a bmesh iterator structure and fills * it with the appropriate function pointers based - * upon its type and then calls BMeshIter_step() - * to return the first element of the iterator. + * upon its type. * */ -BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data) +BM_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data) { /* int argtype; */ iter->itype = itype; @@ -78,7 +77,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_EDGES_OF_VERT: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__edge_of_vert_begin; iter->step = bmiter__edge_of_vert_step; @@ -86,7 +85,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_FACES_OF_VERT: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__face_of_vert_begin; iter->step = bmiter__face_of_vert_step; @@ -94,7 +93,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_LOOPS_OF_VERT: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__loop_of_vert_begin; iter->step = bmiter__loop_of_vert_step; @@ -102,7 +101,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_FACES_OF_EDGE: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__face_of_edge_begin; iter->step = bmiter__face_of_edge_step; @@ -110,7 +109,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_VERTS_OF_FACE: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__vert_of_face_begin; iter->step = bmiter__vert_of_face_step; @@ -118,7 +117,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_EDGES_OF_FACE: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__edge_of_face_begin; iter->step = bmiter__edge_of_face_step; @@ -126,7 +125,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_LOOPS_OF_FACE: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__loop_of_face_begin; iter->step = bmiter__loop_of_face_step; @@ -134,7 +133,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_LOOPS_OF_LOOP: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__loops_of_loop_begin; iter->step = bmiter__loops_of_loop_step; @@ -142,7 +141,7 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat break; case BM_LOOPS_OF_EDGE: if (!data) - return NULL; + return FALSE; iter->begin = bmiter__loops_of_edge_begin; iter->step = bmiter__loops_of_edge_step; @@ -153,8 +152,26 @@ BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *dat } iter->begin(iter); - return BM_iter_step(iter); + return TRUE; } +/* + * BMESH ITERATOR NEW + * + * Takes a bmesh iterator structure and fills + * it with the appropriate function pointers based + * upon its type and then calls BMeshIter_step() + * to return the first element of the iterator. + * + */ +BM_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data) +{ + if (BM_iter_init(iter, bm, itype, data)) { + return BM_iter_step(iter); + } + else { + return NULL; + } +} #endif /* __BMESH_ITERATORS_INLINE_C__ */ diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index a432049e238..a378ddaeabb 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -349,7 +349,7 @@ static void bmesh_rationalize_normals(BMesh *bm, int undo) return; } - BMO_op_initf(bm, &bmop, "righthandfaces faces=%af doflip=%d", FALSE); + BMO_op_initf(bm, &bmop, "righthandfaces faces=%af do_flip=%b", FALSE); BMO_push(bm, &bmop); bmesh_righthandfaces_exec(bm, &bmop); diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 19e9971619a..61f698fe7d9 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -98,9 +98,9 @@ static BMOpDefine def_vertexsmooth = { "vertexsmooth", {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices - {BMO_OP_SLOT_INT, "mirror_clip_x"}, //set vertices close to the x axis before the operation to 0 - {BMO_OP_SLOT_INT, "mirror_clip_y"}, //set vertices close to the y axis before the operation to 0 - {BMO_OP_SLOT_INT, "mirror_clip_z"}, //set vertices close to the z axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_x"}, //set vertices close to the x axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, //set vertices close to the y axis before the operation to 0 + {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, //set vertices close to the z axis before the operation to 0 {BMO_OP_SLOT_FLT, "clipdist"}, //clipping threshod for the above three slots {0} /* null-terminating sentine */, }, @@ -117,7 +117,7 @@ static BMOpDefine def_vertexsmooth = { static BMOpDefine def_righthandfaces = { "righthandfaces", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, - {BMO_OP_SLOT_INT, "doflip"}, //internal flag, used by bmesh_rationalize_normals + {BMO_OP_SLOT_BOOL, "do_flip"}, //internal flag, used by bmesh_rationalize_normals {0} /* null-terminating sentine */, }, bmesh_righthandfaces_exec, @@ -138,8 +138,8 @@ static BMOpDefine def_regionextend = { "regionextend", {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output slot, computed boundary geometry. - {BMO_OP_SLOT_INT, "constrict"}, //find boundary inside the regions, not outside. - {BMO_OP_SLOT_INT, "usefaces"}, //extend from faces instead of edges + {BMO_OP_SLOT_BOOL, "constrict"}, //find boundary inside the regions, not outside. + {BMO_OP_SLOT_BOOL, "use_faces"}, //extend from faces instead of edges {0} /* null-terminating sentine */, }, bmesh_regionextend_exec, @@ -156,7 +156,7 @@ static BMOpDefine def_edgerotate = { "edgerotate", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input edges {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, //newly spun edges - {BMO_OP_SLOT_INT, "ccw"}, //rotate edge counter-clockwise if true, othewise clockwise + {BMO_OP_SLOT_BOOL, "ccw"}, //rotate edge counter-clockwise if true, othewise clockwise {0} /* null-terminating sentine */, }, bmesh_edgerotate_exec, @@ -210,8 +210,8 @@ static BMOpDefine def_mirror = { {BMO_OP_SLOT_FLT, "mergedist"}, //maximum distance for merging. does no merging if 0. {BMO_OP_SLOT_ELEMENT_BUF, "newout"}, //output geometry, mirrored {BMO_OP_SLOT_INT, "axis"}, //the axis to use, 0, 1, or 2 for x, y, z - {BMO_OP_SLOT_INT, "mirror_u"}, //mirror UVs across the u axis - {BMO_OP_SLOT_INT, "mirror_v"}, //mirror UVs across the v axis + {BMO_OP_SLOT_BOOL, "mirror_u"}, //mirror UVs across the u axis + {BMO_OP_SLOT_BOOL, "mirror_v"}, //mirror UVs across the v axis {0, /* null-terminating sentine */}}, bmesh_mirror_exec, 0, @@ -375,10 +375,10 @@ static BMOpDefine def_join_triangles = { "join_triangles", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input geometry. {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //joined faces - {BMO_OP_SLOT_INT, "compare_sharp"}, - {BMO_OP_SLOT_INT, "compare_uvs"}, - {BMO_OP_SLOT_INT, "compare_vcols"}, - {BMO_OP_SLOT_INT, "compare_materials"}, + {BMO_OP_SLOT_BOOL, "cmp_sharp"}, + {BMO_OP_SLOT_BOOL, "cmp_uvs"}, + {BMO_OP_SLOT_BOOL, "cmp_vcols"}, + {BMO_OP_SLOT_BOOL, "cmp_materials"}, {BMO_OP_SLOT_FLT, "limit"}, {0, /* null-terminating sentine */}}, bmesh_jointriangles_exec, @@ -421,7 +421,7 @@ static BMOpDefine def_edgenet_fill = { "edgenet_fill", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */ {BMO_OP_SLOT_MAPPING, "restrict"}, /* restricts edges to groups. maps edges to integer */ - {BMO_OP_SLOT_INT, "use_restrict"}, + {BMO_OP_SLOT_BOOL, "use_restrict"}, {BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */ {BMO_OP_SLOT_MAPPING, "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */ @@ -535,7 +535,7 @@ static BMOpDefine def_bmesh_to_mesh = { "bmesh_to_mesh", {{BMO_OP_SLOT_PNT, "mesh"}, //pointer to a mesh structure to fill in {BMO_OP_SLOT_PNT, "object"}, //pointer to an object structure - {BMO_OP_SLOT_INT, "notesselation"}, //don't calculate mfaces + {BMO_OP_SLOT_BOOL, "notesselation"}, //don't calculate mfaces {0, /* null-terminating sentine */}}, bmesh_to_mesh_exec, 0, @@ -551,7 +551,7 @@ static BMOpDefine def_mesh_to_bmesh = { "mesh_to_bmesh", {{BMO_OP_SLOT_PNT, "mesh"}, //pointer to a Mesh structure {BMO_OP_SLOT_PNT, "object"}, //pointer to an Object structure - {BMO_OP_SLOT_INT, "set_shapekey"}, //load active shapekey coordinates into verts + {BMO_OP_SLOT_BOOL, "set_shapekey"}, //load active shapekey coordinates into verts {0, /* null-terminating sentine */}}, mesh_to_bmesh_exec, 0 @@ -615,7 +615,7 @@ static BMOpDefine def_extrudefaceregion = { "extrudefaceregion", {{BMO_OP_SLOT_ELEMENT_BUF, "edgefacein"}, {BMO_OP_SLOT_MAPPING, "exclude"}, - {BMO_OP_SLOT_INT, "alwayskeeporig"}, + {BMO_OP_SLOT_BOOL, "alwayskeeporig"}, {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, {0} /* null-terminating sentine */}, extrude_edge_context_exec, @@ -634,7 +634,7 @@ static BMOpDefine def_dissolveedgessop = { "dissolveedges", {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, {BMO_OP_SLOT_ELEMENT_BUF, "regionout"}, - {BMO_OP_SLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges. + {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges. {0} /* null-terminating sentine */}, dissolveedges_exec, BMO_OP_FLAG_UNTAN_MULTIRES @@ -653,7 +653,7 @@ static BMOpDefine def_dissolvefacesop = { "dissolvefaces", {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, {BMO_OP_SLOT_ELEMENT_BUF, "regionout"}, - {BMO_OP_SLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges. + {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges. {0} /* null-terminating sentine */}, dissolvefaces_exec, BMO_OP_FLAG_UNTAN_MULTIRES @@ -696,9 +696,9 @@ static BMOpDefine def_subdop = { {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */ - {BMO_OP_SLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h - {BMO_OP_SLOT_INT, "gridfill"}, //fill in fully-selected faces with a grid - {BMO_OP_SLOT_INT, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle + {BMO_OP_SLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h + {BMO_OP_SLOT_BOOL, "gridfill"}, //fill in fully-selected faces with a grid + {BMO_OP_SLOT_BOOL, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle {0} /* null-terminating sentine */, }, @@ -708,7 +708,8 @@ static BMOpDefine def_subdop = { static BMOpDefine def_delop = { "del", - {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, {BMO_OP_SLOT_INT, "context"}, + {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, + {BMO_OP_SLOT_INT, "context"}, {0} /* null-terminating sentine */}, delop_exec, 0 @@ -757,7 +758,7 @@ static BMOpDefine def_spinop = { {BMO_OP_SLOT_VEC, "dvec"}, /* translation delta per step */ {BMO_OP_SLOT_FLT, "ang"}, /* total rotation angle (degrees) */ {BMO_OP_SLOT_INT, "steps"}, /* number of steps */ - {BMO_OP_SLOT_INT, "dupli"}, /* duplicate or extrude? */ + {BMO_OP_SLOT_BOOL, "do_dupli"}, /* duplicate or extrude? */ {0} /* null-terminating sentine */}, spinop_exec, 0 @@ -965,8 +966,8 @@ static BMOpDefine def_create_monkey = { static BMOpDefine def_create_cone = { "create_cone", {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts - {BMO_OP_SLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces - {BMO_OP_SLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons + {BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces + {BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons {BMO_OP_SLOT_INT, "segments"}, {BMO_OP_SLOT_FLT, "diameter1"}, //diameter of one end {BMO_OP_SLOT_FLT, "diameter2"}, //diameter of the opposite @@ -983,8 +984,8 @@ static BMOpDefine def_create_cone = { static BMOpDefine def_create_circle = { "create_circle", {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output verts - {BMO_OP_SLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces - {BMO_OP_SLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons + {BMO_OP_SLOT_BOOL, "cap_ends"}, //wheter or not to fill in the ends with faces + {BMO_OP_SLOT_BOOL, "cap_tris"}, //fill ends with triangles instead of ngons {BMO_OP_SLOT_INT, "segments"}, {BMO_OP_SLOT_FLT, "diameter"}, //diameter of one end {BMO_OP_SLOT_MAT, "mat"}, //matrix to multiply the new geometry with-- @@ -1018,9 +1019,9 @@ static BMOpDefine def_bevel = { {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */ {BMO_OP_SLOT_ELEMENT_BUF, "face_spans"}, /* new geometry */ {BMO_OP_SLOT_ELEMENT_BUF, "face_holes"}, /* new geometry */ - {BMO_OP_SLOT_INT, "use_lengths"}, /* grab edge lengths from a PROP_FLT customdata laye */ - {BMO_OP_SLOT_INT, "use_even"}, /* corner vert placement: use shell/angle calculations */ - {BMO_OP_SLOT_INT, "use_dist"}, /* corner vert placement: evaluate percent as a distance, + {BMO_OP_SLOT_BOOL, "use_lengths"}, /* grab edge lengths from a PROP_FLT customdata laye */ + {BMO_OP_SLOT_BOOL, "use_even"}, /* corner vert placement: use shell/angle calculations */ + {BMO_OP_SLOT_BOOL, "use_dist"}, /* corner vert placement: evaluate percent as a distance, * modifier uses this. We could do this as another float setting */ {BMO_OP_SLOT_INT, "lengthlayer"}, /* which PROP_FLT layer to us */ {BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand bevelled edge */ diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 66222c39c68..edfea460f1a 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -63,9 +63,10 @@ static const char *bmo_error_messages[] = { /* operator slot type information - size of one element of the type given. */ -const int BMO_OPSLOT_TYPEINFO[] = { +const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = { 0, sizeof(int), + sizeof(int), sizeof(float), sizeof(void *), 0, /* unused */ @@ -309,6 +310,7 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, void BMO_slot_float_set(BMOperator *op, const char *slotname, const float f) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_FLT); if (!(slot->slottype == BMO_OP_SLOT_FLT)) return; @@ -318,16 +320,28 @@ void BMO_slot_float_set(BMOperator *op, const char *slotname, const float f) void BMO_slot_int_set(BMOperator *op, const char *slotname, const int i) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_INT); if (!(slot->slottype == BMO_OP_SLOT_INT)) return; slot->data.i = i; } +void BMO_slot_bool_set(BMOperator *op, const char *slotname, const int i) +{ + BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_BOOL); + if (!(slot->slottype == BMO_OP_SLOT_BOOL)) + return; + + slot->data.i = i; +} + /* only supports square mats */ void BMO_slot_mat_set(struct BMOperator *op, const char *slotname, const float *mat, int size) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_MAT); if (!(slot->slottype == BMO_OP_SLOT_MAT)) return; @@ -350,6 +364,7 @@ void BMO_slot_mat_set(struct BMOperator *op, const char *slotname, const float * void BMO_slot_mat4_get(struct BMOperator *op, const char *slotname, float r_mat[4][4]) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_MAT); if (!(slot->slottype == BMO_OP_SLOT_MAT)) return; @@ -359,6 +374,7 @@ void BMO_slot_mat4_get(struct BMOperator *op, const char *slotname, float r_mat[ void BMO_slot_mat3_set(struct BMOperator *op, const char *slotname, float r_mat[3][3]) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_MAT); if (!(slot->slottype == BMO_OP_SLOT_MAT)) return; @@ -368,6 +384,7 @@ void BMO_slot_mat3_set(struct BMOperator *op, const char *slotname, float r_mat[ void BMO_slot_ptr_set(BMOperator *op, const char *slotname, void *p) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_PNT); if (!(slot->slottype == BMO_OP_SLOT_PNT)) return; @@ -377,6 +394,7 @@ void BMO_slot_ptr_set(BMOperator *op, const char *slotname, void *p) void BMO_slot_vec_set(BMOperator *op, const char *slotname, const float vec[3]) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_VEC); if (!(slot->slottype == BMO_OP_SLOT_VEC)) return; @@ -387,6 +405,7 @@ void BMO_slot_vec_set(BMOperator *op, const char *slotname, const float vec[3]) float BMO_slot_float_get(BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_FLT); if (!(slot->slottype == BMO_OP_SLOT_FLT)) return 0.0f; @@ -396,16 +415,28 @@ float BMO_slot_float_get(BMOperator *op, const char *slotname) int BMO_slot_int_get(BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_INT); if (!(slot->slottype == BMO_OP_SLOT_INT)) return 0; return slot->data.i; } +int BMO_slot_bool_get(BMOperator *op, const char *slotname) +{ + BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_BOOL); + if (!(slot->slottype == BMO_OP_SLOT_BOOL)) + return 0; + + return slot->data.i; +} + void *BMO_slot_ptr_get(BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_PNT); if (!(slot->slottype == BMO_OP_SLOT_PNT)) return NULL; @@ -415,6 +446,7 @@ void *BMO_slot_ptr_get(BMOperator *op, const char *slotname) void BMO_slot_vec_get(BMOperator *op, const char *slotname, float r_vec[3]) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_VEC); if (!(slot->slottype == BMO_OP_SLOT_VEC)) return; @@ -481,6 +513,7 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty int BMO_slot_buf_count(struct BMesh *UNUSED(bm), struct BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); /* check if its actually a buffer */ if (!(slot->slottype > BMO_OP_SLOT_VEC)) @@ -492,6 +525,7 @@ int BMO_slot_buf_count(struct BMesh *UNUSED(bm), struct BMOperator *op, const ch int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname) { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING); /* check if its actually a buffer */ if (!(slot->slottype == BMO_OP_SLOT_MAPPING)) @@ -548,6 +582,8 @@ void BMO_slot_map_to_flag(struct BMesh *bm, struct BMOperator *op, BMOpSlot *slot = BMO_slot_get(op, slotname); BMElemF *ele_f; + BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING); + /* sanity check */ if (slot->slottype != BMO_OP_SLOT_MAPPING) return; if (!slot->data.ghash) return; @@ -562,6 +598,8 @@ static void *bmo_slot_buffer_alloc(BMOperator *op, const char *slotname, int len { BMOpSlot *slot = BMO_slot_get(op, slotname); + BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + /* check if its actually a buffer */ if (!(slot->slottype > BMO_OP_SLOT_VEC)) return NULL; @@ -682,6 +720,8 @@ void BMO_slot_from_flag(BMesh *bm, BMOperator *op, const char *slotname, BMOpSlot *output = BMO_slot_get(op, slotname); int totelement = BMO_mesh_flag_count(bm, oflag, htype), i = 0; + BLI_assert(output->slottype > BMO_OP_SLOT_VEC); + if (totelement) { bmo_slot_buffer_alloc(op, slotname, totelement); @@ -730,7 +770,9 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slotnam BMOpSlot *slot = BMO_slot_get(op, slotname); BMHeader **data = slot->data.p; int i; - + + BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + for (i = 0; i < slot->len; i++) { if (!(htype & data[i]->htype)) continue; @@ -755,6 +797,8 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slotna BMOpSlot *slot = BMO_slot_get(op, slotname); BMHeader **data = slot->data.p; int i; + + BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); for (i = 0; i < slot->len; i++) { if (!(htype & data[i]->htype)) @@ -793,12 +837,14 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag) * Flags elements in a slots buffer */ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname, - const short oflag, const char htype) + const short oflag, const char htype) { BMOpSlot *slot = BMO_slot_get(op, slotname); BMHeader **data = slot->data.p; int i; - + + BLI_assert(slot->slottype > BMO_OP_SLOT_VEC); + for (i = 0; i < slot->len; i++) { if (!(htype & data[i]->htype)) continue; @@ -814,7 +860,7 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname * Removes flags from elements in a slots buffer */ void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slotname, - const short oflag, const char htype) + const short oflag, const char htype) { BMOpSlot *slot = BMO_slot_get(op, slotname); BMHeader **data = slot->data.p; @@ -1102,19 +1148,6 @@ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op) return errorcode; } -/* example: - * BMO_CallOp(bm, "del %d %hv", DEL_ONLYFACES, BM_ELEM_SELECT); - * - * d - int - * i - int - * f - float - * hv - header flagged verts - * he - header flagged edges - * hf - header flagged faces - * fv - flagged verts - * fe - flagged edges - * ff - flagged faces - */ #define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0) @@ -1155,6 +1188,20 @@ static int bmesh_opname_to_opcode(const char *opname) return -1; } +/* Example: + * BMO_op_callf(bm, "del %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT); + * + * i - int + * b - boolean (same as int but 1/0 only) + * f - float + * hv - header flagged verts (hflag) + * he - header flagged edges (hflag) + * hf - header flagged faces (hflag) + * fv - flagged verts (oflag) + * fe - flagged edges (oflag) + * ff - flagged faces (oflag) + */ + int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist) { BMOpDefine *def; @@ -1265,10 +1312,13 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist) break; } case 'i': - case 'd': BMO_slot_int_set(op, slotname, va_arg(vlist, int)); state = 1; break; + case 'b': + BMO_slot_bool_set(op, slotname, va_arg(vlist, int)); + state = 1; + break; case 'p': BMO_slot_ptr_set(op, slotname, va_arg(vlist, void *)); state = 1; diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index 98e9a510126..aab8d7d40dd 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -190,11 +190,11 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op) BLI_array_declare(edges); SmallHash hash; float fac = BMO_slot_float_get(op, "percent"); - const short do_even = BMO_slot_int_get(op, "use_even"); - const short do_dist = BMO_slot_int_get(op, "use_dist"); + const short do_even = BMO_slot_bool_get(op, "use_even"); + const short do_dist = BMO_slot_bool_get(op, "use_dist"); int i, li, has_elens, HasMDisps = CustomData_has_layer(&bm->ldata, CD_MDISPS); - has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_int_get(op, "use_lengths"); + has_elens = CustomData_has_layer(&bm->edata, CD_PROP_FLT) && BMO_slot_bool_get(op, "use_lengths"); if (has_elens) { li = BMO_slot_int_get(op, "lengthlayer"); } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index d90e5c36c80..6ba0c91fb4d 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -728,7 +728,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E BMVert *startv; BMVert *endv; EPathNode *node; - int i, use_restrict = BMO_slot_int_get(op, "use_restrict"); + int i, use_restrict = BMO_slot_bool_get(op, "use_restrict"); startv = edata[BM_elem_index_get(edge)].ftag ? edge->v2 : edge->v1; endv = edata[BM_elem_index_get(edge)].ftag ? edge->v1 : edge->v2; @@ -872,7 +872,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) BMEdge **edges = NULL; PathBase *pathbase = edge_pathbase_new(); BLI_array_declare(edges); - int use_restrict = BMO_slot_int_get(op, "use_restrict"); + int use_restrict = BMO_slot_bool_get(op, "use_restrict"); int i, j, group = 0; unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 05aead466d1..46124590d5e 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -79,7 +79,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) BMWalker regwalker; int i; - int use_verts = BMO_slot_int_get(op, "use_verts"); + int use_verts = BMO_slot_bool_get(op, "use_verts"); if (use_verts) { /* tag verts that start out with only 2 edges, @@ -160,7 +160,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) } - BMO_op_callf(bm, "del geom=%ff context=%d", FACE_ORIG, DEL_FACES); + BMO_op_callf(bm, "del geom=%ff context=%i", FACE_ORIG, DEL_FACES); if (use_verts) { @@ -247,7 +247,7 @@ void dissolveedges_exec(BMesh *bm, BMOperator *op) BMIter viter; BMVert *v; - int use_verts = BMO_slot_int_get(op, "use_verts"); + int use_verts = BMO_slot_bool_get(op, "use_verts"); if (use_verts) { BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 2e1c91d920c..676e2eeb5f6 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -468,7 +468,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) float q[4]; float rmat[3][3]; float phi, si; - int steps, dupli, a, usedvec; + int steps, do_dupli, a, usedvec; BMO_slot_vec_get(op, "cent", cent); BMO_slot_vec_get(op, "axis", axis); @@ -477,7 +477,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) usedvec = !is_zero_v3(dvec); steps = BMO_slot_int_get(op, "steps"); phi = BMO_slot_float_get(op, "ang") * (float)M_PI / (360.0f * steps); - dupli = BMO_slot_int_get(op, "dupli"); + do_dupli = BMO_slot_bool_get(op, "do_dupli"); si = (float)sin(phi); q[0] = (float)cos(phi); @@ -488,7 +488,7 @@ void spinop_exec(BMesh *bm, BMOperator *op) BMO_slot_copy(op, op, "geom", "lastout"); for (a = 0; a < steps; a++) { - if (dupli) { + if (do_dupli) { BMO_op_initf(bm, &dupop, "dupe geom=%s", op, "lastout"); BMO_op_exec(bm, &dupop); BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s", diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index b6a87e604ec..2c6a0e0de6a 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -107,7 +107,7 @@ void bmesh_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) BLI_array_free(edges); - BMO_op_callf(bm, "del geom=%ff context=%d", EXT_DEL, DEL_ONLYFACES); + BMO_op_callf(bm, "del geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES); BMO_slot_from_flag(bm, op, "faceout", EXT_KEEP, BM_FACE); } @@ -201,7 +201,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) /* if one flagged face is bordered by an unflagged face, then we delete * original geometry unless caller explicitly asked to keep it. */ - if (!BMO_slot_int_get(op, "alwayskeeporig")) { + if (!BMO_slot_bool_get(op, "alwayskeeporig")) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (!BMO_elem_flag_test(bm, e, EXT_INPUT)) continue; @@ -248,7 +248,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) } if (delorig) { - BMO_op_initf(bm, &delop, "del geom=%fvef context=%d", + BMO_op_initf(bm, &delop, "del geom=%fvef context=%i", EXT_DEL, DEL_ONLYTAGGED); } @@ -576,7 +576,7 @@ void bmesh_solidify_face_region_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &reverseop); /* Extrude the region */ - BMO_op_initf(bm, &extrudeop, "extrudefaceregion alwayskeeporig=%i", TRUE); + BMO_op_initf(bm, &extrudeop, "extrudefaceregion alwayskeeporig=%b", TRUE); BMO_slot_copy(op, &extrudeop, "geom", "edgefacein"); BMO_op_exec(bm, &extrudeop); diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 921c579447b..3f102661d30 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -231,8 +231,10 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op) BMEdge *e; BLI_array_declare(jedges); JoinEdge *jedges = NULL; - int dosharp = BMO_slot_int_get(op, "compare_sharp"), douvs = BMO_slot_int_get(op, "compare_uvs"); - int dovcols = BMO_slot_int_get(op, "compare_vcols"), domat = BMO_slot_int_get(op, "compare_materials"); + int dosharp = BMO_slot_bool_get(op, "cmp_sharp"); + int douvs = BMO_slot_bool_get(op, "cmp_uvs"); + int dovcols = BMO_slot_bool_get(op, "cmp_vcols"); + int domat = BMO_slot_bool_get(op, "cmp_materials"); float limit = BMO_slot_float_get(op, "limit"); int i, totedge; diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index 4f6db9056e5..7b929042ea9 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -69,7 +69,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) BLI_array_declare(fedges); float (*keyco)[3] = NULL; int *keyi; - int set_key = BMO_slot_int_get(op, "set_shapekey"); + int set_key = BMO_slot_bool_get(op, "set_shapekey"); int totuv, i, j; if (!me || !me->totvert) { @@ -370,7 +370,7 @@ void object_load_bmesh_exec(BMesh *bm, BMOperator *op) /* Scene *scene = BMO_slot_ptr_get(op, "scene"); */ Mesh *me = ob->data; - BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notesselation=%i", me, ob, TRUE); + BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notesselation=%b", me, ob, TRUE); } @@ -447,7 +447,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) BMFace *f; BMIter iter, liter; int i, j, *keyi, ototvert, totloop; - int dotess = !BMO_slot_int_get(op, "notesselation"); + int dotess = !BMO_slot_bool_get(op, "notesselation"); ototvert = me->totvert; diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index 82e77fc9a96..128b64b08de 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -48,8 +48,8 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op) float scale[3] = {1.0f, 1.0f, 1.0f}; float dist = BMO_slot_float_get(op, "mergedist"); int i, ototvert, ototedge, axis = BMO_slot_int_get(op, "axis"); - int mirroru = BMO_slot_int_get(op, "mirror_u"); - int mirrorv = BMO_slot_int_get(op, "mirror_v"); + int mirroru = BMO_slot_bool_get(op, "mirror_u"); + int mirrorv = BMO_slot_bool_get(op, "mirror_v"); ototvert = bm->totvert; ototedge = bm->totedge; diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index f7a1a8f4d06..dc9b26cd665 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -495,8 +495,9 @@ void bmesh_create_circle_exec(BMesh *bm, BMOperator *op) BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL; float vec[3], mat[4][4], phi, phid; float dia = BMO_slot_float_get(op, "diameter"); - int cap_ends = BMO_slot_int_get(op, "cap_ends"), segs = BMO_slot_int_get(op, "segments"); - int cap_tris = BMO_slot_int_get(op, "cap_tris"); + int segs = BMO_slot_int_get(op, "segments"); + int cap_ends = BMO_slot_bool_get(op, "cap_ends"); + int cap_tris = BMO_slot_bool_get(op, "cap_tris"); int a; if (!segs) @@ -567,8 +568,9 @@ void bmesh_create_cone_exec(BMesh *bm, BMOperator *op) float dia1 = BMO_slot_float_get(op, "diameter1"); float dia2 = BMO_slot_float_get(op, "diameter2"); float depth = BMO_slot_float_get(op, "depth"); - int cap_ends = BMO_slot_int_get(op, "cap_ends"), segs = BMO_slot_int_get(op, "segments"); - int cap_tris = BMO_slot_int_get(op, "cap_tris"); + int segs = BMO_slot_int_get(op, "segments"); + int cap_ends = BMO_slot_bool_get(op, "cap_ends"); + int cap_tris = BMO_slot_bool_get(op, "cap_tris"); int a; if (!segs) diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 310762e0e37..ce00441dcac 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -693,8 +693,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) fractal = BMO_slot_float_get(op, "fractal"); beauty = BMO_slot_int_get(op, "beauty"); cornertype = BMO_slot_int_get(op, "quadcornertype"); - singleedge = BMO_slot_int_get(op, "singleedge"); - gridfill = BMO_slot_int_get(op, "gridfill"); + singleedge = BMO_slot_bool_get(op, "singleedge"); + gridfill = BMO_slot_bool_get(op, "gridfill"); BLI_srandom(seed); @@ -1022,8 +1022,8 @@ void BM_mesh_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float s BMOperator op; BMO_op_initf(bm, &op, "esubd edges=%he smooth=%f fractal=%f " - "beauty=%d numcuts=%d quadcornertype=%d singleedge=%d " - "gridfill=%d seed=%d", + "beauty=%i numcuts=%i quadcornertype=%i singleedge=%b " + "gridfill=%b seed=%i", flag, smooth, fractal, beauty, numcuts, cornertype, singleedge, gridfill, seed); diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 90efe0b6e44..a14af618411 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -25,7 +25,6 @@ #include "BLI_scanfill.h" #include "BLI_math.h" #include "BLI_array.h" -#include "BLI_editVert.h" #include "BLI_smallhash.h" #include "bmesh.h" @@ -159,9 +158,9 @@ void bmesh_triangle_fill_exec(BMesh *bm, BMOperator *op) BMOIter siter; BMEdge *e; BMOperator bmop; - EditEdge *eed; - EditVert *eve, *v1, *v2; - EditFace *efa; + ScanFillEdge *eed; + ScanFillVert *eve, *v1, *v2; + ScanFillFace *efa; SmallHash hash; BLI_smallhash_init(&hash); @@ -186,7 +185,7 @@ void bmesh_triangle_fill_exec(BMesh *bm, BMOperator *op) v1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1); v2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2); eed = BLI_addfilledge(v1, v2); - eed->tmp.p = e; + /* eed->tmp.p = e; */ /* UNUSED */ } BLI_edgefill(0); diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index f4dd89e1848..86282a38b29 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -123,7 +123,7 @@ void bmesh_edgerotate_exec(BMesh *bm, BMOperator *op) { BMOIter siter; BMEdge *e, *e2; - int ccw = BMO_slot_int_get(op, "ccw"); + int ccw = BMO_slot_bool_get(op, "ccw"); BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { if (!(e2 = BM_edge_rotate(bm, e, ccw))) { @@ -221,15 +221,15 @@ static void bmesh_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces void bmesh_regionextend_exec(BMesh *bm, BMOperator *op) { - int usefaces = BMO_slot_int_get(op, "usefaces"); - int constrict = BMO_slot_int_get(op, "constrict"); + int use_faces = BMO_slot_bool_get(op, "use_faces"); + int constrict = BMO_slot_bool_get(op, "constrict"); BMO_slot_buffer_flag_enable(bm, op, "geom", SEL_ORIG, BM_ALL); if (constrict) - bmesh_regionextend_constrict(bm, op, usefaces); + bmesh_regionextend_constrict(bm, op, use_faces); else - bmesh_regionextend_extend(bm, op, usefaces); + bmesh_regionextend_extend(bm, op, use_faces); BMO_slot_from_flag(bm, op, "geomout", SEL_FLAG, BM_ALL); } @@ -270,7 +270,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BLI_array_declare(fstack); BMLoop *l, *l2; float maxx, cent[3]; - int i, maxi, flagflip = BMO_slot_int_get(op, "doflip"); + int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip"); startf = NULL; maxx = -1.0e10; @@ -381,9 +381,9 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op) float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist"); int i, j, clipx, clipy, clipz; - clipx = BMO_slot_int_get(op, "mirror_clip_x"); - clipy = BMO_slot_int_get(op, "mirror_clip_y"); - clipz = BMO_slot_int_get(op, "mirror_clip_z"); + clipx = BMO_slot_bool_get(op, "mirror_clip_x"); + clipy = BMO_slot_bool_get(op, "mirror_clip_y"); + clipz = BMO_slot_bool_get(op, "mirror_clip_z"); i = 0; BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) { diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index e16063b50c6..28d3fa6e170 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -38,6 +38,7 @@ #include "DNA_anim_types.h" +#include "DNA_mesh_types.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_meshdata_types.h" @@ -48,7 +49,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "BLI_ghash.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index a8978a0bbde..f1ea39e45b9 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -43,7 +43,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" #include "BLI_graph.h" diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index bb493d3fec4..e2b89ba90e1 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -53,7 +53,6 @@ #ifdef RIGID_DEFORM -#include "BLI_editVert.h" #include "BLI_polardecomp.h" #endif diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 89bccf8f00e..4ccefe276ba 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -703,7 +703,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) float thresh = CTX_data_tool_settings(C)->select_thresh; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%d thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -744,7 +744,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op) float thresh = CTX_data_tool_settings(C)->select_thresh; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%d thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -789,7 +789,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op) float thresh = CTX_data_tool_settings(C)->select_thresh; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%d thresh=%f", BM_ELEM_SELECT, type, thresh); + EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh); /* execute the operator */ BMO_op_exec(em->bm, &bmop); diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index b8d3dbeded9..db761c7d27e 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -99,7 +99,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) ts->editbutflag|flag, cuts, 0, RNA_enum_get(op->ptr, "quadcorner"), RNA_boolean_get(op->ptr, "quadtri"), - 1, RNA_int_get(op->ptr, "seed")); + TRUE, RNA_int_get(op->ptr, "seed")); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -919,11 +919,11 @@ static int delete_mesh(bContext *C, Object *obedit, wmOperator *op, int event, S int use_verts = RNA_boolean_get(op->ptr, "use_verts"); //"Dissolve" if (bem->selectmode & SCE_SELECT_FACE) { - if (!EDBM_CallOpf(bem, op, "dissolvefaces faces=%hf use_verts=%i", BM_ELEM_SELECT, use_verts)) + if (!EDBM_CallOpf(bem, op, "dissolvefaces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts)) return OPERATOR_CANCELLED; } else if (bem->selectmode & SCE_SELECT_EDGE) { - if (!EDBM_CallOpf(bem, op, "dissolveedges edges=%he use_verts=%i", BM_ELEM_SELECT, use_verts)) + if (!EDBM_CallOpf(bem, op, "dissolveedges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts)) return OPERATOR_CANCELLED; } else if (bem->selectmode & SCE_SELECT_VERTEX) { @@ -1215,8 +1215,9 @@ static int editbmesh_edge_split(bContext *C, wmOperator *op) BMOperator bmop; int len = 0; - if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he numcuts=%d", - BM_ELEM_SELECT, RNA_int_get(op->ptr,"number_cuts"))) { + if (!EDBM_InitOpf(em, &bmop, op, "edgesplit edges=%he numcuts=%i", + BM_ELEM_SELECT, RNA_int_get(op->ptr,"number_cuts"))) + { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &bmop); @@ -1380,7 +1381,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) if (!eed) return OPERATOR_CANCELLED; - EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%d", eed, do_ccw); + EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%b", eed, do_ccw); /* avoid adding to the selection if we start off with only a selected edge, * we could also just deselect the single edge easily but use the BMO api @@ -1564,7 +1565,7 @@ static int normals_make_consistent_exec(bContext *C, wmOperator *op) /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ - if (!EDBM_CallOpf(em, op, "righthandfaces faces=%hf doflip=%d", BM_ELEM_SELECT, 1)) + if (!EDBM_CallOpf(em, op, "righthandfaces faces=%hf do_flip=%d", BM_ELEM_SELECT, TRUE)) return OPERATOR_CANCELLED; if (RNA_boolean_get(op->ptr, "inside")) @@ -1600,7 +1601,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; ModifierData *md; - int mirrx = 0, mirry = 0, mirrz = 0; + int mirrx = FALSE, mirry = FALSE, mirrz = FALSE; int i, repeat; float clipdist = 0.0f; @@ -1618,11 +1619,11 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) if (mmd->flag & MOD_MIR_CLIPPING) { if (mmd->flag & MOD_MIR_AXIS_X) - mirrx = 1; + mirrx = TRUE; if (mmd->flag & MOD_MIR_AXIS_Y) - mirry = 1; + mirry = TRUE; if (mmd->flag & MOD_MIR_AXIS_Z) - mirrz = 1; + mirrz = TRUE; clipdist = mmd->tolerance; } @@ -1635,7 +1636,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op) for (i = 0; i < repeat; i++) { if (!EDBM_CallOpf(em, op, - "vertexsmooth verts=%hv mirror_clip_x=%d mirror_clip_y=%d mirror_clip_z=%d clipdist=%f", + "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f", BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist)) { return OPERATOR_CANCELLED; @@ -1840,7 +1841,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "meshrotateuvs faces=%hf dir=%d", BM_ELEM_SELECT, dir); + EDBM_InitOpf(em, &bmop, op, "meshrotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -1893,7 +1894,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "meshrotatecolors faces=%hf dir=%d", BM_ELEM_SELECT, dir); + EDBM_InitOpf(em, &bmop, op, "meshrotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -2197,8 +2198,7 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op) BMOperator bmop; int count; - EDBM_InitOpf(em, &bmop, op, "finddoubles verts=%hv dist=%f", - BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); + EDBM_InitOpf(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist")); BMO_op_exec(em->bm, &bmop); count = BMO_slot_map_count(em->bm, &bmop, "targetmapout"); @@ -2276,7 +2276,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ - EDBM_InitOpf(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%d", sv->data, ev->data, type); + EDBM_InitOpf(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->data, ev->data, type); /* execute the operator */ BMO_op_exec(em->bm, &bmop); @@ -3162,8 +3162,8 @@ static int knife_cut_exec(bContext *C, wmOperator *op) BMO_slot_int_set(&bmop, "flag", B_KNIFE); BMO_slot_int_set(&bmop, "quadcornertype", SUBD_STRAIGHT_CUT); - BMO_slot_int_set(&bmop, "singleedge", 0); - BMO_slot_int_set(&bmop, "gridfill", 0); + BMO_slot_bool_set(&bmop, "singleedge", FALSE); + BMO_slot_bool_set(&bmop, "gridfill", FALSE); BMO_slot_float_set(&bmop, "radius", 0); @@ -3262,7 +3262,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS); BM_mesh_normals_update(bmnew); - BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p", basenew->object->data, basenew->object); + BMO_op_callf(bmnew, "bmesh_to_mesh mesh=%p object=%p notesselation=%b", + basenew->object->data, basenew->object, TRUE); BM_mesh_free(bmnew); ((Mesh *)basenew->object->data)->edit_btmesh = NULL; @@ -3407,8 +3408,9 @@ static int fill_mesh_exec(bContext *C, wmOperator *op) BMEditMesh *em = ((Mesh *)obedit->data)->edit_btmesh; BMOperator bmop; - if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) + if (!EDBM_InitOpf(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) { return OPERATOR_CANCELLED; + } BMO_op_exec(em->bm, &bmop); @@ -3510,9 +3512,9 @@ static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) dovcols = RNA_boolean_get(op->ptr, "vcols"); domaterials = RNA_boolean_get(op->ptr, "materials"); - if (!EDBM_CallOpf(em, op, - "join_triangles faces=%hf limit=%f compare_sharp=%i compare_uvs=%i compare_vcols=%i compare_materials=%i", - BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) + if (!EDBM_CallOpf(em, op, + "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", + BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) { return OPERATOR_CANCELLED; } @@ -3683,8 +3685,9 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, axis); if (!EDBM_InitOpf(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%d ang=%f dupli=%d", - BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli)) { + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", + BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli)) + { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &spinop); @@ -3808,8 +3811,8 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) negate_v3(dvec); if (!EDBM_InitOpf(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%d ang=%f dupli=0", - BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns)) + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b", + BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns, FALSE)) { return OPERATOR_CANCELLED; } @@ -4505,8 +4508,8 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op) fac = w[recursion - i - 1] * factor; if (!EDBM_InitOpf(em, &bmop, op, - "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%i use_even=%i use_dist=%i", - BM_ELEM_SELECT, fac, li, 1, use_even, use_dist)) + "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b", + BM_ELEM_SELECT, fac, li, TRUE, use_even, use_dist)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/bmesh_utils.c index f124823b106..7419eb5ba58 100644 --- a/source/blender/editors/mesh/bmesh_utils.c +++ b/source/blender/editors/mesh/bmesh_utils.c @@ -27,6 +27,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -110,8 +111,7 @@ int EDBM_InitOpf(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *f va_start(list, fmt); if (!BMO_op_vinitf(bm, bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -172,8 +172,7 @@ int EDBM_CallOpf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) va_start(list, fmt); if (!BMO_op_vinitf(bm, &bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -197,8 +196,7 @@ int EDBM_CallAndSelectOpf(BMEditMesh *em, wmOperator *op, const char *selectslot va_start(list, fmt); if (!BMO_op_vinitf(bm, &bmop, fmt, list)) { - BKE_report(op->reports, RPT_ERROR, - "Parse error in EDBM_CallOpf"); + BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__); va_end(list); return 0; } @@ -295,6 +293,11 @@ void EDBM_LoadEditBMesh(Scene *scene, Object *ob) BMesh *bm = me->edit_btmesh->bm; BMO_op_callf(bm, "object_load_bmesh scene=%p object=%p", scene, ob); + +#ifdef USE_TESSFACE_DEFAULT + BKE_mesh_tessface_calc(me); +#endif + } void EDBM_FreeEditBMesh(BMEditMesh *tm) @@ -409,11 +412,11 @@ void EDBM_select_flush(BMEditMesh *em) void EDBM_select_more(BMEditMesh *em) { BMOperator bmop; - int usefaces = em->selectmode > SCE_SELECT_EDGE; + int use_faces = em->selectmode > SCE_SELECT_EDGE; BMO_op_initf(em->bm, &bmop, - "regionextend geom=%hvef constrict=%d usefaces=%d", - BM_ELEM_SELECT, 0, usefaces); + "regionextend geom=%hvef constrict=%i use_faces=%b", + BM_ELEM_SELECT, FALSE, use_faces); BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL); BMO_op_finish(em->bm, &bmop); @@ -424,11 +427,11 @@ void EDBM_select_more(BMEditMesh *em) void EDBM_select_less(BMEditMesh *em) { BMOperator bmop; - int usefaces = em->selectmode > SCE_SELECT_EDGE; + int use_faces = em->selectmode > SCE_SELECT_EDGE; BMO_op_initf(em->bm, &bmop, - "regionextend geom=%hvef constrict=%d usefaces=%d", - BM_ELEM_SELECT, 0, usefaces); + "regionextend geom=%hvef constrict=%i use_faces=%b", + BM_ELEM_SELECT, FALSE, use_faces); BMO_op_exec(em->bm, &bmop); BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ELEM_SELECT, BM_ALL); BMO_op_finish(em->bm, &bmop); @@ -519,7 +522,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata) #endif - BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", &um->me, 1); + BMO_op_callf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%b", &um->me, TRUE); um->selectmode = em->selectmode; return um; @@ -531,14 +534,15 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata)) Object *ob; undomesh *um = umv; BMesh *bm; - + + /* BMESH_TODO - its possible the name wont be found right?, should fallback */ ob = (Object *)find_id("OB", um->obname); ob->shapenr = em->bm->shapenr; BMEdit_Free(em); bm = BM_mesh_create(ob, bm_mesh_allocsize_default); - BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", &um->me, ob, 0); + BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE); em2 = BMEdit_Create(bm, TRUE); *em = *em2; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index bec1403a8dd..65a34e2d1b3 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -38,11 +38,11 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index ea9dc73ee94..c12d28e4166 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -145,8 +145,10 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) em = me->edit_btmesh; if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) + "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -188,8 +190,9 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, 2.0f)) { return OPERATOR_CANCELLED; + } /* BMESH_TODO make plane side this: M_SQRT2 - plane (diameter of 1.41 makes it unit size) */ make_prim_finish(C, &state, enter_editmode); @@ -241,11 +244,13 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_circle segments=%i diameter=%f cap_ends=%i cap_tris=%i mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), - cap_end, cap_tri, mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4", + RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), + cap_end, cap_tri, mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -298,11 +303,17 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%i cap_tris=%i depth=%f mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), - RNA_float_get(op->ptr, "radius"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", + RNA_int_get(op->ptr, "vertices"), + RNA_float_get(op->ptr, "radius"), + RNA_float_get(op->ptr, "radius"), + cap_end, cap_tri, + RNA_float_get(op->ptr, "depth"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -357,11 +368,14 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%i cap_tris=%i depth=%f mat=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), - RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4", + RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), + RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -415,11 +429,11 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", - RNA_int_get(op->ptr, "x_subdivisions"), - RNA_int_get(op->ptr, "y_subdivisions"), - RNA_float_get(op->ptr, "size") * dia, mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", + RNA_int_get(op->ptr, "x_subdivisions"), + RNA_int_get(op->ptr, "y_subdivisions"), + RNA_float_get(op->ptr, "size") * dia, mat)) { return OPERATOR_CANCELLED; } @@ -517,11 +531,13 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", - RNA_int_get(op->ptr, "ring_count"), RNA_int_get(op->ptr, "segments"), - RNA_float_get(op->ptr,"size"), mat)) + if (!EDBM_CallAndSelectOpf(em, op, "vertout", + "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4", + RNA_int_get(op->ptr, "ring_count"), RNA_int_get(op->ptr, "segments"), + RNA_float_get(op->ptr,"size"), mat)) + { return OPERATOR_CANCELLED; + } make_prim_finish(C, &state, enter_editmode); @@ -571,10 +587,12 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) me = obedit->data; em = me->edit_btmesh; - if (!EDBM_CallAndSelectOpf(em, op, "vertout", - "create_icosphere subdivisions=%i diameter=%f mat=%m4", - RNA_int_get(op->ptr, "subdivisions"), - RNA_float_get(op->ptr, "size"), mat)) { + if (!EDBM_CallAndSelectOpf( + em, op, "vertout", + "create_icosphere subdivisions=%i diameter=%f mat=%m4", + RNA_int_get(op->ptr, "subdivisions"), + RNA_float_get(op->ptr, "size"), mat)) + { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c index 8e56a357487..1b8e90ffce7 100755 --- a/source/blender/editors/mesh/knifetool.c +++ b/source/blender/editors/mesh/knifetool.c @@ -54,9 +54,9 @@ #include "WM_types.h" #include "DNA_scene_types.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "BKE_tessmesh.h" -#include "BLI_editVert.h" #include "mesh_intern.h" @@ -1802,8 +1802,8 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) for (i = 0; i < totface; i++) { SmallHash *hash = &shash; - EditFace *efa; - EditVert *eve, *lasteve; + ScanFillFace *efa; + ScanFillVert *eve, *lasteve; int j; float rndscale = FLT_EPSILON * 25; @@ -1818,7 +1818,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) for (entry = face_nets[i].first; entry; entry = entry->next) { if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) { eve = BLI_addfillvert(entry->kfe->v1->v->co); - eve->xs = 0; + eve->poly_nr = 0; rnd_offset_co(eve->co, rndscale); eve->tmp.p = entry->kfe->v1->v; BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v1, eve); @@ -1826,7 +1826,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v2)) { eve = BLI_addfillvert(entry->kfe->v2->v->co); - eve->xs = 0; + eve->poly_nr = 0; rnd_offset_co(eve->co, rndscale); eve->tmp.p = entry->kfe->v2->v; BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v2, eve); @@ -1837,16 +1837,16 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1); eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2); - eve->xs++; - lasteve->xs++; + eve->poly_nr++; + lasteve->poly_nr++; } for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) { lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1); eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2); - if (eve->xs > 1 && lasteve->xs > 1) { - EditEdge *eed; + if (eve->poly_nr > 1 && lasteve->poly_nr > 1) { + ScanFillEdge *eed; eed = BLI_addfilledge(lasteve, eve); if (entry->kfe->oe) eed->f = FILLBOUNDARY; /* mark as original boundary edge */ @@ -1855,9 +1855,9 @@ static void knifenet_fill_faces(knifetool_opdata *kcd) BMO_elem_flag_disable(bm, entry->kfe->e->v2, DEL); } else { - if (lasteve->xs < 2) + if (lasteve->poly_nr < 2) BLI_remlink(&fillvertbase, lasteve); - if (eve->xs < 2) + if (eve->poly_nr < 2) BLI_remlink(&fillvertbase, eve); } } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 59861d674f2..dbcc0447a89 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -38,6 +38,7 @@ #include "DNA_ID.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -50,7 +51,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_blender.h" @@ -310,7 +310,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) if (lcd->do_cut) { BM_mesh_esubdivideflag(lcd->ob, em->bm, BM_ELEM_SELECT, 0.0f, 0.0f, 0, cuts, SUBDIV_SELECT_LOOPCUT, - SUBD_PATH, 0, 0, 0); + SUBD_PATH, 0, FALSE, 0); /* force edge slide to edge select mode in in face select mode */ if (em->selectmode & SCE_SELECT_FACE) { diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 0d7d6ca8108..c35bf8988b7 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -44,7 +45,6 @@ #include "BLI_utildefines.h" #include "BLI_array.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_edgehash.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 16c1da06383..d01b9805800 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -59,12 +59,6 @@ ok: the EDBM module is for editmode bmesh stuff. in contrast, the /*calls a bmesh op, reporting errors to the user, etc*/ int EDBM_CallOpf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); -/*calls a bmesh op, reporting errors to the user, etc. - - selects an output slot specified by selslot*/ -//int EDBM_CallAndSelectOpf(struct BMEditMesh *em, struct wmOperator *op, char *selslot, char *fmt, ...); -//moved to ED_mesh.h - /*same as above, but doesn't report errors.*/ int EDBM_CallOpfSilent(struct BMEditMesh *em, const char *fmt, ...); @@ -90,31 +84,6 @@ float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3]) /* ******************** editface.c */ -#if 0 /* REMOVE AFTER BMESH MERGE */ - -/* ******************* editmesh.c */ - -extern void free_editvert(EditMesh *em, EditVert *eve); -extern void free_editedge(EditMesh *em, EditEdge *eed); -extern void free_editface(EditMesh *em, EditFace *efa); - -/*frees dst mesh, then copies the contents of - *src (the struct) to dst. */ -void set_editMesh(EditMesh *dst, EditMesh *src); - -extern void free_vertlist(EditMesh *em, ListBase *edve); -extern void free_edgelist(EditMesh *em, ListBase *lb); -extern void free_facelist(EditMesh *em, ListBase *lb); - -extern void remedge(EditMesh *em, EditEdge *eed); - -extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example); -extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditEdge *example); -extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); -extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2); - -#endif - void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); void MESH_OT_separate(struct wmOperatorType *ot); @@ -137,58 +106,6 @@ void MESH_OT_duplicate(struct wmOperatorType *ot); void MESH_OT_fgon_make(struct wmOperatorType *ot); void MESH_OT_fgon_clear(struct wmOperatorType *ot); -#if 0 /* REMOVE AFTER BMESH MERGE */ - -/* ******************* editmesh_lib.c */ -void EM_stats_update(EditMesh *em); - -extern void EM_fgon_flags(EditMesh *em); -extern void EM_hide_reset(EditMesh *em); - -extern int faceselectedOR(EditFace *efa, int flag); -extern int faceselectedAND(EditFace *efa, int flag); - -void EM_remove_selection(EditMesh *em, void *data, int type); -void EM_clear_flag_all(EditMesh *em, int flag); -void EM_set_flag_all(EditMesh *em, int flag); -void EM_set_flag_all_selectmode(EditMesh *em, int flag); - -void EM_data_interp_from_verts(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *eve, float fac); -void EM_data_interp_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4); - -int EM_nvertices_selected(EditMesh *em); -int EM_nedges_selected(EditMesh *em); -int EM_nfaces_selected(EditMesh *em); - -float EM_face_perimeter(EditFace *efa); - -void EM_store_selection(EditMesh *em, void *data, int type); - -extern EditFace *exist_face(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4); -extern void flipface(EditMesh *em, EditFace *efa); // flips for normal direction -extern int compareface(EditFace *vl1, EditFace *vl2); - -/* flag for selection bits, *nor will be filled with normal for extrusion constraint */ -/* return value defines if such normal was set */ -extern short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor); -extern short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor); -extern short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor); -extern short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int all); -extern short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor, int all); - -extern void adduplicateflag(EditMesh *em, int flag); -extern void delfaceflag(EditMesh *em, int flag); - -extern void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3]); -extern void translateflag(EditMesh *em, short flag, float *vec); - -extern int convex(float *v1, float *v2, float *v3, float *v4); - -extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1, - struct EditFace *efa2, int i1, int i2, int i3, int i4); - -#endif - extern int EM_view3d_poll(struct bContext *C); struct wmKeyMap* knifetool_modal_keymap(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 99947cb9ae2..436c924a7d7 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -32,6 +32,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_ID.h" @@ -48,7 +49,6 @@ #include "BKE_report.h" #include "BKE_tessmesh.h" -#include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BLI_math_vector.h" diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 90f125cf75a..7453e9c9227 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -38,7 +38,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BKE_context.h" diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 1b5011402fc..bad0718c613 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -41,6 +41,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_meshdata_types.h" @@ -50,7 +51,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "BLI_ghash.h" #include "BLI_rand.h" /* for randome face sorting */ #include "BLI_threads.h" diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 5f3a7cfe93b..6df8ed1155a 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -944,21 +944,22 @@ static int multiresbake_check(bContext *C, wmOperator *op) break; } - if(!me->mtface) { + if(!me->mtpoly) { BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking"); ok= 0; - } else { - /* BMESH_TODO - use MPoly rather then tessface */ - a= me->totface; + } + else { + a = me->totpoly; while (ok && a--) { - Image *ima= me->mtface[a].tpage; + Image *ima = me->mtpoly[a].tpage; if(!ima) { BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker"); ok= 0; - } else { + } + else { ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); if(!ibuf) { diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a28b5c4feaa..b0d99ddd788 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -40,7 +40,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "BLI_ghash.h" #include "BLI_rand.h" @@ -56,6 +55,7 @@ #include "DNA_object_force.h" #include "DNA_meshdata_types.h" #include "DNA_vfont_types.h" +#include "DNA_mesh_types.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 2083c51efa9..8b5a9ae6c9b 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -34,13 +34,13 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_utildefines.h" #include "DNA_curve_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index e8a09732313..547c5b24778 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -46,7 +46,6 @@ #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_path_util.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f64f25391f9..1a226112db4 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" +#include "DNA_mesh_types.h" #include "DNA_constraint_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" @@ -48,7 +49,6 @@ #include "DNA_object_types.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 68c017adecd..aac8ef4c5e3 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -34,13 +34,13 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_key_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_group_types.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 78d90bb39d2..c60041fe67b 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -48,6 +48,7 @@ #include "DNA_scene_types.h" #include "DNA_particle_types.h" +#include "BLI_array.h" #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -207,13 +208,13 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to if (use_vert_sel) { BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { (*dvert_arr)[i] = BM_elem_flag_test(eve, BM_ELEM_SELECT) ? - CustomData_em_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT) : NULL; + CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT) : NULL; i++; } } else { BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - (*dvert_arr)[i] = CustomData_em_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); + (*dvert_arr)[i] = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); i++; } } @@ -748,100 +749,68 @@ static void vgroup_normalize(Object *ob) } } -/* This adds the indices of vertices to a list if they are not already present -It returns the number that it added (0-2) -It relies on verts having -1 for unassigned indices -*/ -static int tryToAddVerts(int *verts, int length, int a, int b) -{ - char containsA = FALSE; - char containsB = FALSE; - int added = 0; - int i; - for(i = 0; i < length && (!containsA || !containsB); i++) { - if(verts[i] == a) { - containsA = TRUE; - } else if(verts[i] == b) { - containsB = TRUE; - } else if(verts[i] == -1) { - if(!containsA) { - verts[i] = a; - containsA = TRUE; - added++; - } else if(!containsB){ - verts[i] = b; - containsB = TRUE; - added++; - } - } - } - return added; -} - -/* BMESH_TODO - use MPoly's */ - -/* This finds all of the vertices connected to vert by an edge -and returns an array of indices of size count - -count is an int passed by reference so it can be assigned the value of the length here. -*/ +/* This finds all of the vertices face-connected to vert by an edge and returns a + * MEM_allocated array of indices of size count. + * count is an int passed by reference so it can be assigned the value of the length here. */ static int* getSurroundingVerts(Mesh *me, int vert, int *count) { - int length = 0; - int *tverts; + MPoly *mp = me->mpoly; + int i = me->totpoly; + /* Instead of looping twice on all polys and loops, and use a temp array, let's rather + * use a BLI_array, with a reasonable starting/reserved size (typically, there are not + * many vertices face-linked to another one, even 8 might be too high...). */ int *verts = NULL; - MFace *mf = me->mface; - int totface = me->totface; - int found = 0; - int i; - for(i = 0; i < totface; i++, mf++) { - if(vert == mf->v1 || vert == mf->v2 || vert == mf->v3 || (mf->v4 &&vert == mf->v4)) { - length+=2; - } - } - if(!length) { - return NULL; - } - tverts = MEM_mallocN(sizeof(int)*length, "tempSurroundingVerts"); - mf = me->mface; - for(i = 0; i < length; i++) { - tverts[i] = -1; - } - for(i = 0; i < totface; i++, mf++) { - int a=-1, b=-1; - if(mf->v1 == vert) { - a = mf->v2; - if(mf->v4) { - b = mf->v4; - } else { - b = mf->v3; - } - } else if(mf->v2 == vert) { - a = mf->v1; - b = mf->v3; - } else if(mf->v3 == vert) { - a = mf->v2; - if(mf->v4) { - b = mf->v4; - } else { - b = mf->v1; + BLI_array_declare(verts); + + BLI_array_reserve(verts, 8); + while(i--) { + int j = mp->totloop; + int first_l = mp->totloop - 1; + MLoop *ml = &me->mloop[mp->loopstart]; + while(j--) { + /* XXX This assume a vert can only be once in a poly, even though + * it seems logical to me, not totaly sure of that. */ + if (ml->v == vert) { + int a, b, k; + if(j == first_l) { + /* We are on the first corner. */ + a = ml[1].v; + b = ml[j].v; + } + else if(!j) { + /* We are on the last corner. */ + a = (ml-1)->v; + b = me->mloop[mp->loopstart].v; + } + else { + a = (ml-1)->v; + b = (ml+1)->v; + } + + /* Append a and b verts to array, if not yet present. */ + k = BLI_array_count(verts); + /* XXX Maybe a == b is enough? */ + while(k-- && !(a == b && a == -1)) { + if(verts[k] == a) + a = -1; + else if(verts[k] == b) + b = -1; + } + if(a != -1) + BLI_array_append(verts, a); + if(b != -1) + BLI_array_append(verts, b); + + /* Vert found in this poly, we can go to next one! */ + break; } - } else if (mf->v4 && mf->v4 == vert){ - a = mf->v1; - b = mf->v3; - } else { - continue; - } - found += tryToAddVerts(tverts, length, a, b); - } - if(found) { - verts = MEM_mallocN(sizeof(int)* found, "surroundingVerts"); - for(i = 0; i < found; i++) { - verts[i] = tverts[i]; + ml++; } - *count = found; + mp++; } - MEM_freeN(tverts); + + /* Do not free the array! */ + *count = BLI_array_count(verts); return verts; } @@ -1087,12 +1056,11 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, Mesh *me = ob->data; MVert *mvert = me->mvert; - const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0; int *verts = NULL; + if(!(me->editflag & ME_EDIT_VERT_SEL)) + return; for(i = 0; i < me->totvert && mvert; i++, mvert++) { - - if(use_vert_sel && (mvert->flag & SELECT)) { - + if(mvert->flag & SELECT) { int count=0; if((verts = getSurroundingVerts(me, i, &count))) { MVert m; @@ -1100,7 +1068,8 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, int k; DerivedMesh *dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH); - for(k = 0; k < count; k++) { + k = count; + while(k--) { dm->getVert(dm, verts[k], &m); p[k] = m; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 13383445c93..4b4d7354898 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -37,7 +37,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_dlrbTree.h" #include "BLI_utildefines.h" #include "BLI_jitter.h" diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 5e0f4629e11..540735fca19 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -31,6 +31,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_curve_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -43,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 22bac3a6699..039b1c2f866 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -34,7 +34,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_dlrbTree.h" #include "BLI_utildefines.h" @@ -44,6 +43,7 @@ #include "DNA_curve_types.h" #include "DNA_scene_types.h" #include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_userdef_types.h" #include "BKE_context.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 681ab3a1492..980a6b44e4e 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -50,7 +50,6 @@ #include "BLI_memarena.h" #include "BLI_threads.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "PIL_time.h" diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2bff8476ea9..8c8c2da1712 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -42,9 +42,9 @@ #include "BLI_ghash.h" #include "BLI_pbvh.h" #include "BLI_threads.h" -#include "BLI_editVert.h" #include "BLI_rand.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index ce07beae674..11e926fb065 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -34,13 +34,13 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_ghash.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_brush_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "BKE_brush.h" diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 9e1ff82c20d..e2ea6849a72 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -42,7 +42,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index e7dc5e8408c..8925866df8d 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -42,7 +42,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 43bea1c311d..150872813b2 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -41,7 +41,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index dd988c94dc9..ce7338ced13 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -32,6 +32,7 @@ #include <string.h> #include <stdio.h> +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -40,7 +41,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 38d99c084b3..cf003d8c1eb 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -34,6 +34,7 @@ #include "DNA_curve_types.h" #include "DNA_group_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_scene_types.h" @@ -53,7 +54,6 @@ #include "ED_armature.h" #include "ED_mesh.h" -#include "BLI_editVert.h" typedef struct SceneStats { int totvert, totvertsel; diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 9bacdf8327b..6086496b00b 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -42,7 +42,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLF_translation.h" diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 09a4a9eb749..ca647d9962a 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -36,10 +36,10 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7ce88ee9b48..87abf0e8548 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -39,6 +39,7 @@ #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_meta_types.h" #include "DNA_scene_types.h" @@ -50,7 +51,6 @@ #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_edgehash.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 61b4260450b..2ab4491baa2 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -41,7 +41,6 @@ #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_edgehash.h" #include "BLI_rand.h" diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 98301e63705..35145064169 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -38,6 +38,7 @@ #include "DNA_curve_types.h" #include "DNA_lattice_types.h" #include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -46,7 +47,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 0a942a42540..9bbf4744b8c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "RNA_access.h" @@ -42,7 +43,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BLF_translation.h" diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index ec6d1bdbe87..079db789a3c 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -39,6 +39,7 @@ #include "DNA_armature_types.h" #include "DNA_curve_types.h" #include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -48,7 +49,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_linklist.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 087ed8380d6..9d2f549458f 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -38,13 +38,13 @@ #include "DNA_armature_types.h" #include "DNA_curve_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_linklist.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 86a2abe7a74..e14946da28a 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -41,7 +41,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 862b68ea7e1..a766f0b1881 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -47,6 +47,7 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" /* PET modes */ @@ -81,7 +82,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLI_editVert.h" #include "BLI_ghash.h" #include "BLI_linklist.h" #include "BLI_smallhash.h" diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 13f7d279da9..0226ccc4938 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -38,7 +38,6 @@ #include "DNA_listBase.h" -#include "BLI_editVert.h" #include "BLI_smallhash.h" #include "BKE_tessmesh.h" diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5158f2beada..abbe2db9f19 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -41,6 +41,7 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" #include "DNA_screen_types.h" @@ -103,7 +104,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_array.h" #include "BLI_utildefines.h" #include "BLI_smallhash.h" @@ -290,7 +290,7 @@ static void createTransTexspace(TransInfo *t) if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) { ob->dtx |= OB_TEXSPACE; - *texflag &= ~AUTOSPACE; + *texflag &= ~ME_AUTOSPACE; } copy_v3_v3(td->iloc, td->loc); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 4073081ffc2..8013520639e 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -44,6 +44,7 @@ #include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_view3d_types.h" #include "DNA_modifier_types.h" @@ -92,7 +93,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index f95856b2373..67a0d5dbe04 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -46,6 +46,7 @@ #include "DNA_armature_types.h" #include "DNA_curve_types.h" #include "DNA_lattice_types.h" +#include "DNA_mesh_types.h" #include "DNA_meta_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" @@ -63,7 +64,6 @@ #include "BKE_tessmesh.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BIF_gl.h" diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 19dbf8b713e..957dce97c02 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -32,6 +32,7 @@ #include "DNA_armature_types.h" #include "DNA_curve_types.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -46,7 +47,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BLF_translation.h" diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 183ade56cf0..d08c7f65e2d 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -40,6 +40,7 @@ #include "DNA_armature_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes #include "DNA_space_types.h" #include "DNA_screen_types.h" @@ -49,7 +50,6 @@ #include "RNA_access.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index ae4f99414bd..5ead0959d5c 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_modifier_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "BKE_DerivedMesh.h" @@ -45,7 +46,6 @@ #include "BLI_utildefines.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "ED_util.h" diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 7f301123ab8..61b1dece957 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -35,12 +35,12 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_packedFile_types.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BKE_context.h" #include "BKE_global.h" diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 56a835beeb8..6ab68d2261e 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -37,10 +37,10 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index 9759ab447f6..20ff8b07bc6 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -32,6 +32,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -40,7 +41,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_context.h" diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index ca8f1e4fb97..8de03f330d9 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -43,7 +43,6 @@ #include "DNA_space_types.h" #include "BLI_math.h" -#include "BLI_editVert.h" #include "BLI_utildefines.h" #include "BKE_DerivedMesh.h" diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 0df2a70302a..df1c9c48f99 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -39,6 +39,7 @@ #include "DNA_object_types.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_node_types.h" #include "DNA_image_types.h" @@ -47,7 +48,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" #include "BLI_array.h" #include "BLI_utildefines.h" diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 70971e43409..b63cb458c0a 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -37,10 +37,10 @@ #include "MEM_guardedalloc.h" #include "DNA_object_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_scene_types.h" -#include "BLI_editVert.h" #include "BLI_ghash.h" #include "BLI_math.h" #include "BLI_math_vector.h" diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 6d15d023fbe..c2bcb290865 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" #include "DNA_camera_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -45,7 +46,6 @@ #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "BLI_uvproject.h" #include "BLI_utildefines.h" #include "BLI_rand.h" @@ -64,7 +64,6 @@ #include "BLI_math.h" #include "BLI_edgehash.h" -#include "BLI_editVert.h" #include "BLI_scanfill.h" #include "BLI_array.h" #include "BLI_uvproject.h" @@ -213,8 +212,8 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, BM_mesh_elem_index_ensure(em->bm, BM_VERT); BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { - EditVert *v, *lastv, *firstv; - EditFace *sefa; + ScanFillVert *v, *lastv, *firstv; + ScanFillFace *sefa; ParamKey key, vkeys[4]; ParamBool pin[4], select[4]; BMLoop *ls[3]; @@ -226,7 +225,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, if((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT)==0)) continue; - /* tf= (MTexPoly *)CustomData_em_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ + /* tf= (MTexPoly *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ lsel = 0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { @@ -414,7 +413,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e numOfEdges = derivedMesh->getNumEdges(derivedMesh); numOfFaces = derivedMesh->getNumTessFaces(derivedMesh); - faceMap = MEM_mallocN(numOfFaces*sizeof(EditFace *), "unwrap_edit_face_map"); + faceMap = MEM_mallocN(numOfFaces*sizeof(BMFace *), "unwrap_edit_face_map"); BM_mesh_elem_index_ensure(em->bm, BM_VERT); EDBM_init_index_arrays(em, 0, 1, 1); @@ -423,7 +422,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e for(i = 0; i < numOfFaces; i++) faceMap[i] = EDBM_get_face_for_index(em, origFaceIndices[i]); - edgeMap = MEM_mallocN(numOfEdges*sizeof(EditEdge *), "unwrap_edit_edge_map"); + edgeMap = MEM_mallocN(numOfEdges*sizeof(BMEdge *), "unwrap_edit_edge_map"); /* map subsurfed edges to original editEdges */ for(i = 0; i < numOfEdges; i++) { diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index b128a6e46e7..8318d906f72 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1294,6 +1294,7 @@ struct GPU_Buffers { int gridsize; unsigned int tot_tri, tot_quad; + int smooth; }; void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert, @@ -1462,6 +1463,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids, buffers->grid_indices = grid_indices; buffers->totgrid = totgrid; buffers->gridsize = gridsize; + buffers->smooth = smooth; //printf("node updated %p\n", buffers); } @@ -1556,6 +1558,78 @@ GPU_Buffers *GPU_build_grid_buffers(DMGridData **UNUSED(grids), int *UNUSED(grid return buffers; } +static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers) +{ + int i; + + for(i = 0; i < buffers->totface; ++i) { + MFace *f = buffers->mface + buffers->face_indices[i]; + + glBegin((f->v4)? GL_QUADS: GL_TRIANGLES); + glNormal3sv(buffers->mvert[f->v1].no); + glVertex3fv(buffers->mvert[f->v1].co); + glNormal3sv(buffers->mvert[f->v2].no); + glVertex3fv(buffers->mvert[f->v2].co); + glNormal3sv(buffers->mvert[f->v3].no); + glVertex3fv(buffers->mvert[f->v3].co); + if(f->v4) { + glNormal3sv(buffers->mvert[f->v4].no); + glVertex3fv(buffers->mvert[f->v4].co); + } + glEnd(); + } +} + +static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers) +{ + int i, x, y, gridsize = buffers->gridsize; + + if(buffers->smooth) { + for(i = 0; i < buffers->totgrid; ++i) { + DMGridData *grid = buffers->grids[buffers->grid_indices[i]]; + + for(y = 0; y < gridsize-1; y++) { + glBegin(GL_QUAD_STRIP); + for(x = 0; x < gridsize; x++) { + DMGridData *a = &grid[y*gridsize + x]; + DMGridData *b = &grid[(y+1)*gridsize + x]; + + glNormal3fv(a->no); + glVertex3fv(a->co); + glNormal3fv(b->no); + glVertex3fv(b->co); + } + glEnd(); + } + } + } + else { + for(i = 0; i < buffers->totgrid; ++i) { + DMGridData *grid = buffers->grids[buffers->grid_indices[i]]; + + for(y = 0; y < gridsize-1; y++) { + glBegin(GL_QUAD_STRIP); + for(x = 0; x < gridsize; x++) { + DMGridData *a = &grid[y*gridsize + x]; + DMGridData *b = &grid[(y+1)*gridsize + x]; + + if(x > 0) { + DMGridData *c = &grid[y*gridsize + x-1]; + DMGridData *d = &grid[(y+1)*gridsize + x-1]; + float fno[3]; + normal_quad_v3(fno, d->co, b->co, a->co, c->co); + glNormal3fv(fno); + } + + glVertex3fv(a->co); + glVertex3fv(b->co); + } + glEnd(); + } + } + } +} + void GPU_draw_buffers(GPU_Buffers *buffers) { if(buffers->vert_buf && buffers->index_buf) { @@ -1584,47 +1658,12 @@ void GPU_draw_buffers(GPU_Buffers *buffers) glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); } + /* fallbacks if we are out of memory or VBO is disabled */ else if(buffers->totface) { - /* fallback if we are out of memory */ - int i; - - for(i = 0; i < buffers->totface; ++i) { - MFace *f = buffers->mface + buffers->face_indices[i]; - - glBegin((f->v4)? GL_QUADS: GL_TRIANGLES); - glNormal3sv(buffers->mvert[f->v1].no); - glVertex3fv(buffers->mvert[f->v1].co); - glNormal3sv(buffers->mvert[f->v2].no); - glVertex3fv(buffers->mvert[f->v2].co); - glNormal3sv(buffers->mvert[f->v3].no); - glVertex3fv(buffers->mvert[f->v3].co); - if(f->v4) { - glNormal3sv(buffers->mvert[f->v4].no); - glVertex3fv(buffers->mvert[f->v4].co); - } - glEnd(); - } + gpu_draw_buffers_legacy_mesh(buffers); } else if(buffers->totgrid) { - int i, x, y, gridsize = buffers->gridsize; - - for(i = 0; i < buffers->totgrid; ++i) { - DMGridData *grid = buffers->grids[buffers->grid_indices[i]]; - - for(y = 0; y < gridsize-1; y++) { - glBegin(GL_QUAD_STRIP); - for(x = 0; x < gridsize; x++) { - DMGridData *a = &grid[y*gridsize + x]; - DMGridData *b = &grid[(y+1)*gridsize + x]; - - glNormal3fv(a->no); - glVertex3fv(a->co); - glNormal3fv(b->no); - glVertex3fv(b->co); - } - glEnd(); - } - } + gpu_draw_buffers_legacy_grids(buffers); } } diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index f422e80b864..a5adc8c200a 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -143,7 +143,7 @@ typedef struct TFace { /* **************** MESH ********************* */ /* texflag */ -#define AUTOSPACE 1 +#define ME_AUTOSPACE 1 /* me->editflag */ #define ME_EDIT_MIRROR_X (1 << 0) @@ -232,4 +232,7 @@ typedef struct TFace { #define USE_BMESH_SAVE_WITHOUT_MFACE +/* enable this so meshes get tessfaces calculated by default */ +// #define USE_TESSFACE_DEFAULT + #endif diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 93e8c2973f2..c0cda33f8d8 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -77,7 +77,6 @@ typedef enum ModifierType { eModifierType_Ocean, eModifierType_DynamicPaint, eModifierType_Remesh, - eModifierType_NgonInterp, NUM_MODIFIER_TYPES } ModifierType; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 70bc8254476..ddefaa73792 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2968,5 +2968,3 @@ int main(int argc, char **argv) return return_status; } - - diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index eaa39548712..4ddb356f518 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -54,7 +54,6 @@ #include "DNA_scene_types.h" -#include "BLI_editVert.h" #include "BLI_math.h" #include "BKE_customdata.h" @@ -447,7 +446,7 @@ static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values) static int rna_Mesh_texspace_editable(PointerRNA *ptr) { Mesh *me= (Mesh*)ptr->data; - return (me->texflag & AUTOSPACE)? 0: PROP_EDITABLE; + return (me->texflag & ME_AUTOSPACE)? 0: PROP_EDITABLE; } static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) @@ -1942,7 +1941,7 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) /* texture space */ prop= RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE); + RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE); RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); @@ -2085,7 +2084,7 @@ static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop) PropertyRNA *prop; FunctionRNA *func; - PropertyRNA *parm; + //PropertyRNA *parm; RNA_def_property_srna(cprop, "MeshPolygons"); srna= RNA_def_struct(brna, "MeshPolygons", NULL); @@ -2098,7 +2097,7 @@ static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "add", "ED_mesh_polys_add"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX); + RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX); } @@ -2521,7 +2520,7 @@ static void rna_def_mesh(BlenderRNA *brna) /* texture space */ prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE); + RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE); RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); /*prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 6bcd8c0a5bc..b448040e978 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -35,6 +35,7 @@ #include "rna_internal.h" #include "DNA_armature_types.h" +#include "DNA_mesh_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" @@ -73,7 +74,6 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, - {eModifierType_NgonInterp, "NGONINTERP", ICON_MOD_LATTICE, "Precision UV Interpolation", ""}, {0, "", 0, "Deform", ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, @@ -183,8 +183,6 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_MultiresModifier; case eModifierType_Surface: return &RNA_SurfaceModifier; - case eModifierType_NgonInterp: - return &RNA_NgonInterpModifier; case eModifierType_Smoke: return &RNA_SmokeModifier; case eModifierType_Solidify: @@ -3081,28 +3079,6 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) // XXX how to update? } - - -static void rna_def_modifier_ngoninterp(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "NgonInterpModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "Precision UV Modifier", "Precision UV interpolation"); - RNA_def_struct_sdna(srna, "NgonInterpModifierData"); - RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW); - - prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED); - RNA_def_property_range(prop, 1, 10000); - RNA_def_property_ui_range(prop, 1, 100, 1, 0); - RNA_def_property_ui_text(prop, "Resolution", "Size of interpolation grids"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - -} - - - void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -3206,9 +3182,6 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_dynamic_paint(brna); rna_def_modifier_ocean(brna); rna_def_modifier_remesh(brna); - - /* BMESH_ONLY */ - rna_def_modifier_ngoninterp(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a5eb610dd29..ed443f47eb3 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -148,8 +148,6 @@ EnumPropertyItem object_type_curve_items[] = { #include "BKE_scene.h" #include "BKE_deform.h" -#include "BLI_editVert.h" /* for EditMesh->mat_nr */ - #include "ED_mesh.h" #include "ED_object.h" #include "ED_particle.h" diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 225351a2e5a..71f79b59df5 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -257,7 +257,6 @@ EnumPropertyItem image_color_depth_items[] = { #include "MEM_guardedalloc.h" #include "BLI_threads.h" -#include "BLI_editVert.h" #include "BKE_brush.h" #include "BKE_context.h" diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index f405b98524c..c7e28851084 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -323,7 +323,7 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin DAG_on_visible_update(bmain, FALSE); } -static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceView3D_viewport_shade_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); ScrArea *sa= rna_area_from_space(ptr); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index e4ce7304577..cb3f30c9284 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -59,7 +59,7 @@ static char *rna_tracking_path(PointerRNA *UNUSED(ptr)) return BLI_sprintfN("tracking"); } -static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; MovieTracking *tracking= &clip->tracking; @@ -73,7 +73,7 @@ static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene } } -static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; MovieTracking *tracking= &clip->tracking; @@ -83,7 +83,7 @@ static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scen settings->default_search_size= settings->default_pattern_size; } -static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; MovieTracking *tracking= &clip->tracking; @@ -366,7 +366,7 @@ void rna_trackingObject_name_set(PointerRNA *ptr, const char *value) BKE_tracking_object_unique_name(&clip->tracking, object); } -static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MovieClip *clip= (MovieClip*)ptr->id.data; diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 8170481cfd6..96a8a4216d4 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -67,7 +67,6 @@ set(SRC intern/MOD_meshdeform.c intern/MOD_mirror.c intern/MOD_multires.c - intern/MOD_ngoninterp.c intern/MOD_none.c intern/MOD_ocean.c intern/MOD_particleinstance.c diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 91ff1ad0063..8aefd928858 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -144,8 +144,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, } } - BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%i use_dist=%i", - EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN)!=0, (bmd->flags & BME_BEVEL_DIST) != 0); + BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%b use_dist=%b", + EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN) != 0, (bmd->flags & BME_BEVEL_DIST) != 0); BMO_pop(bm); BLI_assert(em->looptris == NULL); diff --git a/source/blender/modifiers/intern/MOD_ngoninterp.c b/source/blender/modifiers/intern/MOD_ngoninterp.c deleted file mode 100644 index 498e5d3bdea..00000000000 --- a/source/blender/modifiers/intern/MOD_ngoninterp.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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) 2005 by the Blender Foundation. - * All rights reserved. - * - * Contributor(s): Daniel Dunbar - * Ton Roosendaal, - * Ben Batt, - * Brecht Van Lommel, - * Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -/** \file blender/modifiers/intern/MOD_mask.c - * \ingroup modifiers - */ - -#include <string.h> - -#include "MEM_guardedalloc.h" - -#include "BLI_utildefines.h" -#include "BLI_ghash.h" -#include "BLI_array.h" -#include "BLI_edgehash.h" -#include "BLI_math.h" - -#include "DNA_armature_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_object_types.h" - -#include "BKE_cdderivedmesh.h" -#include "BKE_mesh.h" -#include "BKE_modifier.h" -#include "BKE_deform.h" - -#include "depsgraph_private.h" - -#include "MOD_util.h" - -static void copyData(ModifierData *md, ModifierData *target) -{ - NgonInterpModifierData *mmd = (NgonInterpModifierData*) md; - NgonInterpModifierData *tmmd = (NgonInterpModifierData*) target; - - tmmd->resolution = mmd->resolution; -} - -static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), - DerivedMesh *derivedData, - int UNUSED(useRenderParams), - int UNUSED(isFinalCalc)) -{ - NgonInterpModifierData *nmd= (NgonInterpModifierData *)md; - DerivedMesh *dm= derivedData; - DerivedMesh *cddm, *dummy; - MFace *mf; - MPoly *mpoly; - MLoop *mloop; - MFace *mface = NULL, *mf2; - MVert *mvert = NULL, *omvert; - BLI_array_declare(mface); - BLI_array_declare(mvert); - int *verts=NULL, *loops=NULL; - BLI_array_declare(verts); - BLI_array_declare(loops); - float *w = NULL, (*cos)[3] = NULL; - BLI_array_declare(w); - BLI_array_declare(cos); - int *origv = NULL, *origf = NULL, *of, *ov; - BLI_array_declare(origv); - BLI_array_declare(origf); - DerivedMesh *copy = NULL; - int i; - - int numTex; - int numCol; - int hasWCol; - int hasOrigSpace; - - if (nmd->resolution <= 0) - return dm; - - if (!CDDM_Check(dm)) { - dm = copy = CDDM_copy(dm); - } - - CDDM_recalc_tesselation(dm); - - mf = dm->getTessFaceArray(dm); - of = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); - mpoly = CDDM_get_polys(dm); - mloop = CDDM_get_loops(dm); - - /*eek!*/ - if (!of) - return dm; - - /*create a dummy mesh to compute interpolated loops on*/ - dummy = CDDM_from_template(dm, 0, 0, 0, 3, 0); - - /* CustomData we check must match what is passed to mesh_loops_to_mface_corners() */ - numTex = CustomData_number_of_layers(&dm->polyData, CD_MTEXPOLY); - numCol = CustomData_number_of_layers(&dummy->loopData, CD_MLOOPCOL); - hasWCol = CustomData_has_layer(&dummy->loopData, CD_WEIGHT_MLOOPCOL); - hasOrigSpace = CustomData_has_layer(&dummy->loopData, CD_ORIGSPACE_MLOOP); - - /*copy original verts here, so indices stay correct*/ - omvert = dm->getVertArray(dm); - ov = dm->getVertDataArray(dm, CD_ORIGINDEX); - for (i=0; i<dm->numVertData; i++) { - BLI_array_append(mvert, omvert[i]); - BLI_array_append(origv, ov ? ov[i] : i); - } - - for (i=0; i<dm->numTessFaceData; i++, mf++, of++) { - int x, y, x2; - float fac; - - BLI_array_empty(verts); - -#define NG_MAKE_VERT(orig)\ - BLI_array_append(mvert, omvert[orig]);\ - BLI_array_append(origv, ov ? ov[orig] : orig);\ - BLI_array_append(verts, BLI_array_count(mvert)-1); - -#define NG_MAKE_VERTCO(orig, coord) NG_MAKE_VERT(orig); copy_v3_v3(mvert[BLI_array_count(mvert)-1].co, coord) - - y = 0; - fac = 1.0f / (float)(nmd->resolution + 1); - for (x=0; x<nmd->resolution+2; x++) { - float co1[3], co2[3], co3[3]; - - sub_v3_v3v3(co1, omvert[mf->v1].co, omvert[mf->v3].co); - sub_v3_v3v3(co2, omvert[mf->v2].co, omvert[mf->v3].co); - - mul_v3_fl(co1, 1.0f - fac*x); - mul_v3_fl(co2, 1.0f - fac*x); - - add_v3_v3(co1, omvert[mf->v3].co); - add_v3_v3(co2, omvert[mf->v3].co); - - if (x == 0) { - BLI_array_append(verts, mf->v1); - } else if (x == nmd->resolution+1) { - BLI_array_append(verts, mf->v3); - } else { - NG_MAKE_VERTCO(mf->v1, co1); - } - - for (x2=0; x2<(nmd->resolution-x); x2++) { - sub_v3_v3v3(co3, co1, co2); - mul_v3_fl(co3, 1.0f - (1.0f/(float)(nmd->resolution-x+1))*(x2+1)); - add_v3_v3(co3, co2); - - NG_MAKE_VERTCO(mf->v2, co3); - } - - if (x == 0) { - BLI_array_append(verts, mf->v2); - } else if (x != nmd->resolution+1) { - NG_MAKE_VERTCO(mf->v1, co2); - } - } - - y = 0; - for (x=0; x<BLI_array_count(verts)-2; x++) { - int v1, v2, v3; - - if (x2 == nmd->resolution-y+1) { - x2 = 0; - y++; - continue; - } else { - /*int lindex[3] = {0, 1, 2};*/ /*UNUSED*/ - - v1 = verts[x]; - v2 = verts[x+1]; - v3 = verts[x+(nmd->resolution-y)+2]; - - BLI_array_growone(mface); - BLI_array_growone(origf); - - /*make first face*/ - origf[BLI_array_count(origf)-1] = *of; - mf2 = mface + BLI_array_count(mface)-1; - *mf2 = *mf; - - mf2->v1 = v1; - mf2->v2 = v2; - mf2->v3 = v3; - mf2->v4 = 0; - - if (x2 != nmd->resolution-y) { - /*make second face*/ - BLI_array_growone(mface); - BLI_array_growone(origf); - - origf[BLI_array_count(origf)-1] = *of; - mf2 = mface + BLI_array_count(mface)-1; - *mf2 = *mf; - - mf2->v1 = verts[x+(nmd->resolution-y)+3]; - mf2->v2 = v3; - mf2->v3 = v2; - mf2->v4 = 0; - } - } - - x2++; - } - } - - cddm = CDDM_from_template(dm, BLI_array_count(mvert), dm->numEdgeData, BLI_array_count(mface), 0, 0); - - mf2 = mface; - for (i=0; i<BLI_array_count(mface); i++, mf2++) { - MPoly *mp = mpoly + *of; - MLoop *ml; - float co[3], cent[3] = {0.0f, 0.0f, 0.0f}; - int j, lindex[4] = {0, 1, 2}; /* only ever use 3 in this case */ - - BLI_array_empty(w); - BLI_array_empty(cos); - BLI_array_empty(loops); - - mp = mpoly + origf[i]; - ml = mloop + mp->loopstart; - for (j=0; j<mp->totloop; j++, ml++) { - BLI_array_growone(cos); - BLI_array_growone(w); - BLI_array_append(loops, j+mp->loopstart); - copy_v3_v3(cos[j], mvert[ml->v].co); - } - - /*scale source face coordinates a bit, so points sitting directly on an - edge will work.*/ - mul_v3_fl(cent, 1.0f/(float)(mp->totloop)); - for (j=0; j<mp->totloop; j++) { - sub_v3_v3(cos[j], cent); - mul_v3_fl(cos[j], 1.0f+FLT_EPSILON*1500.0f); - add_v3_v3(cos[j], cent); - } - - copy_v3_v3(co, (mvert + mf2->v1)->co); - interp_weights_poly_v3(w, cos, mp->totloop, co); - CustomData_interp(&dm->loopData, &dummy->loopData, loops, w, NULL, mp->totloop, 0); - - copy_v3_v3(co, (mvert + mf2->v2)->co); - interp_weights_poly_v3(w, cos, mp->totloop, co); - CustomData_interp(&dm->loopData, &dummy->loopData, loops, w, NULL, mp->totloop, 1); - - copy_v3_v3(co, (mvert + mf2->v3)->co); - interp_weights_poly_v3(w, cos, mp->totloop, co); - CustomData_interp(&dm->loopData, &dummy->loopData, loops, w, NULL, mp->totloop, 2); - - mesh_loops_to_mface_corners(&cddm->faceData, &dummy->loopData, &dm->polyData, - lindex, i, origf[i], 3, - numTex, numCol, hasWCol, hasOrigSpace); - } - - CustomData_copy_data(&dm->vertData, &cddm->vertData, 0, 0, dm->numVertData); - CustomData_copy_data(&dm->edgeData, &cddm->edgeData, 0, 0, dm->numEdgeData); - - CDDM_set_mface(cddm, mface); - CDDM_set_mvert(cddm, mvert); - - /*set origindex pointer*/ - MEM_freeN(CustomData_get_layer(&cddm->faceData, CD_ORIGINDEX)); - CustomData_set_layer(&cddm->faceData, CD_MFACE, mface); - - if (CustomData_has_layer(&cddm->vertData, CD_ORIGINDEX)) - CustomData_set_layer(&cddm->vertData, CD_ORIGINDEX, origv); - - CustomData_set_layer(&cddm->faceData, CD_ORIGINDEX, origf); - - BLI_array_free(cos); - BLI_array_free(w); - - dummy->needsFree = 1; - dummy->release(dummy); - - /*create polys from mface triangles*/ - CDDM_tessfaces_to_faces(cddm); /*builds ngon faces from tess (mface) faces*/ - - return cddm; -} - - -ModifierTypeInfo modifierType_NgonInterp = { - /* name */ "NgonInterp", - /* structName */ "NgonInterpModifierData", - /* structSize */ sizeof(NgonInterpModifierData), - /* type */ eModifierTypeType_Constructive, - /* flags */ eModifierTypeFlag_AcceptsMesh|eModifierTypeFlag_SupportsMapping|eModifierTypeFlag_SupportsEditmode, - - /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, - /* initData */ 0, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, -}; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 6a84346b69e..5f8c29944bd 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -262,6 +262,5 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(WeightVGProximity); INIT_TYPE(DynamicPaint); INIT_TYPE(Remesh); - INIT_TYPE(NgonInterp); #undef INIT_TYPE } diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index f785f112ccb..ec9b2b80d83 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -30,7 +30,6 @@ #define DO_PROFILE 0 -#include "BLI_editVert.h" #include "BLI_math.h" #include "BLI_string.h" #include "BLI_utildefines.h" diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index ebc9a61f604..e79bad57ee0 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -646,3 +646,39 @@ void PyC_RunQuicky(const char *filepath, int n, ...) PyGILState_Release(gilstate); } } + +/* generic function to avoid depending on RNA */ +void *PyC_RNA_AsPointer(PyObject *value, const char *type_name) +{ + PyObject* as_pointer; + PyObject* pointer; + + if (!strcmp(Py_TYPE(value)->tp_name, type_name) && + (as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL && + PyCallable_Check(as_pointer)) + { + void *result = NULL; + + /* must be a 'type_name' object */ + pointer = PyObject_CallObject(as_pointer, NULL); + Py_DECREF(as_pointer); + + if (!pointer) { + PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed"); + return NULL; + } + result = PyLong_AsVoidPtr(pointer); + Py_DECREF(pointer); + if (!result) { + PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed"); + } + + return result; + } + else { + PyErr_Format(PyExc_TypeError, + "expected '%.200s' type found '%.200s' instead", + type_name, Py_TYPE(value)->tp_name); + return NULL; + } +} diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index a71a2821c9a..18eac6d42f8 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -54,4 +54,6 @@ void PyC_SetHomePath(const char *py_path_bundle); #define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL) +void *PyC_RNA_AsPointer(PyObject *value, const char *type_name); + #endif // __PY_CAPI_UTILS_H__ diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index 66e8ff510ef..9c1fc07108a 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -56,6 +56,8 @@ #include "bpy_rna.h" +#include "../generic/py_capi_utils.h" + #include "gpu.h" #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name) @@ -157,8 +159,6 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj { PyObject* pyscene; PyObject* pymat; - PyObject* as_pointer; - PyObject* pointer; PyObject* result; PyObject* dict; PyObject* val; @@ -177,47 +177,16 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat)) return NULL; - if (!strcmp(Py_TYPE(pyscene)->tp_name, "Scene") && - (as_pointer = PyObject_GetAttrString(pyscene, "as_pointer")) != NULL && - PyCallable_Check(as_pointer)) { - // must be a scene object - pointer = PyObject_CallObject(as_pointer, NULL); - if (!pointer) { - PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); - return NULL; - } - scene = (Scene*)PyLong_AsVoidPtr(pointer); - Py_DECREF(pointer); - if (!scene) { - PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); - return NULL; - } - } - else { - PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type"); + scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene"); + if (scene == NULL) { return NULL; } - if (!strcmp(Py_TYPE(pymat)->tp_name, "Material") && - (as_pointer = PyObject_GetAttrString(pymat, "as_pointer")) != NULL && - PyCallable_Check(as_pointer)) { - // must be a material object - pointer = PyObject_CallObject(as_pointer, NULL); - if (!pointer) { - PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); - return NULL; - } - material = (Material*)PyLong_AsVoidPtr(pointer); - Py_DECREF(pointer); - if (!material) { - PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed"); - return NULL; - } - } - else { - PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type"); + material = (Material *)PyC_RNA_AsPointer(pymat, "Material"); + if (material == NULL) { return NULL; } + // we can call our internal function at last: shader = GPU_shader_export(scene, material); if (!shader) { diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index c97d2b58596..e72a2d2427a 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -37,7 +37,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_editVert.h" /* lasso tessellation */ #include "BLI_math.h" #include "BLI_scanfill.h" /* lasso tessellation */ #include "BLI_utildefines.h" @@ -230,9 +229,9 @@ static void wm_gesture_draw_circle(wmGesture *gt) static void draw_filled_lasso(wmGesture *gt) { - EditVert *v=NULL, *lastv=NULL, *firstv=NULL; + ScanFillVert *v=NULL, *lastv=NULL, *firstv=NULL; /* EditEdge *e; */ /* UNUSED */ - EditFace *efa; + ScanFillFace *efa; short *lasso= (short *)gt->customdata; int i; diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index e36d9c0b0ab..1ae03ca9f6f 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -63,6 +63,7 @@ #include "BKE_tracking.h" /* free tracking clipboard */ #include "BLI_listbase.h" +#include "BLI_scanfill.h" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -387,6 +388,8 @@ void WM_exit_ext(bContext *C, const short do_python) BLF_exit(); + BLI_scanfill_free(); /* the order this is called doesn't matter */ + #ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 6eb2ab72e67..a7f21dca0ca 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -371,7 +371,7 @@ void make_editNurb (struct Object *obedit){} void uiItemR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, char *name, int icon){} -struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag){struct PointerRNA a = {}; return a;} +struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag){struct PointerRNA a = {0}; return a;} struct uiLayout *uiLayoutRow(struct uiLayout *layout, int align){return (struct uiLayout *) NULL;} struct uiLayout *uiLayoutColumn(struct uiLayout *layout, int align){return (struct uiLayout *) NULL;} struct uiLayout *uiLayoutColumnFlow(struct uiLayout *layout, int number, int align){return (struct uiLayout *) NULL;} diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 1cecac4001c..884ab63f93b 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1417,7 +1417,7 @@ static void my_tex_space_mesh(Mesh *me) my_boundbox_mesh(me, loc, size); - if(me->texflag & AUTOSPACE) { + if(me->texflag & ME_AUTOSPACE) { if(me->key) { kb= me->key->refkey; if (kb) { diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 023c3dcbfc9..c32dc6c1096 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1169,8 +1169,6 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale) return; } - MT_Vector3 *local = new MT_Vector3(scale); - p_scale[0] = 1/p_scale[0]; p_scale[1] = 1/p_scale[1]; p_scale[2] = 1/p_scale[2]; |