Fix T38269: scene full copy in mesh edit or sculpt mode did not copy mesh edits.
This commit is contained in:
parent
aa18c4c445
commit
018fe81779
Notes:
blender-bot
2023-02-14 11:19:19 +01:00
Referenced by issue #38269, Scene - Full Copy Bug?
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 ***** */
|
||||
|
||||
|
|
|
@ -870,22 +870,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.
|
||||
*/
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue