pasteKey problem


#1

Hello everyone,

I hope you can help with this because I’m getting mental here hehe… So this is the problem: I’m trying to copy some keyframes for an animation to another one, the copy part it’s perfect, but when I use the comand “pasteKey -t $p;” it’s not pasting it in frame $p, it’s doing it in the first frame. I checked if the value of $p was correct and it is. So I don’t know what the problem can be.

global proc copiarAni(string $ani, string $b1, string $e1, string $b2) {

            //Extraer los campos
            $a=`textField -query -text $ani`+":ctrl_*";
            $x=`textField -query -text $b1`;
            $y=`textField -query -text $e1`;
            $p=`textField -query -text $b2`;
            $n="ctrl_*";
            $a2=`textField -query -text $ani`+":ctrl_Maestro*";
            $n2="ctrl_Maestro*";
            $frame1= ""+$x+":"+$y+"";
            
            select -r `ls -tr "nurbsCurve" $a`;
            select -d $a2;
            copyKey -time $frame1;
            select -r `ls -tr "nurbsCurve" $n`;
            select -d $n2;
            pasteKey -t $p;

            
            // print ($p+", ");
            return;
}

    //Crear una ventana

    if (`window -ex ventana`) deleteUI ventana;
    window -sizeable false -width 80 -height 60 ventana;
    columnLayout -adjustableColumn true -rowSpacing 12;
        frameLayout -label "Animacion a Copiar" -collapsable true; 
            //Campo texto
            columnLayout -adjustableColumn true -rowSpacing 2; 
            //Campo texto
            $ani=`textField -w 80 -tx "Nombre_golpe" frame0`;
            setParent ..;
            columnLayout -adjustableColumn false -rowSpacing 2; 
            $b1=`textField -w 80 -tx "Frame_Begin" frame1`;
            $e1=`textField -w 80 -tx "Frame_End" frame2`;
            setParent ..;
        setParent ..;
        frameLayout -label "Intervalo a donde copiar" -collapsable true -collapse false;
            columnLayout -adjustableColumn false -rowSpacing 2;
            $b2=`textField -w 80 -tx "Frame_Begin" frame1_1`;
            //$e2=`textField -w 80 -tx "Frame_End" frame2_2`;
            setParent ..;
        setParent ..;
        button -label "Copiar Animacion" -command "copiarAni($ani,$b1,$e1,$b2);";
    setParent ..; 

    showWindow ventana;

Please if you can help me would be lovely.
Thank you


#2

You probably solved this by now, but anyway…

If you want to paste keys manually, it won’t work unless a target node doesn’t have at least on key, or animation curve.
Maybe that is the same problem with your script.
Try to add a single keyframe on a desired attribute, just before you paste.

Hope it helps,
cheers
Dejan


#3

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.