Were there any attempts to use lisp/scheme as the extension language for blender

Hi, were they any work on using lisp as the extension language for blender. I remember there was one to use Lua. And how hard it is to embed common lisp or scheme inside blender?

1 Like

I am very interested in hearing a response to this…
Using lisp would be a dream come true for me!

1 Like

You could get a LISP interpreter written preferably in C or Python, because if is C it can be accessed with Python’s ctypes, if is Python it can be included with a simple import statement.

For plain and simple console programs it would work perfectly without problems. However if the scheme program was to use Blender’s API it would require writing special glue code. Only that way the Scheme/Lisp program can call the BPY functions. Currently I have no idea about getting that glue code to work but if is done automatically and on the fly it would be awesome and it would save months of work (porting the entire Python API is the big problem actually).

Interpreters:

https://github.com/search?l=Python&q=lisp&type=Repositories
http://norvig.com/lispy.html

@paarulakan @Travisty

There is a embeddable version of common lisp aptly called ECL. It is been shown to work very well with Qt framework. I’d like to embed ECL within blender as part of a research project. I know that implementing other language for scripting is considered an anti feature, but of there is a guideline on how to do that or doc on how python api works, it would be of immense help.

I am pretty sure there is no such documentation (about how the python api works). You will just have to read the code to figure it out. (A useful thing, much more useful than adding another scripting language IMO, would be to create such a document.)

What scattered (and somewhat out-of-date) documentation exists is either here or here.

1 Like

Lisp is my favorite programming language. Unfortunately, it’s not very popular. I mean Scheme is supported in Gimp, but there’s still not a lot of activity around it. Although, Autolisp seems to be doing not as bad. The only 3D program that I know written in Lisp is Mirai and that program is dead. What are you interested in doing in your research project? If you manage to embed lisp in Blender, please let the community know.

Just for testing purposes. I spend a few minutes today to hack an initial attempt.

  • Lots of ways have to be figured out how to wrap this up into a proper and usable solution. If anyone is interested to go further with this is welcomed.

  • As of now the most simple solution currently is to mix Python+Lisp at the same time, though Lisp programs have to be developed separately and become pure, so they rely on plain input and output, then this output is read from Python code and does any additional operations in the bpy API.

  • Another attempt would be to create a lisp library that contains these special function declarations. However it means that these functions will emit real Python code as strings, and Python will interpret with “eval”.

  • Forget about efficiency because now you have an interpreter on interpreter, but the real deal is to have an actual port to C and accessed with the help of ctypes. :slight_smile:

2020-03-08 09_18_33-Blender
blenderlisp.zip (2.6 KB)

If you download the zip file then you would have to edit the batch file in Windows (or rename to sh for other OS).

D:\programs\graphics\blender28\blender.exe --debug --python-expr "import sys; sys.path.append('D:\\programming\\02\\blenderlisp')"

Alternatively if you do not want any shell script, just place the lispy.py anywhere visible from the FILEPATH. (ie: blender28\2.82\python\lib)

2 Likes