Cleanup: Naming, BKE prefix

Done for smoke functions.

Smoke modifier functions seems an oddballs here,
but probably also to be renamed.
This commit is contained in:
2019-02-15 17:26:57 +01:00
parent f5ac1f444b
commit f15d810b1f
4 changed files with 24 additions and 23 deletions

View File

@@ -30,15 +30,16 @@ struct Mesh *smokeModifier_do(
struct Scene *scene,
struct Object *ob, struct Mesh *me);
void smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
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, 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);
void BKE_smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void BKE_smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
float BKE_smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
int BKE_smoke_get_data_flags(struct SmokeDomainSettings *sds);
#endif /* __BKE_SMOKE_H__ */

View File

@@ -946,7 +946,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
zero_v3(force);
if (pd->f_source) {
float density;
if ((density = smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
if ((density = BKE_smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
float influence = strength * efd->falloff;
if (pd->flag & PFIELD_SMOKE_DENSITY) {
influence *= density;

View File

@@ -580,7 +580,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
SmokeDomainSettings *sds = smd->domain;
int ret = 0;
int fluid_fields = smoke_get_data_flags(sds);
int fluid_fields = BKE_smoke_get_data_flags(sds);
/* version header */
ptcache_file_write(pf, SMOKE_CACHE_VERSION, 4, sizeof(char));
@@ -698,7 +698,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
unsigned char *obstacles;
float *tmp_array = MEM_callocN(out_len, "Smoke old cache tmp");
int fluid_fields = smoke_get_data_flags(sds);
int fluid_fields = BKE_smoke_get_data_flags(sds);
/* Part part of the new cache header */
sds->active_color[0] = 0.7f;
@@ -767,7 +767,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
char version[4];
int ch_res[3];
float ch_dx;
int fluid_fields = smoke_get_data_flags(sds);
int fluid_fields = BKE_smoke_get_data_flags(sds);
int cache_fields = 0;
int active_fields = 0;
int reallocate = 0;
@@ -805,12 +805,12 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
BKE_smoke_reallocate_fluid(sds, ch_dx, ch_res, 1);
sds->dx = ch_dx;
copy_v3_v3_int(sds->res, ch_res);
sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2];
if (sds->flags & MOD_SMOKE_HIGHRES) {
smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
BKE_smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1);
}
}
@@ -959,7 +959,7 @@ static int ptcache_smoke_openvdb_write(struct OpenVDBWriter *writer, void *smoke
OpenVDBWriter_add_meta_v3(writer, "blender/smoke/active_color", sds->active_color);
OpenVDBWriter_add_meta_mat4(writer, "blender/smoke/obmat", sds->obmat);
int fluid_fields = smoke_get_data_flags(sds);
int fluid_fields = BKE_smoke_get_data_flags(sds);
struct OpenVDBFloatGrid *clip_grid = NULL;
@@ -1042,7 +1042,7 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
SmokeDomainSettings *sds = smd->domain;
int fluid_fields = smoke_get_data_flags(sds);
int fluid_fields = BKE_smoke_get_data_flags(sds);
int active_fields, cache_fields = 0;
int cache_res[3];
float cache_dx;
@@ -1084,13 +1084,13 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_
/* reallocate fluid if needed*/
if (reallocate) {
sds->active_fields = active_fields | cache_fields;
smoke_reallocate_fluid(sds, cache_dx, cache_res, 1);
BKE_smoke_reallocate_fluid(sds, cache_dx, cache_res, 1);
sds->dx = cache_dx;
copy_v3_v3_int(sds->res, cache_res);
sds->total_cells = cache_res[0] * cache_res[1] * cache_res[2];
if (sds->flags & MOD_SMOKE_HIGHRES) {
smoke_reallocate_highres_fluid(sds, cache_dx, cache_res, 1);
BKE_smoke_reallocate_highres_fluid(sds, cache_dx, cache_res, 1);
}
}

View File

@@ -121,13 +121,13 @@ void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha),
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), 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; }
float BKE_smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; }
#endif /* WITH_SMOKE */
#ifdef WITH_SMOKE
void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
void BKE_smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
{
int use_heat = (sds->active_fields & SM_ACTIVE_HEAT);
int use_fire = (sds->active_fields & SM_ACTIVE_FIRE);
@@ -149,7 +149,7 @@ void smoke_reallocate_fluid(SmokeDomainSettings *sds, float dx, int res[3], int
sds->shadow = MEM_callocN(sizeof(float) * res[0] * res[1] * res[2], "SmokeDomainShadow");
}
void smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
void BKE_smoke_reallocate_highres_fluid(SmokeDomainSettings *sds, float dx, int res[3], int free_old)
{
int use_fire = (sds->active_fields & (SM_ACTIVE_HEAT | SM_ACTIVE_FIRE));
int use_colors = (sds->active_fields & SM_ACTIVE_COLORS);
@@ -293,13 +293,13 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, int scene_fram
copy_v3_v3_int(sds->res_max, res);
/* allocate fluid */
smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
BKE_smoke_reallocate_fluid(sds, sds->dx, sds->res, 0);
smd->time = scene_framenr;
/* allocate highres fluid */
if (sds->flags & MOD_SMOKE_HIGHRES) {
smoke_reallocate_highres_fluid(sds, sds->dx, sds->res, 0);
BKE_smoke_reallocate_highres_fluid(sds, sds->dx, sds->res, 0);
}
/* allocate shadow buffer */
if (!sds->shadow)
@@ -1929,9 +1929,9 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
struct FLUID_3D *fluid_old = sds->fluid;
struct WTURBULENCE *turb_old = sds->wt;
/* allocate new fluid data */
smoke_reallocate_fluid(sds, sds->dx, res, 0);
BKE_smoke_reallocate_fluid(sds, sds->dx, res, 0);
if (sds->flags & MOD_SMOKE_HIGHRES) {
smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
BKE_smoke_reallocate_highres_fluid(sds, sds->dx, res, 0);
}
/* copy values from old fluid to new */
@@ -3077,7 +3077,7 @@ static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *view_la
/* get smoke velocity and density at given coordinates
* returns fluid density or -1.0f if outside domain. */
float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
float BKE_smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
{
SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
zero_v3(velocity);
@@ -3131,7 +3131,7 @@ float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity
return -1.0f;
}
int smoke_get_data_flags(SmokeDomainSettings *sds)
int BKE_smoke_get_data_flags(SmokeDomainSettings *sds)
{
int flags = 0;