Commit: 60b9d413dbf1afc24b428dbe3bfea4bc0ec164c5
Author: Sybren A. Stüvel
Date:   Wed Jul 4 12:45:30 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB60b9d413dbf1afc24b428dbe3bfea4bc0ec164c5

Pass copy flag to modifier copyData function

This will allow modifiers to decide whether to copy or share caches between
ModifierData copies.

===================================================================

M       source/blender/blenkernel/BKE_modifier.h
M       source/blender/blenkernel/intern/modifier.c
M       source/blender/modifiers/intern/MOD_armature.c
M       source/blender/modifiers/intern/MOD_cloth.c
M       source/blender/modifiers/intern/MOD_correctivesmooth.c
M       source/blender/modifiers/intern/MOD_dynamicpaint.c
M       source/blender/modifiers/intern/MOD_explode.c
M       source/blender/modifiers/intern/MOD_fluidsim.c
M       source/blender/modifiers/intern/MOD_hook.c
M       source/blender/modifiers/intern/MOD_laplaciandeform.c
M       source/blender/modifiers/intern/MOD_meshdeform.c
M       source/blender/modifiers/intern/MOD_meshsequencecache.c
M       source/blender/modifiers/intern/MOD_ocean.c
M       source/blender/modifiers/intern/MOD_particlesystem.c
M       source/blender/modifiers/intern/MOD_smoke.c
M       source/blender/modifiers/intern/MOD_subsurf.c
M       source/blender/modifiers/intern/MOD_surfacedeform.c
M       source/blender/modifiers/intern/MOD_warp.c
M       source/blender/modifiers/intern/MOD_weightvgedit.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index c9f724a9bc4..987bb59cba3 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -162,8 +162,10 @@ typedef struct ModifierTypeInfo {
 
        /* Copy instance data for this modifier type. Should copy all user
         * level settings to the target modifier.
+        *
+        * \param flag  Copying options (see BKE_library.h's LIB_ID_COPY_... 
flags for more).
         */
-       void (*copyData)(const struct ModifierData *md, struct ModifierData 
*target);
+       void (*copyData)(const struct ModifierData *md, struct ModifierData 
*target, const int flag);
 
 
        /********************* Deform modifier functions *********************/ 
/* DEPRECATED */
@@ -387,7 +389,7 @@ void          modifier_free(struct ModifierData *md);
 
 bool          modifier_unique_name(struct ListBase *modifiers, struct 
ModifierData *md);
 
-void          modifier_copyData_generic(const struct ModifierData *md, struct 
ModifierData *target);
+void          modifier_copyData_generic(const struct ModifierData *md, struct 
ModifierData *target, const int flag);
 void          modifier_copyData(struct ModifierData *md, struct ModifierData 
*target);
 void          modifier_copyData_ex(struct ModifierData *md, struct 
ModifierData *target, const int flag);
 bool          modifier_dependsOnTime(struct ModifierData *md);
diff --git a/source/blender/blenkernel/intern/modifier.c 
b/source/blender/blenkernel/intern/modifier.c
index 4c2a58e7126..b877a08b6cf 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -293,7 +293,7 @@ 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)
+void modifier_copyData_generic(const ModifierData *md_src, ModifierData 
*md_dst, const int UNUSED(flag))
 {
        const ModifierTypeInfo *mti = modifierType_getInfo(md_src->type);
 
@@ -326,7 +326,7 @@ void modifier_copyData_ex(ModifierData *md, ModifierData 
*target, const int flag
        target->flag = md->flag;
 
        if (mti->copyData) {
-               mti->copyData(md, target);
+               mti->copyData(md, target, flag);
        }
 
        if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
diff --git a/source/blender/modifiers/intern/MOD_armature.c 
b/source/blender/modifiers/intern/MOD_armature.c
index 09ba865cce3..a069b261067 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -64,14 +64,14 @@ static void initData(ModifierData *md)
        amd->deformflag = ARM_DEF_VGROUP;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
 #if 0
        const ArmatureModifierData *amd = (const ArmatureModifierData *) md;
 #endif
        ArmatureModifierData *tamd = (ArmatureModifierData *) target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
        tamd->prevCos = NULL;
 }
 
diff --git a/source/blender/modifiers/intern/MOD_cloth.c 
b/source/blender/modifiers/intern/MOD_cloth.c
index 58979fa201b..34f571f5e30 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -155,7 +155,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), 
ModifierData *md)
        return dataMask;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
UNUSED(flag))
 {
        const ClothModifierData *clmd = (const ClothModifierData *) md;
        ClothModifierData *tclmd = (ClothModifierData *) target;
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c 
b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 879b07de6d9..d59360896e8 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -80,12 +80,12 @@ static void initData(ModifierData *md)
 }
 
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
        const CorrectiveSmoothModifierData *csmd = (const 
CorrectiveSmoothModifierData *)md;
        CorrectiveSmoothModifierData *tcsmd = (CorrectiveSmoothModifierData 
*)target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        if (csmd->bind_coords) {
                tcsmd->bind_coords = MEM_dupallocN(csmd->bind_coords);
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c 
b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 9131bc0659f..61219096b43 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -57,7 +57,7 @@ static void initData(ModifierData *md)
        pmd->type = MOD_DYNAMICPAINT_TYPE_CANVAS;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
UNUSED(flag))
 {
        const DynamicPaintModifierData *pmd  = (const DynamicPaintModifierData 
*)md;
        DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
diff --git a/source/blender/modifiers/intern/MOD_explode.c 
b/source/blender/modifiers/intern/MOD_explode.c
index 948aaf0751e..04bfe96bc59 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -70,14 +70,14 @@ static void freeData(ModifierData *md)
 
        MEM_SAFE_FREE(emd->facepa);
 }
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
 #if 0
        const ExplodeModifierData *emd = (const ExplodeModifierData *) md;
 #endif
        ExplodeModifierData *temd = (ExplodeModifierData *) target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        temd->facepa = NULL;
 }
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c 
b/source/blender/modifiers/intern/MOD_fluidsim.c
index ffa74be0b33..272cc5c17f4 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -65,7 +65,7 @@ static void freeData(ModifierData *md)
        fluidsim_free(fluidmd);
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
UNUSED(flag))
 {
        const FluidsimModifierData *fluidmd = (const FluidsimModifierData *) md;
        FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;
diff --git a/source/blender/modifiers/intern/MOD_hook.c 
b/source/blender/modifiers/intern/MOD_hook.c
index a5013bb38c6..4b34bdd2c16 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -63,12 +63,12 @@ static void initData(ModifierData *md)
        hmd->flag = 0;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
        const HookModifierData *hmd = (const HookModifierData *) md;
        HookModifierData *thmd = (HookModifierData *) target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        thmd->curfalloff = curvemapping_copy(hmd->curfalloff);
 
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c 
b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index e5b96c633f7..0224d412ba6 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -704,12 +704,12 @@ static void initData(ModifierData *md)
        lmd->flag = 0;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
        const LaplacianDeformModifierData *lmd = (const 
LaplacianDeformModifierData *)md;
        LaplacianDeformModifierData *tlmd = (LaplacianDeformModifierData 
*)target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        tlmd->vertexco = MEM_dupallocN(lmd->vertexco);
        tlmd->cache_system = NULL;
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c 
b/source/blender/modifiers/intern/MOD_meshdeform.c
index af37b30b7aa..05e1568f780 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -81,12 +81,12 @@ static void freeData(ModifierData *md)
        if (mmd->bindcos) MEM_freeN(mmd->bindcos);  /* deprecated */
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
        const MeshDeformModifierData *mmd = (const MeshDeformModifierData *) md;
        MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        if (mmd->bindinfluences) tmmd->bindinfluences = 
MEM_dupallocN(mmd->bindinfluences);
        if (mmd->bindoffsets) tmmd->bindoffsets = 
MEM_dupallocN(mmd->bindoffsets);
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c 
b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index a6c9f865e4c..fd8676d6653 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -55,14 +55,14 @@ static void initData(ModifierData *md)
        mcmd->read_flag = MOD_MESHSEQ_READ_ALL;
 }
 
-static void copyData(const ModifierData *md, ModifierData *target)
+static void copyData(const ModifierData *md, ModifierData *target, const int 
flag)
 {
 #if 0
        const MeshSeqCacheModifierData *mcmd = (const MeshSeqCacheModifierData 
*)md;
 #endif
        MeshSeqCacheModifierData *tmcmd = (MeshSeqCacheModifierData *)target;
 
-       modifier_copyData_generic(md, target);
+       modifier_copyData_generic(md, target, flag);
 
        tmcmd->reader = NULL;
 }
diff --git a/source/blender/modifiers/intern/MOD_ocean.c 
b/source/blender/modifiers/intern/MOD_ocean.c
index 702e557ccb1..58454782b2e 10

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to