Backup Script
home
Setup

General Python Integration

While Serpens is great for building UI or quickly creating simple addons, algorithms are hard often to translate into nodes. This shouldn’t stop you from using Serpens as you can integrate code into your Serpens addon.
You can even use an external IDE for writing your script and see the changes live inside of blender. Serpens really only supports single file addons, so you won’t be able to use Serpens only for a part of your otherwise custom addon. Code should be an addition to a Serpens addon, not the other way around.
Note that while you can edit the exported Serpens code and use it as a starting point, it won’t be optimal in any way. We are doing a lot of generalization in the code to make it easier for users to work with the nodes and think less about programming. This means that we will have unnecessary parameters, weirdly formatted code, type conversion without any effect, and utility functions that you wouldn’t otherwise use. The generated code might be a good starting point to learn the general syntax and then build on top of with your own scripts, but you shouldn’t take it as the correct way to write something.

Nodes

There are different nodes that can help you to use python inside of Serpens. You can find these in the python section.
The most useful node here will probably be the Run Script nodes, as well as the Scriptlines. Scriptline allows you to quickly add a couple of lines into your nodes while Run Script lets you add an entire script. You can even use the register and unregister functions in these to make complex additions.
You can pass parameters from Serpens to your code. For the other way around, you need to create the Serpens container (variable or property) first and then set that in your code to access it in the nodes.
At various places in the Serpens UI, you’ll find copy buttons that copy the python name of an item or node. You can use these python names in your code.
TOP