Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: Allow BlenderProc to be used as a Python package #901

Open
hummat opened this issue May 22, 2023 · 2 comments
Open

[FEATURE]: Allow BlenderProc to be used as a Python package #901

hummat opened this issue May 22, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@hummat
Copy link
Member

hummat commented May 22, 2023

Is your feature request related to a problem? Please describe.
Right now BlenderProc seems to be usable only as a stand alone program and not as a Python package. Additionally, a Blender installation is required.

Describe the solution you'd like
Given a Python script my_script.py like so:

from blenderproc.python.utility import Initializer
from blenderproc.api import renderer

Initializer.init(clean_up_scene=False)
renderer.render(verbose=True)

I would like to be able to run it using python my_script.py.

Describe alternatives you've considered
I've largely achieved this by simply commenting everything in BlenderProc/blenderproc/__init__.py and installing BPY using pip install bpy. This is just a hack of course and no real solution.

Additional context
As BlenderProc allows for a much more intuitive interaction with the Blender Python API compared to directly using BPY (comparable to, but much more extensive than, EasyBPY), I believe this to be a nice feature, e.g. for visualization callbacks in training pipelines.

@hummat hummat added the enhancement New feature or request label May 22, 2023
@hummat
Copy link
Member Author

hummat commented May 22, 2023

Probably duplicate of #840

@hummat
Copy link
Member Author

hummat commented May 25, 2023

Not sure if this is related but using BlenderProc (or BPY from pip?) in this fashion seems to lead to memory leaks. Memory usage is increasing linearly with each call to render and after execution I'm seeing the following message:

Freeing memory after the leak detector has run. This can happen when using static variables in C++ that are defined outside of functions. To fix this error, use the 'construct on first use' idiom. Error: Not freed memory blocks: 25165, total unfreed memory 23.370861 MB

The amount of unfreed memory indicated depends on the number of calls to render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
1 participant