Steve Sierra
Forum Replies Created
-
Great !
Thanks again Dan 😉
-
Thanks Dan !
I’ll look into “pseudo effects” to see what I can do.
Cheers ????
PS: Still don’t know how to mark an thread as answered… ? -
Steve Sierra
April 11, 2017 at 1:50 pm in reply to: remove keys on property A except where property B has keysHello again,
Could someone tell me how to mark a post as resolved ?
Thanks ! -
Steve Sierra
April 11, 2017 at 1:37 pm in reply to: remove keys on property A except where property B has keysYep ! That works Xavier ???? Thank you very much…
Meanwhile, I did a less elegant version of my own… It has more functions, but doeasn’t use nearestKeyIndex.
Could you tell me which one is quickest ?Thanks again !
S.PS: There seems to be an error in the pasted code in the first function… it’s : for(var t = 1; t <= Len; t++)
var B = app.project.item(1).layer("KeyLayer Comp 1").property("Time Remap");
var A= app.project.item(1).layer("Shape Layer 1").property("Contents").property("Group 1").property("Contents").property("Path 1").property("Path");
var ATimes = [];
var BTimes = [];
var BAIndexes = [];//--------------------------------------------------------------------------------------------------------------------------
app.beginUndoGroup("S_RemoveKeys");
//--------------------------------------------------------------------------------------------------------------------------BTimes = getKeyTimes(B);
ATimes = getKeyTimes(A);
removePostKeys(A, B, ATimes, BTimes);
removeMiddleKeys(A, B, ATimes, BTimes);
removePreKeys(A, ATimes, BTimes);//--------------------------------------------------------------------------------------------------------------------------
app.endUndoGroup();
//--------------------------------------------------------------------------------------------------------------------------function getKeyTimes(prop){
var Len = prop.numKeys;
var keyTimes = [];
for(var t = 1; t <= Len; t++){
var e = prop.keyTime(t);
keyTimes.push(e);
}
return keyTimes;
}
function removePostKeys(A, B, ATimes, BTimes){
for(var i = B.numKeys - 1; i > 0; i--){
var c = BTimes[i];
for(var t = A.numKeys; t > 0; t--){
var a = ATimes[t-1];
if(a !== c ){
A.removeKey(t);
}else{
break;
}
}break;
}
}function removeMiddleKeys(A, B, ATimes, BTimes){
for(var j = B.numKeys - 1; j > 0; j--){
for(var i = j; i > 0; i--){
var c = BTimes[i];
var q = BTimes[i - 1];
for(var t = A.numKeys - 1; t > 0; t--){
var a = ATimes[t];
if(a > q && a < c ){
A.removeKey(t + 1);
}else{
if(a == q){
break;
}
}
}
}break;
}
}
function removePreKeys(A, ATimes, BTimes){
var c = BTimes[1];
for(var t = A.numKeys; t > 0; t--){
var a = ATimes[t];
if(a < c ){
A.removeKey(t);
}
}
}
-
Steve Sierra
April 11, 2017 at 8:18 am in reply to: remove keys on property A except where property B has keysHello Xavier,
Thanks for your reply !
I haven’t had the time to thourougly check out your proposition, but I can’t seem to get it to work…
I believe there was a “;” too many in the first function, but I think there might be a problem with the last function as well.
Can IdxB use tB to define itself while tB uses idxB ? Doesn’t one have to be defined first to define the second ?Thanks again for your answer, I’ll fiddle with it tomorrow and keep you posted !
Cheers !;)
-
Thank you Dan !
I’ll have to do it by hand, unless I can find a way to imitate it…Let’s say we have a mask interpolating between two different keyframes A and B.
here’s what I’m thinking :
first :
– if both keyframes don’t have the same number of verticies, add verticies where needed.
– if it isn’t possible, use (A+ 1 frame) as (A) or (B- 1 frame) as (B)then :
– set keys at every frame
– gather vertices order and position info at every frame
– compare every vertice’s x and y position compared to the previous and next vertex at frames A and B (verticies V1-V2-V3)
– if the verticies are in the same x and y “order”(xV1A&& xV1B && yV1A && yV1B