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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-06-24 21:40:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-06-24 21:46:07 +0300
commitc0c1b4542f391fbec18b7168d2d845212fb44ac3 (patch)
tree435370566bde2c349ad54ca54c57520108348e43 /source/blender/editors
parenta5ff780065bf6768811bf459953a1a1eabe989c1 (diff)
Fix T65996: metaballs converted to meshes appear to render at an incorrect isosurface.
Not much to be done here really, besides adding yet another hack to that giant pile of hacks that are mballs... So to avoid newly created copy of basis of mball to influence to mball computation, we simply switch it to Empty object for the depsgraph update run. Not nice, but working (besides a weird change of basis obflag which should not happen), and presumably reasonably safe change.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_add.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 823f6c55a06..0fdb1cec16f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2029,6 +2029,18 @@ static Base *duplibase_for_convert(
ED_object_base_select(basen, BA_SELECT);
ED_object_base_select(base, BA_DESELECT);
+ /* XXX An ugly hack needed because if we re-run depsgraph with some new MBall objects
+ * having same 'family name' as orig ones, they will affect end result of MBall computation...
+ * For until we get rid of that name-based thingy in MBalls, that should do the trick
+ * (this is weak, but other solution (to change name of obn) is even worse imho).
+ * See T65996. */
+ const bool is_meta_ball = (obn->type == OB_MBALL);
+ void *obdata = obn->data;
+ if (is_meta_ball) {
+ obn->type = OB_EMPTY;
+ obn->data = NULL;
+ }
+
/* XXX Doing that here is stupid, it means we update and re-evaluate the whole depsgraph every
* time we need to duplicate an object to convert it. Even worse, this is not 100% correct, since
* we do not yet have duplicated obdata.
@@ -2043,6 +2055,11 @@ static Base *duplibase_for_convert(
BKE_scene_graph_update_tagged(depsgraph, bmain);
scene->customdata_mask = customdata_mask_prev;
+ if (is_meta_ball) {
+ obn->type = OB_MBALL;
+ obn->data = obdata;
+ }
+
return basen;
}
@@ -2312,8 +2329,6 @@ static int convert_exec(bContext *C, wmOperator *op)
}
if (!(baseob->flag & OB_DONE)) {
- baseob->flag |= OB_DONE;
-
basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, baseob);
newob = basen->object;
@@ -2339,6 +2354,7 @@ static int convert_exec(bContext *C, wmOperator *op)
basact = basen;
}
+ baseob->flag |= OB_DONE;
mballConverted = 1;
}
}