bcongdon / bpy_lambda

🎥 A compiled binary of Blender-as-a-Python-Module (bpy) for use in AWS Lambda
MIT License
66 stars 22 forks source link

Blender compositing not working #11

Open dedosmedia opened 5 years ago

dedosmedia commented 5 years ago

Always that I try to render some compositing nodes I get black pictures in the output. Does not work this module with compositing nodes?

My test.blend file is just an input node (single jpg image) and a composite node. Like this: blender

I have been testing with Docker lambci/lambda:build-python3.6 container, with module bpy_lambda installed.

This is my python code, to open the test.blend and the write a still image to /tmp/output.jpg on disk : `try: import bpy except ImportError: from bpy_lambda import bpy

bpy.ops.wm.open_mainfile(filepath="test.blend") bpy.ops.render.render(write_still=True) ` When I run:

python test.py /tmp/output.jpg is just a black picture

This is the log from the python script: bpy_lambda


On the same machine I installed blender binaries. Running this command I render the composition.

blender -b "test.blend" --use-extension 1 -noaudio -nojoystick -P test.py

This time it works correctly, /tmp/output.jpg is just my same input0.jpg image, which is right.

This is the log: blender binary

Notice this time the log has some lines with "Compositing" word, which are not when I user bpy_lambda. Fra:47 Mem:109.20M (0.00M, Peak 109.20M) | Time:00:00.11 | Compositing | Tile 31-40

Is there a way I can get it working with bpy_lambda?

Thanks so much in advance young dude!!

I attach my files for reference: test.zip

bcongdon commented 5 years ago

The current docker image for bpy_lamdba has the Blender compositor disabled (https://github.com/bcongdon/bpy_lambda/blob/master/docker/Dockerfile#L72)

You can try rebuilding with that flag flipped to ON, but you might run into other dependency issues.

dedosmedia commented 5 years ago

Thanks for your Quick answer!!! I tried changing it to ON, but now I have an erro when importing bpy: libOpenImageIO.so.1.7: cannot open shared object file: No such file or directory

Maybe I will make another try tomorrow. Thanks so much

bcongdon commented 5 years ago

FWIW, I was able to get around the error with libOpenImageIO by setting the flag -DWITH_OPENIMAGEIO=ON in the Dockerfile.

However, now I'm getting an error trace like this upon import:

ImportError: cannot import name 'orientation_helper'
Exception in module register(): '/var/task/bpy_lambda/2.79/scripts/addons/io_curve_svg/__init__.py'
Traceback (most recent call last):
  File "/var/task/bpy_lambda/2.79/scripts/modules/addon_utils.py", line 350, in enable
    mod.register()
  File "/var/task/bpy_lambda/2.79/scripts/addons/io_curve_svg/__init__.py", line 71, in register
    bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
AttributeError: 'RNA_Types' object has no attribute 'TOPBAR_MT_file_import'

I'm not sure what to make of that. I did a bit of searching for RNA_Types and TOPBAR_MT_file_import, but not much came up that would indicate what the issue is.

QuteBits commented 4 years ago

^ I get the same error when running tests on a fresh build (which built just fine from scratch on a fresh machine)

QuteBits commented 4 years ago

image

bcongdon commented 4 years ago

As far as I can tell, those errors are seemingly harmless, but I still haven't been able to track down their source

safsin commented 3 years ago

bpy.types.TOPBAR_MT_file_import replaced bpy.types.INFO_MT_file_import for Blender >= 2.8. Therefore, the addons used here are meant for Blender >= 2.8, while bpy_lambda is for 2.79.

However, after I replaced 2 occurrences of bpy.types.TOPBAR_MT_file_import in /var/task/bpy_lambda/2.79/scripts/addons/io_curve_svg/__init__.py with 'bpy.types.INFO_MT_file_import', I got new errors -

File "/.local/lib/python3.6/site-packages/bpy_lambda/2.79/scripts/addons/io_mesh_stl/init.py", line 76, in @orientation_helper(axis_forward='Y', axis_up='Z') NameError: name 'orientation_helper' is not defined

Another observation: On python console in terminal, I get these errors only the first time I execute import statement (from bpy_lambda import bpy). On executing the same statement a second time, no errors come up and I'm able to use bpy with no errors (probably errors might come if I try using erroneous addons). Any idea why this might be happening? @bcongdon