diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-20 17:11:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-20 17:16:22 +0400 |
commit | 018fe81779e81ad43b16c74969764ae3b71d4b40 (patch) | |
tree | d7b0c1a56e74055ea20358d2d88fa41090245a73 /source/blender/editors | |
parent | aa18c4c445cbe7e5cbf0b766a42cfc9e4b764002 (diff) |
Fix T38269: scene full copy in mesh edit or sculpt mode did not copy mesh edits.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_sculpt.h | 1 | ||||
-rw-r--r-- | source/blender/editors/include/ED_util.h | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_internal.c | 11 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 28 |
6 files changed, 34 insertions, 22 deletions
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 4c6c4090548..ba69be5b4c0 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -44,7 +44,6 @@ struct rcti; void ED_operatortypes_sculpt(void); void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob); -void ED_sculpt_force_update(struct bContext *C); void ED_sculpt_get_average_stroke(struct Object *ob, float stroke[3]); int ED_sculpt_minmax(struct bContext *C, float min[3], float max[3]); int ED_sculpt_mask_layers_ensure(struct Object *ob, diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 7f642db9fbd..fa0e5b6cf84 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -46,6 +46,8 @@ struct Mesh; void ED_editors_init(struct bContext *C); void ED_editors_exit(struct bContext *C); +void ED_editors_flush_edits(struct bContext *C, bool for_render); + /* ************** Undo ************************ */ /* undo.c */ diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index ae3ccf644a2..b2eefe63102 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -70,6 +70,7 @@ #include "ED_object.h" #include "ED_render.h" #include "ED_screen.h" +#include "ED_util.h" #include "ED_view3d.h" #include "RE_pipeline.h" @@ -772,11 +773,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even /* handle UI stuff */ WM_cursor_wait(1); - /* flush multires changes (for sculpt) */ - multires_force_render_update(active_object); - - /* flush changes from dynamic topology sculpt */ - sculptsession_bm_to_me_for_render(active_object); + /* flush sculpt and editmode changes */ + ED_editors_flush_edits(C, true); /* cleanup sequencer caches before starting user triggered render. * otherwise, invalidated cache entries can make their way into @@ -784,9 +782,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even * since sequence rendering can call that recursively... (peter) */ BKE_sequencer_cache_cleanup(); - /* get editmode results */ - ED_object_editmode_load(CTX_data_edit_object(C)); - // store spare // get view3d layer, local layer, make this nice api call to render // store spare diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index eba8028dffb..9051b20a4d6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3649,6 +3649,7 @@ static int scene_new_exec(bContext *C, wmOperator *op) ED_object_single_users(bmain, newscene, false, true); } else if (type == SCE_COPY_FULL) { + ED_editors_flush_edits(C, false); ED_object_single_users(bmain, newscene, true, true); } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8c3024ee072..331701cb486 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -104,19 +104,6 @@ #include <omp.h> #endif -void ED_sculpt_force_update(bContext *C) -{ - Object *ob = CTX_data_active_object(C); - - if (ob && (ob->mode & OB_MODE_SCULPT)) { - multires_force_update(ob); - - /* Set reorder=false so that saving the file doesn't reorder - * the BMesh's elements */ - sculptsession_bm_to_me(ob, FALSE); - } -} - void ED_sculpt_get_average_stroke(Object *ob, float stroke[3]) { if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) { diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index df1dad69db0..ab4cd1697ba 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -51,7 +51,9 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_multires.h" #include "BKE_packedFile.h" +#include "BKE_paint.h" #include "ED_armature.h" #include "ED_image.h" @@ -139,6 +141,32 @@ void ED_editors_exit(bContext *C) mesh_mirrtopo_table(NULL, 'e'); } +/* flush any temp data from object editing to DNA before writing files, + * rendering, copying, etc. */ +void ED_editors_flush_edits(bContext *C, bool for_render) +{ + Object *obact = CTX_data_active_object(C); + Object *obedit = CTX_data_edit_object(C); + + /* get editmode results */ + if (obedit) + ED_object_editmode_load(CTX_data_edit_object(C)); + + if (obact && (obact->mode & OB_MODE_SCULPT)) { + /* flush multires changes (for sculpt) */ + multires_force_update(obact); + + if (for_render) { + /* flush changes from dynamic topology sculpt */ + sculptsession_bm_to_me_for_render(obact); + } + else { + /* Set reorder=false so that saving the file doesn't reorder + * the BMesh's elements */ + sculptsession_bm_to_me(obact, FALSE); + } + } +} /* ***** XXX: functions are using old blender names, cleanup later ***** */ |