From 76015f98aec0c186240ed9cf515a2e89d2c1894c Mon Sep 17 00:00:00 2001 From: raa Date: Sat, 11 Mar 2017 22:34:09 +0300 Subject: [PATCH 01/10] Fix icon alignment for pie buttons --- source/blender/editors/interface/interface_widgets.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 76c4eeef0c2..4a2c13e395f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1558,7 +1558,11 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB /* menu item - add some more padding so menus don't feel cramped. it must * be part of the button so that this area is still clickable */ - if (ui_block_is_menu(but->block) && !ui_block_is_pie_menu(but->block)) + if (ui_block_is_pie_menu(but->block)) { + if (but->dt == UI_EMBOSS_RADIAL) + rect->xmin += 0.3f * U.widget_unit; + } + else if (ui_block_is_menu(but->block)) rect->xmin += 0.3f * U.widget_unit; widget_draw_icon(but, icon, alpha, rect, show_menu_icon); From 68ca973f7f81e551889532d0c1b76485d9f40245 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 12 Mar 2017 06:45:29 +0100 Subject: [PATCH 02/10] Fix T50628: gray out cycles device menu when no device configured only for GPU Compute. --- intern/cycles/blender/addon/ui.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 3a689913230..c9b98956c93 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -86,12 +86,10 @@ def use_sample_all_lights(context): return cscene.sample_all_lights_direct or cscene.sample_all_lights_indirect -def show_device_selection(context): - type = get_device_type(context) - if type == 'NETWORK': +def show_device_active(context): + cscene = context.scene.cycles + if cscene.device != 'GPU': return True - if not type in {'CUDA', 'OPENCL'}: - return False return context.user_preferences.addons[__package__].preferences.has_active_device() @@ -1636,7 +1634,7 @@ def draw_device(self, context): split = layout.split(percentage=1/3) split.label("Device:") row = split.row() - row.active = show_device_selection(context) + row.active = show_device_active(context) row.prop(cscene, "device", text="") if engine.with_osl() and use_cpu(context): From 3f948369223e30f86d3abacf8f89f2c5aeb61214 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 12 Mar 2017 15:48:44 +0100 Subject: [PATCH 03/10] Fix T50788: blender startup crash on macOS with some types of volumes available. --- source/blender/editors/space_file/fsmenu.c | 30 +++++++++------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 631ff06a77a..d7aa1040e0f 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -537,28 +537,22 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) /* Finally get user favorite places */ if (read_bookmarks) { UInt32 seed; - OSErr err = noErr; - CFArrayRef pathesArray; - LSSharedFileListRef list; - LSSharedFileListItemRef itemRef; - CFIndex i, pathesCount; - CFURLRef cfURL = NULL; - CFStringRef pathString = NULL; - list = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL); - pathesArray = LSSharedFileListCopySnapshot(list, &seed); - pathesCount = CFArrayGetCount(pathesArray); + LSSharedFileListRef list = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL); + CFArrayRef pathesArray = LSSharedFileListCopySnapshot(list, &seed); + CFIndex pathesCount = CFArrayGetCount(pathesArray); - for (i = 0; i < pathesCount; i++) { - itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i); + for (CFIndex i = 0; i < pathesCount; i++) { + LSSharedFileListItemRef itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i); - err = LSSharedFileListItemResolve(itemRef, - kLSSharedFileListNoUserInteraction | - kLSSharedFileListDoNotMountVolumes, - &cfURL, NULL); - if (err != noErr) + CFURLRef cfURL = NULL; + OSErr err = LSSharedFileListItemResolve(itemRef, + kLSSharedFileListNoUserInteraction | + kLSSharedFileListDoNotMountVolumes, + &cfURL, NULL); + if (err != noErr || !cfURL) continue; - pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle); + CFStringRef pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle); if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8)) continue; From 8ca11f5b72832ed64282c0b2186fe950bd753a5e Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 12 Mar 2017 18:14:43 +0100 Subject: [PATCH 04/10] UI: Always open enum-search popups with empty search string It might be useful to keep the search string stored in some cases, but in most it's not useful but confusing. Especially if the string is taken from a menu showing a different enum. --- source/blender/windowmanager/intern/wm_operators.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index cef5e7e4a8e..9d4c3986678 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1118,6 +1118,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); + search[0] = '\0'; #if 0 /* ok, this isn't so easy... */ uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_struct_ui_name(op->type->srna), 10, 10, UI_searchbox_size_x(), UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); #endif From f28376d8d938fed33ea6c53d745ec343ac3c2b5d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Mar 2017 04:25:21 +1100 Subject: [PATCH 05/10] Cleanup: style --- source/blender/alembic/intern/abc_exporter.cc | 4 ++-- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenkernel/intern/tracking_stabilize.c | 6 ++++-- source/blender/blenkernel/intern/writeffmpeg.c | 7 ++++--- source/blender/bmesh/intern/bmesh_core.c | 3 ++- source/blender/render/intern/source/shadeoutput.c | 4 ++-- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 90a99469389..61e7712150f 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -347,7 +347,7 @@ void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx) Object *ob = base->object; if (export_object(&m_settings, ob)) { - switch(ob->type) { + switch (ob->type) { case OB_LAMP: case OB_LATTICE: case OB_MBALL: @@ -533,7 +533,7 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent) } } - switch(ob->type) { + switch (ob->type) { case OB_MESH: { Mesh *me = static_cast(ob->data); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index b0671f33094..54cfae620a1 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -67,7 +67,7 @@ #include "BKE_deform.h" -/* Workaround for cyclic depenndnecy with curves. +/* Workaround for cyclic dependency with curves. * In such case curve_cache might not be ready yet, */ #define CYCLIC_DEPENDENCY_WORKAROUND diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index 722fc89a75f..3dfaa1ed77d 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -755,7 +755,8 @@ static void average_marker_positions(StabContext *ctx, int framenr, float r_ref_ if (ok) { r_ref_pos[0] /= weight_sum; r_ref_pos[1] /= weight_sum; - } else { + } + else { /* No usable tracking data on any track on this frame. * Use data from neighbouring frames to extrapolate... */ @@ -784,7 +785,8 @@ static void average_marker_positions(StabContext *ctx, int framenr, float r_ref_ * Also default to this frame when we're in a gap */ average_marker_positions(ctx, next_lower, r_ref_pos); - } else if (next_higher < MAXFRAME) { + } + else if (next_higher < MAXFRAME) { average_marker_positions(ctx, next_higher, r_ref_pos); } use_values_from_fcurves(ctx, false); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 9994d479ce7..156b74f5c3d 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -568,7 +568,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int if (context->ffmpeg_crf >= 0) { ffmpeg_dict_set_int(&opts, "crf", context->ffmpeg_crf); - } else { + } + else { c->bit_rate = context->ffmpeg_video_bitrate * 1000; c->rc_max_rate = rd->ffcodecdata.rc_max_rate * 1000; c->rc_min_rate = rd->ffcodecdata.rc_min_rate * 1000; @@ -576,8 +577,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int } if (context->ffmpeg_preset) { - char const * preset_name; - switch(context->ffmpeg_preset) { + char const *preset_name; + switch (context->ffmpeg_preset) { case FFM_PRESET_ULTRAFAST: preset_name = "ultrafast"; break; case FFM_PRESET_SUPERFAST: preset_name = "superfast"; break; case FFM_PRESET_VERYFAST: preset_name = "veryfast"; break; diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 68cacf55efe..b075d508295 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -2756,7 +2756,8 @@ BMVert *bmesh_urmv_loop_multi( } STACK_PUSH(edges, e_iter); - } else { + } + else { /* at least one edge attached isn't connected to our loops */ is_mixed_edge_any = true; } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index c4de95e863e..a8fb72fb7f8 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -2143,7 +2143,7 @@ const float (*RE_object_instance_get_matrix(struct ObjectInstanceRen *obi, int m const float (*RE_render_current_get_matrix(int matrix_id))[4] { - switch(matrix_id) { + switch (matrix_id) { case RE_VIEW_MATRIX: return (const float(*)[4])R.viewmat; case RE_VIEWINV_MATRIX: @@ -2171,4 +2171,4 @@ float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) } return result; -} \ No newline at end of file +} From 6521307dcd5b68137db5fbfed11f2d188d100869 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Mar 2017 03:45:15 +1100 Subject: [PATCH 06/10] BMesh: rename cryptic functions Use expanded names for bmesh primitive operations (urmv jvke semv jfke). Use 'bmesh_kernel_' prefix, these functions aren't intended for wide use so favor readability. Remove BM_face_vert_separate, it wasn't used and only skipped step of finding correct loop of face. --- source/blender/bmesh/bmesh.h | 5 +- source/blender/bmesh/intern/bmesh_core.c | 74 ++++++++----------- source/blender/bmesh/intern/bmesh_core.h | 52 +++++++------ source/blender/bmesh/intern/bmesh_mods.c | 43 +++++------ source/blender/bmesh/intern/bmesh_mods.h | 7 +- source/blender/bmesh/intern/bmesh_polygon.c | 2 +- source/blender/bmesh/operators/bmo_inset.c | 4 +- .../bmesh/operators/bmo_offset_edgeloops.c | 4 +- source/blender/bmesh/tools/bmesh_separate.c | 2 +- source/blender/editors/mesh/editmesh_rip.c | 4 +- 10 files changed, 92 insertions(+), 105 deletions(-) diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index f29d280d071..b84a3d5e559 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -192,9 +192,10 @@ * * These conventions should be used throughout the bmesh module. * - * - ``BM_***()`` - High level BMesh API function for use anywhere. - * - ``bmesh_***()`` - Low level API function. + * - ``bmesh_kernel_*()`` - Low level API, for primitive functions that others are built ontop of. + * - ``bmesh_***()`` - Low level API function. * - ``bm_***()`` - 'static' functions, not apart of the API at all, but use prefix since they operate on BMesh data. + * - ``BM_***()`` - High level BMesh API function for use anywhere. * - ``BMO_***()`` - High level operator API function for use anywhere. * - ``bmo_***()`` - Low level / internal operator API functions. * - ``_bm_***()`` - Functions which are called via macros only. diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index b075d508295..cee5450a37d 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1021,7 +1021,7 @@ static int UNUSED_FUNCTION(bm_loop_length)(BMLoop *l) * \param use_loop_mdisp_flip: When set, flip the Z-depth of the mdisp, * (use when flipping normals, disable when mirroring, eg: symmetrize). */ -void bmesh_loop_reverse( +void bmesh_kernel_loop_reverse( BMesh *bm, BMFace *f, const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip) { @@ -1438,7 +1438,7 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *f_example) * * \return A BMFace pointer */ -BMFace *bmesh_sfme( +BMFace *bmesh_kernel_split_face_make_edge( BMesh *bm, BMFace *f, BMLoop *l_v1, BMLoop *l_v2, BMLoop **r_l, #ifdef USE_BMESH_HOLES @@ -1584,7 +1584,7 @@ BMFace *bmesh_sfme( * * \return The newly created BMVert pointer. */ -BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) +BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) { BMLoop *l_next; BMEdge *e_new; @@ -1766,7 +1766,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) * faces with just 2 edges. It is up to the caller to decide what to do with * these faces. */ -BMEdge *bmesh_jekv( +BMEdge *bmesh_kernel_join_edge_kill_vert( BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool check_edge_double, const bool kill_degenerate_faces) @@ -1920,7 +1920,7 @@ BMEdge *bmesh_jekv( * * Collapse an edge, merging surrounding data. * - * Unlike #BM_vert_collapse_edge & #bmesh_jekv which only handle 2 valence verts, + * Unlike #BM_vert_collapse_edge & #bmesh_kernel_join_edge_kill_vert which only handle 2 valence verts, * this can handle any number of connected edges/faces. * *
@@ -1932,7 +1932,7 @@ BMEdge *bmesh_jekv(
  * +-+-+-+    +-+-+-+
  * 
*/ -BMVert *bmesh_jvke( +BMVert *bmesh_kernel_join_vert_kill_edge( BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool check_edge_double, const bool kill_degenerate_faces) @@ -2035,7 +2035,7 @@ BMVert *bmesh_jvke( * In the example A, faces \a f1 and \a f2 are joined by a single edge, * and the euler can safely be used. * In example B however, \a f1 and \a f2 are joined by multiple edges and will produce an error. - * The caller in this case should call #bmesh_jekv on the extra edges + * The caller in this case should call #bmesh_kernel_join_edge_kill_vert on the extra edges * before attempting to fuse \a f1 and \a f2. * * \note The order of arguments decides whether or not certain per-face attributes are present @@ -2044,7 +2044,7 @@ BMVert *bmesh_jvke( * * \return A BMFace pointer */ -BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e) +BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e) { BMLoop *l_iter, *l_f1 = NULL, *l_f2 = NULL; int newlen = 0, i, f1len = 0, f2len = 0; @@ -2249,7 +2249,7 @@ bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src) } -/** \name BM_vert_separate, bmesh_vert_separate and friends +/** \name BM_vert_separate, bmesh_kernel_vert_separate and friends * \{ */ /* BM_edge_face_count(e) >= 1 */ @@ -2269,7 +2269,7 @@ BLI_INLINE bool bm_edge_supports_separate(const BMEdge *e) * * \return Success */ -void bmesh_vert_separate( +void bmesh_kernel_vert_separate( BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select) { @@ -2385,7 +2385,7 @@ void bmesh_vert_separate( * * Takes a list of edges, which have been split from their original. * - * Any edges which failed to split off in #bmesh_vert_separate will be merged back into the original edge. + * Any edges which failed to split off in #bmesh_kernel_vert_separate will be merged back into the original edge. * * \param edges_separate * A list-of-lists, each list is from a single original edge (the first edge is the original), @@ -2398,7 +2398,7 @@ void bmesh_vert_separate( * \note this function looks like it could become slow, * but in common cases its only going to iterate a few times. */ -static void bmesh_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separate) +static void bmesh_kernel_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separate) { do { LinkNode *n_orig = edges_separate->link; @@ -2418,7 +2418,7 @@ static void bmesh_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separate) } /** - * High level function which wraps both #bmesh_vert_separate and #bmesh_edge_separate + * High level function which wraps both #bmesh_kernel_vert_separate and #bmesh_kernel_edge_separate */ void BM_vert_separate( BMesh *bm, BMVert *v, @@ -2435,7 +2435,7 @@ void BM_vert_separate( LinkNode *edges_orig = NULL; do { BMLoop *l_sep = e->l; - bmesh_edge_separate(bm, e, l_sep, copy_select); + bmesh_kernel_edge_separate(bm, e, l_sep, copy_select); BLI_linklist_prepend_alloca(&edges_orig, l_sep->e); BLI_assert(e != l_sep->e); } while (bm_edge_supports_separate(e)); @@ -2444,10 +2444,10 @@ void BM_vert_separate( } } - bmesh_vert_separate(bm, v, r_vout, r_vout_len, copy_select); + bmesh_kernel_vert_separate(bm, v, r_vout, r_vout_len, copy_select); if (edges_separate) { - bmesh_vert_separate__cleanup(bm, edges_separate); + bmesh_kernel_vert_separate__cleanup(bm, edges_separate); } } @@ -2472,7 +2472,7 @@ void BM_vert_separate_hflag( LinkNode *edges_orig = NULL; do { BMLoop *l_sep = e->l; - bmesh_edge_separate(bm, e, l_sep, copy_select); + bmesh_kernel_edge_separate(bm, e, l_sep, copy_select); /* trick to avoid looping over separated edges */ if (edges_separate == NULL && edges_orig == NULL) { e_first = l_sep->e; @@ -2486,10 +2486,10 @@ void BM_vert_separate_hflag( } } while ((e_iter = BM_DISK_EDGE_NEXT(e_iter, v)) != e_first); - bmesh_vert_separate(bm, v, r_vout, r_vout_len, copy_select); + bmesh_kernel_vert_separate(bm, v, r_vout, r_vout_len, copy_select); if (edges_separate) { - bmesh_vert_separate__cleanup(bm, edges_separate); + bmesh_kernel_vert_separate__cleanup(bm, edges_separate); } } @@ -2574,7 +2574,7 @@ bool BM_edge_splice(BMesh *bm, BMEdge *e_dst, BMEdge *e_src) * \note Does nothing if \a l_sep is already the only loop in the * edge radial. */ -void bmesh_edge_separate( +void bmesh_kernel_edge_separate( BMesh *bm, BMEdge *e, BMLoop *l_sep, const bool copy_select) { @@ -2620,7 +2620,7 @@ void bmesh_edge_separate( * * \note Will be a no-op and return original vertex if only two edges at that vertex. */ -BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep) +BMVert *bmesh_kernel_unglue_region_make_vert(BMesh *bm, BMLoop *l_sep) { BMVert *v_new = NULL; BMVert *v_sep = l_sep->v; @@ -2630,10 +2630,12 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep) /* peel the face from the edge radials on both sides of the * loop vert, disconnecting the face from its fan */ - if (!BM_edge_is_boundary(l_sep->e)) - bmesh_edge_separate(bm, l_sep->e, l_sep, false); - if (!BM_edge_is_boundary(l_sep->prev->e)) - bmesh_edge_separate(bm, l_sep->prev->e, l_sep->prev, false); + if (!BM_edge_is_boundary(l_sep->e)) { + bmesh_kernel_edge_separate(bm, l_sep->e, l_sep, false); + } + if (!BM_edge_is_boundary(l_sep->prev->e)) { + bmesh_kernel_edge_separate(bm, l_sep->prev->e, l_sep->prev, false); + } /* do inline, below */ #if 0 @@ -2681,13 +2683,13 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep) } /** - * A version of #bmesh_urmv_loop that disconnects multiple loops at once. + * A version of #bmesh_kernel_unglue_region_make_vert that disconnects multiple loops at once. * The loops must all share the same vertex, can be in any order * and are all moved to use a single new vertex - which is returned. * * This function handles the details of finding fans boundaries. */ -BMVert *bmesh_urmv_loop_multi( +BMVert *bmesh_kernel_unglue_region_make_vert_multi( BMesh *bm, BMLoop **larr, int larr_len) { BMVert *v_sep = larr[0]->v; @@ -2871,9 +2873,9 @@ static void bmesh_edge_vert_swap__recursive(BMEdge *e, BMVert *v_dst, BMVert *v_ /** * This function assumes l_sep is apart of a larger fan which has already been - * isolated by calling bmesh_edge_separate to segregate it radially. + * isolated by calling #bmesh_kernel_edge_separate to segregate it radially. */ -BMVert *bmesh_urmv_loop_region(BMesh *bm, BMLoop *l_sep) +BMVert *bmesh_kernel_unglue_region_make_vert_multi_isolated(BMesh *bm, BMLoop *l_sep) { BMVert *v_new = BM_vert_create(bm, l_sep->v->co, l_sep->v, BM_CREATE_NOP); /* passing either 'l_sep->e', 'l_sep->prev->e' will work */ @@ -2882,20 +2884,6 @@ BMVert *bmesh_urmv_loop_region(BMesh *bm, BMLoop *l_sep) return v_new; } - -/** - * \brief Unglue Region Make Vert (URMV) - * - * Disconnects f_sep from the vertex fan at \a v_sep - * - * \return The newly created BMVert - */ -BMVert *bmesh_urmv(BMesh *bm, BMFace *f_sep, BMVert *v_sep) -{ - BMLoop *l = BM_face_vert_share_loop(f_sep, v_sep); - return bmesh_urmv_loop(bm, l); -} - /** * Avoid calling this where possible, * low level function so both face pointers remain intact but point to swapped data. diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h index f72e9d7b198..fb6b66809f3 100644 --- a/source/blender/bmesh/intern/bmesh_core.h +++ b/source/blender/bmesh/intern/bmesh_core.h @@ -64,21 +64,16 @@ void BM_face_kill(BMesh *bm, BMFace *f); void BM_edge_kill(BMesh *bm, BMEdge *e); void BM_vert_kill(BMesh *bm, BMVert *v); -void bmesh_edge_separate( - BMesh *bm, BMEdge *e, BMLoop *l_sep, - const bool copy_select); bool BM_edge_splice(BMesh *bm, BMEdge *e_dst, BMEdge *e_src); bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src); bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b); -void bmesh_vert_separate( - BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, - const bool copy_select); - -void bmesh_loop_reverse( +void bmesh_kernel_loop_reverse( BMesh *bm, BMFace *f, const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip); +void bmesh_face_swap_data(BMFace *f_a, BMFace *f_b); + BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del); void BM_vert_separate( BMesh *bm, BMVert *v, BMEdge **e_in, int e_in_len, const bool copy_select, @@ -90,34 +85,43 @@ void BM_vert_separate_wire_hflag( BMesh *bm, BMVert *v_dst, BMVert *v_src, const char hflag); -/* EULER API - For modifying structure */ -BMFace *bmesh_sfme( +/** + * BMesh Kernel: For modifying structure. + * + * Names are on the verbose side but these are only for low-level access. + */ +void bmesh_kernel_vert_separate( + BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, + const bool copy_select); +void bmesh_kernel_edge_separate( + BMesh *bm, BMEdge *e, BMLoop *l_sep, + const bool copy_select); + +BMFace *bmesh_kernel_split_face_make_edge( BMesh *bm, BMFace *f, BMLoop *l1, BMLoop *l2, BMLoop **r_l, #ifdef USE_BMESH_HOLES - ListBase *holes, + ListBase *holes, #endif - BMEdge *example, - const bool no_double - ); + BMEdge *example, + const bool no_double + ); -BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e); -BMEdge *bmesh_jekv( +BMVert *bmesh_kernel_split_edge_make_vert( + BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e); +BMEdge *bmesh_kernel_join_edge_kill_vert( BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool check_edge_splice, const bool kill_degenerate_faces); -BMVert *bmesh_jvke( +BMVert *bmesh_kernel_join_vert_kill_edge( BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool check_edge_double, const bool kill_degenerate_faces); -BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e); -BMVert *bmesh_urmv(BMesh *bm, BMFace *f_sep, BMVert *v_sep); -BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep); -BMVert *bmesh_urmv_loop_multi( - BMesh *bm, BMLoop **larr, int larr_len); -BMVert *bmesh_urmv_loop_region(BMesh *bm, BMLoop *l_sep); +BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e); -void bmesh_face_swap_data(BMFace *f_a, BMFace *f_b); +BMVert *bmesh_kernel_unglue_region_make_vert(BMesh *bm, BMLoop *l_sep); +BMVert *bmesh_kernel_unglue_region_make_vert_multi(BMesh *bm, BMLoop **larr, int larr_len); +BMVert *bmesh_kernel_unglue_region_make_vert_multi_isolated(BMesh *bm, BMLoop *l_sep); #endif /* __BMESH_CORE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 500da6b8788..1cd51528e06 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -234,7 +234,7 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMLoop *l_a, BMLoop *l_b, const bool do_de if (l_a->v == l_b->v) { const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); - bmesh_loop_reverse(bm, l_b->f, cd_loop_mdisp_offset, true); + bmesh_kernel_loop_reverse(bm, l_b->f, cd_loop_mdisp_offset, true); } BMFace *faces[2] = {l_a->f, l_b->f}; @@ -288,9 +288,9 @@ BMFace *BM_face_split( } #ifdef USE_BMESH_HOLES - f_new = bmesh_sfme(bm, f, l_a, l_b, r_l, NULL, example, no_double); + f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, NULL, example, no_double); #else - f_new = bmesh_sfme(bm, f, l_a, l_b, r_l, example, no_double); + f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, r_l, example, no_double); #endif if (f_new) { @@ -370,19 +370,19 @@ BMFace *BM_face_split_n( f_tmp = BM_face_copy(bm, bm, f, true, true); #ifdef USE_BMESH_HOLES - f_new = bmesh_sfme(bm, f, l_a, l_b, &l_new, NULL, example, false); + f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, NULL, example, false); #else - f_new = bmesh_sfme(bm, f, l_a, l_b, &l_new, example, false); + f_new = bmesh_kernel_split_face_make_edge(bm, f, l_a, l_b, &l_new, example, false); #endif - /* bmesh_sfme returns in 'l_new' a Loop for f_new going from 'v_a' to 'v_b'. + /* bmesh_kernel_split_face_make_edge returns in 'l_new' a Loop for f_new going from 'v_a' to 'v_b'. * The radial_next is for 'f' and goes from 'v_b' to 'v_a' */ if (f_new) { e = l_new->e; for (i = 0; i < n; i++) { - v_new = bmesh_semv(bm, v_b, e, &e_new); + v_new = bmesh_kernel_split_edge_make_vert(bm, v_b, e, &e_new); BLI_assert(v_new != NULL); - /* bmesh_semv returns in 'e_new' the edge going from 'v_new' to 'v_b' */ + /* bmesh_kernel_split_edge_make_vert returns in 'e_new' the edge going from 'v_new' to 'v_b' */ copy_v3_v3(v_new->co, cos[i]); /* interpolate the loop data for the loops with (v == v_new), using orig face */ @@ -507,7 +507,7 @@ BMEdge *BM_vert_collapse_faces( /* single face or no faces */ /* same as BM_vert_collapse_edge() however we already * have vars to perform this operation so don't call. */ - e_new = bmesh_jekv(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); + e_new = bmesh_kernel_join_edge_kill_vert(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); /* e_new = BM_edge_exists(tv, tv2); */ /* same as return above */ } @@ -542,7 +542,7 @@ BMEdge *BM_vert_collapse_edge( BMVert *tv2 = BM_edge_other_vert(e2, v_kill); if (tv2) { /* only action, other calls here only get the edge to return */ - e_new = bmesh_jekv(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); + e_new = bmesh_kernel_join_edge_kill_vert(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); } } } @@ -564,7 +564,7 @@ BMVert *BM_edge_collapse( BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool kill_degenerate_faces) { - return bmesh_jvke(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); + return bmesh_kernel_join_vert_kill_edge(bm, e_kill, v_kill, do_del, true, kill_degenerate_faces); } /** @@ -616,7 +616,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac) } v_other = BM_edge_other_vert(e, v); - v_new = bmesh_semv(bm, v, e, &e_new); + v_new = bmesh_kernel_split_edge_make_vert(bm, v, e, &e_new); if (r_e != NULL) { *r_e = e_new; } @@ -1090,23 +1090,18 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_f /** * \brief Rip a single face from a vertex fan */ -BMVert *BM_face_vert_separate(BMesh *bm, BMFace *sf, BMVert *sv) +BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *l_sep) { - return bmesh_urmv(bm, sf, sv); + return bmesh_kernel_unglue_region_make_vert(bm, l_sep); } -/** - * \brief Rip a single face from a vertex fan - * - * \note same as #BM_face_vert_separate but faster (avoids a loop lookup) - */ -BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *sl) +BMVert *BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep) { - return bmesh_urmv_loop(bm, sl); + return bmesh_kernel_unglue_region_make_vert_multi_isolated(bm, l_sep); } -BMVert *BM_face_loop_separate_multi( - BMesh *bm, BMLoop **larr, int larr_len) +BMVert *BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len) { - return bmesh_urmv_loop_multi(bm, larr, larr_len); + return bmesh_kernel_unglue_region_make_vert_multi(bm, larr, larr_len); } + diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index 5e95e9a2cc7..330a714418d 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -86,9 +86,8 @@ enum { }; -BMVert *BM_face_vert_separate(BMesh *bm, BMFace *sf, BMVert *sv); -BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *sl); -BMVert *BM_face_loop_separate_multi( - BMesh *bm, BMLoop **larr, int larr_len); +BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *l_sep); +BMVert *BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep); +BMVert *BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len); #endif /* __BMESH_MODS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 6acd790fc0c..78ee7589d23 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -844,7 +844,7 @@ void BM_face_normal_flip_ex( BMesh *bm, BMFace *f, const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip) { - bmesh_loop_reverse(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip); + bmesh_kernel_loop_reverse(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip); negate_v3(f->no); } diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index e2ff09669d7..f0796e425fa 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -663,7 +663,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op) /* run the separate arg */ if (!BM_edge_is_boundary(es->e_old)) { - bmesh_edge_separate(bm, es->e_old, es->l, false); + bmesh_kernel_edge_separate(bm, es->e_old, es->l, false); } /* calc edge-split info */ @@ -742,7 +742,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op) /* disable touching twice, this _will_ happen if the flags not disabled */ BM_elem_flag_disable(v, BM_ELEM_TAG); - bmesh_vert_separate(bm, v, &vout, &r_vout_len, false); + bmesh_kernel_vert_separate(bm, v, &vout, &r_vout_len, false); v = NULL; /* don't use again */ /* in some cases the edge doesn't split off */ diff --git a/source/blender/bmesh/operators/bmo_offset_edgeloops.c b/source/blender/bmesh/operators/bmo_offset_edgeloops.c index 7a6f779b34f..a9840a72fc9 100644 --- a/source/blender/bmesh/operators/bmo_offset_edgeloops.c +++ b/source/blender/bmesh/operators/bmo_offset_edgeloops.c @@ -270,7 +270,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op) v_other = BM_edge_other_vert(e, v); if (BM_elem_index_get(v_other) == -1) { if (BM_vert_is_edge_pair(v_other)) { - /* defer bmesh_jekv to avoid looping over data we're removing */ + /* defer bmesh_kernel_join_edge_kill_vert to avoid looping over data we're removing */ v_other->e = e; STACK_PUSH(varr, v_other); } @@ -278,7 +278,7 @@ void bmo_offset_edgeloops_exec(BMesh *bm, BMOperator *op) } while ((v = STACK_POP(varr))) { - bmesh_jekv(bm, v->e, v, true, false, false); + bmesh_kernel_join_edge_kill_vert(bm, v->e, v, true, false, false); } } } diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c index 04e03664956..ff28ed4c156 100644 --- a/source/blender/bmesh/tools/bmesh_separate.c +++ b/source/blender/bmesh/tools/bmesh_separate.c @@ -120,7 +120,7 @@ void BM_mesh_separate_faces( } /* Perform the split */ - bmesh_urmv_loop_multi(bm, loop_split.data, loop_split.count); + BM_face_loop_separate_multi(bm, loop_split.data, loop_split.count); BLI_buffer_empty(&loop_split); } diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e05ce727e22..1a2f9fdb62b 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -596,7 +596,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve BMVert *v_new; BLI_assert(l_sep->v == v); - v_new = bmesh_urmv_loop_region(bm, l_sep); + v_new = BM_face_loop_separate_multi_isolated(bm, l_sep); BLI_assert(BM_vert_find_first_loop(v)); BM_vert_select_set(bm, v, false); @@ -665,7 +665,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve BM_vert_select_set(bm, v, false); - bmesh_vert_separate(bm, v, &vout, &vout_len, true); + bmesh_kernel_vert_separate(bm, v, &vout, &vout_len, true); if (vout_len < 2) { MEM_freeN(vout); From 18ed060bc335a09885be4d22c5b021462afb4961 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Sun, 12 Mar 2017 13:55:43 -0400 Subject: [PATCH 07/10] Fix T50930 Typo in 'jpeg2k_codec' description --- source/blender/makesrna/intern/rna_scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 121e4f56a6e..899466f05df 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -5390,7 +5390,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "jp2_codec"); RNA_def_property_enum_items(prop, jp2_codec_items); - RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpek2000"); + RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpeg2000"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); #endif From b759d3c9c57683114ae8ff91acea4c29b6afb47e Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Sun, 12 Mar 2017 20:31:34 +0100 Subject: [PATCH 08/10] fix T50923: Inconsistent default values and wrong order of parameters in api call --- source/blender/editors/io/io_collada.c | 46 ++++---- .../blender/makesrna/intern/rna_scene_api.c | 107 +++++++++++++----- 2 files changed, 102 insertions(+), 51 deletions(-) diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index baae92f962e..0e185cd93a7 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -256,11 +256,11 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "triangulate", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "triangulate", 1, NULL, ICON_NONE); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "use_object_instantiation", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "use_object_instantiation", 1, NULL, ICON_NONE); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "use_blender_profile", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "use_blender_profile", 1, NULL, ICON_NONE); row = uiLayoutRow(box, false); split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT); @@ -296,6 +296,8 @@ static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op) void WM_OT_collada_export(wmOperatorType *ot) { + struct StructRNA *func = ot->srna; + static EnumPropertyItem prop_bc_export_mesh_type[] = { {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"}, {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"}, @@ -325,64 +327,64 @@ void WM_OT_collada_export(wmOperatorType *ot) ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); - RNA_def_boolean(ot->srna, + RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers to exported mesh (non destructive))"); - RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX, + RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX, "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX); - RNA_def_enum(ot->srna, "export_mesh_type_selection", prop_bc_export_mesh_type, 0, + RNA_def_enum(func, "export_mesh_type_selection", prop_bc_export_mesh_type, 0, "Resolution", "Modifier resolution for export"); - RNA_def_boolean(ot->srna, "selected", 0, "Selection Only", + RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements"); - RNA_def_boolean(ot->srna, "include_children", 0, "Include Children", + RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)"); - RNA_def_boolean(ot->srna, "include_armatures", 0, "Include Armatures", + RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)"); - RNA_def_boolean(ot->srna, "include_shapekeys", 1, "Include Shape Keys", + RNA_def_boolean(func, "include_shapekeys", 1, "Include Shape Keys", "Export all Shape Keys from Mesh Objects"); - RNA_def_boolean(ot->srna, "deform_bones_only", 0, "Deform Bones only", + RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); - RNA_def_boolean(ot->srna, "active_uv_only", 0, "Only Selected UV Map", + RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map", "Export only the selected UV Map"); - RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures", + RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", "Export textures assigned to the object UV Maps"); - RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures", + RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); - RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy", + RNA_def_boolean(func, "use_texture_copies", 1, "Copy", "Copy textures to same folder where the .dae file is exported"); - RNA_def_boolean(ot->srna, "triangulate", 1, "Triangulate", + RNA_def_boolean(func, "triangulate", 1, "Triangulate", "Export Polygons (Quads & NGons) as Triangles"); - RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances", + RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); - RNA_def_boolean(ot->srna, "use_blender_profile", 1, "Use Blender Profile", + RNA_def_boolean(func, "use_blender_profile", 1, "Use Blender Profile", "Export additional Blender specific information (for material, shaders, bones, etc.)"); - RNA_def_boolean(ot->srna, "sort_by_name", 0, "Sort by Object name", + RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); - RNA_def_int(ot->srna, "export_transformation_type", 0, INT_MIN, INT_MAX, + RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); - RNA_def_enum(ot->srna, "export_transformation_type_selection", prop_bc_export_transformation_type, 0, + RNA_def_enum(func, "export_transformation_type_selection", prop_bc_export_transformation_type, 0, "Transform", "Transformation type for translation, scale and rotation"); - RNA_def_boolean(ot->srna, "open_sim", 0, "Export to SL/OpenSim", + RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim", "Compatibility mode for SL, OpenSim and other compatible online worlds"); } diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index bb70f9dccd0..d4d8e23fdf5 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -263,34 +263,53 @@ static void rna_Scene_alembic_export( /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ #include "../../collada/collada.h" +/* Note: This definition must match to the generated function call */ static void rna_Scene_collada_export( Scene *scene, - const char *filepath, + const char *filepath, int apply_modifiers, - int export_mesh_type, + int export_mesh_type, int selected, int include_children, int include_armatures, int include_shapekeys, int deform_bones_only, - int active_uv_only, int include_uv_textures, int include_material_textures, int use_texture_copies, - - int use_ngons, + int triangulate, int use_object_instantiation, int use_blender_profile, int sort_by_name, - int open_sim, - int export_transformation_type) + int export_transformation_type, + int open_sim) { - collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected, - include_children, include_armatures, include_shapekeys, deform_bones_only, - active_uv_only, include_uv_textures, include_material_textures, - use_texture_copies, use_ngons, use_object_instantiation, use_blender_profile, sort_by_name, export_transformation_type, open_sim); + collada_export(scene, + filepath, + + apply_modifiers, + export_mesh_type, + + selected, + include_children, + include_armatures, + include_shapekeys, + deform_bones_only, + + active_uv_only, + include_uv_textures, + include_material_textures, + use_texture_copies, + + triangulate, + use_object_instantiation, + use_blender_profile, + sort_by_name, + + export_transformation_type, + open_sim); } #endif @@ -354,30 +373,60 @@ void RNA_api_scene(StructRNA *srna) parm = RNA_def_string(func, "filepath", NULL, FILE_MAX, "File Path", "File path to write Collada file"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ - RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers"); + + RNA_def_boolean(func, + "apply_modifiers", 0, "Apply Modifiers", + "Apply modifiers to exported mesh (non destructive))"); + RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX, - "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX); - RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements"); - RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)"); - RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)"); - RNA_def_boolean(func, "include_shapekeys", 0, "Include Shape Keys", "Export all Shape Keys from Mesh Objects"); - RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); + "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX); - RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer"); - RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", "Export textures assigned to the object UV maps"); - RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); - RNA_def_boolean(func, "use_texture_copies", 0, "copy", "Copy textures to same folder where the .dae file is exported"); + RNA_def_boolean(func, "selected", 0, "Selection Only", + "Export only selected elements"); - RNA_def_boolean(func, "use_ngons", 1, "Use NGons", "Keep NGons in Export"); - RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); - RNA_def_boolean(func, "use_blender_profile", 1, "Use Blender Profile", "Export additional Blender specific information (for material, shaders, bones, etc.)"); - RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); - RNA_def_boolean(func, "open_sim", 0, "Export for SL/OpenSim", "Compatibility mode for SL, OpenSim and similar online worlds"); + RNA_def_boolean(func, "include_children", 0, "Include Children", + "Export all children of selected objects (even if not selected)"); + + RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", + "Export related armatures (even if not selected)"); + + RNA_def_boolean(func, "include_shapekeys", 1, "Include Shape Keys", + "Export all Shape Keys from Mesh Objects"); + + RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", + "Only export deforming bones with armatures"); + + + RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map", + "Export only the selected UV Map"); + + RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", + "Export textures assigned to the object UV Maps"); + + RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", + "Export textures assigned to the object Materials"); + + RNA_def_boolean(func, "use_texture_copies", 1, "Copy", + "Copy textures to same folder where the .dae file is exported"); + + + RNA_def_boolean(func, "triangulate", 1, "Triangulate", + "Export Polygons (Quads & NGons) as Triangles"); + + RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", + "Instantiate multiple Objects from same Data"); + + RNA_def_boolean(func, "use_blender_profile", 1, "Use Blender Profile", + "Export additional Blender specific information (for material, shaders, bones, etc.)"); + + RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", + "Sort exported data by Object name"); RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, - "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); + "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); - RNA_def_function_ui_description(func, "Export to collada file"); + RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim", + "Compatibility mode for SL, OpenSim and other compatible online worlds"); #endif #ifdef WITH_ALEMBIC From 10404e3e56c6f8278cd542feefe7048867086d32 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Mar 2017 07:12:28 +1100 Subject: [PATCH 09/10] Comments: minor clarification --- source/blender/blenlib/intern/math_geom.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 3cf26ccf904..58699a0593b 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2851,6 +2851,9 @@ bool barycentric_coords_v2(const float v1[2], const float v2[2], const float v3[ /** * \note: using #cross_tri_v2 means locations outside the triangle are correctly weighted + * + * \note This is *exactly* the same calculation as #resolve_tri_uv_v2, + * although it has double precision and is used for texture baking, so keep both. */ void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]) { @@ -2890,9 +2893,11 @@ void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const fl } } -/* same as #barycentric_weights_v2 but works with a quad, +/** + * same as #barycentric_weights_v2 but works with a quad, * note: untested for values outside the quad's bounds - * this is #interp_weights_poly_v2 expanded for quads only */ + * this is #interp_weights_poly_v2 expanded for quads only + */ void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float co[2], float w[4]) { @@ -3345,6 +3350,8 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3 * Barycentric reverse * * Compute coordinates (u, v) for point \a st with respect to triangle (\a st0, \a st1, \a st2) + * + * \note same basic result as #barycentric_weights_v2, see it's comment for details. */ void resolve_tri_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]) From e8021f5e3bd41d2447c35d999aef1a7588bc039a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Mar 2017 07:28:37 +1100 Subject: [PATCH 10/10] UI: expose mesh conversion in apply menu The mesh convert operator can 'freeze' a mesh (WYSIWYG, modifiers, shape keys etc). However its not very obvious that the way to perform this operation is to convert a mesh to a mesh. Expose this as 'Visual Geometry to Mesh' in the 'Apply' menu, since this is where users might expect to see it. --- release/scripts/startup/bl_ui/space_view3d.py | 1 + 1 file changed, 1 insertion(+) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b6479df3047..a4238c53308 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1533,6 +1533,7 @@ class VIEW3D_MT_object_apply(Menu): layout.separator() layout.operator("object.visual_transform_apply", text="Visual Transform", text_ctxt=i18n_contexts.default) + layout.operator("object.convert", text="Visual Geometry to Mesh", text_ctxt=i18n_contexts.default).target = 'MESH' layout.operator("object.duplicates_make_real")