Cleanup: Avoid passing context to shrinkwrap blenkernel function
Such lower level functions generally shouldn't know about Blender's overall context. If that spreads everywhere, things get hard to reason about.
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
* (So that you don't have to pass an enormous amount of arguments to functions)
|
||||
*/
|
||||
|
||||
struct bContext;
|
||||
struct BVHTree;
|
||||
struct MDeformVert;
|
||||
struct Mesh;
|
||||
@@ -122,7 +121,10 @@ void shrinkwrapGpencilModifier_deform(ShrinkwrapGpencilModifierData *mmd,
|
||||
/**
|
||||
* Used in `editmesh_mask_extract.cc` to shrink-wrap the extracted mesh to the sculpt.
|
||||
*/
|
||||
void BKE_shrinkwrap_mesh_nearest_surface_deform(bContext *C, Object *ob_source, Object *ob_target);
|
||||
void BKE_shrinkwrap_mesh_nearest_surface_deform(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob_source,
|
||||
Object *ob_target);
|
||||
|
||||
/**
|
||||
* Used in `object_remesh.cc` to preserve the details and volume in the voxel remesher.
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "BKE_DerivedMesh.hh"
|
||||
#include "BKE_attribute.h"
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_lattice.hh"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_modifier.hh"
|
||||
@@ -1517,10 +1516,11 @@ void shrinkwrapGpencilModifier_deform(ShrinkwrapGpencilModifierData *mmd,
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_shrinkwrap_mesh_nearest_surface_deform(bContext *C, Object *ob_source, Object *ob_target)
|
||||
void BKE_shrinkwrap_mesh_nearest_surface_deform(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob_source,
|
||||
Object *ob_target)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Scene *sce = CTX_data_scene(C);
|
||||
ShrinkwrapModifierData ssmd = {{nullptr}};
|
||||
ModifierEvalContext ctx = {depsgraph, ob_source, ModifierApplyFlag(0)};
|
||||
|
||||
@@ -1534,7 +1534,7 @@ void BKE_shrinkwrap_mesh_nearest_surface_deform(bContext *C, Object *ob_source,
|
||||
shrinkwrapModifier_deform(
|
||||
&ssmd,
|
||||
&ctx,
|
||||
sce,
|
||||
scene,
|
||||
ob_source,
|
||||
src_me,
|
||||
nullptr,
|
||||
|
||||
@@ -218,7 +218,7 @@ static int geometry_extract_apply(bContext *C,
|
||||
BKE_mesh_copy_parameters_for_eval(new_ob_mesh, mesh);
|
||||
|
||||
if (params->apply_shrinkwrap) {
|
||||
BKE_shrinkwrap_mesh_nearest_surface_deform(C, new_ob, ob);
|
||||
BKE_shrinkwrap_mesh_nearest_surface_deform(CTX_data_depsgraph_pointer(C), scene, new_ob, ob);
|
||||
}
|
||||
|
||||
if (params->add_solidify) {
|
||||
|
||||
Reference in New Issue
Block a user