Does Point Curvature have a keyframe?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Does Point Curvature have a keyframe?

Post by heyvern »

I am trying to figure out how to determine if a point has a curvature key frame.

It doesn't appear to be as straight forward as checking something like fAnimPos using "haskey".

I have a situation where I am checking for keys and moving and deleting the values/keys.
User avatar
hayasidist
Posts: 3522
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Does Point Curvature have a keyframe?

Post by hayasidist »

in summary IIRC:

local vecChannel = curve:Curvature(pointNum) -- point number in curve not in mesh
if (vecChannel:HasKey(moho.layerFrame)) then
...
end

more details in http://www.kelleytown.com/forum/animato ... IC_ID=1537 (may need VIP access for that one) and http://www.kelleytown.com/forum/animato ... IC_ID=1183 .
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Re: Does Point Curvature have a keyframe?

Post by heyvern »

Awesome! Thanks! Works perfectly.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Re: Does Point Curvature have a keyframe?

Post by heyvern »

Woohoo!

This is great. I used this to create a modified "meshinstance" script that matches the keyframes for both point position and curvature.

I've been using meshinstance for smart bone actions to copy key motion for multiple layers that are identical. Problem is meshinstance only matches the movement on every frame not the keys. My modified version duplicates and matches key frames for translation and curvature so I can remove the scripts after duplicating everything. The modded version will add and delete keys to match the source keys.

Previously I had to go to each dup layer and key the point motion by hand before removing the meshinstance scripts. I also had to match curvature "by eye" which is a pain and not very accurate.

It is unfortunate that point curvature keys are such a royal pain in the arse to access. Had to jump through some hoops. Would be nice if the script interface had the same point curvature access for a single point as fAnimPos... but... all's well that ends well. :)
User avatar
hayasidist
Posts: 3522
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Does Point Curvature have a keyframe?

Post by hayasidist »

yeah - there's a few other features that are more buried than helpfully exposed - such as curve exposure (which I only mention as it's currently being discussed in another thread).

that variant of meshinstance sounds interesting - is it available somewhere?
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Re: Does Point Curvature have a keyframe?

Post by heyvern »

hayasidist wrote:yeah - there's a few other features that are more buried than helpfully exposed - such as curve exposure (which I only mention as it's currently being discussed in another thread).

that variant of meshinstance sounds interesting - is it available somewhere?

It can be eventually. It still has some rough edges I'm trying to smooth over. I was actually thinking of creating a new menu script to "duplicate" point motion on multiple layers. I was using Meshinstance because it was the closest thing to what I needed at the time. To be honest it's way "overkill" for my purposes because it matches motion on every frame, and I only needed key frame matching. I load the layer scripts, key frame, then remove. It should probably just be a menu script.

When I added in the curvature feature to my version, it was especially tricky because of the way meshinstance is coded. I realize now that I only need a very simple script that matches key frames "in one go". Don't really need to have it run as a layer script all the time. It could just be a menu script that can run on multiple layers. Select a source layer and apply that to other layers. If I did THAT the scripting to access keys would be so simple, I would just count and copy all key frames and I wouldn't have to rename layers (hard to see what layer is what with all of the "dot-dups" copied everywhere.)

For example, I have a full head turn with a character wearing glasses. The glasses are split into 4 layers, arm right, lens right, lens left, arm left. The points and bone binding are all identical for all 4 layers, the only change is layer order during the turn. So during modeling and smart bone creation, the plan was to get everything perfect on ONE layer and THEN duplicate it 3 times... doesn't work out as planned. I end up tweaking the smart bone turns and actions and have to replicate all of that motion on multiple layers (not just the glasses, there are other "duplicate" layers like the face and face masking, hair, etc) that have the exact same points and motion but simply are on different layers with different shapes filled or not.

Right now my version of meshinstance is like that small car Bourne uses to run from the police in the Bourne Identity movie. It wasn't his first choice, the brakes are kind of squishy, but it gets the job done. :)
Post Reply