Fix T79517: Data Transfer modifier fails in edit-mode
This commit is contained in:
parent
6b573d9877
commit
18c9f7ef72
Notes:
blender-bot
2023-02-14 04:56:36 +01:00
Referenced by issue #79517, Data Transfer modifier not showing transferred uvs in editmode (when the "on_cage" modifier option is used)
|
@ -95,7 +95,15 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
|
|||
/* This is a direct copy of a main mesh, so for now it has the same topology. */
|
||||
mesh_dst->runtime.deformed_only = true;
|
||||
}
|
||||
/* XXX WHAT? Why? Comment, please! And pretty sure this is not valid for regular Mesh copying? */
|
||||
/* This option is set for run-time meshes that have been copied from the current objects mode.
|
||||
* Currently this is used for edit-mesh although it could be used for sculpt or other
|
||||
* kinds of data specific to an objects mode.
|
||||
*
|
||||
* The flag signals that the mesh hasn't been modified from the data that generated it,
|
||||
* allowing us to use the object-mode data for drawing.
|
||||
*
|
||||
* While this could be the callers responsibility, keep here since it's
|
||||
* highly unlikely we want to create a duplicate and not use it for drawing. */
|
||||
mesh_dst->runtime.is_original = false;
|
||||
|
||||
/* Only do tessface if we have no polys. */
|
||||
|
|
|
@ -109,9 +109,12 @@ typedef struct Mesh_Runtime {
|
|||
/** Set by modifier stack if only deformed from original. */
|
||||
char deformed_only;
|
||||
/**
|
||||
* Copied from edit-mesh (hint, draw with editmesh data).
|
||||
* In the future we may leave the mesh-data empty
|
||||
* since its not needed if we can use edit-mesh data. */
|
||||
* Copied from edit-mesh (hint, draw with edit-mesh data when true).
|
||||
*
|
||||
* Modifiers that edit the mesh data in-place must set this to false
|
||||
* (most #eModifierTypeType_NonGeometrical modifiers). Otherwise the edit-mesh
|
||||
* data will be used for drawing, missing changes from modifiers. See T79517.
|
||||
*/
|
||||
char is_original;
|
||||
|
||||
/** #eMeshWrapperType and others. */
|
||||
|
|
|
@ -204,29 +204,31 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
BKE_reports_init(&reports, RPT_STORE);
|
||||
|
||||
/* Note: no islands precision for now here. */
|
||||
BKE_object_data_transfer_ex(ctx->depsgraph,
|
||||
scene,
|
||||
ob_source,
|
||||
ctx->object,
|
||||
result,
|
||||
dtmd->data_types,
|
||||
false,
|
||||
dtmd->vmap_mode,
|
||||
dtmd->emap_mode,
|
||||
dtmd->lmap_mode,
|
||||
dtmd->pmap_mode,
|
||||
space_transform,
|
||||
false,
|
||||
max_dist,
|
||||
dtmd->map_ray_radius,
|
||||
0.0f,
|
||||
dtmd->layers_select_src,
|
||||
dtmd->layers_select_dst,
|
||||
dtmd->mix_mode,
|
||||
dtmd->mix_factor,
|
||||
dtmd->defgrp_name,
|
||||
invert_vgroup,
|
||||
&reports);
|
||||
if (BKE_object_data_transfer_ex(ctx->depsgraph,
|
||||
scene,
|
||||
ob_source,
|
||||
ctx->object,
|
||||
result,
|
||||
dtmd->data_types,
|
||||
false,
|
||||
dtmd->vmap_mode,
|
||||
dtmd->emap_mode,
|
||||
dtmd->lmap_mode,
|
||||
dtmd->pmap_mode,
|
||||
space_transform,
|
||||
false,
|
||||
max_dist,
|
||||
dtmd->map_ray_radius,
|
||||
0.0f,
|
||||
dtmd->layers_select_src,
|
||||
dtmd->layers_select_dst,
|
||||
dtmd->mix_mode,
|
||||
dtmd->mix_factor,
|
||||
dtmd->defgrp_name,
|
||||
invert_vgroup,
|
||||
&reports)) {
|
||||
result->runtime.is_original = false;
|
||||
}
|
||||
|
||||
if (BKE_reports_contain(&reports, RPT_ERROR)) {
|
||||
const char *report_str = BKE_reports_string(&reports, RPT_ERROR);
|
||||
|
|
|
@ -637,6 +637,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd,
|
|||
CustomData_free_layers(pdata, CD_NORMAL, num_polys);
|
||||
MEM_SAFE_FREE(loopnors);
|
||||
|
||||
result->runtime.is_original = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -308,6 +308,8 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
|||
}
|
||||
}
|
||||
|
||||
mesh->runtime.is_original = false;
|
||||
|
||||
/* Mark tessellated CD layers as dirty. */
|
||||
mesh->runtime.cd_dirty_vert |= CD_MASK_TESSLOOPNORMAL;
|
||||
|
||||
|
|
|
@ -233,6 +233,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
/* XXX TODO is this still needed? */
|
||||
// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS;
|
||||
|
||||
mesh->runtime.is_original = false;
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
|
|
|
@ -677,6 +677,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
/* Currently Modifier stack assumes there is no poly normal data passed around... */
|
||||
CustomData_free_layers(pdata, CD_NORMAL, numPolys);
|
||||
|
||||
result->runtime.is_original = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -312,6 +312,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
MEM_freeN(new_w);
|
||||
MEM_freeN(dw);
|
||||
|
||||
mesh->runtime.is_original = false;
|
||||
|
||||
/* Return the vgroup-modified mesh. */
|
||||
return mesh;
|
||||
}
|
||||
|
|
|
@ -456,6 +456,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
MEM_freeN(dw2);
|
||||
MEM_SAFE_FREE(indices);
|
||||
|
||||
mesh->runtime.is_original = false;
|
||||
|
||||
/* Return the vgroup-modified mesh. */
|
||||
return mesh;
|
||||
}
|
||||
|
|
|
@ -637,6 +637,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
TIMEIT_END(perf);
|
||||
#endif
|
||||
|
||||
mesh->runtime.is_original = false;
|
||||
|
||||
/* Return the vgroup-modified mesh. */
|
||||
return mesh;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue