The Pyjea node editor is part of the Panjea Plugin, it requires PyQt5 for Python2 and Blender2.8.
Using Pyjea you can script logic that drives animation in Blender, and create runtime game logic for the Panjea.com open world.
The Input node allows you to enter any valid python expression.
When you declare a variable in an input, it will become a global variable.
Above makes a a global variable, and sets it to 1. If you use a Python node to change this variable, connect the Input Node to an output node to see it update.
The While node runs when its condition input is true. The body input is run each loop iteration, and the result is sent to the output.
The basic math nodes each have two inputs and a single output.
Random node returns a random number in range from 0.0 to 1.0
The Python node allows you to directly write a Python function, The function arguments will be mapped to input slots. The function return is mapped to the node output.
The following examples are much easier to follow after you have finished our basic Python lessons 1-5. This example is nearly a direct port of lesson1.py to a nodes format. Pyjea Nodes use many constructs that are higher level than regular Python, like the Set If node used in this example. The SetIf node only sets to the given key/index when the condition is true, otherwise it just returns the input list, dict or string.
Above is the entire graph for this example, take note of the purple dashed line, this marks a point where the graph iterates in a cycle for some number of steps. For nodes have an output on the top called index, these can be plugged into any node that has a bottom input. In this case the For-index it plugged into the var of an Input node, the Input node simply relays the index to a Get and Equals node. The Equals node checks if the current index matches the player position mey, then if the player is on that current line, it triggers SetIf to set the player icon in that line.
This example is a rewrite of Example1, made using less nodes and more Python. The String and Multipy nodes are replaced by more compact Python expressions like: "🌲"*16. The SetIf, Get, and Equals nodes are replaced by a simple Python Function node that contains:
def myfunction(idx,x,y,map,p): line = list(map[idx]) if idx == y: line[x] = p return lineUse less nodes and more Python when you can, this will allow you to quickly refactor things later on.
First take a look at the pure Python version of this example, see lesson4.py Notice the ugly and legacy code in lesson4.py, here we replace that with simple nodes. Because lists only have 10 inputs each, and our ASCII art contains more lines than that; two lists are used, which are then added together to form the final list.
Using the Print node symbol mapping and color mapping inputs, you can easily replace symbols with other symbols, and color each one.
Note how the special full block symbol "█" replaces all the symbols, this is the same trick used in lesson4.py to fake a pixel.