diff options
author | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:12 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:12 +0300 |
commit | 00dcfdf916c69672210b006e62d966f1bc2fbeb7 (patch) | |
tree | 0cbb1b91fe26c750197126085b74224a795a103c /source/blender/editors/physics | |
parent | a39532670f6b668da7be5810fb1f844b82feeba3 (diff) | |
parent | d5934974219135102f364f57c45a8b1465e2b8d9 (diff) |
Merge branch 'master' into xr-devxr-dev
Diffstat (limited to 'source/blender/editors/physics')
7 files changed, 39 insertions, 30 deletions
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index ee59efbc925..e56d58c2135 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -11,7 +11,6 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/clog - ../../../../intern/glew-mx ../../../../intern/guardedalloc ../../../../intern/mantaflow/extern # RNA_prototypes.h diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index e8ceb97ed7a..1ce90849a88 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -21,6 +21,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "BKE_attribute.h" #include "BKE_context.h" #include "BKE_deform.h" #include "BKE_dynamicpaint.h" @@ -233,7 +234,7 @@ static int output_toggle_exec(bContext *C, wmOperator *op) ED_mesh_color_add(ob->data, name, true, true, op->reports); } else { - ED_mesh_color_remove_named(ob->data, name); + BKE_id_attribute_remove(ob->data, name, NULL); } } /* Vertex Weight Layer */ 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++) { diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c index 54d28b49e0c..d1a2bb31454 100644 --- a/source/blender/editors/physics/particle_edit_undo.c +++ b/source/blender/editors/physics/particle_edit_undo.c @@ -21,6 +21,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_layer.h" #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_undo_system.h" @@ -211,7 +212,7 @@ static bool particle_undosys_poll(struct bContext *C) Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); return (edit != NULL); @@ -225,7 +226,7 @@ static bool particle_undosys_step_encode(struct bContext *C, ParticleUndoStep *us = (ParticleUndoStep *)us_p; ViewLayer *view_layer = CTX_data_view_layer(C); us->scene_ref.ptr = CTX_data_scene(C); - us->object_ref.ptr = OBACT(view_layer); + us->object_ref.ptr = BKE_view_layer_active_object_get(view_layer); PTCacheEdit *edit = PE_get_current(depsgraph, us->scene_ref.ptr, us->object_ref.ptr); undoptcache_from_editcache(&us->data, edit); return true; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 6bea6e2c19e..f13b7519cd7 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -26,6 +26,7 @@ #include "BKE_lib_id.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" @@ -703,7 +704,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, PTCacheEditKey *ekey; BVHTreeFromMesh bvhtree = {NULL}; MFace *mface = NULL, *mf; - MEdge *medge = NULL, *me; + const MEdge *medge = NULL, *me; MVert *mvert; Mesh *mesh, *target_mesh; int numverts; @@ -749,7 +750,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, BKE_mesh_tessface_ensure(mesh); numverts = mesh->totvert; - mvert = mesh->mvert; + mvert = BKE_mesh_verts_for_write(mesh); /* convert to global coordinates */ for (int i = 0; i < numverts; i++) { @@ -757,11 +758,11 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, } if (mesh->totface != 0) { - mface = mesh->mface; + mface = CustomData_get_layer(&mesh->fdata, CD_MFACE); BKE_bvhtree_from_mesh_get(&bvhtree, mesh, BVHTREE_FROM_FACES, 2); } else if (mesh->totedge != 0) { - medge = mesh->medge; + medge = BKE_mesh_edges(mesh); BKE_bvhtree_from_mesh_get(&bvhtree, mesh, BVHTREE_FROM_EDGES, 2); } else { diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 96195bdcc2e..1d3cf7c36af 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -256,8 +256,8 @@ static void fluid_bake_sequence(FluidJob *job) frame = is_first_frame ? fds->cache_frame_start : (*pause_frame); /* Save orig frame and update scene frame. */ - orig_frame = CFRA; - CFRA = frame; + orig_frame = scene->r.cfra; + scene->r.cfra = frame; /* Loop through selected frames. */ for (; frame <= fds->cache_frame_end; frame++) { @@ -280,7 +280,7 @@ static void fluid_bake_sequence(FluidJob *job) *(job->progress) = progress; } - CFRA = frame; + scene->r.cfra = frame; /* Update animation system. */ ED_update_for_newframe(job->bmain, job->depsgraph); @@ -293,7 +293,7 @@ static void fluid_bake_sequence(FluidJob *job) } /* Restore frame position that we were on before bake. */ - CFRA = orig_frame; + scene->r.cfra = orig_frame; } static void fluid_bake_endjob(void *customdata) @@ -502,6 +502,7 @@ static void fluid_free_startjob(void *customdata, short *stop, short *do_update, BKE_fluid_cache_free(fds, job->ob, cache_map); #else UNUSED_VARS(fds); + UNUSED_VARS(cache_map); #endif *do_update = true; diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c index 66ae2d323fd..3cd2a7dbd29 100644 --- a/source/blender/editors/physics/rigidbody_constraint.c +++ b/source/blender/editors/physics/rigidbody_constraint.c @@ -16,6 +16,7 @@ #include "BKE_collection.h" #include "BKE_context.h" +#include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_report.h" @@ -88,7 +89,7 @@ bool ED_rigidbody_constraint_add( /* create constraint group if it doesn't already exits */ if (rbw->constraints == NULL) { rbw->constraints = BKE_collection_add(bmain, NULL, "RigidBodyConstraints"); - id_fake_user_set(&rbw->constraints->id); + id_us_plus(&rbw->constraints->id); } /* make rigidbody constraint settings */ ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, type); @@ -122,7 +123,7 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); int type = RNA_enum_get(op->ptr, "type"); bool changed; @@ -174,7 +175,7 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); /* apply to active object */ if (ELEM(NULL, ob, ob->rigidbody_constraint)) { |