From 158b4e61a050a25fec47a00797ab7db46fc3198c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 22 Dec 2013 04:35:52 +1100 Subject: Mesh Modifiers: refactor copying using a generic function --- source/blender/blenkernel/BKE_modifier.h | 1 + source/blender/blenkernel/intern/modifier.c | 13 +++++++++++ source/blender/makesdna/DNA_modifier_types.h | 4 ++-- source/blender/modifiers/intern/MOD_array.c | 16 +++---------- source/blender/modifiers/intern/MOD_boolean.c | 6 ++--- source/blender/modifiers/intern/MOD_build.c | 8 +++---- source/blender/modifiers/intern/MOD_cast.c | 11 +++------ source/blender/modifiers/intern/MOD_curve.c | 7 +++--- source/blender/modifiers/intern/MOD_decimate.c | 10 +++----- source/blender/modifiers/intern/MOD_displace.c | 11 +++------ source/blender/modifiers/intern/MOD_edgesplit.c | 6 ++--- source/blender/modifiers/intern/MOD_explode.c | 7 +++--- source/blender/modifiers/intern/MOD_hook.c | 10 ++------ .../blender/modifiers/intern/MOD_laplaciandeform.c | 7 +++--- .../blender/modifiers/intern/MOD_laplaciansmooth.c | 8 +++---- source/blender/modifiers/intern/MOD_lattice.c | 5 ++-- source/blender/modifiers/intern/MOD_mask.c | 8 +++---- source/blender/modifiers/intern/MOD_meshcache.c | 27 +++------------------- source/blender/modifiers/intern/MOD_mirror.c | 7 +++--- source/blender/modifiers/intern/MOD_multires.c | 10 +++----- .../modifiers/intern/MOD_particleinstance.c | 10 +++----- .../blender/modifiers/intern/MOD_particlesystem.c | 8 +++---- source/blender/modifiers/intern/MOD_remesh.c | 10 +++----- source/blender/modifiers/intern/MOD_screw.c | 12 +++------- source/blender/modifiers/intern/MOD_shrinkwrap.c | 14 +++-------- source/blender/modifiers/intern/MOD_simpledeform.c | 10 +++----- source/blender/modifiers/intern/MOD_skin.c | 5 ++-- source/blender/modifiers/intern/MOD_smooth.c | 8 +++---- source/blender/modifiers/intern/MOD_solidify.c | 14 +++-------- source/blender/modifiers/intern/MOD_subsurf.c | 10 ++++---- source/blender/modifiers/intern/MOD_triangulate.c | 5 ++-- source/blender/modifiers/intern/MOD_uvproject.c | 19 +++------------ source/blender/modifiers/intern/MOD_uvwarp.c | 13 +++-------- source/blender/modifiers/intern/MOD_warp.c | 13 +---------- source/blender/modifiers/intern/MOD_wave.c | 19 +++------------ source/blender/modifiers/intern/MOD_weightvgedit.c | 19 ++------------- source/blender/modifiers/intern/MOD_weightvgmix.c | 17 +++----------- .../modifiers/intern/MOD_weightvgproximity.c | 19 +++------------ 38 files changed, 122 insertions(+), 285 deletions(-) diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 3275adf79fa..25dee613d20 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -318,6 +318,7 @@ void modifier_free(struct ModifierData *md); void modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md); +void modifier_copyData_generic(const struct ModifierData *md, struct ModifierData *target); void modifier_copyData(struct ModifierData *md, struct ModifierData *target); bool modifier_dependsOnTime(struct ModifierData *md); bool modifier_supportsMapping(struct ModifierData *md); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 4d2f6971f64..f9a0d462ac0 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -253,6 +253,19 @@ void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData) } } +/* callback's can use this + * to avoid copying every member. + */ +void modifier_copyData_generic(const ModifierData *md_src, ModifierData *md_dst) +{ + ModifierTypeInfo *mti = modifierType_getInfo(md_src->type); + const size_t data_size = sizeof(ModifierData); + const char *md_src_data = ((char *)md_src) + data_size; + char *md_dst_data = ((char *)md_dst) + data_size; + BLI_assert(data_size <= (size_t)mti->structSize); + memcpy(md_dst_data, md_src_data, (size_t)mti->structSize - data_size); +} + void modifier_copyData(ModifierData *md, ModifierData *target) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 92055fdcc05..b3c7427074c 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -646,7 +646,7 @@ typedef struct ParticleSystemModifierData { struct ParticleSystem *psys; struct DerivedMesh *dm; int totdmvert, totdmedge, totdmface; - short flag, rt; + short flag, pad; } ParticleSystemModifierData; typedef enum { @@ -670,7 +670,7 @@ typedef struct ParticleInstanceModifierData { ModifierData modifier; struct Object *ob; - short psys, flag, axis, rt; + short psys, flag, axis, pad; float position, random_position; } ParticleInstanceModifierData; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index bc38b0e030b..2bf7bb5f672 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -84,21 +84,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ArrayModifierData *amd = (ArrayModifierData *) md; ArrayModifierData *tamd = (ArrayModifierData *) target; - - tamd->start_cap = amd->start_cap; - tamd->end_cap = amd->end_cap; - tamd->curve_ob = amd->curve_ob; - tamd->offset_ob = amd->offset_ob; - tamd->count = amd->count; - copy_v3_v3(tamd->offset, amd->offset); - copy_v3_v3(tamd->scale, amd->scale); - tamd->length = amd->length; - tamd->merge_dist = amd->merge_dist; - tamd->fit_type = amd->fit_type; - tamd->offset_type = amd->offset_type; - tamd->flags = amd->flags; +#endif + modifier_copyData_generic(md, target); } static void foreachObjectLink( diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 03d40eb58f1..bee7a32f6aa 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -52,11 +52,11 @@ static void copyData(ModifierData *md, ModifierData *target) { +#if 0 BooleanModifierData *bmd = (BooleanModifierData *) md; BooleanModifierData *tbmd = (BooleanModifierData *) target; - - tbmd->object = bmd->object; - tbmd->operation = bmd->operation; +#endif + modifier_copyData_generic(md, target); } static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index a54cc80839b..d74044fa1ef 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -62,13 +62,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 BuildModifierData *bmd = (BuildModifierData *) md; BuildModifierData *tbmd = (BuildModifierData *) target; - - tbmd->start = bmd->start; - tbmd->length = bmd->length; - tbmd->randomize = bmd->randomize; - tbmd->seed = bmd->seed; +#endif + modifier_copyData_generic(md, target); } static bool dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 05b51c2cf4b..44cf240816e 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -66,16 +66,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 CastModifierData *cmd = (CastModifierData *) md; CastModifierData *tcmd = (CastModifierData *) target; - - tcmd->fac = cmd->fac; - tcmd->radius = cmd->radius; - tcmd->size = cmd->size; - tcmd->flag = cmd->flag; - tcmd->type = cmd->type; - tcmd->object = cmd->object; - BLI_strncpy(tcmd->defgrp_name, cmd->defgrp_name, sizeof(tcmd->defgrp_name)); +#endif + modifier_copyData_generic(md, target); } static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 28749d5ce90..28042185de0 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -59,12 +59,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 CurveModifierData *cmd = (CurveModifierData *) md; CurveModifierData *tcmd = (CurveModifierData *) target; - - tcmd->defaxis = cmd->defaxis; - tcmd->object = cmd->object; - BLI_strncpy(tcmd->name, cmd->name, sizeof(tcmd->name)); +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index e4399d1e416..155ccf034d7 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -70,15 +70,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 DecimateModifierData *dmd = (DecimateModifierData *) md; DecimateModifierData *tdmd = (DecimateModifierData *) target; - - tdmd->percent = dmd->percent; - tdmd->iter = dmd->iter; - tdmd->angle = dmd->angle; - BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, sizeof(tdmd->defgrp_name)); - tdmd->flag = dmd->flag; - tdmd->mode = dmd->mode; +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 61f5495bee8..54f2e688f31 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -69,17 +69,12 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 DisplaceModifierData *dmd = (DisplaceModifierData *) md; +#endif DisplaceModifierData *tdmd = (DisplaceModifierData *) target; - tdmd->texture = dmd->texture; - tdmd->strength = dmd->strength; - tdmd->direction = dmd->direction; - BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, sizeof(tdmd->defgrp_name)); - tdmd->midlevel = dmd->midlevel; - tdmd->texmapping = dmd->texmapping; - tdmd->map_object = dmd->map_object; - BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, sizeof(tdmd->uvlayer_name)); + modifier_copyData_generic(md, target); if (tdmd->texture) { id_us_plus(&tdmd->texture->id); diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index a17858d58f5..609d37a1327 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -113,11 +113,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md; EdgeSplitModifierData *temd = (EdgeSplitModifierData *) target; - - temd->split_angle = emd->split_angle; - temd->flags = emd->flags; +#endif + modifier_copyData_generic(md, target); } static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DerivedMesh *dm, diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 9fd11f78ea0..aef6a12e8ff 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -72,13 +72,14 @@ static void freeData(ModifierData *md) } static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ExplodeModifierData *emd = (ExplodeModifierData *) md; +#endif ExplodeModifierData *temd = (ExplodeModifierData *) target; + modifier_copyData_generic(md, target); + temd->facepa = NULL; - temd->flag = emd->flag; - temd->protect = emd->protect; - temd->vgroup = emd->vgroup; } static bool dependsOnTime(ModifierData *UNUSED(md)) { diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 4e8af650cb2..31aad533727 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -64,15 +64,9 @@ static void copyData(ModifierData *md, ModifierData *target) HookModifierData *hmd = (HookModifierData *) md; HookModifierData *thmd = (HookModifierData *) target; - copy_v3_v3(thmd->cent, hmd->cent); - thmd->falloff = hmd->falloff; - thmd->force = hmd->force; - thmd->object = hmd->object; - thmd->totindex = hmd->totindex; + modifier_copyData_generic(md, target); + thmd->indexar = MEM_dupallocN(hmd->indexar); - memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv)); - BLI_strncpy(thmd->name, hmd->name, sizeof(thmd->name)); - BLI_strncpy(thmd->subtarget, hmd->subtarget, sizeof(thmd->subtarget)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 5040ffbe916..defd287034e 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -797,12 +797,11 @@ static void copyData(ModifierData *md, ModifierData *target) { LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md; LaplacianDeformModifierData *tlmd = (LaplacianDeformModifierData *)target; - tlmd->total_verts = lmd->total_verts; - tlmd->repeat = lmd->repeat; - BLI_strncpy(tlmd->anchor_grp_name, lmd->anchor_grp_name, sizeof(tlmd->anchor_grp_name)); + + modifier_copyData_generic(md, target); + tlmd->vertexco = MEM_dupallocN(lmd->vertexco); tlmd->cache_system = MEM_dupallocN(lmd->cache_system); - tlmd->flag = lmd->flag; } static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index f97818a02d4..ed562afaf11 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -642,14 +642,12 @@ static void init_data(ModifierData *md) static void copy_data(ModifierData *md, ModifierData *target) { +#if 0 LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md; LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target; +#endif - tsmd->lambda = smd->lambda; - tsmd->lambda_border = smd->lambda_border; - tsmd->repeat = smd->repeat; - tsmd->flag = smd->flag; - BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); + modifier_copyData_generic(md, target); } static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index b83323d9141..76db877c229 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -56,11 +56,12 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 LatticeModifierData *lmd = (LatticeModifierData *) md; LatticeModifierData *tlmd = (LatticeModifierData *) target; +#endif - tlmd->object = lmd->object; - BLI_strncpy(tlmd->name, lmd->name, sizeof(tlmd->name)); + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 839e30d9c1a..e754ac8f766 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -57,13 +57,11 @@ static void copyData(ModifierData *md, ModifierData *target) { +#if 0 MaskModifierData *mmd = (MaskModifierData *) md; MaskModifierData *tmmd = (MaskModifierData *) target; - - BLI_strncpy(tmmd->vgroup, mmd->vgroup, sizeof(tmmd->vgroup)); - tmmd->flag = mmd->flag; - tmmd->mode = mmd->mode; - tmmd->ob_arm = mmd->ob_arm; +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 6d5caaa3ad1..925d9691892 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -68,32 +68,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md; MeshCacheModifierData *tmcmd = (MeshCacheModifierData *)target; - - tmcmd->flag = mcmd->flag; - tmcmd->type = mcmd->type; - - tmcmd->time_mode = mcmd->time_mode; - tmcmd->play_mode = mcmd->play_mode; - - tmcmd->forward_axis = mcmd->forward_axis; - tmcmd->up_axis = mcmd->up_axis; - tmcmd->flip_axis = mcmd->flip_axis; - - tmcmd->interp = mcmd->interp; - - tmcmd->frame_start = mcmd->frame_start; - tmcmd->frame_scale = mcmd->frame_scale; - - tmcmd->factor = mcmd->factor; - tmcmd->deform_mode = mcmd->deform_mode; - - tmcmd->eval_frame = mcmd->eval_frame; - tmcmd->eval_time = mcmd->eval_time; - tmcmd->eval_factor = mcmd->eval_factor; - - BLI_strncpy(tmcmd->filepath, mcmd->filepath, sizeof(tmcmd->filepath)); +#endif + modifier_copyData_generic(md, target); } static bool dependsOnTime(ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index ec09b80dc5a..7f8fb851668 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -59,12 +59,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 MirrorModifierData *mmd = (MirrorModifierData *) md; MirrorModifierData *tmmd = (MirrorModifierData *) target; - - tmmd->flag = mmd->flag; - tmmd->tolerance = mmd->tolerance; - tmmd->mirror_ob = mmd->mirror_ob; +#endif + modifier_copyData_generic(md, target); } static void foreachObjectLink(ModifierData *md, Object *ob, diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 848f7ee0fc1..b3b08ce5c85 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -61,15 +61,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 MultiresModifierData *mmd = (MultiresModifierData *) md; MultiresModifierData *tmmd = (MultiresModifierData *) target; - - tmmd->lvl = mmd->lvl; - tmmd->sculptlvl = mmd->sculptlvl; - tmmd->renderlvl = mmd->renderlvl; - tmmd->totlvl = mmd->totlvl; - tmmd->simple = mmd->simple; - tmmd->flags = mmd->flags; +#endif + modifier_copyData_generic(md, target); } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index c51fa329df2..a493db139a0 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -66,15 +66,11 @@ static void initData(ModifierData *md) } static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md; ParticleInstanceModifierData *tpimd = (ParticleInstanceModifierData *) target; - - tpimd->ob = pimd->ob; - tpimd->psys = pimd->psys; - tpimd->flag = pimd->flag; - tpimd->axis = pimd->axis; - tpimd->position = pimd->position; - tpimd->random_position = pimd->random_position; +#endif + modifier_copyData_generic(md, target); } static bool isDisabled(ModifierData *md, int useRenderParams) diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 327ae577108..8e72c49740f 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -73,15 +73,15 @@ static void freeData(ModifierData *md) } static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md; +#endif ParticleSystemModifierData *tpsmd = (ParticleSystemModifierData *) target; + modifier_copyData_generic(md, target); + tpsmd->dm = NULL; tpsmd->totdmvert = tpsmd->totdmedge = tpsmd->totdmface = 0; - //tpsmd->facepa = 0; - tpsmd->flag = psmd->flag; - /* need to keep this to recognise a bit later in BKE_object_copy */ - tpsmd->psys = psmd->psys; } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index c8fdbc535bc..8f0db9f8ebf 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -62,15 +62,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 RemeshModifierData *rmd = (RemeshModifierData *) md; RemeshModifierData *trmd = (RemeshModifierData *) target; - - trmd->threshold = rmd->threshold; - trmd->scale = rmd->scale; - trmd->hermite_num = rmd->hermite_num; - trmd->depth = rmd->depth; - trmd->flag = rmd->flag; - trmd->mode = rmd->mode; +#endif + modifier_copyData_generic(md, target); } #ifdef WITH_MOD_REMESH diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 640ed926908..9e5b4fad439 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -124,17 +124,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ScrewModifierData *sltmd = (ScrewModifierData *) md; ScrewModifierData *tltmd = (ScrewModifierData *) target; - - tltmd->ob_axis = sltmd->ob_axis; - tltmd->angle = sltmd->angle; - tltmd->axis = sltmd->axis; - tltmd->flag = sltmd->flag; - tltmd->steps = sltmd->steps; - tltmd->render_steps = sltmd->render_steps; - tltmd->screw_ofs = sltmd->screw_ofs; - tltmd->iter = sltmd->iter; +#endif + modifier_copyData_generic(md, target); } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index e06c4f22553..6e96a160cd4 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -64,19 +64,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md; ShrinkwrapModifierData *tsmd = (ShrinkwrapModifierData *)target; - - tsmd->target = smd->target; - tsmd->auxTarget = smd->auxTarget; - - BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); - - tsmd->keepDist = smd->keepDist; - tsmd->shrinkType = smd->shrinkType; - tsmd->shrinkOpts = smd->shrinkOpts; - tsmd->projAxis = smd->projAxis; - tsmd->subsurfLevels = smd->subsurfLevels; +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 3c1f15a933d..fdc5578c049 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -255,15 +255,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md; SimpleDeformModifierData *tsmd = (SimpleDeformModifierData *)target; - - tsmd->mode = smd->mode; - tsmd->axis = smd->axis; - tsmd->origin = smd->origin; - tsmd->factor = smd->factor; - copy_v2_v2(tsmd->limit, smd->limit); - BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 90c37459d31..a031cd10ca8 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1835,10 +1835,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 SkinModifierData *smd = (SkinModifierData *) md; SkinModifierData *tsmd = (SkinModifierData *) target; - - *tsmd = *smd; +#endif + modifier_copyData_generic(md, target); } static DerivedMesh *applyModifier(ModifierData *md, diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 96d7d5956c5..eb8c62cfd89 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -61,13 +61,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 SmoothModifierData *smd = (SmoothModifierData *) md; SmoothModifierData *tsmd = (SmoothModifierData *) target; - - tsmd->fac = smd->fac; - tsmd->repeat = smd->repeat; - tsmd->flag = smd->flag; - BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); +#endif + modifier_copyData_generic(md, target); } static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 2696a3e156b..534f4532733 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -176,19 +176,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 SolidifyModifierData *smd = (SolidifyModifierData *) md; SolidifyModifierData *tsmd = (SolidifyModifierData *) target; - tsmd->offset = smd->offset; - tsmd->offset_fac = smd->offset_fac; - tsmd->offset_fac_vg = smd->offset_fac_vg; - tsmd->offset_clamp = smd->offset_clamp; - tsmd->crease_inner = smd->crease_inner; - tsmd->crease_outer = smd->crease_outer; - tsmd->crease_rim = smd->crease_rim; - tsmd->flag = smd->flag; - tsmd->mat_ofs = smd->mat_ofs; - tsmd->mat_ofs_rim = smd->mat_ofs_rim; - BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 4e2656bbf00..3de85047ebf 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -60,13 +60,15 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 SubsurfModifierData *smd = (SubsurfModifierData *) md; +#endif SubsurfModifierData *tsmd = (SubsurfModifierData *) target; - tsmd->flags = smd->flags; - tsmd->levels = smd->levels; - tsmd->renderLevels = smd->renderLevels; - tsmd->subdivType = smd->subdivType; + modifier_copyData_generic(md, target); + + tsmd->emCache = tsmd->mCache = NULL; + } static void freeData(ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index d519c981a23..182c339abfd 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -76,10 +76,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 TriangulateModifierData *smd = (TriangulateModifierData *) md; TriangulateModifierData *tsmd = (TriangulateModifierData *) target; - - *tsmd = *smd; +#endif + modifier_copyData_generic(md, target); } static DerivedMesh *applyModifier(ModifierData *md, diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index ad1e2a464a8..8ded9847c2a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -59,11 +59,7 @@ static void initData(ModifierData *md) { UVProjectModifierData *umd = (UVProjectModifierData *) md; - int i; - for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) - umd->projectors[i] = NULL; - umd->image = NULL; umd->flags = 0; umd->num_projectors = 1; umd->aspectx = umd->aspecty = 1.0f; @@ -72,20 +68,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 UVProjectModifierData *umd = (UVProjectModifierData *) md; UVProjectModifierData *tumd = (UVProjectModifierData *) target; - int i; - - for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i) - tumd->projectors[i] = umd->projectors[i]; - tumd->image = umd->image; - tumd->flags = umd->flags; - tumd->num_projectors = umd->num_projectors; - tumd->aspectx = umd->aspectx; - tumd->aspecty = umd->aspecty; - tumd->scalex = umd->scalex; - tumd->scaley = umd->scaley; - BLI_strncpy(tumd->uvlayer_name, umd->uvlayer_name, sizeof(umd->uvlayer_name)); +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index 240daa52400..4640a36909b 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -68,18 +68,11 @@ static void initData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 UVWarpModifierData *umd = (UVWarpModifierData *)md; UVWarpModifierData *tumd = (UVWarpModifierData *)target; - - tumd->axis_u = umd->axis_u; - tumd->axis_v = umd->axis_v; - copy_v2_v2(tumd->center, umd->center); - tumd->object_src = umd->object_src; - BLI_strncpy(tumd->bone_src, umd->bone_src, sizeof(tumd->bone_src)); - tumd->object_dst = umd->object_dst; - BLI_strncpy(tumd->bone_dst, umd->bone_dst, sizeof(tumd->bone_dst)); - BLI_strncpy(tumd->vgroup_name, umd->vgroup_name, sizeof(tumd->vgroup_name)); - BLI_strncpy(tumd->uvlayer_name, umd->uvlayer_name, sizeof(umd->uvlayer_name)); +#endif + modifier_copyData_generic(md, target); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 83b05ae708a..e6d6c629681 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -66,20 +66,9 @@ static void copyData(ModifierData *md, ModifierData *target) WarpModifierData *wmd = (WarpModifierData *) md; WarpModifierData *twmd = (WarpModifierData *) target; - twmd->object_from = wmd->object_from; - twmd->object_to = wmd->object_to; + modifier_copyData_generic(md, target); - twmd->strength = wmd->strength; - twmd->falloff_radius = wmd->falloff_radius; - twmd->falloff_type = wmd->falloff_type; - BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); twmd->curfalloff = curvemapping_copy(wmd->curfalloff); - - /* map info */ - twmd->texture = wmd->texture; - twmd->map_object = wmd->map_object; - BLI_strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); - twmd->texmapping = wmd->texmapping; } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 168907e293c..1a81b1fdf4c 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -89,25 +89,12 @@ static void freeData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 WaveModifierData *wmd = (WaveModifierData *) md; +#endif WaveModifierData *twmd = (WaveModifierData *) target; - twmd->damp = wmd->damp; - twmd->flag = wmd->flag; - twmd->height = wmd->height; - twmd->lifetime = wmd->lifetime; - twmd->narrow = wmd->narrow; - twmd->speed = wmd->speed; - twmd->startx = wmd->startx; - twmd->starty = wmd->starty; - twmd->timeoffs = wmd->timeoffs; - twmd->width = wmd->width; - twmd->falloff = wmd->falloff; - twmd->objectcenter = wmd->objectcenter; - twmd->texture = wmd->texture; - twmd->map_object = wmd->map_object; - twmd->texmapping = wmd->texmapping; - BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + modifier_copyData_generic(md, target); if (twmd->texture) { id_us_plus(&twmd->texture->id); diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index c8da0eb6de7..fee4e81cb2d 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -89,24 +89,9 @@ static void copyData(ModifierData *md, ModifierData *target) WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md; WeightVGEditModifierData *twmd = (WeightVGEditModifierData *) target; - BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + modifier_copyData_generic(md, target); - twmd->edit_flags = wmd->edit_flags; - twmd->falloff_type = wmd->falloff_type; - twmd->default_weight = wmd->default_weight; - - twmd->cmap_curve = curvemapping_copy(wmd->cmap_curve); - - twmd->add_threshold = wmd->add_threshold; - twmd->rem_threshold = wmd->rem_threshold; - - twmd->mask_constant = wmd->mask_constant; - BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name)); - twmd->mask_texture = wmd->mask_texture; - twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; - twmd->mask_tex_mapping = wmd->mask_tex_mapping; - twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); + twmd->cmap_curve = curvemapping_copy(wmd->cmap_curve); if (twmd->mask_texture) { id_us_plus(&twmd->mask_texture->id); diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 1ec287b3b3a..304d4c8774a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -134,23 +134,12 @@ static void freeData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; +#endif WeightVGMixModifierData *twmd = (WeightVGMixModifierData *) target; - BLI_strncpy(twmd->defgrp_name_a, wmd->defgrp_name_a, sizeof(twmd->defgrp_name_a)); - BLI_strncpy(twmd->defgrp_name_b, wmd->defgrp_name_b, sizeof(twmd->defgrp_name_b)); - twmd->default_weight_a = wmd->default_weight_a; - twmd->default_weight_b = wmd->default_weight_b; - twmd->mix_mode = wmd->mix_mode; - twmd->mix_set = wmd->mix_set; - - twmd->mask_constant = wmd->mask_constant; - BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name)); - twmd->mask_texture = wmd->mask_texture; - twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; - twmd->mask_tex_mapping = wmd->mask_tex_mapping; - twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); + modifier_copyData_generic(md, target); if (twmd->mask_texture) { id_us_plus(&twmd->mask_texture->id); diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 67168e52949..06f4664c11b 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -254,25 +254,12 @@ static void freeData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { +#if 0 WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md; +#endif WeightVGProximityModifierData *twmd = (WeightVGProximityModifierData *) target; - BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); - twmd->proximity_mode = wmd->proximity_mode; - twmd->proximity_flags = wmd->proximity_flags; - twmd->proximity_ob_target = wmd->proximity_ob_target; - - twmd->falloff_type = wmd->falloff_type; - - twmd->mask_constant = wmd->mask_constant; - BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name)); - twmd->mask_texture = wmd->mask_texture; - twmd->mask_tex_use_channel = wmd->mask_tex_use_channel; - twmd->mask_tex_mapping = wmd->mask_tex_mapping; - twmd->mask_tex_map_obj = wmd->mask_tex_map_obj; - BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name)); - twmd->min_dist = wmd->min_dist; - twmd->max_dist = wmd->max_dist; + modifier_copyData_generic(md, target); if (twmd->mask_texture) { id_us_plus(&twmd->mask_texture->id); -- cgit v1.2.3