Friday, December 28, 2018

LMMS Scripting

The new scripting system in LMMS allows you to run javascript inside of LMMS. You can generate beats and notes, and call external an external process like mplayer, which on Linux allows you to embed the mplayer window into the LMMS workspace.
above blender2.8 embedded inside of LMMS above: amsynth, hydrogen, and vlc inside of LMMS
LMMS X11 Scripting Fork

Wednesday, October 31, 2018

Back to CSDA Baguio

First day of blender2.8 classes at CSDA in Baguio City. Students have no prior 3D software experience. Crash course in blender sculpting.


Tuesday, May 23, 2017

Unblender CPP14

Blender contains a specialized logic brick editor which is used to drive game logic in Blender's internal game engine (BGE). The Unblender fork removes the old BGE, and replaces it with a generic logic editor, for better export to external game engines like Unreal.

new Unblender generic logic nodes

Unblender supports material and texture groups

The logic brick editor is written in C and not yet exposed to the Python UI scripting layer. The C source code of Blender is split into two layers: DNA and RNA. DNA contains the core data types (structs), and the RNA wraps the data types with a public API. These layers are bound by C code generated by makesdna and makesrna. Rebuilding Blender from source only takes a couple minutes, which makes it even easier modify.


Below is an example of a custom logic brick, The struct bForEachCont abstracts a for each loop over a group of objects. It contains a pointer to a Group struct, the items to loop over.
typedef struct bForEachCont {
 struct Group *group;
 char body1[128];
 char body2[128];
} bForEachCont;

Inside Unblender's logic brick editor this controller UI will show a selector for any groups the user has defined. This allows the user to abstract away the name of a Group in the scene from the code that operates on it. Variables and other special key names, used in hand written code for runtime game logic, no longer need to be kept in sync with object and material names in the 3D scene by the artist and level designer.

Blender is not C++ (yet)

The core of Blender is written in C, with some use of C99 features (non-trival struct initialization). A C++ wrapper over the C API is generated by the build process, RNA_blender_cpp.h (55K lines). While this provides a clean interface for C++ code to use the Blender API, it is not a solution to make deep changes to blender.

Unblender removes this restriction, by making Blender's core fully C++. This makes it easy for the user to fork Unblender, and directly integrate C++ at any level: from compiled plugins to, changing the core data types like Object from a struct to a class with custom methods and data.

Blender Forward and Backwards Compatible

Unblender is a hard fork of Blender, and there is no expectation that these changes will ever be merged back into the BF main repo. As a fully independent fork that will continue for years to come, the long term plan is to:

  • blender core c++14
  • stay compatible with Blender2.7
  • merge new code from Blender2.8
  • merge code from the FractureModifier fork
  • stay C compatible as much as possible
  • custom pipeline to Unreal Engine
  • custom pipeline to Unity Engine
  • all new c++ modules are licensed MIT (not GPL)
  • rapid dev cycle bypassing the Blender Foundation

Porting Blender to C++14

Most of Blender's core is written in plain C, and very easy to port to C++, as these commits show, its mostly a matter of removing non-trivial struct initialization (a C99 feature) and some changes to the CMake build: [1] [2] [3] [4]

The C code generated by makesrna is harder to port to be C and C++ compatible, because it uses static structs that are initialized globally, and C allows you to forward declare a struct reference and use it in the initialization of another struct - while C++ only allows you to forward declare a pointer to a struct and use that in the initialization of another struct. These commits begin the work of fixing this problem. [5] [6]

PointerPropertyRNA rna_GroupLogicNode_group = {
 {(PropertyRNA *)&rna_GroupLogicNode_filter_startswith, NULL,
 -1, "group", 8388609, 0, 0, "group pointer",
 0, "*",
 NULL, 318767104, NULL, NULL,
 0, -1, NULL},
 GroupLogicNode_group_get, GroupLogicNode_group_set, NULL, NULL,&RNA_Group

StringPropertyRNA rna_GroupLogicNode_filter_startswith = {
 {NULL, (PropertyRNA *)&rna_GroupLogicNode_group,
 -1, "filter_startswith", 262145, 0, 0, "if starts with",
 "filters group results",
 0, "*",
 NULL, 318767104, NULL, NULL,
 0, -1, NULL},
 GroupLogicNode_filter_startswith_get, GroupLogicNode_filter_startswith_length, GroupLogicNode_filter_startswith_set, NULL, NULL, NULL, 64, ""

Above is an example of C code generated by makesrna, you will notice that the initialization of rna_GroupLogicNode_group begins with taking the address of rna_GroupLogicNode_filter_startswith, and casting it to a pointer of type PropertyRNA, but the definition of rna_GroupLogicNode_filter_startswith comes after. This is valid C code, but not valid C++. The workaround in C++ is to use a forward declared pointer to the struct.

Current Status

In the top level CMakeLists.txt file change set(WITH_CPP_CORE OFF) to set(WITH_CPP_CORE ON). At the moment all the libraries will compile but will fail at the final linker stage, with missing symbol errors from depsgraph and RNA.

Sunday, May 14, 2017


Above is a prototype of automatic translation of a Python-like language to Unreal Engine blueprint nodes.

Below another example that also shows the generated UnrealEnginePython script that builds the blueprint nodes inside of Unreal Editor.

Unblender Fork on Github

Unblender is a new fork of Blender that removes the BGE, and replaces it with a generic logic brick editor that can export logic to Unreal and other custom game engines.

Above shows the first working build of Unblender, with new "Actuators" bricks that just get references to scene: objects, meshes, materials, and textures. Below shows how event inputs are plugged into single line code callbacks, and then rewritten to use less bricks with a python script.

Saturday, October 8, 2016

Bosemans Dirty Little Secret

Out of sight and out of mind seems to be the policy of the city of Boseman. The police are busy taking down tents in the city, and forcing homeless just outside of town, under the freeway, where there are no trash cans or oversight. The garbage is sinking into the mud and soil, and each day becomes harder to clean up, while everybody in town ignores the growing problem, and is too busy drinking and getting drunk to actually care.

If you are resident of Boseman, print out this flyer, post it, and help organize the clean up of site-1

Saturday, May 7, 2016


Some people have been asking me what happened to: PythonJS, Rusthon and Pythia. I am still working on them in a new fork that I will make public later, along with a partial rewrite of CPython.

For the next couple months I am working from the quiet town of Barstow, which has a mix of mad-max/thug culture and raw nature.

Bush Hacking

Sunday, February 14, 2016

Back in Gotham City

After two weeks in Oakland, Jimmy and I return to Sacramento. We had not even been in the city for more than 30minutes, before we saw the police with their anger and power.

The video above is of the Sacramento police arresting a young, peaceful protester in front of city hall.

update: feb 15th, 2016

Arrest of Rafterman (me)

My first arrest for protesting at cityhall. Sgt. John Harris looked down at me and says "is he moving? (no) get him"

Wednesday, February 10, 2016