Cleanup: Fluid engine API return types
Use bool return type where possible instead of int (the return values from fluid object are already boolean instead of int). Also removed several if guards in API functions. If one of the arguments is in fact invalid / nullptr (should not happen though), it better to catch them directly where they failed and not silently escape them.
This commit is contained in:
parent
af35ada2f3
commit
6bca9d8c11
|
@ -33,41 +33,41 @@ struct MANTA;
|
|||
/* Fluid functions */
|
||||
struct MANTA *manta_init(int *res, struct FluidModifierData *fmd);
|
||||
void manta_free(struct MANTA *fluid);
|
||||
int manta_ensure_obstacle(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
int manta_ensure_guiding(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
int manta_ensure_invelocity(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
int manta_ensure_outflow(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
int manta_write_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_write_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_write_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_read_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_read_data(struct MANTA *fluid,
|
||||
bool manta_ensure_obstacle(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_ensure_guiding(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_ensure_invelocity(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_ensure_outflow(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_write_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_write_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_write_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_read_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_read_data(struct MANTA *fluid,
|
||||
struct FluidModifierData *fmd,
|
||||
int framenr,
|
||||
bool resumable);
|
||||
int manta_read_noise(struct MANTA *fluid,
|
||||
bool manta_read_noise(struct MANTA *fluid,
|
||||
struct FluidModifierData *fmd,
|
||||
int framenr,
|
||||
bool resumable);
|
||||
int manta_read_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_read_particles(struct MANTA *fluid,
|
||||
bool manta_read_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_read_particles(struct MANTA *fluid,
|
||||
struct FluidModifierData *fmd,
|
||||
int framenr,
|
||||
bool resumable);
|
||||
int manta_read_guiding(struct MANTA *fluid,
|
||||
bool manta_read_guiding(struct MANTA *fluid,
|
||||
struct FluidModifierData *fmd,
|
||||
int framenr,
|
||||
bool sourceDomain);
|
||||
int manta_bake_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_bake_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_bake_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_bake_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_bake_guiding(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_has_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_has_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_has_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_has_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
int manta_has_guiding(struct MANTA *fluid,
|
||||
bool manta_bake_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_bake_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_bake_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_bake_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_bake_guiding(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_has_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_has_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_has_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_has_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr);
|
||||
bool manta_has_guiding(struct MANTA *fluid,
|
||||
struct FluidModifierData *fmd,
|
||||
int framenr,
|
||||
bool domain);
|
||||
|
@ -113,7 +113,7 @@ float *manta_get_phi(struct MANTA *fluid);
|
|||
float *manta_get_pressure(struct MANTA *fluid);
|
||||
|
||||
/* Smoke functions */
|
||||
void manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
void manta_smoke_get_rgba(struct MANTA *smoke, float *data, int sequential);
|
||||
void manta_noise_get_rgba(struct MANTA *smoke, float *data, int sequential);
|
||||
void manta_smoke_get_rgba_fixed_color(struct MANTA *smoke,
|
||||
|
@ -124,9 +124,9 @@ void manta_noise_get_rgba_fixed_color(struct MANTA *smoke,
|
|||
float color[3],
|
||||
float *data,
|
||||
int sequential);
|
||||
int manta_smoke_ensure_heat(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
int manta_smoke_ensure_fire(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
int manta_smoke_ensure_colors(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_smoke_ensure_heat(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_smoke_ensure_fire(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_smoke_ensure_colors(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
|
||||
/* Smoke accessors */
|
||||
float *manta_smoke_get_density(struct MANTA *smoke);
|
||||
|
@ -147,9 +147,9 @@ float *manta_smoke_get_color_b_in(struct MANTA *smoke);
|
|||
float *manta_smoke_get_fuel_in(struct MANTA *smoke);
|
||||
float *manta_smoke_get_react_in(struct MANTA *smoke);
|
||||
float *manta_smoke_get_emission_in(struct MANTA *smoke);
|
||||
int manta_smoke_has_heat(struct MANTA *smoke);
|
||||
int manta_smoke_has_fuel(struct MANTA *smoke);
|
||||
int manta_smoke_has_colors(struct MANTA *smoke);
|
||||
bool manta_smoke_has_heat(struct MANTA *smoke);
|
||||
bool manta_smoke_has_fuel(struct MANTA *smoke);
|
||||
bool manta_smoke_has_colors(struct MANTA *smoke);
|
||||
float *manta_noise_get_density(struct MANTA *smoke);
|
||||
float *manta_noise_get_fuel(struct MANTA *smoke);
|
||||
float *manta_noise_get_react(struct MANTA *smoke);
|
||||
|
@ -163,14 +163,14 @@ float *manta_noise_get_texture_u2(struct MANTA *smoke);
|
|||
float *manta_noise_get_texture_v2(struct MANTA *smoke);
|
||||
float *manta_noise_get_texture_w2(struct MANTA *smoke);
|
||||
float *manta_noise_get_flame(struct MANTA *smoke);
|
||||
int manta_noise_has_fuel(struct MANTA *smoke);
|
||||
int manta_noise_has_colors(struct MANTA *smoke);
|
||||
bool manta_noise_has_fuel(struct MANTA *smoke);
|
||||
bool manta_noise_has_colors(struct MANTA *smoke);
|
||||
void manta_noise_get_res(struct MANTA *smoke, int *res);
|
||||
int manta_noise_get_cells(struct MANTA *smoke);
|
||||
|
||||
/* Liquid functions */
|
||||
void manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
int manta_liquid_ensure_sndparts(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
bool manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd);
|
||||
bool manta_liquid_ensure_sndparts(struct MANTA *fluid, struct FluidModifierData *fmd);
|
||||
|
||||
/* Liquid accessors */
|
||||
int manta_liquid_get_particle_res_x(struct MANTA *liquid);
|
||||
|
@ -212,9 +212,6 @@ float manta_liquid_get_snd_particle_position_z_at(struct MANTA *liquid, int i);
|
|||
float manta_liquid_get_snd_particle_velocity_x_at(struct MANTA *liquid, int i);
|
||||
float manta_liquid_get_snd_particle_velocity_y_at(struct MANTA *liquid, int i);
|
||||
float manta_liquid_get_snd_particle_velocity_z_at(struct MANTA *liquid, int i);
|
||||
bool manta_liquid_flip_from_file(struct MANTA *liquid);
|
||||
bool manta_liquid_mesh_from_file(struct MANTA *liquid);
|
||||
bool manta_liquid_particle_from_file(struct MANTA *liquid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -458,8 +458,7 @@ bool MANTA::initObstacle(FluidModifierData *fmd)
|
|||
string finalString = parseScript(tmpString, fmd);
|
||||
pythonCommands.push_back(finalString);
|
||||
|
||||
mUsingObstacle = true;
|
||||
return runPythonString(pythonCommands);
|
||||
return (mUsingObstacle = runPythonString(pythonCommands));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -473,8 +472,7 @@ bool MANTA::initGuiding(FluidModifierData *fmd)
|
|||
string finalString = parseScript(tmpString, fmd);
|
||||
pythonCommands.push_back(finalString);
|
||||
|
||||
mUsingGuiding = true;
|
||||
return runPythonString(pythonCommands);
|
||||
return (mUsingGuiding = runPythonString(pythonCommands));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -486,8 +484,7 @@ bool MANTA::initFractions(FluidModifierData *fmd)
|
|||
string finalString = parseScript(tmpString, fmd);
|
||||
pythonCommands.push_back(finalString);
|
||||
|
||||
mUsingFractions = true;
|
||||
return runPythonString(pythonCommands);
|
||||
return (mUsingFractions = runPythonString(pythonCommands));
|
||||
}
|
||||
|
||||
bool MANTA::initInVelocity(FluidModifierData *fmd)
|
||||
|
@ -498,8 +495,7 @@ bool MANTA::initInVelocity(FluidModifierData *fmd)
|
|||
string finalString = parseScript(tmpString, fmd);
|
||||
pythonCommands.push_back(finalString);
|
||||
|
||||
mUsingInvel = true;
|
||||
return runPythonString(pythonCommands);
|
||||
return (mUsingInvel = runPythonString(pythonCommands));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -512,8 +508,7 @@ bool MANTA::initOutflow(FluidModifierData *fmd)
|
|||
string finalString = parseScript(tmpString, fmd);
|
||||
pythonCommands.push_back(finalString);
|
||||
|
||||
mUsingOutflow = true;
|
||||
return runPythonString(pythonCommands);
|
||||
return (mUsingOutflow = runPythonString(pythonCommands));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -565,7 +560,7 @@ MANTA::~MANTA()
|
|||
pythonCommands.push_back(finalString);
|
||||
result = runPythonString(pythonCommands);
|
||||
|
||||
assert(result);
|
||||
BLI_assert(result);
|
||||
UNUSED_VARS(result);
|
||||
}
|
||||
|
||||
|
@ -610,7 +605,7 @@ bool MANTA::runPythonString(vector<string> commands)
|
|||
}
|
||||
PyGILState_Release(gilstate);
|
||||
|
||||
assert(success);
|
||||
BLI_assert(success);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -1590,7 +1585,7 @@ bool MANTA::updateVariables(FluidModifierData *fmd)
|
|||
return runPythonString(pythonCommands);
|
||||
}
|
||||
|
||||
void MANTA::exportSmokeScript(FluidModifierData *fmd)
|
||||
bool MANTA::exportSmokeScript(FluidModifierData *fmd)
|
||||
{
|
||||
if (with_debug)
|
||||
cout << "MANTA::exportSmokeScript()" << endl;
|
||||
|
@ -1696,9 +1691,14 @@ void MANTA::exportSmokeScript(FluidModifierData *fmd)
|
|||
myfile.open(cacheDirScript);
|
||||
myfile << final_script;
|
||||
myfile.close();
|
||||
if (!myfile) {
|
||||
cerr << "Fluid Error -- Could not export standalone Mantaflow smoke domain script";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MANTA::exportLiquidScript(FluidModifierData *fmd)
|
||||
bool MANTA::exportLiquidScript(FluidModifierData *fmd)
|
||||
{
|
||||
if (with_debug)
|
||||
cout << "MANTA::exportLiquidScript()" << endl;
|
||||
|
@ -1804,6 +1804,11 @@ void MANTA::exportLiquidScript(FluidModifierData *fmd)
|
|||
myfile.open(cacheDirScript);
|
||||
myfile << final_script;
|
||||
myfile.close();
|
||||
if (!myfile) {
|
||||
cerr << "Fluid Error -- Could not export standalone Mantaflow liquid domain script";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Call Mantaflow Python functions through this function. Use isAttribute for object attributes,
|
||||
|
|
|
@ -104,8 +104,8 @@ struct MANTA {
|
|||
bool bakeGuiding(FluidModifierData *fmd, int framenr);
|
||||
|
||||
/* IO for Mantaflow scene script. */
|
||||
void exportSmokeScript(struct FluidModifierData *fmd);
|
||||
void exportLiquidScript(struct FluidModifierData *fmd);
|
||||
bool exportSmokeScript(struct FluidModifierData *fmd);
|
||||
bool exportLiquidScript(struct FluidModifierData *fmd);
|
||||
|
||||
/* Check cache status by frame. */
|
||||
bool hasConfig(FluidModifierData *fmd, int framenr);
|
||||
|
|
|
@ -37,203 +37,145 @@ void manta_free(MANTA *fluid)
|
|||
fluid = nullptr;
|
||||
}
|
||||
|
||||
int manta_ensure_obstacle(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
bool manta_ensure_obstacle(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->initObstacle(fmd);
|
||||
}
|
||||
int manta_ensure_guiding(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
bool manta_ensure_guiding(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->initGuiding(fmd);
|
||||
}
|
||||
int manta_ensure_invelocity(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
bool manta_ensure_invelocity(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->initInVelocity(fmd);
|
||||
}
|
||||
int manta_ensure_outflow(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
bool manta_ensure_outflow(MANTA *fluid, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->initOutflow(fmd);
|
||||
}
|
||||
|
||||
int manta_write_config(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_write_config(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->writeConfiguration(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_write_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_write_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->writeData(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_write_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_write_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->writeNoise(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_read_config(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_read_config(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readConfiguration(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_read_data(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
bool manta_read_data(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readData(fmd, framenr, resumable);
|
||||
}
|
||||
|
||||
int manta_read_noise(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
bool manta_read_noise(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readNoise(fmd, framenr, resumable);
|
||||
}
|
||||
|
||||
int manta_read_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_read_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readMesh(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_read_particles(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
bool manta_read_particles(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readParticles(fmd, framenr, resumable);
|
||||
}
|
||||
|
||||
int manta_read_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool sourceDomain)
|
||||
bool manta_read_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool sourceDomain)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->readGuiding(fmd, framenr, sourceDomain);
|
||||
}
|
||||
|
||||
int manta_bake_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_bake_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->bakeData(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_bake_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_bake_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->bakeNoise(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_bake_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_bake_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->bakeMesh(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_bake_particles(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_bake_particles(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->bakeParticles(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_bake_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_bake_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->bakeGuiding(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_has_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_has_data(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->hasData(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_has_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_has_noise(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->hasNoise(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_has_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_has_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->hasMesh(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_has_particles(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
bool manta_has_particles(MANTA *fluid, FluidModifierData *fmd, int framenr)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->hasParticles(fmd, framenr);
|
||||
}
|
||||
|
||||
int manta_has_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool domain)
|
||||
bool manta_has_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool domain)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return 0;
|
||||
return fluid->hasGuiding(fmd, framenr, domain);
|
||||
}
|
||||
|
||||
void manta_update_variables(MANTA *fluid, FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid)
|
||||
return;
|
||||
fluid->updateVariables(fmd);
|
||||
}
|
||||
|
||||
int manta_get_frame(MANTA *fluid)
|
||||
{
|
||||
if (!fluid)
|
||||
return 0;
|
||||
return fluid->getFrame();
|
||||
}
|
||||
|
||||
float manta_get_timestep(MANTA *fluid)
|
||||
{
|
||||
if (!fluid)
|
||||
return 0;
|
||||
return fluid->getTimestep();
|
||||
}
|
||||
|
||||
void manta_adapt_timestep(MANTA *fluid)
|
||||
{
|
||||
if (!fluid)
|
||||
return;
|
||||
fluid->adaptTimestep();
|
||||
}
|
||||
|
||||
bool manta_needs_realloc(MANTA *fluid, FluidModifierData *fmd)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return false;
|
||||
return fluid->needsRealloc(fmd);
|
||||
}
|
||||
|
||||
void manta_update_pointers(struct MANTA *fluid, struct FluidModifierData *fmd, bool flush)
|
||||
{
|
||||
if (!fluid || !fmd)
|
||||
return;
|
||||
fluid->updatePointers(fmd, flush);
|
||||
}
|
||||
|
||||
|
@ -372,11 +314,9 @@ float *manta_get_pressure(MANTA *fluid)
|
|||
}
|
||||
|
||||
/* Smoke functions */
|
||||
void manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd)
|
||||
bool manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd)
|
||||
{
|
||||
if (!smoke || !fmd)
|
||||
return;
|
||||
smoke->exportSmokeScript(fmd);
|
||||
return smoke->exportSmokeScript(fmd);
|
||||
}
|
||||
|
||||
static void get_rgba(
|
||||
|
@ -452,18 +392,13 @@ void manta_noise_get_rgba_fixed_color(MANTA *smoke, float color[3], float *data,
|
|||
get_rgba_fixed_color(color, smoke->getTotalCellsHigh(), data, sequential);
|
||||
}
|
||||
|
||||
int manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
bool manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!smoke || !fmd)
|
||||
return 0;
|
||||
return smoke->initHeat(fmd);
|
||||
}
|
||||
|
||||
int manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
bool manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!smoke || !fmd)
|
||||
return 0;
|
||||
|
||||
bool result = smoke->initFire(fmd);
|
||||
if (smoke->usingNoise()) {
|
||||
result &= smoke->initFireHigh(fmd);
|
||||
|
@ -471,11 +406,8 @@ int manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd)
|
|||
return result;
|
||||
}
|
||||
|
||||
int manta_smoke_ensure_colors(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
bool manta_smoke_ensure_colors(MANTA *smoke, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!smoke || !fmd)
|
||||
return 0;
|
||||
|
||||
bool result = smoke->initColors(fmd);
|
||||
if (smoke->usingNoise()) {
|
||||
result &= smoke->initColorsHigh(fmd);
|
||||
|
@ -560,107 +492,104 @@ float *manta_smoke_get_emission_in(MANTA *smoke)
|
|||
return smoke->getEmissionIn();
|
||||
}
|
||||
|
||||
int manta_smoke_has_heat(MANTA *smoke)
|
||||
bool manta_smoke_has_heat(MANTA *smoke)
|
||||
{
|
||||
return (smoke->getHeat()) ? 1 : 0;
|
||||
return smoke->getHeat() != nullptr;
|
||||
;
|
||||
}
|
||||
int manta_smoke_has_fuel(MANTA *smoke)
|
||||
bool manta_smoke_has_fuel(MANTA *smoke)
|
||||
{
|
||||
return (smoke->getFuel()) ? 1 : 0;
|
||||
return smoke->getFuel() != nullptr;
|
||||
}
|
||||
int manta_smoke_has_colors(MANTA *smoke)
|
||||
bool manta_smoke_has_colors(MANTA *smoke)
|
||||
{
|
||||
return (smoke->getColorR() && smoke->getColorG() && smoke->getColorB()) ? 1 : 0;
|
||||
return smoke->getColorR() != nullptr && smoke->getColorG() != nullptr &&
|
||||
smoke->getColorB() != nullptr;
|
||||
}
|
||||
|
||||
float *manta_noise_get_density(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getDensityHigh() : nullptr;
|
||||
return smoke->getDensityHigh();
|
||||
}
|
||||
float *manta_noise_get_fuel(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getFuelHigh() : nullptr;
|
||||
return smoke->getFuelHigh();
|
||||
}
|
||||
float *manta_noise_get_react(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getReactHigh() : nullptr;
|
||||
return smoke->getReactHigh();
|
||||
}
|
||||
float *manta_noise_get_color_r(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getColorRHigh() : nullptr;
|
||||
return smoke->getColorRHigh();
|
||||
}
|
||||
float *manta_noise_get_color_g(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getColorGHigh() : nullptr;
|
||||
return smoke->getColorGHigh();
|
||||
}
|
||||
float *manta_noise_get_color_b(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getColorBHigh() : nullptr;
|
||||
return smoke->getColorBHigh();
|
||||
}
|
||||
float *manta_noise_get_flame(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getFlameHigh() : nullptr;
|
||||
return smoke->getFlameHigh();
|
||||
}
|
||||
float *manta_noise_get_texture_u(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureU() : nullptr;
|
||||
return smoke->getTextureU();
|
||||
}
|
||||
float *manta_noise_get_texture_v(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureV() : nullptr;
|
||||
return smoke->getTextureV();
|
||||
}
|
||||
float *manta_noise_get_texture_w(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureW() : nullptr;
|
||||
return smoke->getTextureW();
|
||||
}
|
||||
float *manta_noise_get_texture_u2(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureU2() : nullptr;
|
||||
return smoke->getTextureU2();
|
||||
}
|
||||
float *manta_noise_get_texture_v2(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureV2() : nullptr;
|
||||
return smoke->getTextureV2();
|
||||
}
|
||||
float *manta_noise_get_texture_w2(MANTA *smoke)
|
||||
{
|
||||
return (smoke && smoke->usingNoise()) ? smoke->getTextureW2() : nullptr;
|
||||
return smoke->getTextureW2();
|
||||
}
|
||||
|
||||
int manta_noise_has_fuel(MANTA *smoke)
|
||||
bool manta_noise_has_fuel(MANTA *smoke)
|
||||
{
|
||||
return (smoke->getFuelHigh()) ? 1 : 0;
|
||||
return smoke->getFuelHigh() != nullptr;
|
||||
}
|
||||
int manta_noise_has_colors(MANTA *smoke)
|
||||
bool manta_noise_has_colors(MANTA *smoke)
|
||||
{
|
||||
return (smoke->getColorRHigh() && smoke->getColorGHigh() && smoke->getColorBHigh()) ? 1 : 0;
|
||||
return smoke->getColorRHigh() != nullptr && smoke->getColorGHigh() != nullptr &&
|
||||
smoke->getColorBHigh() != nullptr;
|
||||
;
|
||||
}
|
||||
|
||||
void manta_noise_get_res(MANTA *smoke, int *res)
|
||||
{
|
||||
if (smoke && smoke->usingNoise()) {
|
||||
res[0] = smoke->getResXHigh();
|
||||
res[1] = smoke->getResYHigh();
|
||||
res[2] = smoke->getResZHigh();
|
||||
}
|
||||
}
|
||||
int manta_noise_get_cells(MANTA *smoke)
|
||||
{
|
||||
int total_cells_high = smoke->getResXHigh() * smoke->getResYHigh() * smoke->getResZHigh();
|
||||
return (smoke && smoke->usingNoise()) ? total_cells_high : 0;
|
||||
return smoke->getResXHigh() * smoke->getResYHigh() * smoke->getResZHigh();
|
||||
}
|
||||
|
||||
/* Liquid functions */
|
||||
void manta_liquid_export_script(MANTA *liquid, FluidModifierData *fmd)
|
||||
bool manta_liquid_export_script(MANTA *liquid, FluidModifierData *fmd)
|
||||
{
|
||||
if (!liquid || !fmd)
|
||||
return;
|
||||
liquid->exportLiquidScript(fmd);
|
||||
return liquid->exportLiquidScript(fmd);
|
||||
}
|
||||
|
||||
int manta_liquid_ensure_sndparts(MANTA *liquid, struct FluidModifierData *fmd)
|
||||
bool manta_liquid_ensure_sndparts(MANTA *liquid, struct FluidModifierData *fmd)
|
||||
{
|
||||
if (!liquid || !fmd)
|
||||
return 0;
|
||||
return liquid->initLiquidSndParts(fmd);
|
||||
}
|
||||
|
||||
|
@ -834,16 +763,3 @@ float manta_liquid_get_snd_particle_velocity_z_at(MANTA *liquid, int i)
|
|||
{
|
||||
return liquid->getSndParticleVelocityZAt(i);
|
||||
}
|
||||
|
||||
bool manta_liquid_flip_from_file(MANTA *liquid)
|
||||
{
|
||||
return liquid->usingFlipFromFile();
|
||||
}
|
||||
bool manta_liquid_mesh_from_file(MANTA *liquid)
|
||||
{
|
||||
return liquid->usingMeshFromFile();
|
||||
}
|
||||
bool manta_liquid_particle_from_file(MANTA *liquid)
|
||||
{
|
||||
return liquid->usingParticleFromFile();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue