Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-20 17:11:12 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-20 17:16:22 +0400
commit018fe81779e81ad43b16c74969764ae3b71d4b40 (patch)
treed7b0c1a56e74055ea20358d2d88fa41090245a73 /source/blender
parentaa18c4c445cbe7e5cbf0b766a42cfc9e4b764002 (diff)
Fix T38269: scene full copy in mesh edit or sculpt mode did not copy mesh edits.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/ED_sculpt.h1
-rw-r--r--source/blender/editors/include/ED_util.h2
-rw-r--r--source/blender/editors/render/render_internal.c11
-rw-r--r--source/blender/editors/screen/screen_ops.c1
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c13
-rw-r--r--source/blender/editors/util/ed_util.c28
-rw-r--r--source/blender/windowmanager/intern/wm_files.c20
7 files changed, 36 insertions, 40 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 ***** */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index c4c91b40df2..71d78a83b00 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -871,22 +871,6 @@ bool write_crash_blend(void)
}
/**
- * Flush any temp data from object editing to DNA before writing the blend file to disk.
- */
-static void write_flush_editdata(bContext *C)
-{
- Object *obedit;
-
- obedit = CTX_data_edit_object(C);
-
- if (obedit) {
- ED_object_editmode_load(obedit);
- }
-
- ED_sculpt_force_update(C);
-}
-
-/**
* \see #wm_homefile_write_exec wraps #BLO_write_file in a similar way.
*/
int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *reports)
@@ -943,7 +927,7 @@ int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *
/* don't forget not to return without! */
WM_cursor_wait(1);
- write_flush_editdata(C);
+ ED_editors_flush_edits(C, false);
fileflags |= G_FILE_HISTORY; /* write file history */
@@ -1019,7 +1003,7 @@ int wm_homefile_write_exec(bContext *C, wmOperator *op)
BLI_make_file_string("/", filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
printf("trying to save homefile at %s ", filepath);
- write_flush_editdata(C);
+ ED_editors_flush_edits(C, false);
/* force save as regular blend file */
fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);