diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2018-02-27 00:49:30 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2018-02-27 00:49:30 +0300 |
commit | f228a08d027ef700344d35f1ba958249afa93222 (patch) | |
tree | fc6c60d89f911bcb0c5019e2e6e4243e49cba9af /source/blender/editors | |
parent | e94276d4033c72000942a49100e552e800d09e58 (diff) | |
parent | 7dd0e36dc4582e57a3f5235f384b5207882c923e (diff) |
merge from master
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 1 | ||||
-rw-r--r-- | source/blender/editors/io/io_collada.c | 40 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_utils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 85 |
5 files changed, 84 insertions, 48 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index eb101fd89a7..85bcfb603cd 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -116,7 +116,7 @@ static void animedit_get_yscale_factor(bAnimContext *ac) /* grab scale factor directly from action editor setting * NOTE: This theme setting doesn't have an ID, as it cannot be accessed normally - * since it is a float, and the theem settings methods can only handle chars. + * since it is a float, and the theme settings methods can only handle chars. */ ac->yscale_fac = btheme->tact.keyframe_scale_fac; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 3a77a103aeb..246f7d7bd61 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1591,6 +1591,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB rcti temp = *rect; temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false); + rect->xmax = temp.xmin; } /* If there's an icon too (made with uiDefIconTextBut) then draw the icon diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index 98c88ba5fc9..d89af5e85bd 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -28,7 +28,7 @@ * \ingroup collada */ #ifdef WITH_COLLADA -#include "DNA_scene_types.h" +#include "DNA_space_types.h" #include "BLT_translation.h" @@ -91,6 +91,9 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) int include_armatures; int include_shapekeys; int deform_bones_only; + + int include_animations; + int sample_animations; int sampling_rate; int include_material_textures; @@ -144,7 +147,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) include_children = RNA_boolean_get(op->ptr, "include_children"); include_armatures = RNA_boolean_get(op->ptr, "include_armatures"); include_shapekeys = RNA_boolean_get(op->ptr, "include_shapekeys"); - sampling_rate = RNA_int_get(op->ptr, "sampling_rate"); + + include_animations = RNA_boolean_get(op->ptr, "include_animations"); + sample_animations = RNA_boolean_get(op->ptr, "sample_animations"); + sampling_rate = (sample_animations)? RNA_int_get(op->ptr, "sampling_rate") : 0; + deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only"); include_material_textures = RNA_boolean_get(op->ptr, "include_material_textures"); @@ -164,7 +171,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) /* get editmode results */ ED_object_editmode_load(CTX_data_edit_object(C)); - export_count = collada_export(C, + Scene *scene = CTX_data_scene(C); + CTX_data_eval_ctx(C, &eval_ctx); + + export_count = collada_export(&eval_ctx, + scene, filepath, apply_modifiers, export_mesh_type, @@ -173,6 +184,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) include_armatures, include_shapekeys, deform_bones_only, + include_animations, sampling_rate, active_uv_only, @@ -209,6 +221,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) { uiLayout *box, *row, *col, *split; + bool include_animations = RNA_boolean_get(imfptr, "include_animations"); /* Export Options: */ box = uiLayoutBox(layout); @@ -239,9 +252,15 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected")); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "include_animations", 0, NULL, ICON_NONE); + row = uiLayoutRow(box, false); + if (include_animations) { + uiItemR(row, imfptr, "sample_animations", 0, NULL, ICON_NONE); + row = uiLayoutColumn(box, false); + uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE); + uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "sample_animations")); + } - /* Texture options */ box = uiLayoutBox(layout); row = uiLayoutRow(box, false); @@ -284,7 +303,6 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT); uiItemL(split, IFACE_("Transformation Type"), ICON_NONE); uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE); - row = uiLayoutRow(box, false); uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE); @@ -376,8 +394,14 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); - RNA_def_int(func, "sampling_rate", 0, -1, INT_MAX, - "Samplintg Rate", "The maximum distance of frames between 2 keyframes. Disabled when value is -1", -1, INT_MAX); + RNA_def_boolean(func, "include_animations", false, + "Include Animations", "Export Animations if available.\nExporting Animations will enforce the decomposition of node transforms\ninto <translation> <rotation> and <scale> components"); + + RNA_def_boolean(func, "sample_animations", 0, + "Sample Animations", "Auto-generate keyframes with a frame distance set by 'Sampling Rate'.\nWhen disabled, export only the keyframes defined in the animation f-curves (may be less accurate)"); + + RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX, + "Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX); RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map", diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 0e56dc817e4..907f346c931 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -171,8 +171,8 @@ int graphop_editable_keyframes_poll(bContext *C) /* editable curves must fulfill the following criteria: * - it has bezier keyframes - * - it must not be protected from editing (this is already checked for with the foredit flag - * - F-Curve modifiers do not interfere with the result too much + * - it must not be protected from editing (this is already checked for with the edit flag + * - F-Curve modifiers do not interfere with the result too much * (i.e. the modifier-control drawing check returns false) */ if (fcu->bezt == NULL) diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index f66c9ee9951..61e0004915d 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -286,6 +286,21 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist /*************** visibility and selection utilities **************/ +static void uvedit_vertex_select_tagged(BMEditMesh *em, Scene *scene, bool select, int cd_loop_uv_offset) +{ + BMFace *efa; + BMLoop *l; + BMIter iter, liter; + + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (BM_elem_flag_test(l->v, BM_ELEM_TAG)) { + uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); + } + } + } +} + bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa) { ToolSettings *ts = scene->toolsettings; @@ -1291,9 +1306,7 @@ static int uv_select_more_less(bContext *C, const bool select) if (ts->uv_selectmode == UV_SELECT_FACE) { /* clear tags */ - BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - BM_elem_flag_disable(efa, BM_ELEM_TAG); - } + BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false); /* mark loops to be selected */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { @@ -1485,9 +1498,7 @@ static void uv_weld_align(bContext *C, int tool) BMIter iter, liter, eiter; /* clear tag */ - BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - BM_elem_flag_disable(eve, BM_ELEM_TAG); - } + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); /* tag verts with a selected UV */ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { @@ -2587,12 +2598,8 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) { /* Tag all verts as untouched, then touch the ones that have a face center * in the loop and select all MLoopUV's that use a touched vert. */ - BMVert *eve; - - BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - BM_elem_flag_disable(eve, BM_ELEM_TAG); - } - + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { @@ -2677,11 +2684,7 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) { /* Tag all verts as untouched, then touch the ones that have a face center * in the loop and select all MLoopUV's that use a touched vert. */ - BMVert *eve; - - BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - BM_elem_flag_disable(eve, BM_ELEM_TAG); - } + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { @@ -2802,7 +2805,8 @@ static int uv_border_select_exec(bContext *C, wmOperator *op) else { /* other selection modes */ changed = true; - + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (!uvedit_face_visible_test(scene, obedit, ima, efa)) continue; @@ -2814,15 +2818,21 @@ static int uv_border_select_exec(bContext *C, wmOperator *op) /* UV_SYNC_SELECTION - can't do pinned selection */ if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) { uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); + BM_elem_flag_enable(l->v, BM_ELEM_TAG); } } else if (pinned) { if ((luv->flag & MLOOPUV_PINNED) && BLI_rctf_isect_pt_v(&rectf, luv->uv)) { uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); + BM_elem_flag_enable(l->v, BM_ELEM_TAG); } } } } + + if (sima->sticky == SI_STICKY_VERTEX) { + uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset); + } } if (changed) { @@ -2872,19 +2882,6 @@ static int uv_inside_circle(const float uv[2], const float offset[2], const floa return ((x * x + y * y) < 1.0f); } -static bool uv_select_inside_ellipse(BMEditMesh *em, Scene *scene, const bool select, - const float offset[2], const float ellipse[2], BMLoop *l, MLoopUV *luv, - const int cd_loop_uv_offset) -{ - if (uv_inside_circle(luv->uv, offset, ellipse)) { - uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); - return true; - } - else { - return false; - } -} - static int uv_circle_select_exec(bContext *C, wmOperator *op) { SpaceImage *sima = CTX_wm_space_image(C); @@ -2944,12 +2941,22 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) } } else { + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - changed |= uv_select_inside_ellipse(em, scene, select, offset, ellipse, l, luv, cd_loop_uv_offset); + if (uv_inside_circle(luv->uv, offset, ellipse)) { + changed = true; + uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); + BM_elem_flag_enable(l->v, BM_ELEM_TAG); + } } } + + if (sima->sticky == SI_STICKY_VERTEX) { + uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset); + } } if (changed) { @@ -3040,6 +3047,8 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo } } else { /* Vert Sel */ + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (uvedit_face_visible_test(scene, obedit, ima, efa)) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { @@ -3053,11 +3062,16 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo { uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset); changed = true; + BM_elem_flag_enable(l->v, BM_ELEM_TAG); } } } } } + + if (sima->sticky == SI_STICKY_VERTEX) { + uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset); + } } if (changed) { @@ -3966,17 +3980,14 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op) BMFace *efa; BMLoop *loop; BMIter iter, liter; - bool clear = RNA_boolean_get(op->ptr, "clear"); + bool flag_set = !RNA_boolean_get(op->ptr, "clear"); const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) { if (uvedit_edge_select_test(scene, loop, cd_loop_uv_offset)) { - if (clear) - BM_elem_flag_disable(loop->e, BM_ELEM_SEAM); - else - BM_elem_flag_enable(loop->e, BM_ELEM_SEAM); + BM_elem_flag_set(loop->e, BM_ELEM_SEAM, flag_set); } } } |