Page MenuHome

Fix T75889: Cannot bake mantaflow via Python API
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on May 11 2020, 5:27 PM.

Details

Summary

The issue was that the current implementation heavily depends on dumping
variables into the __main__ module...
However, sometimes Blender replaces that module when a script in the
text editor is executed. In that case the mantaflow script did not have
access to the variables it needed.

A better fix would be to create a separate module that contains all the variables.
Unfortunately, mantaflow dumps some variables into this module itself using PyRun_SimpleString.
Changing that, might require changes in the mantaflow API. That's out of scope for this fix.

This fix just makes sure that mantaflow always uses the same module independent of whether
it is invoked from some button press or a script from the text editor.

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.May 11 2020, 5:27 PM
Jacques Lucke (JacquesLucke) created this revision.
Jacques Lucke (JacquesLucke) added inline comments.
intern/mantaflow/intern/MANTA_main.cpp
557–563

@Sebastián Barschkis (sebbas) Do you remember why this special treatment is necessary? I don't see the need for it.

intern/mantaflow/intern/MANTA_main.cpp
557–563

No, not sure ... I guess you've already tried building without the ifdef on Windows and it's not problematic? In that case, I would remove it and watch out for it.

intern/mantaflow/intern/MANTA_main.cpp
557–563

No, I haven't. Will do tomorrow.

I'll commit this cleanup separately if it works on windows.

This revision is now accepted and ready to land.May 12 2020, 11:59 AM