Houdini Python Scripting Rubiks Cube HDA Breakdown
>>  Python Rubiks Cube
This HDA utilizes the Type Operator's Event Handling system to create a fully-functional Rubik's Cube - built and manipulated entirely with Python.

The On-Created event runs a Python script that generates the SOP and SHOP networks each time the asset is dropped to scene. This guarantees flawless integration with any Houdini project.

A second module consist of conditional functions that permit geometry rotation without breaking transformations at the global level.

On-Delete and On-Update events run Python scripts that delete all networks within the HDA (this prevents baking networks to the asset).
Tools Used: SideFX Houdini | Python | Rendered with Houdini's PBR Renderer
>>  On-Created Python Script

Houdini's Eventing Handling Type Operator tab allows scripts to be implemented based upon actions taken within the project scene.

On-Created refers to running a specific script when the HDA is dropped to scene. This event is utilized by using an empty HDA.

Instead of baking SOP and SHOP networks to the HDA, an On-Created Python script runs once the empty HDA is dropped to scene.

This script constructs and configures the SOP and SHOP networks that make up the geometry and surface shader elements of the Rubiks Cube.

By generating the asset with a Python script, all respective elements of the asset have defined namespace variables. This allows name-association with other modules to remain transferable and consistent. Also, by generating the asset through script, flawless implementation to scene is guaranteed.

The script creates 27 cubes, parents a null to and names them, binds a 6 group surface shader to them, extrudes them for additional poly detail, and promotes their translation values to global parameters. The shader is also created and colorized via Python script.

Python Generated Cube (One of 27) | Click Here for On-Created Python Script
Rubiks Cube HDA On-Created SOP and SHOP Result

>>  Promoted UI Parameters

The concept of this HDA is to easily rotate the various grid planes of a rubiks cube - and to do so in a matter that does not break the geometry at the global level, or require handscrubbing keyframes throughout the animation process.

This Python built rubiks cube does this with a user-friendly, one-touch button UI solution.

The myFunctions Python module assigns float templates to promoted cube rotation values. These values are bound to UI commands that allow for rubiks cube grid rotation. A user can rotate to any degree in either direction, or rotate at 90 degrees specifically.

This UI also binds a Set Key button to a custom function that keyframes the rubiks cubes current rotation values. This allows the setting of keyframes without have to do so using the HDA's translation parameters.

This is ideal because it allows transformations at the global level, and combining transformations of both global and asset level parameters will not break the rubiks cube rigging system.

A reset button returns the animation rig to default rotation values of zero - unscrambling the Rubiks Cube.


Rubiks Cube Digital Assets Promoted Parameters | Click Here for Call-Back Script Module
Scrambled Rubiks Cube with Visible Center Cube Locator
Center Cube Null Object, Conditional Rotations Measured From This Locator