Python scripting could be of a great help, especially when it comes to redundant things that if done manually would take ages. In this part you are going to learn how to use python, inside the python shell, to automate the creation of the Rubik’s cube and all the necessary nodes from scratch. By the end of this part you will have built, using python, the geometry of the Rubik’s cube with the materials attached to it and with nulls parented to the cubes that will serve later in the code.
Introduction to Digital Assets
Digital assets are a very important brick in any workflow built around or using Houdini. In this part you will be introduced to digital assets and you will learn, by transforming the Rubik’s cube into one, how to transform a bunch of existing nodes into a digital asset.
Python Inside The Digital Asset
Since digital assets are entities that can live by themselves, it is crucial to be able to include the scripts they use inside them. There are many methods to do that and in this part you are going to learn one of those methods. By creating a simple python function inside the Rubik’s cube digital asset and then adding a button also to the digital asset to be able to call this function.
Rubik`s Rig Core Code
All is ready now to begin building the core code of the Rubik’s cube rig. In this part you are going to go deeper into the python code that will drive the behavior of the rig. You are going to learn about the functions and how to pass parameters from the buttons to these functions, to be able to drive a multitude of conditions that will determine what cubes belong to which faces, which faces will rotate, how they are going to rotate … etc
Keying and Animation
Up until now all the work done so far, allows only to play with the Rubik’s cube, no keys were set and therefore no animation. To bring the cube to life, in this part, you are going to learn how to create the code that will allow setting key frames on the rotations to get an animation!
What if the user needs to use custom geometry instead of the default cubes? In this part you are going to see how to make this possible and how to allow the user to define a custom geometry or not, in which case the default cubes will be used.
Resetting the cube to its initial state is important because not everyone knows how to solve it! 🙂 In this part a reset button will be created as well as making the rotate function more flexible by allowing it to take the angle in as a parameter.