diff options
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 0e03feba340..30dab322fbc 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -30,8 +30,10 @@ #include "BKE_bvhutils.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_mesh.h" +#include "BKE_mesh_legacy_convert.h" #include "BKE_mesh_runtime.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -167,7 +169,7 @@ void PE_free_ptcache_edit(PTCacheEdit *edit) int PE_minmax( Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, float min[3], float max[3]) { - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); ParticleSystem *psys; ParticleSystemModifierData *psmd_eval = NULL; @@ -1449,26 +1451,27 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part vec = edit->emitter_cosnos; nor = vec + 3; + const MVert *verts = BKE_mesh_verts(mesh); const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh); - + MFace *mfaces = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE); for (i = 0; i < totface; i++, vec += 6, nor += 6) { - MFace *mface = &mesh->mface[i]; - MVert *mvert; + MFace *mface = &mfaces[i]; + const MVert *mvert; - mvert = &mesh->mvert[mface->v1]; + mvert = &verts[mface->v1]; copy_v3_v3(vec, mvert->co); copy_v3_v3(nor, vert_normals[mface->v1]); - mvert = &mesh->mvert[mface->v2]; + mvert = &verts[mface->v2]; add_v3_v3v3(vec, vec, mvert->co); add_v3_v3(nor, vert_normals[mface->v2]); - mvert = &mesh->mvert[mface->v3]; + mvert = &verts[mface->v3]; add_v3_v3v3(vec, vec, mvert->co); add_v3_v3(nor, vert_normals[mface->v3]); if (mface->v4) { - mvert = &mesh->mvert[mface->v4]; + mvert = &verts[mface->v4]; add_v3_v3v3(vec, vec, mvert->co); add_v3_v3(nor, vert_normals[mface->v4]); @@ -1512,7 +1515,7 @@ static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob, } } - psys_cache_edit_paths(depsgraph, scene, ob, edit, CFRA, G.is_rendering); + psys_cache_edit_paths(depsgraph, scene, ob, edit, scene->r.cfra, G.is_rendering); /* disable update flag */ LOOP_POINTS { @@ -1647,11 +1650,11 @@ void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int usefla * and flagging with PEK_HIDE will prevent selection. This might get restored once this is * supported in drawing (but doesn't make much sense for hair anyways). */ if (edit->psys && edit->psys->part->type == PART_EMITTER) { - PE_hide_keys_time(scene, edit, CFRA); + PE_hide_keys_time(scene, edit, scene->r.cfra); } /* regenerate path caches */ - psys_cache_edit_paths(depsgraph, scene, ob, edit, CFRA, G.is_rendering); + psys_cache_edit_paths(depsgraph, scene, ob, edit, scene->r.cfra, G.is_rendering); /* disable update flag */ LOOP_POINTS { @@ -3390,7 +3393,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) if (brush) { uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 128); @@ -3566,7 +3569,9 @@ static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagg } if (newtotpart != psys->totpart) { - MFace *mtessface = use_dm_final_indices ? psmd_eval->mesh_final->mface : me->mface; + MFace *mtessface = use_dm_final_indices ? + (MFace *)CustomData_get_layer(&psmd_eval->mesh_final->fdata, CD_MFACE) : + (MFace *)CustomData_get_layer(&me->fdata, CD_MFACE); /* allocate new arrays and copy existing */ new_pars = MEM_callocN(newtotpart * sizeof(ParticleData), "ParticleData new"); @@ -4174,8 +4179,8 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, } totface = mesh->totface; - mface = mesh->mface; - mvert = mesh->mvert; + mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE); + mvert = BKE_mesh_verts_for_write(mesh); /* lets intersect the faces */ for (i = 0; i < totface; i++, mface++) { |