[Bf-blender-cvs] [4494be513ac] blender2.8: Fix smoke to render in Cycles again.
Brecht Van Lommel
noreply at git.blender.org
Fri Sep 21 14:16:57 CEST 2018
Commit: 4494be513ac455b106b2cb9be119136a58212cd1
Author: Brecht Van Lommel
Date: Thu Sep 20 14:41:47 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB4494be513ac455b106b2cb9be119136a58212cd1
Fix smoke to render in Cycles again.
Viewport caching seems still broken, though baking works.
===================================================================
M source/blender/blenkernel/BKE_smoke.h
M source/blender/blenkernel/intern/smoke.c
M source/blender/modifiers/intern/MOD_smoke.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index 441751a7a03..8e800cea043 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -45,7 +45,7 @@ void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
void smokeModifier_createType(struct SmokeModifierData *smd);
-void smokeModifier_copy(const SmokeModifierData *smd, struct SmokeModifierData *tsmd);
+void smokeModifier_copy(const SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag);
float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
int smoke_get_data_flags(struct SmokeDomainSettings *sds);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 673108a61c0..a733842842c 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -130,7 +130,7 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s
void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity),
int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color),
float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {}
-struct Mesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), struct Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *UNUSED(me)) { return NULL; }
+struct Mesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *UNUSED(me)) { return NULL; }
float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
#endif /* WITH_SMOKE */
@@ -274,7 +274,7 @@ static void smoke_set_domain_from_mesh(SmokeDomainSettings *sds, Object *ob, Mes
sds->cell_size[2] /= (float)sds->base_res[2];
}
-static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene, Mesh *me)
+static int smokeModifier_init(SmokeModifierData *smd, Object *ob, int scene_framenr, Mesh *me)
{
if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
{
@@ -305,7 +305,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
/* allocate fluid */
smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
- smd->time = scene->r.cfra;
+ smd->time = scene_framenr;
/* allocate highres fluid */
if (sds->flags & MOD_SMOKE_HIGHRES) {
@@ -319,7 +319,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
}
else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
{
- smd->time = scene->r.cfra;
+ smd->time = scene_framenr;
return 1;
}
@@ -330,7 +330,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
smokeModifier_createType(smd);
}
- smd->time = scene->r.cfra;
+ smd->time = scene_framenr;
return 1;
}
@@ -361,8 +361,10 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd)
MEM_freeN(smd->domain->effector_weights);
smd->domain->effector_weights = NULL;
- BKE_ptcache_free_list(&(smd->domain->ptcaches[0]));
- smd->domain->point_cache[0] = NULL;
+ if (!(smd->modifier.flag & eModifierFlag_SharedCaches)) {
+ BKE_ptcache_free_list(&(smd->domain->ptcaches[0]));
+ smd->domain->point_cache[0] = NULL;
+ }
if (smd->domain->coba) {
MEM_freeN(smd->domain->coba);
@@ -604,7 +606,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
}
}
-void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifierData *tsmd)
+void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag)
{
tsmd->type = smd->type;
tsmd->time = smd->time;
@@ -612,80 +614,98 @@ void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifie
smokeModifier_createType(tsmd);
if (tsmd->domain) {
- tsmd->domain->fluid_group = smd->domain->fluid_group;
- tsmd->domain->coll_group = smd->domain->coll_group;
-
- tsmd->domain->adapt_margin = smd->domain->adapt_margin;
- tsmd->domain->adapt_res = smd->domain->adapt_res;
- tsmd->domain->adapt_threshold = smd->domain->adapt_threshold;
-
- tsmd->domain->alpha = smd->domain->alpha;
- tsmd->domain->beta = smd->domain->beta;
- tsmd->domain->amplify = smd->domain->amplify;
- tsmd->domain->maxres = smd->domain->maxres;
- tsmd->domain->flags = smd->domain->flags;
- tsmd->domain->highres_sampling = smd->domain->highres_sampling;
- tsmd->domain->viewsettings = smd->domain->viewsettings;
- tsmd->domain->noise = smd->domain->noise;
- tsmd->domain->diss_speed = smd->domain->diss_speed;
- tsmd->domain->strength = smd->domain->strength;
-
- tsmd->domain->border_collisions = smd->domain->border_collisions;
- tsmd->domain->vorticity = smd->domain->vorticity;
- tsmd->domain->time_scale = smd->domain->time_scale;
-
- tsmd->domain->burning_rate = smd->domain->burning_rate;
- tsmd->domain->flame_smoke = smd->domain->flame_smoke;
- tsmd->domain->flame_vorticity = smd->domain->flame_vorticity;
- tsmd->domain->flame_ignition = smd->domain->flame_ignition;
- tsmd->domain->flame_max_temp = smd->domain->flame_max_temp;
- copy_v3_v3(tsmd->domain->flame_smoke_color, smd->domain->flame_smoke_color);
-
- MEM_freeN(tsmd->domain->effector_weights);
- tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
- tsmd->domain->openvdb_comp = smd->domain->openvdb_comp;
- tsmd->domain->data_depth = smd->domain->data_depth;
- tsmd->domain->cache_file_format = smd->domain->cache_file_format;
-
- tsmd->domain->slice_method = smd->domain->slice_method;
- tsmd->domain->axis_slice_method = smd->domain->axis_slice_method;
- tsmd->domain->slice_per_voxel = smd->domain->slice_per_voxel;
- tsmd->domain->slice_depth = smd->domain->slice_depth;
- tsmd->domain->slice_axis = smd->domain->slice_axis;
- tsmd->domain->draw_velocity = smd->domain->draw_velocity;
- tsmd->domain->vector_draw_type = smd->domain->vector_draw_type;
- tsmd->domain->vector_scale = smd->domain->vector_scale;
+ SmokeDomainSettings *tsds = tsmd->domain;
+ SmokeDomainSettings *sds = smd->domain;
- if (smd->domain->coba) {
- tsmd->domain->coba = MEM_dupallocN(smd->domain->coba);
+ BKE_ptcache_free_list(&(tsds->ptcaches[0]));
+
+ if (flag & LIB_ID_CREATE_NO_MAIN) {
+ /* Share the cache with the original object's modifier. */
+ tsmd->modifier.flag |= eModifierFlag_SharedCaches;
+ tsds->point_cache[0] = sds->point_cache[0];
+ tsds->ptcaches[0] = sds->ptcaches[0];
+ }
+ else {
+ tsds->point_cache[0] = BKE_ptcache_copy_list(&(tsds->ptcaches[0]), &(sds->ptcaches[0]), flag);
+ }
+
+ tsds->fluid_group = sds->fluid_group;
+ tsds->coll_group = sds->coll_group;
+
+ tsds->adapt_margin = sds->adapt_margin;
+ tsds->adapt_res = sds->adapt_res;
+ tsds->adapt_threshold = sds->adapt_threshold;
+
+ tsds->alpha = sds->alpha;
+ tsds->beta = sds->beta;
+ tsds->amplify = sds->amplify;
+ tsds->maxres = sds->maxres;
+ tsds->flags = sds->flags;
+ tsds->highres_sampling = sds->highres_sampling;
+ tsds->viewsettings = sds->viewsettings;
+ tsds->noise = sds->noise;
+ tsds->diss_speed = sds->diss_speed;
+ tsds->strength = sds->strength;
+
+ tsds->border_collisions = sds->border_collisions;
+ tsds->vorticity = sds->vorticity;
+ tsds->time_scale = sds->time_scale;
+
+ tsds->burning_rate = sds->burning_rate;
+ tsds->flame_smoke = sds->flame_smoke;
+ tsds->flame_vorticity = sds->flame_vorticity;
+ tsds->flame_ignition = sds->flame_ignition;
+ tsds->flame_max_temp = sds->flame_max_temp;
+ copy_v3_v3(tsds->flame_smoke_color, sds->flame_smoke_color);
+
+ MEM_freeN(tsds->effector_weights);
+ tsds->effector_weights = MEM_dupallocN(sds->effector_weights);
+ tsds->openvdb_comp = sds->openvdb_comp;
+ tsds->data_depth = sds->data_depth;
+ tsds->cache_file_format = sds->cache_file_format;
+
+ tsds->slice_method = sds->slice_method;
+ tsds->axis_slice_method = sds->axis_slice_method;
+ tsds->slice_per_voxel = sds->slice_per_voxel;
+ tsds->slice_depth = sds->slice_depth;
+ tsds->slice_axis = sds->slice_axis;
+ tsds->draw_velocity = sds->draw_velocity;
+ tsds->vector_draw_type = sds->vector_draw_type;
+ tsds->vector_scale = sds->vector_scale;
+
+ if (sds->coba) {
+ tsds->coba = MEM_dupallocN(sds->coba);
}
}
else if (tsmd->flow) {
- tsmd->flow->psys = smd->flow->psys;
- tsmd->flow->noise_texture = smd->flow->noise_texture;
-
- tsmd->flow->vel_multi = smd->flow->vel_multi;
- tsmd->flow->vel_normal = smd->flow->vel_normal;
- tsmd->flow->vel_random = smd->flow->vel_random;
-
- tsmd->flow->density = smd->flow->density;
- copy_v3_v3(tsmd->flow->color, smd->flow->color);
- tsmd->flow->fuel_amount = smd->flow->fuel_amount;
- tsmd->flow->temp = smd->flow->temp;
- tsmd->flow->volume_density = smd->flow->volume_density;
- tsmd->flow->surface_distance = smd->flow->surface_distance;
- tsmd->flow->particle_size = smd->flow->particle_size;
- tsmd->flow->subframes = smd->flow->subframes;
-
- tsmd->flow->texture_size = smd->flow->texture_size;
- tsmd->flow->texture_offset = smd->flow->texture_offset;
- BLI_strncpy(tsmd->flow->uvlayer_name, smd->flow->uvlayer_name, sizeof(tsmd->flow->uvlayer_name));
- tsmd->flow->vgroup_density = smd->flow->vgroup_density;
-
- tsmd->flow->type = smd->flow->type;
- tsmd->flow->source = smd->flow->source;
- tsmd->flow->texture_type = smd->flow->texture_type;
- tsmd->flow->flags = smd->flow->flags;
+ SmokeFlowSettings *tsfs = tsmd->flow;
+ SmokeFlowSettings *sfs = smd->flow;
+
+ tsfs->psys = sfs->psys;
+ tsfs->noise_texture = sfs->noise_texture;
+
+ tsfs->vel_multi = sfs->vel_multi;
+ tsfs->vel_normal = sfs->vel_normal;
+ tsfs->vel_random = sfs->vel_random;
+
+ tsfs->density = sfs->density;
+ copy_v3_v3(tsfs->color, sfs->color);
+ tsfs->fuel_amoun
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list