[Bf-committers] Blender Mantaflow integration

Kévin Dietrich kevin.dietrich at mailoo.org
Fri Feb 19 01:19:31 CET 2016

Le 2016-02-18 23:51, David Ullmann a écrit :

> Hi everyone!
> My name is David and first of all thank you Sebastián for your work on the
> Mantaflow integration! I'm really looking forward to
> having its features available in blender.
> I'm just coding for fun in my spare time (I'm an orthopedic surgeon), so
> when I was looking for a new project to play with
> I decided to have a look at Mantaflow and eventually build my own little
> gui to visualize simulation output.
> Since I wanted to work in C++ alone, I modified Manta's code to be able to
> call the solver via C++
> without building the Python wrapper (which also allowed me to skip the
> preprocessing step when
> building Mantaflow). While it's surely debatable if this was really
> necessary (or intelligent), it at least gave me the opportunity
> to familiarize myself with the library to some degree (also this process
> satisfies my OCD tendencies, ahem...).
> Long story short, I gathered all my courage, started to cleanup the code a
> bit and published my modified version of Mantaflow on GitHub.
> One motivation was a concern raised by Kévin Dietrich on blenderartists:
> *"The main thing that bothers me is the way Mantaflow works, you need to
> feed it a python script and a set of OBJ files.*
> *So in the Blender integration, it feels a bit hackish. Maybe there's a way
> to get to the C++ code directly, but I don't really know Mantaflow, so I
> can't tell"*
> I'm really not sure if my modifications are useful for anyone but me
> (knowing that my skills are nothing compared to all
> the pros here) but then at least I had a lot of fun and learned a lot while
> playing around :)
> modified Mantaflow repo: https://github.com/robocyte/mantaflow
> thread on BA:
> http://blenderartists.org/forum/showthread.php?373547-Lets-talk-about-Mantaflow
> Cheers,
> David

Hi David, 

Your approach is not really what I had in mind. What I was thinking
about, I did briefly check, is to make use of the pre-processed files.
Basically two things happen there: 

1. the various "lookup" functions are put inside (threaded) loops [0] 
2. a Python API is generated 

My idea was to just use the result of (1.), and make a nice C/C++ API
for it for use in Blender. If that's even possible. Of course, quite an
API would need to be written, and maybe some stuff would need to
rewritten from scratch, but it's still better than hacking Blender's
Python module. Then, as I said, I don't really Mantaflow's internals, so
I'm just tossing some idea. 

With your approach, it'll make things a bit harder if we want keep the
code somewhat aligned with upstream (unless you get your work accepted
by upstream). Maybe others can comment here too. But it could work out,
I guess. 

Nevertheless, I am going to state it again: as far I'm concerned (and at
least one other developer agrees here), the only way the Mantaflow
"integration" will be accepted in Blender (in master), is to either get
rid of, or bypass, the Python API (i.e. not hacking the BPY module).
(And I know Sebastián is not really to blame here ;) ) 

[0] a bit unreadable, but to showcase what I mean



[1] https://developer.blender.org/diffusion/B/browse/fluid-

More information about the Bf-committers mailing list