Moho Integration

Client: “We’ve many tools from you already. Now we would like to create the new project using the Moho animation software. Can we integrate the tools in there?”

We: “Certainly. We’ll have a look.”

Host Handler

  • RnDeep Layer of abstraction for communicating with other DCCs
  • To integrate a new DCC, one needs to implement specific functionalities using the API provided by the DCC
  • Most of the DCCs in CGI support Python
  • Until now, we integrated 8 DCCs: 3 of those had Javascript APIs

What is Moho?

  • Software for creating 2D animations
  • Provides an API
  • It looks like the API contains all functionalities that we need.
  • API - programming language is Lua.

We: “Ehmmmm… Lua? Our tools are mostly written in Python!”


  • Create on basis of previous Javascript-API-DCCs (Photoshop/After Effects/Toon Boom)
  • C++ Plugin
  • Embedded Python Thread
  • Socket Communication with the DCC
  • DCC commands can usually only be evaluated in main-thread

For Lua, we’ll work with a coroutine
We’ll use a modal Dialog to block the main-thread for us, while a python command is actively running


Goal: Create a C++ Lua Plugin that is capable to run a print statement with the Moho internal Lua.

  • [✓ ] Build Lua.
  • [✓ ] Write plugin.
  • [X ] Load plugin.

We found out, that the Lua52.dll is not shipped with Moho.


Adding Lua52.dll to the plugin installation routine.

  • [✓ ] Load plugin.
  • [✓ ] Implement running python code from Lua code: Python getMenuName() → string Lua Plugin.
  • [X ] Implement running Lua code from Python code.

The reason is, that we shipped our own Lua52.dll. And that caused issues with mutable objects:


  • We can’t use mutable objects
  • Instead of a Lua Array we’ll send a Lua JSON string
  • Lua-JSON-Parser will create an Array from the JSON string
  • [✓ ] Implement running Lua code from Python code.
  • [✓ ] Now we can open up python windows.

It Works!