[Bf-blender-cvs] [dcc6300] master: Fix T40691, dyntopo changes lost on save if sculpting on multiple objects.

Antony Riakiotakis noreply at git.blender.org
Thu Jun 26 22:58:21 CEST 2014


Commit: dcc6300dddbd28ce335b450cfb44b2c4affa3ed8
Author: Antony Riakiotakis
Date:   Thu Jun 26 23:57:00 2014 +0300
https://developer.blender.org/rBdcc6300dddbd28ce335b450cfb44b2c4affa3ed8

Fix T40691, dyntopo changes lost on save if sculpting on multiple
objects.

Flush edits for all objects, not just the active one. Here we might want
to disallow leaving an object on sculpt mode when selecting another, but
this works, no need to enforce it.

===================================================================

M	source/blender/editors/util/ed_util.c

===================================================================

diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index c27e0b8..47fbfbe 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -155,25 +155,27 @@ void ED_editors_exit(bContext *C)
  * rendering, copying, etc. */
 void ED_editors_flush_edits(const bContext *C, bool for_render)
 {
-	Object *obact = CTX_data_active_object(C);
+	Object *ob;
 	Object *obedit = CTX_data_edit_object(C);
-
+	Main *bmain = CTX_data_main(C);
 	/* get editmode results */
 	if (obedit)
 		ED_object_editmode_load(obedit);
 
-	if (obact && (obact->mode & OB_MODE_SCULPT)) {
-		/* flush multires changes (for sculpt) */
-		multires_force_update(obact);
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob && (ob->mode & OB_MODE_SCULPT)) {
+			/* flush multires changes (for sculpt) */
+			multires_force_update(ob);
 
-		if (for_render) {
-			/* flush changes from dynamic topology sculpt */
-			BKE_sculptsession_bm_to_me_for_render(obact);
-		}
-		else {
-			/* Set reorder=false so that saving the file doesn't reorder
+			if (for_render) {
+				/* flush changes from dynamic topology sculpt */
+				BKE_sculptsession_bm_to_me_for_render(ob);
+			}
+			else {
+				/* Set reorder=false so that saving the file doesn't reorder
 			 * the BMesh's elements */
-			BKE_sculptsession_bm_to_me(obact, false);
+				BKE_sculptsession_bm_to_me(ob, false);
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list