diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-06 17:24:34 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-06 17:24:34 +0400 |
commit | acfc0ea5111bcab5ea5795187d08b2f6ec5addaa (patch) | |
tree | d9fb7e477ac551859ca95c1f0482eca8b3af1077 /source/blender | |
parent | 72d0cc1f6123900f5593cd0fe428568f5aa7f682 (diff) | |
parent | 2ed2226ee753cc6a7a19806d99772efa61af897f (diff) |
svn merge ^/trunk/blender -r55815:55840
Diffstat (limited to 'source/blender')
75 files changed, 813 insertions, 177 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index e58d484b0c0..292d74b03d7 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -7,15 +7,15 @@ #include <string.h> #include <math.h> -#include "BKE_ccg.h" -#include "CCGSubSurf.h" -#include "BKE_subsurf.h" - #include "MEM_guardedalloc.h" #include "BLO_sys_types.h" // for intptr_t support #include "BLI_utildefines.h" /* for BLI_assert */ +#include "BKE_ccg.h" +#include "CCGSubSurf.h" +#include "BKE_subsurf.h" + /* used for normalize_v3 in BLI_math_vector * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */ #define EPSILON (1.0e-35f) diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index ed72a0fb37b..4bfe3b1c0bd 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -32,8 +32,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_cloth.h" - #include "DNA_cloth_types.h" #include "DNA_group_types.h" #include "DNA_mesh_types.h" @@ -52,11 +50,12 @@ #include "BLI_rand.h" #include "BKE_DerivedMesh.h" +#include "BKE_cloth.h" #include "BKE_global.h" -#include "BKE_scene.h" #include "BKE_mesh.h" -#include "BKE_object.h" #include "BKE_modifier.h" +#include "BKE_object.h" +#include "BKE_scene.h" #include "BKE_DerivedMesh.h" #ifdef WITH_BULLET diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index cbbaf713e84..d6fd2f92443 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -45,12 +45,12 @@ # include <unistd.h> // read #endif -#include "BLO_readfile.h" -#include "BLO_runtime.h" - #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLO_readfile.h" +#include "BLO_runtime.h" + #include "BKE_blender.h" #include "BKE_report.h" diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index 38fd6e9d32d..2b63d13a9dd 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -30,7 +30,6 @@ * \ingroup blenloader */ - #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -40,13 +39,10 @@ #include "DNA_listBase.h" - -#include "BLO_undofile.h" - #include "BLI_blenlib.h" #include "BLI_linklist.h" - +#include "BLO_undofile.h" /* **************** support for memory-write, for undo buffers *************** */ diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index fcf804c8f4f..472f7d2d8f0 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -54,6 +54,7 @@ set(SRC operators/bmo_join_triangles.c operators/bmo_mesh_conv.c operators/bmo_mirror.c + operators/bmo_poke.c operators/bmo_primitive.c operators/bmo_removedoubles.c operators/bmo_similar.c diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index d0ab0ea5d60..6edbae0831e 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -36,12 +36,12 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "BKE_customdata.h" -#include "BKE_multires.h" - #include "BLI_array.h" #include "BLI_math.h" +#include "BKE_customdata.h" +#include "BKE_multires.h" + #include "bmesh.h" #include "intern/bmesh_private.h" diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 7583332c4db..a84958f6827 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1500,12 +1500,34 @@ static BMOpDefine bmo_solidify_def = { }; /* - * Face Inset. + * Face Inset (Individual). * - * Inset or outset faces. + * Insets individual faces. */ -static BMOpDefine bmo_inset_def = { - "inset", +static BMOpDefine bmo_inset_individual_def = { + "inset_individual", + /* slots_in */ + {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ + {"thickness", BMO_OP_SLOT_FLT}, + {"depth", BMO_OP_SLOT_FLT}, + {"use_even_offset", BMO_OP_SLOT_BOOL}, + {{'\0'}}, + }, + /* slots_out */ + {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ + {{'\0'}}, + }, + bmo_inset_individual_exec, + 0 +}; + +/* + * Face Inset (Regions). + * + * Inset or outset face regions. + */ +static BMOpDefine bmo_inset_region_def = { + "inset_region", /* slots_in */ {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ {"use_boundary", BMO_OP_SLOT_BOOL}, @@ -1520,7 +1542,7 @@ static BMOpDefine bmo_inset_def = { {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ {{'\0'}}, }, - bmo_inset_exec, + bmo_inset_region_exec, 0 }; @@ -1549,6 +1571,29 @@ static BMOpDefine bmo_wireframe_def = { 0 }; +/* + * Pokes a face. + * + * Splits a face into a triangle fan. + */ +static BMOpDefine bmo_poke_def = { + "poke", + /* slots_in */ + {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ + {"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */ + {"center_mode", BMO_OP_SLOT_INT}, /* calculation mode for center vertex */ + {"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */ + {{'\0'}}, + }, + /* slots_out */ + {{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */ + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ + {{'\0'}}, + }, + bmo_poke_exec, + 0 +}; + #ifdef WITH_BULLET /* * Convex Hull @@ -1647,13 +1692,15 @@ const BMOpDefine *bmo_opdefines[] = { &bmo_extrude_face_region_def, &bmo_extrude_vert_indiv_def, &bmo_find_doubles_def, - &bmo_inset_def, + &bmo_inset_individual_def, + &bmo_inset_region_def, &bmo_join_triangles_def, &bmo_mesh_to_bmesh_def, &bmo_mirror_def, &bmo_object_load_bmesh_def, &bmo_pointmerge_def, &bmo_pointmerge_facedata_def, + &bmo_poke_def, &bmo_recalc_face_normals_def, &bmo_region_extend_def, &bmo_remove_doubles_def, diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 180bc53c2e3..c72accbc605 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -482,6 +482,8 @@ typedef struct BMOElemMapping { extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES]; +int BMO_opcode_from_opname(const char *opname); + #ifdef __cplusplus } #endif diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index a358623834f..1d20f94c51c 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -47,7 +47,6 @@ static void bmo_flag_layer_free(BMesh *bm); static void bmo_flag_layer_clear(BMesh *bm); static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier); static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier); -static int bmo_opname_to_opcode(const char *opname); static const char *bmo_error_messages[] = { NULL, @@ -145,7 +144,7 @@ static void bmo_op_slots_init(const BMOSlotType *slot_types, BMOpSlot *slot_args */ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname) { - int opcode = bmo_opname_to_opcode(opname); + int opcode = BMO_opcode_from_opname(opname); #ifdef DEBUG BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname); @@ -1522,20 +1521,27 @@ static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons return i; } -static int bmo_opname_to_opcode(const char *opname) +int BMO_opcode_from_opname(const char *opname) { - int i; - for (i = 0; i < bmo_opdefines_total; i++) { - if (STREQ(opname, bmo_opdefines[i]->opname)) { + const unsigned int tot = bmo_opdefines_total; + unsigned int i; + for (i = 0; i < tot; i++) { + if (STREQ(bmo_opdefines[i]->opname, opname)) { return i; } } - - fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname); return -1; } +static int BMO_opcode_from_opname_check(const char *opname) +{ + int i = BMO_opcode_from_opname(opname); + if (i == -1) + fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname); + return i; +} + /** * \brief Format Strings for #BMOperator Initialization. * @@ -1628,10 +1634,11 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, fmt += i + (noslot ? 0 : 1); - i = bmo_opname_to_opcode(opname); + i = BMO_opcode_from_opname_check(opname); if (i == -1) { MEM_freeN(ofmt); + BLI_assert(0); return false; } diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 16b38c340ff..ff0fc285dc3 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -95,6 +95,13 @@ enum { VPATH_SELECT_TOPOLOGICAL }; +/* Poke face center calculation */ +enum { + BMOP_POKE_MEAN_WEIGHTED = 0, + BMOP_POKE_MEAN, + BMOP_POKE_BOUNDS +}; + extern const BMOpDefine *bmo_opdefines[]; extern const int bmo_opdefines_total; diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h index 79e688bd5ff..2a67407b261 100644 --- a/source/blender/bmesh/intern/bmesh_operators_private.h +++ b/source/blender/bmesh/intern/bmesh_operators_private.h @@ -65,7 +65,8 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op); void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op); void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op); void bmo_find_doubles_exec(BMesh *bm, BMOperator *op); -void bmo_inset_exec(BMesh *bm, BMOperator *op); +void bmo_inset_individual_exec(BMesh *bm, BMOperator *op); +void bmo_inset_region_exec(BMesh *bm, BMOperator *op); void bmo_join_triangles_exec(BMesh *bm, BMOperator *op); void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op); void bmo_mirror_exec(BMesh *bm, BMOperator *op); @@ -73,6 +74,7 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op); void bmo_pointmerge_exec(BMesh *bm, BMOperator *op); void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op); void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op); +void bmo_poke_exec(BMesh *bm, BMOperator *op); void bmo_region_extend_exec(BMesh *bm, BMOperator *op); void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op); void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op); diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index d235aaaa622..525dd5b1f9c 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -337,6 +337,34 @@ void BM_face_calc_center_mean(BMFace *f, float r_cent[3]) } /** + * computes the center of a face, using the mean average + * weighted by edge length + */ +void BM_face_calc_center_mean_weighted(BMFace *f, float r_cent[3]) +{ + BMLoop *l_iter; + BMLoop *l_first; + float totw = 0.0f; + float w_prev; + + zero_v3(r_cent); + + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + w_prev = BM_edge_calc_length(l_iter->prev->e); + do { + const float w_curr = BM_edge_calc_length(l_iter->e); + const float w = (w_curr + w_prev); + madd_v3_v3fl(r_cent, l_iter->v->co, w); + totw += w; + w_prev = w_curr; + } while ((l_iter = l_iter->next) != l_first); + + if (totw != 0.0f) + mul_v3_fl(r_cent, 1.0f / (float) totw); +} + +/** * COMPUTE POLY PLANE * * Projects a set polygon's vertices to diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index c439a41f672..d857ba77fe7 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -37,6 +37,7 @@ float BM_face_calc_area(BMFace *f); float BM_face_calc_perimeter(BMFace *f); void BM_face_calc_center_bounds(BMFace *f, float center[3]); void BM_face_calc_center_mean(BMFace *f, float center[3]); +void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]); void BM_face_normal_update(BMFace *f); void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index a3656ce5b74..d8ed511bc94 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -24,14 +24,14 @@ * \ingroup bmesh * * Inset face regions. + * Inset individual faces. * - * TODO - * - Inset indervidual faces. */ #include "MEM_guardedalloc.h" #include "BLI_math.h" +#include "BLI_array.h" #include "bmesh.h" @@ -39,6 +39,227 @@ #define ELE_NEW 1 + + +/* -------------------------------------------------------------------- */ +/* Inset Individual */ + + +/* Holds Per-Face Inset Edge Data */ +typedef struct EdgeInsetInfo { + float no[3]; + BMEdge *e_old; + BMEdge *e_new; +} EdgeInsetInfo; + +/** + * Individual Face Inset. + * Find all tagged faces (f), duplicate edges around faces, inset verts of + * created edges, create new faces between old and new edges, fill face + * between connected new edges, kill old face (f). + */ +void bmo_inset_individual_exec(BMesh *bm, BMOperator *op) +{ + BMEdge **f_edges = NULL; + BMVert **f_verts = NULL; + BMFace *f; + + BMOIter oiter; + EdgeInsetInfo *eiinfo_arr = NULL; + + BLI_array_declare(eiinfo_arr); + BLI_array_declare(f_edges); + BLI_array_declare(f_verts); + + const float thickness = BMO_slot_float_get(op->slots_in, "thickness"); + const float depth = BMO_slot_float_get(op->slots_in, "depth"); + const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset"); + + /* Only tag faces in slot */ + BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false); + + BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false); + + BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) { + BMLoop *l_iter, *l_first; + BMLoop *l_iter_inner = NULL; + int i; + + BLI_array_empty(f_verts); + BLI_array_empty(f_edges); + BLI_array_empty(eiinfo_arr); + BLI_array_grow_items(f_verts, f->len); + BLI_array_grow_items(f_edges, f->len); + BLI_array_grow_items(eiinfo_arr, f->len); + + /* create verts */ + i = 0; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + f_verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0); + i++; + } while ((l_iter = l_iter->next) != l_first); + + /* make edges */ + i = 0; + l_iter = l_first; + do { + f_edges[i] = BM_edge_create(bm, f_verts[i], f_verts[(i + 1) % f->len], l_iter->e, 0); + + eiinfo_arr[i].e_new = f_edges[i]; + eiinfo_arr[i].e_old = l_iter->e; + BM_edge_calc_face_tangent(l_iter->e, l_iter, eiinfo_arr[i].no); + + /* Tagging (old elements) required when iterating over edges + * connected to verts for translation vector calculation */ + BM_elem_flag_enable(l_iter->e, BM_ELEM_TAG); + BM_elem_index_set(l_iter->e, i); /* set_dirty! */ + i++; + } while ((l_iter = l_iter->next) != l_first); + /* done with edges */ + + bm->elem_index_dirty |= BM_EDGE; + + /* Calculate translation vector for new */ + l_iter = l_first; + do { + EdgeInsetInfo *ei_prev = &eiinfo_arr[BM_elem_index_get(l_iter->prev->e)]; + EdgeInsetInfo *ei_next = &eiinfo_arr[BM_elem_index_get(l_iter->e)]; + float tvec[3]; + float v_new_co[3]; + int index = 0; + + add_v3_v3v3(tvec, ei_prev->no, ei_next->no); + normalize_v3(tvec); + + /* l->e is traversed in order */ + index = BM_elem_index_get(l_iter->e); + + copy_v3_v3(v_new_co, eiinfo_arr[index].e_new->v1->co); + + if (use_even_offset) { + mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(ei_prev->no, ei_next->no) / 2.0f)); + } + + /* Modify vertices and their normals */ + madd_v3_v3fl(v_new_co, tvec, thickness); + + /* Set normal, add depth and write new vertex position*/ + copy_v3_v3(eiinfo_arr[index].e_new->v1->no, f->no); + + madd_v3_v3fl(v_new_co, f->no, depth); + + copy_v3_v3(eiinfo_arr[index].e_new->v1->co, v_new_co); + } while ((l_iter = l_iter->next) != l_first); + + { + BMFace *f_new_inner; + /* Create New Inset Faces */ + f_new_inner = BM_face_create(bm, f_verts, f_edges, f->len, 0); + if (UNLIKELY(f_new_inner == NULL)) { + BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create inner face."); + BLI_array_free(f_edges); + BLI_array_free(f_verts); + BLI_array_free(eiinfo_arr); + return; + } + + /* Copy Face Data */ + BM_elem_attrs_copy(bm, bm, f, f_new_inner); + // Don't tag, gives more useful inner/outer select option + // BMO_elem_flag_enable(bm, f_new_inner, ELE_NEW); + + l_iter_inner = BM_FACE_FIRST_LOOP(f_new_inner); + } + + l_iter = l_first; + do { + BMFace *f_new_outer; + + BMLoop *l_iter_sub; + BMLoop *l_a = NULL; + BMLoop *l_b = NULL; + BMLoop *l_a_other = NULL; + BMLoop *l_b_other = NULL; + BMLoop *l_shared = NULL; + + BM_elem_attrs_copy(bm, bm, l_iter, l_iter_inner); + + f_new_outer = BM_face_create_quad_tri(bm, + l_iter->v, + l_iter->next->v, + l_iter_inner->next->v, + l_iter_inner->v, + f, false); + + if (UNLIKELY(f_new_outer == NULL)) { + BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create an outer face."); + BLI_array_free(f_edges); + BLI_array_free(f_verts); + BLI_array_free(eiinfo_arr); + return; + } + + BM_elem_attrs_copy(bm, bm, f, f_new_outer); + BMO_elem_flag_enable(bm, f_new_outer, ELE_NEW); + BM_elem_flag_enable(f_new_outer, BM_ELEM_TAG); + + /* Copy Loop Data */ + l_a = BM_FACE_FIRST_LOOP(f_new_outer); + l_b = l_a->next; + + l_iter_sub = l_iter; + + /* Skip old face f and new inset face. + * If loop if found we are a boundary. This + * is required as opposed to BM_edge_is_boundary() + * Because f_new_outer shares an edge with f */ + do { + if (l_iter_sub->f != f && l_iter_sub->f != f_new_outer) { + l_shared = l_iter_sub; + break; + } + } while ((l_iter_sub = l_iter_sub->radial_next) != l_iter); + + if (l_shared) { + BM_elem_attrs_copy(bm, bm, l_shared, l_a->next); + BM_elem_attrs_copy(bm, bm, l_shared->next, l_a); + } + else { + l_a_other = BM_edge_other_loop(l_a->e, l_a); + l_b_other = l_a_other->next; + BM_elem_attrs_copy(bm, bm, l_a_other, l_a); + BM_elem_attrs_copy(bm, bm, l_b_other, l_b); + } + + /* Move to the last two loops in new face */ + l_a = l_b->next; + l_b = l_a->next; + + /* This loop should always have >1 radials + * (associated edge connects new and old face) */ + BM_elem_attrs_copy(bm, bm, l_iter, l_b); + BM_elem_attrs_copy(bm, bm, l_iter->next, l_a); + + } while ((l_iter_inner = l_iter_inner->next), + (l_iter = l_iter->next) != l_first); + + BM_face_kill(bm, f); + } + + /* we could flag new edges/verts too, is it useful? */ + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW); + + BLI_array_free(f_verts); + BLI_array_free(f_edges); + BLI_array_free(eiinfo_arr); +} + + + +/* -------------------------------------------------------------------- */ +/* Inset Region */ + typedef struct SplitEdgeInfo { float no[3]; float length; @@ -95,7 +316,7 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l) * - inset the new edges into their faces. */ -void bmo_inset_exec(BMesh *bm, BMOperator *op) +void bmo_inset_region_exec(BMesh *bm, BMOperator *op) { const bool use_outset = BMO_slot_bool_get(op->slots_in, "use_outset"); const bool use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == false); diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 5e4fa29d953..edbb19afc62 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -33,11 +33,11 @@ #include "DNA_meshdata_types.h" -#include "BKE_customdata.h" - #include "BLI_math.h" #include "BLI_array.h" +#include "BKE_customdata.h" + #include "bmesh.h" #include "intern/bmesh_operators_private.h" /* own include */ diff --git a/source/blender/bmesh/operators/bmo_poke.c b/source/blender/bmesh/operators/bmo_poke.c new file mode 100644 index 00000000000..7105210da04 --- /dev/null +++ b/source/blender/bmesh/operators/bmo_poke.c @@ -0,0 +1,141 @@ +/* + * ***** 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. + * + * Contributor(s): Francisco De La Cruz + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_poke.c + * \ingroup bmesh + * + * Pokes a face. + * + * Splits a face into a triangle fan. + */ + +#include "BLI_math.h" + +#include "bmesh.h" + +#include "intern/bmesh_operators_private.h" /* own include */ + +#define ELE_NEW 1 + +/** + * Pokes a face + * + * Splits a face into a triangle fan. + * Iterate over all selected faces, create a new center vertex and + * create triangles between original face edges and new center vertex. + */ +void bmo_poke_exec(BMesh *bm, BMOperator *op) +{ + BMOIter oiter; + BMFace *f; + + const float offset = BMO_slot_float_get(op->slots_in, "offset"); + const bool use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset"); + const int center_mode = BMO_slot_int_get(op->slots_in, "center_mode"); + void (*bm_face_calc_center_fn)(BMFace *f, float r_cent[3]); + + switch (center_mode) { + case BMOP_POKE_MEAN_WEIGHTED: + bm_face_calc_center_fn = BM_face_calc_center_mean_weighted; + break; + case BMOP_POKE_BOUNDS: + bm_face_calc_center_fn = BM_face_calc_center_bounds; + break; + case BMOP_POKE_MEAN: + bm_face_calc_center_fn = BM_face_calc_center_mean; + break; + default: + BLI_assert(0); + break; + } + + BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) { + BMFace *f_new; + float f_center[3]; + BMVert *v_center = NULL; + BMLoop *l_iter, *l_first; + /* only interpolate the centeral loop from the face once, + * then copy to all others in the fan */ + BMLoop *l_center_example; + + /* 1.0 or the average length from the center to the face verts */ + float offset_fac; + + int i; + + bm_face_calc_center_fn(f, f_center); + v_center = BM_vert_create(bm, f_center, NULL, 0); + BMO_elem_flag_enable(bm, v_center, ELE_NEW); + + /* handled by BM_loop_interp_from_face */ + // BM_vert_interp_from_face(bm, v_center, f); + + if (use_relative_offset) { + offset_fac = 0.0f; + } + else { + offset_fac = 1.0f; + } + + i = 0; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + BMLoop *l_new; + + f_new = BM_face_create_quad_tri(bm, l_iter->v, l_iter->next->v, v_center, NULL, f, false); + l_new = BM_FACE_FIRST_LOOP(f_new); + + if (i == 0) { + l_center_example = l_new->prev; + BM_loop_interp_from_face(bm, l_center_example, f, true, true); + } + else { + BM_elem_attrs_copy(bm, bm, l_center_example, l_new->prev); + } + + /* Copy Loop Data */ + BM_elem_attrs_copy(bm, bm, l_iter, l_new); + BM_elem_attrs_copy(bm, bm, l_iter->next, l_new->next); + + BMO_elem_flag_enable(bm, f_new, ELE_NEW); + + if (use_relative_offset) { + offset_fac += len_v3v3(f_center, l_iter->v->co); + } + + } while (i++, (l_iter = l_iter->next) != l_first); + + if (use_relative_offset) { + offset_fac /= (float)f->len; + } + /* else remain at 1.0 */ + + copy_v3_v3(v_center->no, f->no); + madd_v3_v3fl(v_center->co, v_center->no, offset * offset_fac); + + /* Kill Face */ + BM_face_kill(bm, f); + } + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, ELE_NEW); + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW); +} diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 724abb59bcf..402fa28e210 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -23,8 +23,6 @@ #include <list> #include <stdio.h> -#include "BKE_global.h" - #include "COM_compositor.h" #include "COM_WorkScheduler.h" #include "COM_CPUDevice.h" @@ -38,6 +36,8 @@ #include "PIL_time.h" #include "BLI_threads.h" +#include "BKE_global.h" + #if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD # ifndef DEBUG /* test this so we dont get warnings in debug builds */ # warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging. diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 649ef90f7ba..665c5f628d9 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -26,13 +26,13 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" - #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_ghash.h" +#include "BKE_context.h" + #include "reeb.h" #if 0 /* UNUSED 2.5 */ diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 3d2cd260fb9..7edf723022f 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -38,12 +38,12 @@ #include "DNA_listBase.h" #include "DNA_windowmanager_types.h" +#include "BLI_listbase.h" + #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_gpencil.h" -#include "BLI_listbase.h" - #include "ED_gpencil.h" #include "WM_api.h" diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 63741ee08ba..3d04675348f 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -311,4 +311,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis); -#endif /* UI_RESOURCES_H */ +#endif /* __UI_RESOURCES_H__ */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c40d91378b1..16f3cb9c7c2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2233,6 +2233,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval = WM_UI_HANDLER_BREAK; break; + case AKEY: + /* Ctrl + A: Select all */ + if (event->ctrl && !(event->alt || event->shift || event->oskey)) { + ui_textedit_move(but, data, STRCUR_DIR_PREV, + false, STRCUR_JUMP_ALL); + ui_textedit_move(but, data, STRCUR_DIR_NEXT, + true, STRCUR_JUMP_ALL); + retval = WM_UI_HANDLER_BREAK; + } + break; + case TABKEY: /* there is a key conflict here, we can't tab with autocomplete */ if (but->autocomplete_func || data->searchbox) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index e5f9e48c3b0..905c914352f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2506,8 +2506,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int /* make the progress bar a proportion of the original height */ /* hardcoded 4px high for now */ - rect_prog.ymax = rect_prog.ymin + 4; - rect_bar.ymax = rect_bar.ymin + 4; + rect_prog.ymax = rect_prog.ymin + 4 * UI_DPI_FAC; + rect_bar.ymax = rect_bar.ymin + 4 * UI_DPI_FAC; w = value * BLI_rcti_size_x(&rect_prog); @@ -2520,8 +2520,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); /* raise text a bit */ - rect->ymin += 6; - rect->xmin -= 6; + rect->ymin += 6 * UI_DPI_FAC; + rect->xmin -= 6 * UI_DPI_FAC; } static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index f7cf32a074f..a9093824a9d 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) InsetData *opdata = op->customdata; const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " - "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); + "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); @@ -98,7 +98,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) flts_str + NUM_STR_REP_LEN, opdata->modify_depth ? IFACE_("On") : IFACE_("Off"), RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"), - RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off") + RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "individual") ? IFACE_("On") : IFACE_("Off") ); ED_area_headerprint(sa, msg); @@ -191,6 +192,7 @@ static int edbm_inset_calc(wmOperator *op) const float depth = RNA_float_get(op->ptr, "depth"); const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ + const bool individual = RNA_boolean_get(op->ptr, "individual"); opdata = op->customdata; em = opdata->em; @@ -199,12 +201,18 @@ static int edbm_inset_calc(wmOperator *op) EDBM_redo_state_restore(opdata->mesh_backup, em, false); } - EDBM_op_init(em, &bmop, op, - "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " - "thickness=%f depth=%f use_outset=%b", - BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, - thickness, depth, use_outset); - + if (individual) { + EDBM_op_init(em, &bmop, op, + "inset_individual faces=%hf thickness=%f depth=%f use_even_offset=%b", + BM_ELEM_SELECT, thickness, depth, use_even_offset); + } + else { + EDBM_op_init(em, &bmop, op, + "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " + "thickness=%f depth=%f use_outset=%b", + BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, + thickness, depth, use_outset); + } BMO_op_exec(em->bm, &bmop); if (use_select_inset) { @@ -410,6 +418,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) } } break; + case IKEY: + if (event->val == KM_PRESS) { + int individual = RNA_boolean_get(op->ptr, "individual"); + RNA_boolean_set(op->ptr, "individual", !individual); + if (edbm_inset_calc(op)) { + edbm_inset_update_header(op, C); + } + else { + edbm_inset_cancel(C, op); + return OPERATOR_CANCELLED; + } + } + break; + } return OPERATOR_RUNNING_MODAL; @@ -448,4 +470,5 @@ void MESH_OT_inset(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces"); + RNA_def_boolean(ot->srna, "individual", false, "Individual", "Individual Face Inset"); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0e4161d232d..4f691efe950 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2632,6 +2632,67 @@ void MESH_OT_beautify_fill(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } + +/********************** Poke Face **********************/ + +static int edbm_poke_face_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); + BMOperator bmop; + + const float offset = RNA_float_get(op->ptr, "offset"); + const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); + const int center_mode = RNA_enum_get(op->ptr, "center_mode"); + + EDBM_op_init(em, &bmop, op, "poke faces=%hf offset=%f use_relative_offset=%b center_mode=%i", + BM_ELEM_SELECT, offset, use_relative_offset, center_mode); + BMO_op_exec(em->bm, &bmop); + + EDBM_flag_disable_all(em, BM_ELEM_SELECT); + + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); + + if (!EDBM_op_finish(em, &bmop, op, true)) { + return OPERATOR_CANCELLED; + } + + EDBM_mesh_normals_update(em); + + EDBM_update_generic(em, true, true); + + return OPERATOR_FINISHED; + +} + +void MESH_OT_poke(wmOperatorType *ot) +{ + + static EnumPropertyItem poke_center_modes[] = { + {BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"}, + {BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"}, + {BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"}, + {0, NULL, 0, NULL, NULL}}; + + + /* identifiers */ + ot->name = "Poke Faces"; + ot->idname = "MESH_OT_poke"; + ot->description = "Splits a face into a fan"; + + /* api callbacks */ + ot->exec = edbm_poke_face_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Poke Offset", "Poke Offset", -1.0f, 1.0f); + RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry"); + RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEAN_WEIGHTED, "Poke Center", "Poke Face Center Calculation"); +} + /********************** Quad/Tri Operators *************************/ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) @@ -2660,6 +2721,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } + void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4a0bbbb8dbf..5b447bf254f 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -202,6 +202,7 @@ void MESH_OT_edge_face_add(struct wmOperatorType *ot); void MESH_OT_duplicate(struct wmOperatorType *ot); void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot); +void MESH_OT_poke(struct wmOperatorType *ot); #ifdef WITH_FREESTYLE void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index a17b0f5551b..06f920ef16c 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -158,6 +158,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_bridge_edge_loops); WM_operatortype_append(MESH_OT_inset); + WM_operatortype_append(MESH_OT_poke); WM_operatortype_append(MESH_OT_wireframe); WM_operatortype_append(MESH_OT_edge_split); @@ -266,7 +267,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0); - + WM_keymap_add_item(keymap, "MESH_OT_poke", PKEY, KM_PRESS, KM_ALT, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "vertex_only", false); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index b851dc3be94..08349e2e0bb 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -43,13 +43,13 @@ #endif #include "MEM_guardedalloc.h" -#include "BLO_readfile.h" - #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLO_readfile.h" + #include "DNA_world_types.h" #include "DNA_camera_types.h" #include "DNA_material_types.h" diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 796bb99ebaf..f480725277e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -993,8 +993,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */ RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex"); - WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke"); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index b1be9217819..382b0b75c5e 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -35,10 +35,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" - #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_string.h" @@ -46,6 +42,10 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" + #include "ED_screen.h" #include "ED_clip.h" diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 1000aced3a9..1d2ea8d7305 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -37,11 +37,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" -#include "BKE_mask.h" - #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -52,6 +47,11 @@ #include "BLI_rect.h" #include "BLI_math_base.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" +#include "BKE_mask.h" + #include "ED_screen.h" #include "ED_clip.h" #include "ED_mask.h" diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 7b070fde6ba..973200dc340 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -35,14 +35,14 @@ #include "MEM_guardedalloc.h" -#include "BKE_context.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" - #include "BLI_utildefines.h" #include "BLI_math.h" #include "BLI_string.h" +#include "BKE_context.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" + #include "ED_screen.h" #include "ED_clip.h" diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 35179511563..d6f644ab330 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -28,13 +28,12 @@ * \ingroup spfile */ +#include "BLI_blenlib.h" +#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" -#include "BLI_blenlib.h" -#include "BLI_utildefines.h" - #include "BLF_translation.h" #include "DNA_screen_types.h" diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 698c355fad3..d2624c7fa97 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -35,14 +35,14 @@ #include "BIF_gl.h" -#include "BLO_readfile.h" - #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_utildefines.h" #include "BLI_fileops_types.h" +#include "BLO_readfile.h" + #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_global.h" diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1b4ff44bb6b..9bc23ca17c2 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -438,7 +438,6 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) case NC_WINDOW: /* notifier comes from editing color space */ image_scopes_tag_refresh(sa); - ED_area_tag_refresh(sa); ED_area_tag_redraw(sa); break; case NC_SCENE: diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 513bde4375c..0155750fbf8 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -31,10 +31,10 @@ #include "DNA_node_types.h" -#include "BKE_context.h" - #include "BLI_utildefines.h" +#include "BKE_context.h" + #include "ED_node.h" /* own include */ #include "ED_screen.h" #include "ED_transform.h" diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 7678051fd38..2752d76fbf0 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -49,12 +49,12 @@ #include "BIF_gl.h" #include "BIF_glutil.h" -#include "BKE_context.h" - #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_string.h" +#include "BKE_context.h" + #include "ED_image.h" #include "ED_view3d.h" diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index fc603f7a593..e1451ee43e6 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -186,6 +186,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) //#ifdef WITH_PYTHON // XXX BPY_scripts_clear_pyobjects(); //#endif + + /* for global undo/redo we should just clear the editmode stack */ + /* for example, texface stores image pointers */ + undo_editmode_clear(); + if (undoname) BKE_undo_name(C, undoname); else diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 1bf15fd0838..74b0f69c9b8 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -27,9 +27,6 @@ #include <stdlib.h> #include <limits.h> -#include "BKE_cloth.h" -#include "BKE_modifier.h" - #include "DNA_cloth_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -38,6 +35,9 @@ #include "rna_internal.h" +#include "BKE_cloth.h" +#include "BKE_modifier.h" + #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 09ea82e5ec7..e7a8311656f 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -27,12 +27,12 @@ #ifndef __RNA_INTERNAL_H__ #define __RNA_INTERNAL_H__ -#include "UI_resources.h" - #include "BLI_utildefines.h" #include "rna_internal_types.h" +#include "UI_resources.h" + #define RNA_MAGIC ((int)~0) struct ColorBand; diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 9b2bcab4604..bb5ff172672 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -30,9 +30,6 @@ #include "MEM_guardedalloc.h" -#include "BKE_movieclip.h" -#include "BKE_tracking.h" - #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" @@ -40,6 +37,9 @@ #include "rna_internal.h" +#include "BKE_movieclip.h" +#include "BKE_tracking.h" + #include "WM_types.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index cdfcf045e35..b1732a3b184 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -33,7 +33,7 @@ /* **************** ALPHAOVER ******************** */ static bNodeSocketTemplate cmp_node_alphaover_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index e544ec7d9d8..8dcad031e01 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -36,7 +36,7 @@ /* **************** BLUR ******************** */ static bNodeSocketTemplate cmp_node_blur_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_blur_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 60cfd7c90f3..5cdb7b016cd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -34,7 +34,7 @@ /* ******************* Color Spill Supression ********************************* */ static bNodeSocketTemplate cmp_node_color_spill_in[] = { {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {-1, 0, ""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index 693680f58a8..0ab819d6683 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -36,7 +36,7 @@ /* ******************* Color Balance ********************************* */ static bNodeSocketTemplate cmp_node_colorbalance_in[] = { - {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {-1, 0, ""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c index 9b09462ed0f..e122bd51ec6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c @@ -38,7 +38,7 @@ /* ******************* Color Balance ********************************* */ static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { { SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c index 7fa7a5048ab..83ca9128ce4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.c +++ b/source/blender/nodes/composite/nodes/node_composite_composite.c @@ -34,8 +34,8 @@ /* **************** COMPOSITE ******************** */ static bNodeSocketTemplate cmp_node_composite_in[] = { { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index 2bf901491bf..483965f4adf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -95,7 +95,7 @@ void register_node_type_cmp_curve_vec(void) /* **************** CURVE RGB ******************** */ static bNodeSocketTemplate cmp_node_curve_rgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f}, diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 9581ef981cb..a4c34ea523f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -36,7 +36,7 @@ /* ************ qdn: Defocus node ****************** */ static bNodeSocketTemplate cmp_node_defocus_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_defocus_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c index 486c69caba0..35539082556 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.c +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c @@ -33,7 +33,7 @@ /* **************** FILTER ******************** */ static bNodeSocketTemplate cmp_node_despeckle_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c index d9caff0d495..a77fc004ce7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.c +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c @@ -36,7 +36,7 @@ /* **************** Dilate/Erode ******************** */ static bNodeSocketTemplate cmp_node_dilateerode_in[] = { - { SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_dilateerode_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 33f82355629..5794b5a7cb8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -38,8 +38,8 @@ static bNodeSocketTemplate cmp_node_displace_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_VECTOR, 1, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, - { SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_displace_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 408c2ff8d73..16adbc8d53c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -34,7 +34,7 @@ /* **************** FILTER ******************** */ static bNodeSocketTemplate cmp_node_filter_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 01c6f639cbb..f499dec1224 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -35,7 +35,7 @@ /* **************** Hue Saturation ******************** */ static bNodeSocketTemplate cmp_node_hue_sat_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index 71e4df04911..91e5a2d865a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" static bNodeSocketTemplate cmp_node_huecorrect_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index 6a3da2c854b..415cb641548 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -33,7 +33,7 @@ /* **************** INVERT ******************** */ static bNodeSocketTemplate cmp_node_invert_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index a3415761bf8..e9c3e4fd6e0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -33,7 +33,7 @@ /* **************** MIX RGB ******************** */ static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.c b/source/blender/nodes/composite/nodes/node_composite_pixelate.c index d12c09cb25e..95640e2bd9b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.c +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.c @@ -37,7 +37,7 @@ /* **************** Pixelate ******************** */ static bNodeSocketTemplate cmp_node_pixelate_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_pixelate_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 0d8763bf321..9b1cb3a34b0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -36,8 +36,8 @@ static bNodeSocketTemplate cmp_node_scale_in[] = { { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_scale_out[] = { diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c index a1d51bdf171..45192cc6252 100644 --- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c @@ -35,7 +35,7 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate cmp_node_valtorgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_valtorgb_out[] = { diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c index b293b02cfe6..f36f1476bbe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.c +++ b/source/blender/nodes/shader/nodes/node_shader_curves.c @@ -35,7 +35,7 @@ /* **************** CURVE VEC ******************** */ static bNodeSocketTemplate sh_node_curve_vec_in[] = { - { SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; @@ -88,7 +88,7 @@ void register_node_type_sh_curve_vec(void) /* **************** CURVE RGB ******************** */ static bNodeSocketTemplate sh_node_curve_rgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c index 559d9289fb7..0d6f0c6ca10 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c @@ -36,9 +36,9 @@ /* **************** Hue Saturation ******************** */ static bNodeSocketTemplate sh_node_hue_sat_in[] = { { SOCK_FLOAT, 1, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c index 193ea93f54a..9dbd2a340ce 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.c +++ b/source/blender/nodes/shader/nodes/node_shader_invert.c @@ -36,7 +36,7 @@ /* **************** INVERT ******************** */ static bNodeSocketTemplate sh_node_invert_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index aee280760ba..a4cdfdc6f41 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -36,7 +36,7 @@ static bNodeSocketTemplate sh_node_material_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, { -1, 0, "" } }; @@ -53,15 +53,15 @@ static bNodeSocketTemplate sh_node_material_out[] = { static bNodeSocketTemplate sh_node_material_ext_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, { SOCK_RGBA, 1, N_("Mirror"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_FLOAT, 1, N_("Ray Mirror"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, N_("Ray Mirror"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Alpha"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - { SOCK_FLOAT, 1, N_("Translucency"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Translucency"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c index 982eaa228d1..2d4f93fc757 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c @@ -34,7 +34,7 @@ /* **************** MIX RGB ******************** */ static bNodeSocketTemplate sh_node_mix_rgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f}, { -1, 0, "" } diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c index f1415dcac1b..4dc484545a2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.c @@ -30,7 +30,7 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_mix_shader_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_SHADER, 1, N_("Shader")}, { SOCK_SHADER, 1, N_("Shader")}, { -1, 0, "" } diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c index c317fe0f58a..128e31b8352 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ b/source/blender/nodes/shader/nodes/node_shader_output.c @@ -35,7 +35,7 @@ /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_output_in[] = { { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_script.c b/source/blender/nodes/shader/nodes/node_shader_script.c index 6666197770f..c0d62f98d47 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.c +++ b/source/blender/nodes/shader/nodes/node_shader_script.c @@ -29,10 +29,10 @@ * \ingroup shdnodes */ -#include "BKE_idprop.h" - #include "node_shader_util.h" +#include "BKE_idprop.h" + /* **************** Script ******************** */ static void init(bNodeTree *UNUSED(ntree), bNode *node) diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c index d5f0bf30966..0905b45505e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c @@ -34,7 +34,7 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate sh_node_valtorgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate sh_node_valtorgb_out[] = { diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c index 56da4ad24c0..2c9521c78e3 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c @@ -36,9 +36,9 @@ static bNodeSocketTemplate inputs[] = { { SOCK_FLOAT, 1, N_("Hue"), 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE }, - { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, - { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, - { SOCK_FLOAT, 1, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, + { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE }, + { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE }, + { SOCK_FLOAT, 1, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f }, { -1, 0, "" } }; diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c index 12ac27f26b7..b482a76ae8e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c @@ -35,7 +35,7 @@ /* **************** MIX RGB ******************** */ static bNodeSocketTemplate inputs[] = { - { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, + { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE }, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f }, { -1, 0, "" } diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c index 871cdab384e..4977b443de5 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c @@ -35,7 +35,7 @@ /* **************** VALTORGB ******************** */ static bNodeSocketTemplate valtorgb_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate valtorgb_out[] = { diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index cc87d34d769..234dd1e5fec 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -33,6 +33,7 @@ #include <Python.h> #include "BLI_utildefines.h" +#include "BLI_dynstr.h" #include "MEM_guardedalloc.h" @@ -68,6 +69,76 @@ static PyObject *bpy_bmesh_op_repr(BPy_BMeshOpFunc *self) } +/* methods + * ======= */ + + +/* __doc__ + * ------- */ + +static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], const bool is_out) +{ + DynStr *dyn_str = BLI_dynstr_new(); + char *ret; + + int i = 0; + + while (*slot_types[i].name) { + /* cut off '.out' by using a string size arg */ + const int name_len = is_out ? + (strchr(slot_types[i].name, '.') - slot_types[i].name) : + sizeof(slot_types[i].name); + const char *value = "<Unknown>"; + switch (slot_types[i].type) { + case BMO_OP_SLOT_BOOL: value = "False"; break; + case BMO_OP_SLOT_INT: value = "0"; break; + case BMO_OP_SLOT_FLT: value = "0.0"; break; + case BMO_OP_SLOT_PTR: value = "None"; break; + case BMO_OP_SLOT_MAT: value = "Matrix()"; break; + case BMO_OP_SLOT_VEC: value = "Vector()"; break; + case BMO_OP_SLOT_ELEMENT_BUF: value = + (slot_types[i].subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) ? "None" : "[]"; break; + case BMO_OP_SLOT_MAPPING: value = "{}"; break; + } + BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value); + i++; + }; + + ret = BLI_dynstr_get_cstring(dyn_str); + BLI_dynstr_free(dyn_str); + return ret; +} + +static PyObject *bpy_bmesh_op_doc_get(BPy_BMeshOpFunc *self, void *UNUSED(closure)) +{ + PyObject *ret; + char *slot_in; + char *slot_out; + int i; + + i = BMO_opcode_from_opname(self->opname); + + slot_in = bmp_slots_as_args(bmo_opdefines[i]->slot_types_in, false); + slot_out = bmp_slots_as_args(bmo_opdefines[i]->slot_types_out, true); + + ret = PyUnicode_FromFormat("%.200s bmesh.ops.%.200s(bmesh, %s)\n -> dict(%s)", + Py_TYPE(self)->tp_name, + self->opname, slot_in, slot_out); + + MEM_freeN(slot_in); + MEM_freeN(slot_out); + + return ret; +} + +static PyGetSetDef bpy_bmesh_op_getseters[] = { + {(char *)"__doc__", (getter)bpy_bmesh_op_doc_get, (setter)NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; + + +/* Types + * ===== */ PyTypeObject bmesh_op_Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -126,7 +197,7 @@ PyTypeObject bmesh_op_Type = { /*** Attribute descriptor and subclassing stuff ***/ NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + bpy_bmesh_op_getseters, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ @@ -154,20 +225,17 @@ PyTypeObject bmesh_op_Type = { static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject *pyname) { - const unsigned int tot = bmo_opdefines_total; - unsigned int i; const char *opname = _PyUnicode_AsString(pyname); - for (i = 0; i < tot; i++) { - if (STREQ(bmo_opdefines[i]->opname, opname)) { - return bpy_bmesh_op_CreatePyObject(opname); - } + if (BMO_opcode_from_opname(opname) != -1) { + return bpy_bmesh_op_CreatePyObject(opname); + } + else { + PyErr_Format(PyExc_AttributeError, + "BMeshOpsModule: operator \"%.200s\" doesn't exist", + opname); + return NULL; } - - PyErr_Format(PyExc_AttributeError, - "BMeshOpsModule: operator \"%.200s\" doesn't exist", - opname); - return NULL; } static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self)) diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 6aaa58f0ed4..f49018d6e18 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1718,6 +1718,22 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self) return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); } +PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc, +".. method:: calc_center_median_weighted()\n" +"\n" +" Return median center of the face weighted by edge lengths.\n" +"\n" +" :return: a 3D vector.\n" +" :rtype: :class:`mathutils.Vector`\n" +); +static PyObject *bpy_bmface_calc_center_mean_weighted(BPy_BMFace *self) +{ + float cent[3]; + + BPY_BM_CHECK_OBJ(self); + BM_face_calc_center_mean_weighted(self->f, cent); + return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); +} PyDoc_STRVAR(bpy_bmface_calc_center_bounds_doc, ".. method:: calc_center_bounds()\n" @@ -2573,6 +2589,7 @@ static struct PyMethodDef bpy_bmface_methods[] = { {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc}, {"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc}, {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc}, + {"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc}, {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc}, {"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc}, diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 623d45dfd90..0ab8543c4ac 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -31,20 +31,17 @@ * a context manager. */ -/* nifty feature. swap out strings for RNA data */ -#define USE_RNA_DATABLOCKS - #include <Python.h> #include <stddef.h> -#include "BLO_readfile.h" - #include "BLI_utildefines.h" #include "BLI_string.h" #include "BLI_linklist.h" #include "BLI_path_util.h" #include "BLI_listbase.h" +#include "BLO_readfile.h" + #include "BKE_global.h" #include "BKE_main.h" #include "BKE_library.h" @@ -57,6 +54,9 @@ #include "bpy_util.h" #include "bpy_library.h" +/* nifty feature. swap out strings for RNA data */ +#define USE_RNA_DATABLOCKS + #ifdef USE_RNA_DATABLOCKS # include "bpy_rna.h" # include "RNA_access.h" diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 1e3c2479e66..444f8cc57c8 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -628,6 +628,26 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) wm_triple_copy_textures(win, triple); } + if (paintcursor && wm->paintcursors.first) { + for (sa = screen->areabase.first; sa; sa = sa->next) { + for (ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->swinid && ar->swinid == screen->subwinactive) { + CTX_wm_area_set(C, sa); + CTX_wm_region_set(C, ar); + + /* make region ready for draw, scissor, pixelspace */ + ED_region_set(C, ar); + wm_paintcursor_draw(C, ar); + + CTX_wm_region_set(C, NULL); + CTX_wm_area_set(C, NULL); + } + } + } + + wmSubWindowSet(win, screen->mainwin); + } + /* draw overlapping area regions (always like popups) */ for (sa = screen->areabase.first; sa; sa = sa->next) { CTX_wm_area_set(C, sa); @@ -662,26 +682,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) /* always draw, not only when screen tagged */ if (win->gesture.first) wm_gesture_draw(win); - - if (paintcursor && wm->paintcursors.first) { - for (sa = screen->areabase.first; sa; sa = sa->next) { - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->swinid && ar->swinid == screen->subwinactive) { - CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); - - /* make region ready for draw, scissor, pixelspace */ - ED_region_set(C, ar); - wm_paintcursor_draw(C, ar); - - CTX_wm_region_set(C, NULL); - CTX_wm_area_set(C, NULL); - } - } - } - - wmSubWindowSet(win, screen->mainwin); - } /* needs pixel coords in screen */ if (wm->drags.first) { |