Putting shape key frames into a layer keyframe matrix

Hi all! I need to copy the keyframes from a shape that is in a layer and then place those key frames into the layer transform matrix please help! I’ve been working with the api and I can’t get anything to work

Kind regards

Brad

I am going to have to ask @marco on this one, I have not had the occasion to work with that workflow before.

Hi Brad -
Can you clarify a bit further? It’s not possible to copy shape keyframes into a layer transform matrix.
Are you trying to copy/move the shapes out of the layer while applying the transform matrix to the shape’s keys?
If so, that’s possible but it’s a bit harder, since the matrix would have keyframes on every frame, and you would have to “bake” every transform into your shape keyframes, resulting in a key on every frame.
Or do you want to do something else?

Okay so you’re already bringing in shapes from Maya that are keyframed on every frame. They wouldn’t need to be in layers since the transforms are already baked in.
Are you asking if there is a way to “unbake” the keys and use some kind of parent transform/tracking information instead? If so that is a very difficult problem to solve.

Yes! That is exactly what we are trying to do! Any help you can provide in this matter would be amazing!

Hi Paul,

to further clarify yes that is what we would like to do. We would like to keep the shapes movement while also having a clean timeline to add key frames. We appreciate any methods or help you can give us

Regards
Brad

Silhouette doesn’t have any facility to do this directly, but you could maybe write a script to do it.
The issue is extracting the gross tracking data from a set of baked keyframes. Do you happen to have the original tracking data used to generate the shape in Maya, or are the shape keyframes all you have? Are the shape keys mostly “tracked” (even though they are baked), or are they edited more ‘randomly’?
The trick is deriving a homography for every frame that can be converted to a matrix, and then the shape data can be unprojected from there.

Hi Paul,

Would you be able to help with the script please as we are finding the api and modules difficult to navigate. Any help that you could provide would be amazing.

That sounds like a great solution. We do have the original tracking data (specifically the point tracking data).

Regards
Brad

If you have the original point tracking data that’s much easier. What format is it in? Can you import it into Silhouette’s point tracker and generate a Corner-pin layer from it?

From the corner points you should be able to project a homography that would then drive a layer transform. However, that would need to be done manually in Silhouette - there is no scripting API to do that yet. You would need to get your pin format into one that Silhouette can read. Look at Silhouette’s “simple” format which should be easy to support. Import your pins as point trackers and then create a Layer from them in the Roto/Tracker node.
Once you have a layer with transform data, to cull the shape keyframes you need to invert the layer transform for every frame and project the shape’s keyframe with that transform, then compare sets of points from different frames to see if they have “moved”. If they are very close, then you know you can unset that shape keyframe and just rely on the layer transform at that frame to do the work. Repeat for every frame until you only have the “important” shape keyframes.
As I mentioned, this is tricky, and there is no built-in process to do this, but it should be possible.

For good examples of what you can do wtih Silhouette’s scripting, look in Silhouette’s resources/scripts folder tree. And check out the scripting reference guide here: Silhouette Wiki

Hey Paul,

With regards to my early question I believe I may have found a solution however to do it I need to make get the shape point transform position and point tracker position on a particular frame please.

Anything close to shapepoint.position(frame) == pointtracker.position(frame) would be very help as the api is alittle unclear on calls for points on a shape and a tracking points position on frame. Any information you can give on this topic would be greatly appreciated.

Regards
Brad

No, you can’t parent shape control points to things. But you can have actions (scripts) which edit or create new shapes based on other objects (trackers).

Tracker has a getPosition(frame) method to evaluate the point but it’s more complex for shapes. You have to evaluate a Path using shape.evalPath(frame) and then look at the points from that.

Take a look at scripts/gui/reshape.py and scripts/gui/splitShapes.py - several of the Reshape tool context menu operations are implemented in those scripts, and they include some complex shape control point analysis and edting.

Thank you for your time