Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Moving keyframes

    Scheduled Pinned Locked Moved SDK Help
    14 Posts 0 Posters 806 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 14/11/2008 at 14:23, xxxxxxxx wrote:

      Thanks again. I'll have a play when I get a chance, and let you know of any findings if I have any luck (with my limited experience I wouldn't hold your breath though 😉

      Some official documentation would be very welcome.

      Jon

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 17/11/2008 at 11:13, xxxxxxxx wrote:

        OK... with R11 I've managed to change the key frame values:

        main(doc,op)
        {
        var obj = doc->FindObject("Cube");
        var track = obj->GetFirstCTrack();
        var myKey = track->GetCurve()->GetKey(0); // key 0 is first key frame
        myKey->SetValue(track->GetCurve(),70); // in this case, changes x pos to 70 m
        }

        That's all good, but I can't figure out how to move the keyframe positions in the timeline. This doesn't work (an attempt to move the key frame to frame 10:

        myKey->SetTime(10,doc->GetFps());

        Does anyone know how to achieve this?

        Thanks

        Jon

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 17/11/2008 at 11:32, xxxxxxxx wrote:

          In C++, it is: key->SetTime(CCurve, BaseTime);

          So, you might want to try it like this:

          var time = BaseTime();
          myKey->SetTime(track->GetCurve(), time->SetFrame(10,doc->GetFps()));

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 17/11/2008 at 11:53, xxxxxxxx wrote:

            Hey Robert,

            thanks for the super quick reply!

            An error is thrown at BaseTime() ... 'CLASS is not a function'.

            I tried swapping with:

            var time = myKey->GetTime();

            ... but nothing happens.

            Any thoughts?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 17/11/2008 at 12:58, xxxxxxxx wrote:

              That's interesting considering there is a function in the BaseTime class BaseTime(). 🙂

              You could try:

              var time = doc->GetTime();

              and go from there.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 17/11/2008 at 15:25, xxxxxxxx wrote:

                Thanks again, but no joy. I've tried all manner of nonsense, but I'm shooting in the dark.

                Is this to be unknown until official documentation?

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 17/11/2008 at 15:56, xxxxxxxx wrote:

                  I think you must fill the BaseTime with a value.

                  var bt = new(BaseTime);
                  bt->SetData(/*the time you want*/);

                  You then use bt as your time to set a key (or anything else).

                  Cheers
                  Lennart

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 18/11/2008 at 02:50, xxxxxxxx wrote:

                    Blimey what a palaver that was!

                    Thanks so much Robert and Lennart for helping to steer me in the right direction.

                    This seems to work:

                    > \> main(doc,op) \> { \> \> var obj = doc->FindObject("Cube"); \> var track = obj->GetFirstCTrack(); \> var myKey = track->GetCurve()->GetKey()); // key 0 is first key \> var time = new(BaseTime); \> time = doc->GetTime(); \> myKey->SetTime(track->GetCurve(), time->SetFrame(10,doc->GetFps())); // move key frame to frame 10 \> \> } \>

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 18/11/2008 at 04:38, xxxxxxxx wrote:

                      Apologies, major balls-up!

                      Above code doesn't work (aside from typo 'GetKey(0)') - don't know what's going on - I did get it to work, but not with above code. Aaah!

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 18/11/2008 at 05:14, xxxxxxxx wrote:

                        Phew! I'm able to wipe that ostrich egg off my face...

                        main(doc,op)
                        {

                        var obj = doc->FindObject("Cube");
                        var track = obj->GetFirstCTrack();
                        var myKey = track->GetCurve()->GetKey(0)); // key 0 is first key
                        var time = new(BaseTime);
                        time->SetFrame(10, doc->GetFps()); // move key frame to frame 10
                        myKey->SetTime(track->GetCurve(), time);

                        }

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post