Commit: 6ed2fe0229c12d2b72f80ab9dc96d441d6eb40cb Author: Sebastián Barschkis Date: Wed Jul 12 22:09:21 2017 +0200 Branches: fluid-mantaflow https://developer.blender.org/rB6ed2fe0229c12d2b72f80ab9dc96d441d6eb40cb
added settings for snd particle type vector this extra vector stores snd particle types: drop, float, bubble, tracer =================================================================== M intern/mantaflow/extern/manta_fluid_API.h M intern/mantaflow/intern/FLUID.cpp M intern/mantaflow/intern/FLUID.h M intern/mantaflow/intern/manta_fluid_API.cpp M intern/mantaflow/intern/strings/liquid_script.h M release/scripts/startup/bl_ui/properties_physics_smoke.py M source/blender/blenkernel/intern/dynamicpaint.c M source/blender/blenkernel/intern/particle_system.c M source/blender/blenkernel/intern/pointcache.c =================================================================== diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h index 812634a9f94..1365d278f80 100644 --- a/intern/mantaflow/extern/manta_fluid_API.h +++ b/intern/mantaflow/extern/manta_fluid_API.h @@ -45,7 +45,7 @@ void smoke_step(struct FLUID *smoke, int framenr); void smoke_dissolve(struct FLUID *smoke, int speed, int log); void smoke_dissolve_wavelet(struct FLUID *smoke, int speed, int log); void smoke_export(struct FLUID *smoke, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **vx, float **vy, float **vz, float **r, float **g, float **b, int **obstacles); -void liquid_export(struct FLUID *liquid, float **phi, float **pp, float **pvel, float **ppSnd, float **pvelSnd); +void liquid_export(struct FLUID *liquid, float **phi, float **pp, float **pvel, float **ppSnd, float **pvelSnd, int **ptypeSnd); void smoke_turbulence_export(struct FLUID *smoke, float **dens, float **react, float **flame, float **fuel, float **r, float **g, float **b , float **tcu, float **tcv, float **tcw, float **tcu2, float **tcv2, float **tcw2); float *smoke_get_density(struct FLUID *smoke); float *smoke_get_fuel(struct FLUID *smoke); @@ -143,12 +143,14 @@ float liquid_get_flip_particle_velocity_z_at(struct FLUID *liquid, int i); float liquid_get_snd_particle_velocity_x_at(struct FLUID *liquid, int i); float liquid_get_snd_particle_velocity_y_at(struct FLUID *liquid, int i); float liquid_get_snd_particle_velocity_z_at(struct FLUID *liquid, int i); +int liquid_get_snd_particle_type_at(struct FLUID *liquid, int i); void liquid_set_flip_particle_data(struct FLUID* liquid, float* buffer, int numParts); void liquid_set_snd_particle_data(struct FLUID* liquid, float* buffer, int numParts); void liquid_set_flip_particle_velocity(struct FLUID* liquid, float* buffer, int numParts); void liquid_set_snd_particle_velocity(struct FLUID* liquid, float* buffer, int numParts); +void liquid_set_snd_particle_type(struct FLUID* liquid, int* buffer, int numParts); // Fluids in general int *fluid_get_num_obstacle(struct FLUID *fluid); diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp index 86cac7b52d3..9d1c14a37e1 100644 --- a/intern/mantaflow/intern/FLUID.cpp +++ b/intern/mantaflow/intern/FLUID.cpp @@ -131,6 +131,7 @@ FLUID::FLUID(int *res, SmokeModifierData *smd) : mCurrentID(++solverID) mFlipParticleVelocity = NULL; mSndParticleData = NULL; mSndParticleVelocity = NULL; + mSndParticleType = NULL; // Only start Mantaflow once. No need to start whenever new FLUID objected is allocated if (!mantaInitialized) @@ -488,6 +489,7 @@ FLUID::~FLUID() mFlipParticleVelocity = NULL; mSndParticleData = NULL; mSndParticleVelocity = NULL; + mSndParticleType = NULL; // Reset flags mUsingHeat = false; @@ -1094,9 +1096,10 @@ void FLUID::updatePointers() mPhi = (float*) getDataPointer("phi" + solver_ext, solver); mFlipParticleData = (std::vector<pData>*) getDataPointer("pp" + solver_ext, solver); - mFlipParticleVelocity = (std::vector<pVel>*) getDataPointer("pVel" + parts_ext, parts); + mFlipParticleVelocity = (std::vector<pVel>*) getDataPointer("pVel" + parts_ext, parts); mSndParticleData = (std::vector<pData>*) getDataPointer("ppSnd" + solver_ext, solver); - mSndParticleVelocity = (std::vector<pVel>*) getDataPointer("pVelSnd" + parts_ext, parts); + mSndParticleVelocity = (std::vector<pVel>*) getDataPointer("pVelSnd" + parts_ext, parts); + mSndParticleType = (std::vector<int>*) getDataPointer("pTypeSnd" + parts_ext, parts); } // Smoke @@ -1214,6 +1217,16 @@ void FLUID::setSndParticleVelocity(float* buffer, int numParts) } } +void FLUID::setSndParticleType(int* buffer, int numParts) +{ + mSndParticleType->resize(numParts); + int* bufferPType = buffer; + for (std::vector<int>::iterator it = mSndParticleType->begin(); it != mSndParticleType->end(); ++it) { + *it = *bufferPType; + bufferPType++; + } +} + void FLUID::saveMesh(char *filename) { std::string path(filename); diff --git a/intern/mantaflow/intern/FLUID.h b/intern/mantaflow/intern/FLUID.h index d6d08be28d8..0b3d4b262bb 100644 --- a/intern/mantaflow/intern/FLUID.h +++ b/intern/mantaflow/intern/FLUID.h @@ -177,11 +177,14 @@ public: inline float getSndParticleVelocityYAt(int i) { return (mSndParticleVelocity) ? mSndParticleVelocity->at(i).pos[1] : 0.f; } inline float getSndParticleVelocityZAt(int i) { return (mSndParticleVelocity) ? mSndParticleVelocity->at(i).pos[2] : 0.f; } + inline int getSndParticleTypeAt(int i) { return (mSndParticleType) ? mSndParticleType->at(i) : -1; } + inline float* getFlipParticleData() { return (mFlipParticleData) ? (float*) &mFlipParticleData->front() : NULL; } inline float* getSndParticleData() { return (mSndParticleData) ? (float*) &mSndParticleData->front() : NULL; } inline float* getFlipParticleVelocity() { return (mFlipParticleVelocity) ? (float*) &mFlipParticleVelocity->front() : NULL; } - inline float* getSndParticleVelocity() { return (mSndParticleVelocity) ? (float*) &mSndParticleVelocity->front() : NULL; } + inline float* getSndParticleVelocity() { return (mSndParticleVelocity) ? (float*) &mSndParticleVelocity->front() : NULL; } + inline int* getSndParticleType() { return (mSndParticleType) ? (int*) &mSndParticleType->front() : NULL; } inline int getNumFlipParticles() { return (mFlipParticleData) ? mFlipParticleData->size() : 0; } inline int getNumSndParticles() { return (mSndParticleData) ? mSndParticleData->size() : 0; } @@ -194,6 +197,7 @@ public: void setFlipParticleVelocity(float* buffer, int numParts); void setSndParticleVelocity(float* buffer, int numParts); + void setSndParticleType(int* buffer, int numParts); private: // simulation constants @@ -286,6 +290,7 @@ private: std::vector<pData>* mSndParticleData; std::vector<pVel>* mSndParticleVelocity; + std::vector<int>* mSndParticleType; void initDomain(struct SmokeModifierData *smd); void initDomainHigh(struct SmokeModifierData *smd); diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp index 0e6b0619f77..c075851aea9 100644 --- a/intern/mantaflow/intern/manta_fluid_API.cpp +++ b/intern/mantaflow/intern/manta_fluid_API.cpp @@ -160,7 +160,7 @@ extern "C" void smoke_export(FLUID *smoke, float *dt, float *dx, float **dens, f *dx = 1; //dummy value, not needed for smoke } -extern "C" void liquid_export(FLUID *liquid, float **phi, float **pp, float **pvel, float **ppSnd, float **pvelSnd) +extern "C" void liquid_export(FLUID *liquid, float **phi, float **pp, float **pvel, float **ppSnd, float **pvelSnd, int **ptypeSnd) { if (phi) *phi = liquid->getPhi(); @@ -172,6 +172,8 @@ extern "C" void liquid_export(FLUID *liquid, float **phi, float **pp, float **pv *ppSnd = liquid->getSndParticleData(); if (pvelSnd) *pvelSnd = liquid->getSndParticleVelocity(); + if (ptypeSnd) + *ptypeSnd = liquid->getSndParticleType(); } extern "C" void smoke_turbulence_export(FLUID *smoke, float **dens, float **react, float **flame, float **fuel, @@ -719,6 +721,11 @@ extern "C" float liquid_get_snd_particle_velocity_z_at(FLUID *liquid, int i) return liquid->getSndParticleVelocityZAt(i); } +extern "C" int liquid_get_snd_particle_type_at(FLUID *liquid, int i) +{ + return liquid->getSndParticleTypeAt(i); +} + extern "C" void liquid_update_mesh_data(FLUID *liquid, char* filename) { liquid->updateMeshData(filename); @@ -751,6 +758,11 @@ extern "C" void liquid_set_snd_particle_velocity(FLUID* liquid, float* buffer, i liquid->setSndParticleVelocity(buffer, numParts); } +extern "C" void liquid_set_snd_particle_type(FLUID* liquid, int* buffer, int numParts) +{ + liquid->setSndParticleType(buffer, numParts); +} + extern "C" float *fluid_get_inflow(FLUID* fluid) { return fluid->getInflow(); diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index 15f1b40db44..69c0f3b26a8 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -101,6 +101,7 @@ pp_s$ID$ = s$ID$.create(BasicParticleSystem)\n\ ppSnd_s$ID$ = s$ID$.create(BasicParticleSystem)\n\ pVel_pp$ID$ = pp_s$ID$.create(PdataVec3)\n\ pVelSnd_pp$ID$ = ppSnd_s$ID$.create(PdataVec3)\n\ +pTypeSnd_pp$ID$ = ppSnd_s$ID$.create(PdataInt)\n\ mesh_s$ID$ = s$ID$.create(Mesh)\n\ \n\ # Acceleration data for particle nbs\n\ @@ -412,6 +413,7 @@ if 'pp_s$ID$' in globals() : del pp_s$ID$\n\ if 'ppSnd_s$ID$' in globals() : del ppSnd_s$ID$\n\ if 'pVel_pp$ID$' in globals() : del pVel_pp$ID$\n\ if 'pVelSnd_pp$ID$' in globals() : del pVelSnd_pp$ID$\n\ +if 'pTypeSnd_pp$ID$' in globals() : del pTypeSnd_pp$ID$\n\ if 'mesh_s$ID$' in globals() : del mesh_s$ID$\n\ if 'pindex_s$ID$' in globals() : del pindex_s$ID$\n\ if 'gpi_s$ID$' in globals() : del gpi_s$ID$\n\ diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 313a0c3c436..28182fb7bd9 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -362,7 +362,7 @@ class PHYSICS_PT_smoke_particles(PhysicButtonsPanel, Panel): col.enabled = not domain.point_cache.is_baked col.prop(domain, "use_flip_particles", text="FLIP") col.prop(domain, "use_drop_particles", text="Drop") - #col.prop(domain, "use_float_particles", text="Floats") + col.prop(domain, "use_float_particles", text="Float") #col.prop(domain, "use_tracer_particles", text="Tracer") col = split.column() diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 98470c92b88..bb298a13cd4 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -5847,7 +5847,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Particl @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs