Bounce Tool

Import Bounce Data to Blender

This script imports animation data (position and scale) from a CSV file exported by the Anim Toys Bounce tool into Blender, applying it to a specified object.

Purpose

This Python script allows you to transfer the bounce animation, including squash and stretch deformations and Z-axis positional movement, from a Fusion composition (using the Anim Toys Bounce tool) to an object in your Blender scene.

Prerequisites

  1. You must have a CSV file exported from the Anim Toys Bounce tool in Fusion.
  2. You need an object in your Blender scene that you wish to animate.

Script Code


import bpy
import csv

# Path to your CSV file
csv_file_path = "path/to/yourbouncedata.csv"

# Name of the object to animate
object_name = "Sphere"  # Replace with your object's name

# Get the object
obj = bpy.data.objects[object_name]

# Conversion factor: 1000 pixels = 4 meters (Adjust if your scale differs)
conversion_factor = 4 / 1000

# Read the CSV file
with open(csv_file_path, 'r') as file:
    csv_reader = csv.DictReader(file)
    for row in csv_reader:
        frame = int(row['frame'])
        
        # Convert center_y_px to Blender units for z-position (height)
        z_position = float(row['center_y_px']) * conversion_factor
        
        # Get x_size and y_size
        x_size = float(row['x_size'])
        y_size = float(row['y_size'])
        
        # Set the keyframe for z-position (height)
        obj.location[2] = z_position
        obj.keyframe_insert(data_path="location", frame=frame, index=2)
        
        # Set the keyframe for scale
        obj.scale[0] = x_size  # X scale
        obj.scale[1] = x_size  # Y scale (Blender's Y is often depth for 2D imported elements)
        obj.scale[2] = y_size  # Z scale (height)
        obj.keyframe_insert(data_path="scale", frame=frame)

# Update the timeline to show all keyframes
bpy.context.scene.frame_end = frame
            

How to Use

  1. Export Data: In Fusion, use the Export Bounce Data button on your configured Bounce tool to save a .csv file. Remember to specify the full path and filename including the .csv extension.
  2. Open Blender: Open your Blender project.
  3. Open Scripting Tab: Go to the Scripting workspace in Blender.
  4. New Script: Click New to create a new text file in the Text Editor.
  5. Copy & Paste: Copy the Python script code above and paste it into Blender's Text Editor.
  6. Modify Script:
    • Update the csv_file_path variable to the correct full path of your exported CSV file.
      Example (Windows): csv_file_path = r"C:\Users\YourName\Documents\bouncedata.csv"
      Example (Mac/Linux): csv_file_path = "/Users/YourName/Documents/bouncedata.csv"
    • Change the object_name variable to match the exact name of the object in your Blender scene that you want to animate (e.g., Cube, MyBouncingBall).
    • Adjust the conversion_factor if needed. The script assumes that in your Fusion comp, the Starting Height (and thus center_y_px) refers to pixels, and you want to map this to Blender's meter units. The default 4 / 1000 means 1000 pixels of height in Fusion will translate to 4 meters of Z movement in Blender. Change this based on your desired scale.
  7. Run Script: Click the Run Script button (looks like a play icon) in the Text Editor's header.
  8. Check Animation: Your specified object in Blender should now have keyframes for its Z location and X, Y, Z scale, replicating the bounce animation. The script also updates the scene's end frame to match the last frame in the CSV data.

Notes

« Back to All Blender Scripts