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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Ease in/out keyframes created with Python?

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 906 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

      On 26/02/2018 at 10:40, xxxxxxxx wrote:

      I have successfully created a function to make a keyframe on the selected object (Position or Rotation) but I don't know if is it possible to adjust ease in/out keyframe values? What line should I insert to the code? Thanks in advance 🙂

      def MakeKeyframe(obj, PSR, XYZ) :

      doc = c4d.documents.GetActiveDocument()

      if PSR == "Position":
                  DescLevel = c4d.ID_BASEOBJECT_REL_POSITION
              elif PSR == "Rotation":
                  DescLevel = c4d.ID_BASEOBJECT_REL_ROTATION
              # elif here when scaling needed

      if XYZ == "X":
                  SelectedVector = c4d.VECTOR_X
              elif XYZ == "Y":
                  SelectedVector = c4d.VECTOR_Y
              else:
                  SelectedVector = c4d.VECTOR_Z

      ActiveTrack = obj.FindCTrack (c4d.DescID(c4d.DescLevel(DescLevel,c4d.DTYPE_VECTOR,0), c4d.DescLevel(SelectedVector,c4d.DTYPE_REAL,0)))

      if not ActiveTrack:
                  ActiveTrack = c4d.CTrack (obj, c4d.DescID(c4d.DescLevel(DescLevel,c4d.DTYPE_VECTOR,0), c4d.DescLevel(SelectedVector,c4d.DTYPE_REAL,0)))
                  
                  obj.InsertTrackSorted (ActiveTrack)

      Curve = ActiveTrack.GetCurve()
              CurrTime = doc.GetTime()
              CurrFrame = CurrTime.GetFrame(60)
              KeyDict = Curve.AddKey (c4d.BaseTime(CurrFrame, 60))
              ActiveTrack.FillKey (doc, obj, KeyDict["key"])

      c4d.EventAdd()

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

        On 27/02/2018 at 07:29, xxxxxxxx wrote:

        Hi,

        you can define the tangents of a keyframe by using SetValueLeft(), SetValueRight(), SetTimeLeft() and SetTimeRight(). Together with SetInterpolation() this should do the trick.

        Even if we are in the Python subforum, maybe the Overview and Manuals about Animation our C++ docs can also help with this topic.

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

          On 27/02/2018 at 07:42, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          Hi,

          you can define the tangents of a keyframe by using SetValueLeft(), SetValueRight(), SetTimeLeft() and SetTimeRight(). Together with SetInterpolation() this should do the trick.

          Even if we are in the Python subforum, maybe the Overview and Manuals about Animation our C++ docs can also help with this topic.

          I appreciate your kind help really much 🙂 Thanks!

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

            On 09/03/2018 at 21:38, xxxxxxxx wrote:

            Sorry but I'm a little bit noob and all this track/curve/key stuff is so confusing, especially without any real use scenario examples on these pages in the documentation. After a few hours of experimenting without any results it begins to drive me crazy 😞 Even Google can't find any useful and more detailed instructions, and have absolutely no idea where to put these SetTime... commands in my code.

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

              On 12/03/2018 at 03:54, xxxxxxxx wrote:

              Well, those SetTimeX() and SetValueX() functions simply set attributes of a keyframe (CKey), but I guess, that far you already figured it our yourself.
              If the linked manual doesn't help, I'd say, it's probably best, if you provide us with an updated code snippet more closely resembling your current state and then please describe in more detail what is or is not working.

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