Merge branch 'blender-v3.1-release'

This commit is contained in:
Hans Goudey 2022-03-02 10:55:21 -05:00
commit d86f80f42a
2 changed files with 32 additions and 0 deletions

View File

@ -290,6 +290,11 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
const bool renderable = DRW_object_is_renderable(ob);
const bool in_pose_mode = ob->type == OB_ARMATURE && OVERLAY_armature_is_pose_mode(ob, draw_ctx);
const bool in_edit_mode = overlay_object_is_edit_mode(pd, ob);
const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI);
const bool instance_parent_in_edit_mode = is_instance ?
overlay_object_is_edit_mode(
pd, DRW_object_get_dupli_parent(ob)) :
false;
const bool in_particle_edit_mode = (ob->mode == OB_MODE_PARTICLE_EDIT) &&
(pd->ctx_mode == CTX_MODE_PARTICLE);
const bool in_paint_mode = (ob == draw_ctx->obact) &&
@ -316,6 +321,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
const bool draw_wires = draw_surface && has_surface &&
(pd->wireframe_mode || !pd->hide_overlays);
const bool draw_outlines = !in_edit_mode && !in_paint_mode && renderable && has_surface &&
!instance_parent_in_edit_mode &&
(pd->v3d_flag & V3D_SELECT_OUTLINE) &&
(ob->base_flag & BASE_SELECTED);
const bool draw_bone_selection = (ob->type == OB_MESH) && pd->armature.do_pose_fade_geom &&

View File

@ -1246,8 +1246,34 @@ static void modifyGeometry(ModifierData *md,
return;
}
bool use_orig_index_verts = false;
bool use_orig_index_edges = false;
bool use_orig_index_polys = false;
if (geometry_set.has_mesh()) {
const Mesh &mesh = *geometry_set.get_mesh_for_read();
use_orig_index_verts = CustomData_has_layer(&mesh.vdata, CD_ORIGINDEX);
use_orig_index_edges = CustomData_has_layer(&mesh.edata, CD_ORIGINDEX);
use_orig_index_polys = CustomData_has_layer(&mesh.pdata, CD_ORIGINDEX);
}
geometry_set = compute_geometry(
tree, input_nodes, output_node, std::move(geometry_set), nmd, ctx);
if (geometry_set.has_mesh()) {
/* Add #CD_ORIGINDEX layers if they don't exist already. This is required because the
* #eModifierTypeFlag_SupportsMapping flag is set. If the layers did not exist before, it is
* assumed that the output mesh does not have a mapping to the original mesh. */
Mesh &mesh = *geometry_set.get_mesh_for_write();
if (use_orig_index_verts) {
CustomData_add_layer(&mesh.vdata, CD_ORIGINDEX, CD_DEFAULT, nullptr, mesh.totvert);
}
if (use_orig_index_edges) {
CustomData_add_layer(&mesh.edata, CD_ORIGINDEX, CD_DEFAULT, nullptr, mesh.totedge);
}
if (use_orig_index_polys) {
CustomData_add_layer(&mesh.pdata, CD_ORIGINDEX, CD_DEFAULT, nullptr, mesh.totpoly);
}
}
}
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)