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:
authorBastien Montagne <montagne29@wanadoo.fr>2012-01-23 00:05:26 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-01-23 00:05:26 +0400
commit6eb0ca9385aaf69c89172a5826592e5ad9dac198 (patch)
treec9262f0272a3d566077436958400cfe72ebf8461 /source/blender/blenkernel
parentb54182c93fac2bd79d0c9244eaf1d553b93adcb0 (diff)
parent1a93d8834319b890ff0cbc70231b14635603ae95 (diff)
Merged with trunk (-r43609:43611): updated modifier preview.
Noted preview code for DynamicPaint is currently disabled, will see if I can re-enable it…
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h9
-rw-r--r--source/blender/blenkernel/BKE_modifier.h10
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c217
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c21
-rw-r--r--source/blender/blenkernel/intern/modifier.c42
5 files changed, 217 insertions, 82 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index eb7d6d76017..69abfe3c34d 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -627,6 +627,15 @@ int sculpt_get_deform_matrices(struct Scene *scene, struct Object *ob,
float (**deformmats)[3][3], float (**deformcos)[3]);
void weight_to_rgb(float r_rgb[3], const float weight);
+/* Update the weight MCOL preview layer.
+ * If weights are NULL, use object's active vgroup(s).
+ * Else, weights must be an array of weight float values.
+ * If indices is NULL, it must be of numVerts length.
+ * Else, it must be of num length, as indices, which contains vertices' idx to apply weights to.
+ * (other vertices are assumed zero weight).
+ */
+void DM_update_weight_mcol(struct Object *ob, struct DerivedMesh *dm, int const draw_flag,
+ float *weights, int num, const int *indices);
/* convert layers requested by a GLSL material to actually available layers in
* the DerivedMesh, with both a pointer for arrays and an offset for editmesh */
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index d6c48fcb458..947e630273e 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -100,7 +100,10 @@ typedef enum {
eModifierTypeFlag_Single = (1<<7),
/* Some modifier can't be added manually by user */
- eModifierTypeFlag_NoUserAdd = (1<<8)
+ eModifierTypeFlag_NoUserAdd = (1<<8),
+
+ /* For modifiers that use CD_WEIGHT_MCOL for preview. */
+ eModifierTypeFlag_UsesPreview = (1<<9)
} ModifierTypeFlag;
typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin);
@@ -324,6 +327,7 @@ void modifier_setError(struct ModifierData *md, const char *format, ...
__attribute__ ((format (printf, 2, 3)))
#endif
;
+int modifier_isPreview(struct ModifierData *md);
void modifiers_foreachObjectLink(struct Object *ob,
ObjectWalkFunc walk,
@@ -350,6 +354,7 @@ struct Object *modifiers_isDeformedByLattice(struct Object *ob);
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
int modifiers_isCorrectableDeformed(struct Object *ob);
void modifier_freeTemporaryData(struct ModifierData *md);
+int modifiers_isPreview(struct Object *ob);
int modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
@@ -363,6 +368,9 @@ struct LinkNode *modifiers_calcDataMasks(struct Scene *scene,
struct ModifierData *md,
CustomDataMask dataMask,
int required_mode);
+struct ModifierData *modifiers_getLastPreview(struct Scene *scene,
+ struct ModifierData *md,
+ int required_mode);
struct ModifierData *modifiers_getVirtualModifierList(struct Object *ob);
/* ensure modifier correctness when changing ob->data */
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 282696e2ccd..6a98ab324cb 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -986,24 +986,23 @@ void vDM_ColorBand_store(ColorBand *coba)
* note that we could save some memory and allocate RGB only but then we'd need to
* re-arrange the colors when copying to the face since MCol has odd ordering,
* so leave this as is - campbell */
-static unsigned char *calc_weightpaint_vert_array(Object *ob, int const draw_flag, ColorBand *coba)
+static unsigned char *calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, int const draw_flag, ColorBand *coba)
{
- Mesh *me = ob->data;
- unsigned char *wtcol_v = MEM_mallocN (sizeof(unsigned char) * me->totvert * 4, "weightmap_v");
+ MDeformVert *dv = DM_get_vert_data_layer(dm, CD_MDEFORMVERT);
+ int numVerts = dm->getNumVerts(dm);
+ unsigned char *wtcol_v = MEM_mallocN (sizeof(unsigned char) * numVerts * 4, "weightmap_v");
- if (me->dvert) {
+ if (dv) {
unsigned char *wc = wtcol_v;
- MDeformVert *dv= me->dvert;
unsigned int i;
- /* varisbles for multipaint */
+ /* variables for multipaint */
const int defbase_tot = BLI_countlist(&ob->defbase);
const int defbase_act = ob->actdef-1;
char *dg_flags = MEM_mallocN(defbase_tot * sizeof(char), __func__);
const int selected = get_selected_defgroups(ob, dg_flags, defbase_tot);
- /* const int unselected = defbase_tot - selected; */ /* UNUSED */
- for (i = me->totvert; i != 0; i--, wc += 4, dv++) {
+ for (i = numVerts; i != 0; i--, wc += 4, dv++) {
calc_weightpaint_vert_color(wc, dv, coba, defbase_tot, defbase_act, dg_flags, selected, draw_flag);
}
@@ -1012,69 +1011,128 @@ static unsigned char *calc_weightpaint_vert_array(Object *ob, int const draw_fla
else {
int col_i;
weightpaint_color((unsigned char *)&col_i, coba, 0.0f);
- fill_vn_i((int *)wtcol_v, me->totvert, col_i);
+ fill_vn_i((int *)wtcol_v, numVerts, col_i);
}
return wtcol_v;
}
-static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm, int const draw_flag)
+/* return an array of vertex weight colors from given weights, caller must free.
+ *
+ * note that we could save some memory and allocate RGB only but then we'd need to
+ * re-arrange the colors when copying to the face since MCol has odd ordering,
+ * so leave this as is - campbell */
+static unsigned char *calc_colors_from_weights_array(const int num, float *weights)
+{
+ unsigned char *wtcol_v = MEM_mallocN(sizeof(unsigned char) * num * 4, "weightmap_v");
+ unsigned char *wc = wtcol_v;
+ int i;
+
+ for (i = 0; i < num; i++, wc += 4, weights++)
+ weightpaint_color((unsigned char *) wc, NULL, *weights);
+
+ return wtcol_v;
+}
+
+void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
+ float *weights, int num, const int *indices)
{
ColorBand *coba= stored_cb; /* warning, not a local var */
- unsigned char *wtcol_v = calc_weightpaint_vert_array(ob, draw_flag, coba);
- unsigned char *wtcol_f;
- unsigned char(*wtcol_l)[4] = NULL;
- BLI_array_declare(wtcol_l);
+
+ unsigned char *wtcol_v;
+ unsigned char *wtcol_f = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
+ unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_WEIGHT_MLOOPCOL);
MFace *mf = dm->getTessFaceArray(dm);
MLoop *mloop = dm->getLoopArray(dm), *ml;
MPoly *mp = dm->getPolyArray(dm);
- int i, j, totface=dm->getNumTessFaces(dm), totloop;
- int *origIndex = dm->getVertDataArray(dm, CD_ORIGINDEX);
- unsigned char *wtcol_f_step;
+ int numFaces = dm->getNumTessFaces(dm);
+ int numVerts = dm->getNumVerts(dm);
+ int totloop;
+ int i, j;
+
+ /* If no CD_WEIGHT_MCOL existed yet, add a new one! */
+ if (!wtcol_f)
+ wtcol_f = CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+
+ if (wtcol_f) {
+ unsigned char *wtcol_f_step = wtcol_f;
+
+ /* Weights are given by caller. */
+ if (weights) {
+ float *w = weights;
+ /* If indices is not NULL, it means we do not have weights for all vertices,
+ * so we must create them (and set them to zero)... */
+ if(indices) {
+ w = MEM_callocN(sizeof(float)*numVerts, "Temp weight array DM_update_weight_mcol");
+ i = num;
+ while(i--)
+ w[indices[i]] = weights[i];
+ }
+
+ /* Convert float weights to colors. */
+ wtcol_v = calc_colors_from_weights_array(numVerts, w);
+
+ if(indices)
+ MEM_freeN(w);
+ }
- wtcol_f = MEM_mallocN(sizeof (unsigned char) * totface*4*4, "weightmap_f");
- wtcol_f_step = wtcol_f;
+ /* No weights given, take them from active vgroup(s). */
+ else
+ wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba);
- /*first add colors to the tesselation faces*/
- for (i=0; i<totface; i++, mf++, wtcol_f_step += (4 * 4)) {
- /*origindex being NULL means we're operating on original mesh data*/
+ /* Now copy colors in all face verts. */
+ /*first add colors to the tesselation faces*/
+ for (i = 0; i < numFaces; i++, mf++, wtcol_f_step += (4 * 4)) {
+ /*origindex being NULL means we're operating on original mesh data*/
#if 0
- unsigned int fidx= mf->v4 ? 3:2;
+ unsigned int fidx= mf->v4 ? 3:2;
#else /* better zero out triangles 4th component. else valgrind complains when the buffer's copied */
- unsigned int fidx;
- if (mf->v4) {
- fidx = 3;
- }
- else {
- fidx = 2;
- *(int *)(&wtcol_f_step[3 * 4]) = 0;
- }
+ unsigned int fidx;
+ if (mf->v4) {
+ fidx = 3;
+ }
+ else {
+ fidx = 2;
+ *(int *)(&wtcol_f_step[3 * 4]) = 0;
+ }
#endif
- do {
- copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4],
- (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]);
- } while (fidx--);
- }
-
- CustomData_add_layer(&dm->faceData, CD_WEIGHT_MCOL, CD_ASSIGN, wtcol_f, totface);
+ do {
+ copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4],
+ (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]);
+ } while (fidx--);
+ }
- /*now add to loops, so the data can be passed through the modifier stack*/
- totloop = 0;
- for (i=0; i<dm->numPolyData; i++, mp++) {
- ml = mloop + mp->loopstart;
+ /*now add to loops, so the data can be passed through the modifier stack*/
+ /* If no CD_WEIGHT_MLOOPCOL existed yet, we have to add a new one! */
+ if (!wtcol_l) {
+ BLI_array_declare(wtcol_l);
+ totloop = 0;
+ for (i=0; i<dm->numPolyData; i++, mp++) {
+ ml = mloop + mp->loopstart;
+
+ for (j=0; j<mp->totloop; j++, ml++, totloop++) {
+ BLI_array_growone(wtcol_l);
+ copy_v4_v4_char((char *)&wtcol_l[totloop],
+ (char *)&wtcol_v[4 * ml->v]);
+ }
+ }
+ CustomData_add_layer(&dm->loopData, CD_WEIGHT_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
+ }
+ else {
+ totloop = 0;
+ for (i=0; i < dm->numPolyData; i++, mp++) {
+ ml = mloop + mp->loopstart;
- for (j=0; j<mp->totloop; j++, ml++, totloop++) {
- BLI_array_growone(wtcol_l);
- copy_v4_v4_char((char *)&wtcol_l[totloop],
- (char *)&wtcol_v[4 * (origIndex ? origIndex[ml->v] : ml->v)]);
+ for (j=0; j < mp->totloop; j++, ml++, totloop++) {
+ copy_v4_v4_char((char *)&wtcol_l[totloop],
+ (char *)&wtcol_v[4 * ml->v]);
+ }
+ }
}
+ MEM_freeN(wtcol_v);
}
-
- MEM_freeN(wtcol_v);
-
- CustomData_add_layer(&dm->loopData, CD_WEIGHT_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop);
}
@@ -1175,7 +1233,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
int index, int useCache, int build_shapekey_layers)
{
Mesh *me = ob->data;
- ModifierData *firstmd, *md;
+ ModifierData *firstmd, *md, *previewmd = NULL;
LinkNode *datamasks, *curr;
CustomDataMask mask, nextmask, append_mask = 0;
float (*deformedVerts)[3] = NULL;
@@ -1188,8 +1246,17 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
int has_multires = mmd != NULL, multires_applied = 0;
int sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt;
- int draw_flag= ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
- (scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
+ const int draw_flag= ((scene->toolsettings->multipaint ? CALC_WP_MULTIPAINT : 0) |
+ (scene->toolsettings->auto_normalize ? CALC_WP_AUTO_NORMALIZE : 0));
+ /* Generic preview only in object mode! */
+ const int do_mod_mcol = (ob->mode == OB_MODE_OBJECT);
+#if 0 /* XXX Will re-enable this when we have global mod stack options. */
+ const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol;
+#endif
+ const int do_final_wmcol = FALSE;
+ int do_init_wmcol = ((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol);
+ /* XXX Same as above... For now, only weights preview in WPaint mode. */
+ const int do_mod_wmcol = do_init_wmcol;
if(mmd && !mmd->sculptlvl)
has_multires = 0;
@@ -1214,6 +1281,14 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode);
curr = datamasks;
+ if(do_mod_wmcol || do_mod_mcol) {
+ /* Find the last active modifier generating a preview, or NULL if none. */
+ /* XXX Currently, DPaint modifier just ignores this.
+ * Needs a stupid hack...
+ * The whole "modifier preview" thing has to be (re?)designed, anyway! */
+ previewmd = modifiers_getLastPreview(scene, md, required_mode);
+ }
+
if(deform_r) *deform_r = NULL;
*final_r = NULL;
@@ -1375,6 +1450,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
CDDM_calc_normals(dm);
}
+ if(do_init_wmcol)
+ DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
+
/* Constructive modifiers need to have an origindex
* otherwise they wont have anywhere to copy the data from.
*
@@ -1393,8 +1471,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
range_vn_i(DM_get_poly_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0);
}
- if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
- add_weight_mcol_dm(ob, dm, draw_flag);
+/* if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))*/
+/* add_weight_mcol_dm(ob, dm, draw_flag);*/
}
@@ -1464,8 +1542,14 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
}
/* in case of dynamic paint, make sure preview mask remains for following modifiers */
+ /* XXX Temp and hackish solution! */
if (md->type == eModifierType_DynamicPaint)
append_mask |= CD_MASK_WEIGHT_MCOL;
+ /* In case of active preview modifier, make sure preview mask remains for following modifiers. */
+ else if ((md == previewmd) && (do_mod_wmcol)) {
+ DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
+ append_mask |= CD_MASK_WEIGHT_MCOL;
+ }
}
isPrevDeform= (mti->type == eModifierTypeType_OnlyDeform);
@@ -1493,10 +1577,19 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
CDDM_apply_vert_coords(finaldm, deformedVerts);
CDDM_calc_normals(finaldm);
- if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
- add_weight_mcol_dm(ob, finaldm, draw_flag);
+#if 0 /* For later nice mod preview! */
+ /* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
+ if(do_final_wmcol)
+ DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
+#endif
} else if(dm) {
finaldm = dm;
+
+#if 0 /* For later nice mod preview! */
+ /* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
+ if(do_final_wmcol)
+ DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
+#endif
} else {
int recalc_normals= 0;
@@ -1512,11 +1605,13 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
recalc_normals= 1;
}
- if(recalc_normals)
+ if(recalc_normals) {
CDDM_calc_normals(finaldm);
-
- if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
- add_weight_mcol_dm(ob, finaldm, draw_flag);
+ }
+
+ /* In this case, we should never have weight-modifying modifiers in stack... */
+ if(do_init_wmcol)
+ DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
}
/* add an orco layer if needed */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index b8d44a07051..d5d1afef954 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -1574,7 +1574,6 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
int update_normals = 0;
- pmd->canvas->flags &= ~MOD_DPAINT_PREVIEW_READY;
/* loop through surfaces */
for (; surface; surface=surface->next) {
@@ -1655,7 +1654,6 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
}
}
}
- pmd->canvas->flags |= MOD_DPAINT_PREVIEW_READY;
}
}
@@ -1711,24 +1709,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
if (0 && surface->flags & MOD_DPAINT_PREVIEW) {
/* Save preview results to weight layer to be
* able to share same drawing methods */
- int i;
- MLoopCol *col = CustomData_get_layer(&dm->loopData, CD_WEIGHT_MLOOPCOL);
- if (!col) col = CustomData_add_layer(&dm->loopData, CD_WEIGHT_MLOOPCOL, CD_CALLOC, NULL, totloop);
-
- if (col) {
- printf("doint weight preview\n");
- #pragma omp parallel for schedule(static)
- for (i=0; i<totloop; i++) {
- float temp_color[3];
- weight_to_rgb(temp_color, weight[mloop[i].v]);
-
- col[i].a = 255;
- col[i].r = FTOCHAR(temp_color[2]);
- col[i].g = FTOCHAR(temp_color[1]);
- col[i].b = FTOCHAR(temp_color[0]);
- }
- pmd->canvas->flags |= MOD_DPAINT_PREVIEW_READY;
- }
+ DM_update_weight_mcol(ob, result, 0, weight, 0, NULL);
}
/* apply weights into a vertex group, if doesnt exists add a new layer */
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 5a389019519..911d303b4cf 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -142,6 +142,19 @@ int modifier_supportsMapping(ModifierData *md)
(mti->flags & eModifierTypeFlag_SupportsMapping));
}
+int modifier_isPreview(ModifierData *md)
+{
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+
+ if (!(mti->flags & eModifierTypeFlag_UsesPreview))
+ return FALSE;
+
+ if (md->mode & eModifierMode_Realtime)
+ return TRUE;
+
+ return FALSE;
+}
+
ModifierData *modifiers_findByType(Object *ob, ModifierType type)
{
ModifierData *md = ob->modifiers.first;
@@ -385,6 +398,21 @@ LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData
return dataMasks;
}
+ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, int required_mode)
+{
+ ModifierData *tmp_md = NULL;
+
+ if (required_mode != eModifierMode_Realtime)
+ return tmp_md;
+
+ /* Find the latest modifier in stack generating preview. */
+ for(; md; md = md->next) {
+ if(modifier_isEnabled(scene, md, required_mode) && modifier_isPreview(md))
+ tmp_md = md;
+ }
+ return tmp_md;
+}
+
ModifierData *modifiers_getVirtualModifierList(Object *ob)
{
/* Kinda hacky, but should be fine since we are never
@@ -545,6 +573,20 @@ int modifiers_isCorrectableDeformed(Object *ob)
return 0;
}
+/* Check whether the given object has a modifier in its stack that uses WEIGHT_MCOL CD layer
+ * to preview something... Used by DynamicPaint and WeightVG currently. */
+int modifiers_isPreview(Object *ob)
+{
+ ModifierData *md = ob->modifiers.first;
+
+ for (; md; md = md->next) {
+ if (modifier_isPreview(md))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
int modifiers_indexInObject(Object *ob, ModifierData *md_seek)
{
int i= 0;