PDA

View Full Version : Predefined Path to Spline Control?



raw-m
11-15-2013, 07:14 AM
This would be perfect for Spline Control but I'm left a little unsure the best way to set it up!

I've got an animated Camera move that I'm happy with in terms of the path it's taking but I need to change its speed at various positions - a massive pain before Spline Control!

Is there a way to replace an item's already mapped out path with Spline Control - some kind of Path to Spline Control button?

RebelHill
11-15-2013, 08:38 AM
so soon...?


generic
{
knots = 10;
frameStart = 0;
frameStop = 100;
frameRange = frameStop - frameStart;
knotIncrement = frameRange/knots;

motionItem = Scene().firstSelect();
AddNull(motionItem.name+"SplineRoot");
currentFrame = frameStart;
for(i=1;i<=knots;i++)
{
GoToFrame(currentFrame);
now = Scene().currenttime;
motItemPos = motionItem.param(WPOSITION, now);
motItemRot = motionItem.param(ROTATION, now);
AddNull(motionItem.name+"SplineControl"+i);
ParentItem(motionItem.name+"SplineRoot");
Position(motItemPos);
Rotation(motItemRot);
currentFrame += knotIncrement;
}
}

Obviously, set the numbers yourself for how many knots, and the frame range you want to cover, then select the item in question and run it.

raw-m
11-15-2013, 09:20 AM
:bowdown:

raw-m
11-15-2013, 09:38 AM
This is so useful, it should really ship with LW! Had to adjust a few rotations but really great stuff, RH. Lovely! For future ref, is it simple to hook a UI to these things?

RebelHill
11-15-2013, 10:03 AM
I updated it to add the moving items name to the spline null set name, so doing it for multiple items in a scene wont cause naming errors, or make you have to do renaming by hand.

Tbh... I do see a potential usefullness for this as a general thing, I might add a UI and add it to my rigTools.

raw-m
11-15-2013, 10:06 AM
Great news :D. Already finding it useful for a few mograph situations...

raw-m
12-09-2013, 10:54 AM
Hi RH. Just a quickie - is it easy to adapt this script to keys-to-spline? So taking a selected path and adding nulls/Spine Control at the keyframes position on the selected path (rather than at intervals, as the previous one does).