Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index e512c3fdc95..a18e12e06ec 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -34,17 +34,20 @@
#include "BLI_utildefines.h"
#include "DNA_color_types.h" /* CurveMapping. */
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_colortools.h" /* CurveMapping. */
+#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_modifier.h"
#include "BKE_texture.h" /* Texture masking. */
+#include "DEG_depsgraph.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
#include "MOD_weightvg_util.h"
@@ -115,11 +118,13 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
* XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
*/
void weightvg_do_mask(
- int num, const int *indices, float *org_w, const float *new_w,
- Object *ob, DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
- Scene *scene, Tex *texture, int tex_use_channel, int tex_mapping,
+ const ModifierEvalContext *ctx,
+ const int num, const int *indices, float *org_w, const float *new_w,
+ Object *ob, Mesh *mesh, const float fact, const char defgrp_name[MAX_VGROUP_NAME],
+ Scene *scene, Tex *texture, const int tex_use_channel, const int tex_mapping,
Object *tex_map_object, const char *tex_uvlayer_name)
{
+ Depsgraph *depsgraph = ctx->depsgraph;
int ref_didx;
int i;
@@ -132,8 +137,7 @@ void weightvg_do_mask(
float (*tex_co)[3];
/* See mapping note below... */
MappingInfoModifierData t_map;
- float (*v_co)[3];
- int numVerts = dm->getNumVerts(dm);
+ const int numVerts = mesh->totvert;
/* Use new generic get_texture_coords, but do not modify our DNA struct for it...
* XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ?
@@ -144,13 +148,11 @@ void weightvg_do_mask(
t_map.map_object = tex_map_object;
BLI_strncpy(t_map.uvlayer_name, tex_uvlayer_name, sizeof(t_map.uvlayer_name));
t_map.texmapping = tex_mapping;
- v_co = MEM_malloc_arrayN(numVerts, sizeof(*v_co), "WeightVG Modifier, TEX mode, v_co");
- dm->getVertCos(dm, v_co);
+
tex_co = MEM_calloc_arrayN(numVerts, sizeof(*tex_co), "WeightVG Modifier, TEX mode, tex_co");
- get_texture_coords(&t_map, ob, dm, v_co, tex_co, num);
- MEM_freeN(v_co);
+ get_texture_coords_mesh(&t_map, ob, mesh, NULL, tex_co);
- modifier_init_texture(scene, texture);
+ modifier_init_texture(depsgraph, texture);
/* For each weight (vertex), make the mix between org and new weights. */
for (i = 0; i < num; ++i) {
@@ -210,9 +212,11 @@ void weightvg_do_mask(
/* Proceed only if vgroup is valid, else use constant factor. */
/* Get actual dverts (ie vertex group data). */
- dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+ dvert = CustomData_get_layer(&mesh->vdata, CD_MDEFORMVERT);
/* Proceed only if vgroup is valid, else assume factor = O. */
- if (dvert == NULL) return;
+ if (dvert == NULL) {
+ return;
+ }
/* For each weight (vertex), make the mix between org and new weights. */
for (i = 0; i < num; i++) {