# Can I use Weight Paint to Control Animation Properties?

I'm thinking weight paint but maybe I mean Dynamic Paint or even something else I'm unaware of. I have cell fractured a long thin cylinder which I am dropping onto a plane using Blender 2.71 Render (not BGE). It has been rotated a little so that its contact with the plane starts at the lowest shard and works its way to the top. Of course, the whole thing simply falls apart on first contact. So, I use rigid body constraints and this works fine keeping it together. What I want, however, is a progressive shatter as the cylinder shards come into contact. In other words, I want the shards which have not yet reached the plane to stay intact. Keyframing this one shard at a time is tedious, prone to error, and all but impossible when there are hundreds of shards.

Can I use weight paint or anything else to control the enable function (or any other property or function) associated with the constraints to switch from enabled to not enabled as a function of time (or frame number)(in other words, as a function of color)?

I'm sure you could do this with weight paint, however, I think it might be overkill. Weight paint and dynamic paint is per vertex, and bullet collision settings are per object.

You can animate the constraint Enabled variable. and you can also add a driver.

The following code will work on an object I fractured using Cell fracture, the object named "Cube". Then I used the Bullet Constraint tools 'Single constraint' to make the constraints. This code won't work if you have used Empties to constrain the objects together.

Press alt A, you will see the box stays together. Run the script (alt P in textblock) and then animate again. You will see the box stays together, until the plane moves above each object.

object_name = "Cube"

import bpy

for obj in bpy.data.objects:
if  object_name+"_cell" in obj.name:
driver_variable = driver.driver.variables.new()
driver_variable.name = "this_obj"
driver_variable.type = 'TRANSFORMS'
driver_variable.targets[0].transform_type = 'LOC_Z'
driver_variable.targets[0].id = driver_variable.id_data

driver_variable = driver.driver.variables.new()
driver_variable.type = 'TRANSFORMS'
driver_variable.targets[0].transform_type = 'LOC_Z'