diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-06-21 16:14:42 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-06-21 16:14:42 +0300 |
commit | 4ceb006706579a0ad2301d2cde57489b69a7683c (patch) | |
tree | 3825806212dd3d3e5f8a44a16b9b82cfe8142c81 /source/blender/modifiers | |
parent | 2ae172ec32da4a1aacd268bdba45bf82cff7eea9 (diff) | |
parent | 22466a5bdff73afb6ad3afd408e265517e4f3733 (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_dynamicpaint.c | 10 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim.c | 13 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshdeform.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 29 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_surfacedeform.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 6 |
7 files changed, 33 insertions, 38 deletions
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 2497e0b9aab..b1fe3535154 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -37,6 +37,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_dynamicpaint.h" #include "BKE_layer.h" +#include "BKE_library.h" #include "BKE_library_query.h" #include "BKE_modifier.h" @@ -58,6 +59,15 @@ static void copyData(ModifierData *md, ModifierData *target) DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target; dynamicPaint_Modifier_copy(pmd, tpmd); + + if (tpmd->canvas) { + for (DynamicPaintSurface *surface = tpmd->canvas->surfaces.first; surface; surface = surface->next) { + id_us_plus((ID *)surface->init_texture); + } + } + if (tpmd->brush) { + id_us_plus((ID *)tpmd->brush->mat); + } } static void freeData(ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 3e7141c3ce3..85eb7b2ffc9 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -68,12 +68,13 @@ static void copyData(ModifierData *md, ModifierData *target) FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target; - if (tfluidmd->fss) - MEM_freeN(tfluidmd->fss); - - tfluidmd->fss = MEM_dupallocN(fluidmd->fss); - if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) { - tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities); + fluidsim_free(tfluidmd); + + if (fluidmd->fss) { + tfluidmd->fss = MEM_dupallocN(fluidmd->fss); + if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) { + tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities); + } } } diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 2ecf06057db..3684e947fe0 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -150,9 +150,8 @@ void fluidsim_free(FluidsimModifierData *fluidmd) if (fluidmd && fluidmd->fss) { if (fluidmd->fss->meshVelocities) { MEM_freeN(fluidmd->fss->meshVelocities); - fluidmd->fss->meshVelocities = NULL; } - MEM_freeN(fluidmd->fss); + MEM_SAFE_FREE(fluidmd->fss); } return; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index b544710ace0..3c05f8266f0 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -81,7 +81,7 @@ static void copyData(ModifierData *md, ModifierData *target) MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target; - *tmmd = *mmd; + modifier_copyData_generic(md, target); if (mmd->bindinfluences) tmmd->bindinfluences = MEM_dupallocN(mmd->bindinfluences); if (mmd->bindoffsets) tmmd->bindoffsets = MEM_dupallocN(mmd->bindoffsets); @@ -89,8 +89,8 @@ static void copyData(ModifierData *md, ModifierData *target) if (mmd->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid); if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences); if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts); - if (mmd->bindweights) tmmd->dynverts = MEM_dupallocN(mmd->bindweights); /* deprecated */ - if (mmd->bindcos) tmmd->dynverts = MEM_dupallocN(mmd->bindcos); /* deprecated */ + if (mmd->bindweights) tmmd->bindweights = MEM_dupallocN(mmd->bindweights); /* deprecated */ + if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos); /* deprecated */ } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 4a6b79b71b6..120337eb2ea 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -160,40 +160,19 @@ static void freeData(ModifierData *md) static void copyData(ModifierData *md, ModifierData *target) { #ifdef WITH_OCEANSIM +#if 0 OceanModifierData *omd = (OceanModifierData *) md; +#endif OceanModifierData *tomd = (OceanModifierData *) target; - tomd->geometry_mode = omd->geometry_mode; - tomd->resolution = omd->resolution; - tomd->spatial_size = omd->spatial_size; - - tomd->wind_velocity = omd->wind_velocity; - - tomd->damp = omd->damp; - tomd->smallest_wave = omd->smallest_wave; - tomd->depth = omd->depth; + freeData(target); - tomd->wave_alignment = omd->wave_alignment; - tomd->wave_direction = omd->wave_direction; - tomd->wave_scale = omd->wave_scale; - - tomd->chop_amount = omd->chop_amount; - tomd->foam_coverage = omd->foam_coverage; - tomd->time = omd->time; - - tomd->seed = omd->seed; - tomd->flag = omd->flag; + modifier_copyData_generic(md, target); tomd->refresh = 0; - tomd->size = omd->size; - tomd->repeat_x = omd->repeat_x; - tomd->repeat_y = omd->repeat_y; - /* XXX todo: copy cache runtime too */ tomd->cached = 0; - tomd->bakestart = omd->bakestart; - tomd->bakeend = omd->bakeend; tomd->oceancache = NULL; tomd->ocean = BKE_ocean_add(); diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index f6288dc9be0..9339d71524f 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -136,7 +136,9 @@ static void copyData(ModifierData *md, ModifierData *target) SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target; - *tsmd = *smd; + freeData(target); + + modifier_copyData_generic(md, target); if (smd->verts) { tsmd->verts = MEM_dupallocN(smd->verts); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 362df031f92..cae83282238 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -45,6 +45,7 @@ #include "BKE_camera.h" +#include "BKE_library.h" #include "BKE_library_query.h" #include "BKE_material.h" #include "BKE_mesh.h" @@ -70,9 +71,12 @@ static void copyData(ModifierData *md, ModifierData *target) { #if 0 UVProjectModifierData *umd = (UVProjectModifierData *) md; - UVProjectModifierData *tumd = (UVProjectModifierData *) target; #endif + UVProjectModifierData *tumd = (UVProjectModifierData *) target; + modifier_copyData_generic(md, target); + + id_us_plus((ID *)tumd->image); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) |