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

Consider using Blender as a built Python module #9

Open
EricCousineau-TRI opened this issue Oct 16, 2019 · 3 comments
Open

Consider using Blender as a built Python module #9

EricCousineau-TRI opened this issue Oct 16, 2019 · 3 comments

Comments

@EricCousineau-TRI
Copy link
Collaborator

Was perusing some background stuff, and it looks like you could build Blender as a standalone Python module, rather than requiring it be the entry point:
https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule

Perhaps that, combined with permitting off-screen rendering (to avoid file write+read to access the bytes), could be useful?
https://blender.stackexchange.com/questions/69230/python-render-script-different-outcome-when-run-in-background/81240#81240

@EricCousineau-TRI
Copy link
Collaborator Author

FTR, looks like this person had tinkered with getting the rendered image using Viewer nodes, though it's unclear if that requires the GUI to be running:
https://ammous88.wordpress.com/2015/01/16/blender-access-render-results-pixels-directly-from-python-2/

@gizatt
Copy link
Owner

gizatt commented Oct 17, 2019

Oh neat. Hadn't found that first thing. I did look a bit, back when I first wrote this stuff, at trying to get direct data access to the rendered image (precisely to avoid the awkward file write/read), but I couldn't quite finangle it into working... I suspected doing things headless was the problem. That edit to the Blender source might be the trick required to get that working!

About involving Blender as a module: considering Blender is GPL, maybe keeping it in a separate process is a little cleaner from that perspective? (I'm not super clear on where that boundary gets drawn.)

@EricCousineau-TRI
Copy link
Collaborator Author

Oh yeah, definitely would be keeping the overall rendering as a separate process for licensing concerns; namely it'd be for simplifying the execution of the scripts.

In terms of editing the source, though, if it's already being recompiled, then perhaps adding in doing the standalone module as part of the source recompile (and possibly leveraging the system interpreter) could make things a bit simpler -- assuming it doesn't make the licensing too complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants