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.
This commit is contained in:
parent
a5ff780065
commit
c0c1b4542f
Notes:
blender-bot
2023-12-22 20:14:11 +01:00
Referenced by issue #66103, unlink error Referenced by issue #66089, "i" hotkey to insert keyframe doesn't work in color picker Referenced by issue #65996, metaballs converted to meshes appear to render at an incorrect isosurface
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue