1. #1
    New Member Follow User Gallery
    Join Date
    Mar 2019
    Posts
    11

    Default Any chance to add timeline key via script?

    Hi, I'm trying to make a script to add timeline key for each subtools in certain time. I tried to record macro but get nothing, any clue will be very helpful, thanks

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Yes, you can do that. You need:

    [TLNewKeyFrame, Optional time (if omited then use current time)]

    Time is from 0 - 1.0 where 0 is the start time and 1.0 the end time of the whole TimeLine. So a value of 0.5 would be half way through.

    You also need to make sure the correct track is selected before creating a key frame. For that you use [TLSetActiveTrackIndex, track index].

    You can find the TimeLine commands here:
    http://docs.pixologic.com/user-guide...ence/#timeline

  3. #3
    New Member Follow User Gallery
    Join Date
    Mar 2019
    Posts
    11

    Default

    thanks Marcus, I tested several times but its failed, I think the main problem is I dont know how to get the right track after create a layer, do you have any suggestions ?

  4. #4
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Here's an example for importing a MDD file. In this instance the right track is automatically selected on importing the file. (While the track is selected you could store the track using [TLGetActiveTrackIndex] so you could recall it later.)

    The script also adds key frames to the Camera track. To select the Camera track I simulate a click on the document background. If I remember correctly, this was more reliable than using the TimeLine commands.


    [IButton,Add_MDD,"Add an MDD file to TimeLine",
    //make sure we're in Edit mode and can import an OBJ
    [IPress,Tool:Polymesh3D]
    [If,[IGet,Transform:Edit]!=1,//if Edit mode is off
    [IPress,Layer:Clear]
    //draw the polymesh
    [IClick,1004,[IGet,Document:Width]*.5,[IGet,Document:Height]*.5,[IGet,Document:Width]*.5,[IGet,Document:Height]*.95]
    [ISet,Transform:Edit,1]//edit mode on
    ]
    //import OBJ
    [FileNameSetNext,"Body.obj"]
    [IPress,Tool:Import]
    //show the TimeLine
    [IPress,Movie:TimeLine:Show]
    //select camera track
    [IClick,1004,-4096,-4096]
    //add key frames to camera track
    [TLNewKeyFrame,0]
    [TLNewKeyFrame,0.5]
    //import MDD
    [FileNameSetNext,"Boxing.mdd"]
    [IPress,Tool:Layers:Import MDD]
    //layer track will be automatically selected
    //add key frames
    [TLNewKeyFrame,0]
    [TLNewKeyFrame,0.5]
    //select camera track again
    [IClick,1004,-4096,-4096]
    //set to start of TimeLine
    [TLGotoTime,0]
    ]




    HTH,

  5. #5
    New Member Follow User Gallery
    Join Date
    Mar 2019
    Posts
    11

    Default

    I still get the wrong result. (sigh...)
    I uploaded my script and video here, it must be something wrong with my code but I can't find it using my current knowledge...

  6. #6
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Hmm, not sure why but for some reason the Layer track wasn't getting selected for that subtool. I've revised the script to select the track each time. Seems to work OK now.

    mdd_animation.txt

  7. #7
    New Member Follow User Gallery
    Join Date
    Mar 2019
    Posts
    11

    Default

    thanks, it works perfect !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •