Welcome to ask.woodem.org. You may post when you login through your GitHub account.

Woo integration into Blender?

0 votes
81 views
asked Jul 29, 2014 by nmiri127
(Imported automatically from https://www.launchpad.net/woo/+question/252359)

Hi,
Is it possible to import woo (as a python module) into Blender to conduct simulations and post-processing? My scenario:

->I do not know very much Python (just importing modules), I am asking this on behalf of a colleague who is working with woo and requires some "fancy" simulations (something ParaView is not capable of).
->woodaily is installed on my system
->latest Blender version (2.69) is also installed (in which I am fairly proficient)
->Ubuntu 14.04(amd64) LTS

The logic:
I can import woo in a regular python terminal like so: "import woo". However this module is not found in the Blender Python console, I know for a fact that this an issue with the environment variables, but I don't know what ones I need to configure.

Any help would be MUCH appreciated!
-Nabil

5 Answers

0 votes
answered Feb 24, 2015 by eudoxos (49,150 points)
selected Jun 8, 2015 by eudoxos
 
Best answer
Hi Nabil, good news --  I commited changes which make Woo work under Python 3.x. Packages are currently being built in the PPA. There might be glitches, but all big problems have been overcome. Cheers, Václav
0 votes
answered Jul 29, 2014 by eudoxos (49,150 points)
Hi Nabil,

I tried to import woo in Blender and there are two obstacles.

1. The module path does not contain the directory where woo resides, but this is due to the fact that

2. blender integrates Python 3.4, whereas Woo is compiled against Python 2.7.

I filed #1349916 to address this, and did some fixes in setup.py so that at least the compilation starts, but there are for sure issues to be expected. Some modules (e.g. xlrd, xlwt) do not even exist for python3 yet AFAIK.

If you are willing to test the first python3 version once it's ready, I will be happy to give a help.

What is the scenario you plan to use Woo for, with Blender? Just curious.

Cheers, Vaclav

0 votes
answered Jul 29, 2014 by nmiri127
Generally, we are dealing with ice simulations in various scenarios and the team appreciates the fancy static photos I have generated in Blender. So, instead of going woo->Paraview->Blender, I would like to streamline it into more of a Woo/Blender workflow.

I'd definitely be happy to test the python3 version, just tell me what to do :D

Thanks again,
-Nabil
0 votes
answered Aug 1, 2014 by eudoxos (49,150 points)
I looked at python3 support, most of the changes made it to trunk in last commits. setup.py supports use_2to3 to convert python files at install-time, but there are a few outstanding and blocking issues:

* py/_monkey/io.py: unicode vs. str vs. bytes (introduced in py3k), not clear how to make this compatible with both py2k and py3k.
* boost::python iterators are not accepted as iterators in py3k (must look at that in more depth)

For the rest, it seems to be fine, but be patient, it may take a few weeks/months to iron that out. For now, stay on the safe side and use py2k.

I am surprised that blender in 14.04 embeds python3.4, since 2.7 is the default version in the archive (which we support just fine).

Vaclav
0 votes
answered Aug 1, 2014 by nmiri127
Here is an explanation from their team:

"Since Blender 2.5 we've moved on to Python 3.x This means it is not possible to use Python 2.x for scripting in Blender.

Now it's impossible to build against Python 2.x, and even if you did manage by editing the source-code, you'd probably run into problems running Blender, since Blender's own scripts are coded in Python 3.

Setting PYTHONPATH to a non Python 3.3 installation like Python 2.7 will cause Blender to crash and die horribly. (So always make sure you don't have PYTHONPATH set to a non-compatible Python version. But you can use it to point to an external Python 3.3 installation that has extra modules installed that don't come bundled with Blender).

Note: with current Blender pointing to Python 3.1 or Python 3.2 will also fail. So make always sure you point your PYTHONPATH to same version as used in Blender, should you need the external one."

...