Fix T58118: Make duplicates real does nothing

The issue was caused by transflag set in geometry evaluation
never copied back top original object.

Now we have a dedicated operation which does all sort copy
back to original object, so we don't have to worry about
atomic assignments or what gets set where.

Still need to move boundbox to the same function, but it
needs some careful doublechecking first.
This commit is contained in:
2018-12-04 16:04:10 +01:00
parent e666ee965c
commit cf2e35fcfe
9 changed files with 78 additions and 33 deletions

View File

@@ -142,14 +142,6 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
/* Set negative scale flag in object. */
if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
else ob->transflag &= ~OB_NEG_SCALE;
if (DEG_is_active(depsgraph)) {
Object *ob_orig = DEG_get_original_object(ob);
copy_m4_m4(ob_orig->obmat, ob->obmat);
copy_m4_m4(ob_orig->constinv, ob->constinv);
ob_orig->transflag = ob->transflag;
ob_orig->flag = ob->flag;
}
}
void BKE_object_handle_data_update(
@@ -271,6 +263,8 @@ void BKE_object_handle_data_update(
BKE_object_eval_boundbox(depsgraph, ob);
}
/* TODO(sergey): Ensure that bounding box is already calculated, and move this
* into BKE_object_synchronize_to_original(). */
void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
{
if (!DEG_is_active(depsgraph)) {
@@ -286,6 +280,21 @@ void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
}
}
void BKE_object_synchronize_to_original(Depsgraph *depsgraph, Object *object)
{
if (!DEG_is_active(depsgraph)) {
return;
}
Object *object_orig = DEG_get_original_object(object);
/* Base flags. */
object_orig->base_flag = object->base_flag;
/* Transformation flags. */
copy_m4_m4(object_orig->obmat, object->obmat);
copy_m4_m4(object_orig->constinv, object->constinv);
object_orig->transflag = object->transflag;
object_orig->flag = object->flag;
}
bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph,
Object *object)
{
@@ -430,12 +439,6 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
}
object->base_local_view_bits = base->local_view_bits;
/* Copy to original object datablock if needed. */
if (DEG_is_active(depsgraph)) {
Object *object_orig = DEG_get_original_object(object);
object_orig->base_flag = object->base_flag;
}
if (object->mode == OB_MODE_PARTICLE_EDIT) {
for (ParticleSystem *psys = object->particlesystem.first;
psys != NULL;