object traces

Nikolaus Gradwohl2013-09-23T04:46:08+02:00

For this animation I used the bTrace-addon to create a curve from a set of particles. Then I wrote a small python script that copies the current state of the curve every 5 frames. I animated the visibility of the copies to make them appear only if the original curve has passed this position to create a 3D onion skinning like effect.

you can download the blend file here

traces

The python script I used for this animation is

import bpy

base = bpy.context.active_object

for i in range(50):
    bpy.context.scene.frame_set((i+1)*5)

    splines = base.data.splines    
    t = bpy.data.curves.new( "copy%i" %i, "CURVE")
    t.dimensions="3D"
    t.resolution_u = base.data.resolution_u
    t.bevel_resolution = base.data.bevel_resolution
    t.bevel_depth = base.data.bevel_depth * 0.5
    t.fill_mode = 'FULL'

    spline = t.splines.new("BEZIER")
    spline.bezier_points.add( len( splines[0].bezier_points )-1)
    obj = bpy.data.objects.new( 'curve%d' %i, t )

    bpy.context.scene.objects.link(obj)

    for j in range( len( splines[0].bezier_points )):
        spline.bezier_points[j].co = splines[0].bezier_points[j].co
        spline.bezier_points[j].handle_left = splines[0].bezier_points[j].handle_left
        spline.bezier_points[j].handle_right = splines[0].bezier_points[j].handle_right    
    obj.hide = True
    obj.hide_render = True
    obj.keyframe_insert( data_path="hide", index=-1, frame=(i+1)*5)
    obj.keyframe_insert( data_path="hide_render", index=-1, frame=(i+1)*5)
    obj.hide = False
    obj.hide_render = False;
    obj.keyframe_insert( data_path="hide", index=-1, frame=(i+1)*5+1)
    obj.keyframe_insert( data_path="hide_render", index=-1, frame=(i+1)*5+1)
Tweet This! submit to reddit Digg!   Tags: | 1 comments | no trackbacks

See also:

denoising blender animations with opencv and python
Animation Node experiment - closed curve
Animation Node experiment - script node spiral
particle driver experiment
ico sphere vertex traces

Trackbacks

Comments

Leave a response

  1. Marco 2013-10-08T17:32:19+02:00

    Thanks, its so good!

Leave a comment