PyCarrara, a free Python scripting plugin for Carrara
© 2010 Frederic Rible

PyCarrara plugin usage example :

To use the modifier feature of this plugin, you have to provide a Python function called “Modifier()”. The following piece of code is taken from my “Zarathustra” demo scene :


def Modifier(obj, t):

  for i in range(3):

     piston = obj + ("/Piston %d" % (i+1))

     s = c3d.object_get_offset(piston);

     s.z = 21.5 + 4*c3d_midi.Interpolate(appli.pistons[i], t)

     c3d.object_set_offset(piston, s)


The “Modifier()” function is called with two parameters :

· obj : a string with the path of the object for which the modified is setup. This is a text string similar to a Windows or Linux file pathname which describes how to access an object, considering the scene as the root. In the “Zarathustra” scene, “/Trumpet/Piston 1” path gives access to the fist valve.

· t : a float variable containing the frame time in seconds

The “Modifier()” function is called automatically by Carrara for each frame. This function gets the time and calculates the position of any relevant object as described by the user's Python code. In the “Zarathustra” scene, the trumpet valves are driven by the Python script. Each valve has a target helper child used as target for the last bone of the robotic hand fingers.