From 70d48255aeae66c9ce62b0458cf7519adea45cf2 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 26 Aug 2020 11:26:19 +0200 Subject: Fix T79992: Error calling context.copy() in Properties Editor This was an oversight in rB83e3d25bcae3. Basically we still have the "hair" and "point_cloud" entries for the context. However they were ifdef'ed. Note this would mostly happen in 2.90 since we always build without hair and particles there. Differential Revision: https://developer.blender.org/D8712 --- source/blender/editors/space_buttons/buttons_context.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 044fadb9a50..e3e41af02cf 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -795,8 +795,12 @@ const char *buttons_context_dir[] = { "line_style", "collection", "gpencil", +#ifdef WITH_HAIR_NODES "hair", +#endif +#ifdef WITH_PARTICLE_NODES "pointcloud", +#endif "volume", NULL, }; -- cgit v1.2.3 From e0772c6607ae6cd48193101b39d7332cb76ab2c9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Aug 2020 23:20:37 +1000 Subject: Fix T80098: Mesh deform doesn't update in edit mode Use BKE_mesh_wrapper API access to access mesh coordinates for modifier evaluation. Call BKE_mesh_wrapper_ensure_mdata when binding since it's a one off operation. Regression from deaff945d0b96. Reviewed by: @brecht Ref D8709 --- source/blender/editors/armature/meshlaplacian.c | 4 ++++ source/blender/modifiers/intern/MOD_meshdeform.c | 27 ++++++++++-------------- 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 11066595e2e..195d3ebc6c7 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -37,6 +37,7 @@ #include "BKE_bvhutils.h" #include "BKE_mesh.h" #include "BKE_mesh_runtime.h" +#include "BKE_mesh_wrapper.h" #include "BKE_modifier.h" #include "ED_armature.h" @@ -1761,6 +1762,9 @@ void ED_mesh_deform_bind_callback(MeshDeformModifierData *mmd, memset(&mdb, 0, sizeof(MeshDeformBind)); + /* No need to support other kinds of mesh data as binding is a one-off action. */ + BKE_mesh_wrapper_ensure_mdata(cagemesh); + /* get mesh and cage mesh */ mdb.vertexcos = MEM_callocN(sizeof(float) * 3 * totvert, "MeshDeformCos"); mdb.totvert = totvert; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index ae031bffb04..5ef6d5b6485 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -353,9 +353,8 @@ static void meshdeformModifier_do(ModifierData *md, Mesh *cagemesh; MDeformVert *dvert = NULL; float imat[4][4], cagemat[4][4], iobmat[4][4], icagemat[3][3], cmat[4][4]; - float co[3], (*dco)[3] = NULL, (*bindcagecos)[3]; + float(*dco)[3] = NULL, (*bindcagecos)[3]; int a, totvert, totcagevert, defgrp_index; - float(*cagecos)[3] = NULL; MeshdeformUserdata data; static int recursive_bind_sentinel = 0; @@ -406,7 +405,7 @@ static void meshdeformModifier_do(ModifierData *md, /* verify we have compatible weights */ totvert = numVerts; - totcagevert = cagemesh->totvert; + totcagevert = BKE_mesh_wrapper_vert_len(cagemesh); if (mmd->totvert != totvert) { BKE_modifier_set_error(md, "Vertices changed from %d to %d", mmd->totvert, totvert); @@ -422,27 +421,24 @@ static void meshdeformModifier_do(ModifierData *md, goto finally; } - /* setup deformation data */ - cagecos = BKE_mesh_vert_coords_alloc(cagemesh, NULL); - bindcagecos = (float(*)[3])mmd->bindcagecos; - /* We allocate 1 element extra to make it possible to * load the values to SSE registers, which are float4. */ dco = MEM_calloc_arrayN((totcagevert + 1), sizeof(*dco), "MDefDco"); zero_v3(dco[totcagevert]); - for (a = 0; a < totcagevert; a++) { - /* get cage vertex in world space with binding transform */ - copy_v3_v3(co, cagecos[a]); - if (G.debug_value != 527) { - mul_m4_v3(mmd->bindmat, co); + /* setup deformation data */ + BKE_mesh_wrapper_vert_coords_copy(cagemesh, dco, totcagevert); + bindcagecos = (float(*)[3])mmd->bindcagecos; + + if (G.debug_value != 527) { + for (a = 0; a < totcagevert; a++) { + /* get cage vertex in world space with binding transform */ + float co[3]; + mul_v3_m4v3(co, mmd->bindmat, dco[a]); /* compute difference with world space bind coord */ sub_v3_v3v3(dco[a], co, bindcagecos[a]); } - else { - copy_v3_v3(dco[a], co); - } } MOD_get_vgroup(ob, mesh, mmd->defgrp_name, &dvert, &defgrp_index); @@ -464,7 +460,6 @@ static void meshdeformModifier_do(ModifierData *md, finally: MEM_SAFE_FREE(dco); - MEM_SAFE_FREE(cagecos); } static void deformVerts(ModifierData *md, -- cgit v1.2.3