xsi =Application
log = LogMessage

sel0 = xsi.Selection(0)
sel1 = xsi.Selection(1)

xsi.CopyAllAnimation2(sel0.Name, "siAnySource", "siAllParam", "", "", "")
xsi.PasteAllAnimation( sel1.Name)


Select the object you want to copy the animation first.  Then select the
object you want to paste the animation second.

Run the script.

Cheers



-------------------------------------------------------
Emilio Hernández   VFX & 3D animation.


2014-06-24 14:13 GMT-05:00 Francisco Criado <[email protected]>:

> thanks a lot emilio! working ok, just forgot to remove the""...thanks
> again!
> F.
>
>
> On Tuesday, June 24, 2014, Emilio Hernandez <[email protected]> wrote:
>
>> xsi=Application
>>
>> sel = xsi.Selection(0)
>>
>> xsi.CopyAllAnimation2(sel.Name, "siAnySource", "siAllParam", "", "", "")
>>
>>
>>
>> -------------------------------------------------------
>> Emilio Hernández   VFX & 3D animation.
>>
>>
>> 2014-06-24 13:54 GMT-05:00 Emilio Hernandez <[email protected]>:
>>
>>> Hello Francisco.
>>>
>>> As Matt said you need to have a valid selection.
>>>
>>> The piece of script I wrote is in Python and Matt's is in Jscript.
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> Emilio Hernández   VFX & 3D animation.
>>>
>>>
>>> 2014-06-24 13:51 GMT-05:00 Francisco Criado <[email protected]>:
>>>
>>>  Hi Emilio and Matt, thanks for your quick response!
>>>>
>>>> Emilio, it seems that sel.name doen't work, here is the log:
>>>> # ERROR : 2000 - Argument 0 (InputObjs) is invalid
>>>> Application.CopyAllAnimation2("", "", "", "", "", "")
>>>> # ERROR : Traceback (most recent call last):
>>>> #   File "<Script Block >", line 3, in <module>
>>>> #     Application.CopyAllAnimation2("sel.name", "siAnySource",
>>>> "siTransformParam", "", "", "")
>>>> #   File "<COMObject Application>", line 2, in CopyAllAnimation2
>>>> # COM Error: The parameter is incorrect. (0x-7ff8ffa9) - [line 3]
>>>>
>>>>
>>>> and Matt, it seems that on the first line when you set the variable
>>>> there is also an error:
>>>> # ERROR : invalid syntax - [line 1]
>>>>
>>>> tried already with "Application.Selection(0).Name" replacing "sarasa"
>>>> but still didn't work :(
>>>>
>>>> F.
>>>>
>>>>
>>>>
>>>> 2014-06-24 15:12 GMT-03:00 Matt Lind <[email protected]>:
>>>>
>>>> You need to filter the selection for eligible objects, then iterate
>>>>> through that list and call CopyAllAnimation2() for each object in the 
>>>>> list:
>>>>>
>>>>>
>>>>>
>>>>> var oSelectedItems = SIFilter( null, siObjectFilter, true,
>>>>> siQuickSearch );
>>>>>
>>>>>
>>>>>
>>>>> if ( !oSelectedItems || oSelectedItems.Count <= 0 ) {
>>>>>
>>>>> return;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> for ( var i = 0; i < oSelectedItems.Count; i++ ) {
>>>>>
>>>>>                 var oSelectedItem = oSelectedItems(i);
>>>>>
>>>>> CopyAllAnimation2( oSelectedItem, siAnySource, siAllParam );
>>>>>
>>>>>                 }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Matt
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *From:* [email protected] [mailto:
>>>>> [email protected]] *On Behalf Of *Francisco
>>>>> Criado
>>>>> *Sent:* Tuesday, June 24, 2014 11:06 AM
>>>>> *To:* [email protected]
>>>>> *Subject:* simple script
>>>>>
>>>>>
>>>>>
>>>>> Hi guys, just trying to do a quick access button, and getting stuck
>>>>> with something very simple:
>>>>>
>>>>>
>>>>>
>>>>> Application.CopyAllAnimation2("sarasa", "siAnySource", "siAllParam",
>>>>> "", "", "") and my intention is to replace "sarasa" with current
>>>>> selection...
>>>>>
>>>>> is there any command for current selection?
>>>>>
>>>>>
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>>
>>>>>
>>>>> F.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>
> --
> Sent from Gmail Mobile
>

Reply via email to