Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Checking Keyframe curve type

    Cinema 4D SDK
    python r19 windows sdk
    2
    2
    595
    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.
    • O
      owen
      last edited by a_block

      I'm creating a python script to export keyframe data. When doing this I want to check to make sure that the keyframes are on either a position or a rotation track and ignore all others. I'm a little lost on how to do that check. I'm currently building this in xpresso with a python node and hoping to later convert it to a plug in. Here is my current code with comments.

      import c4d
      import math
      
      def main():
          # Get a list of all the animation tracks for the object
          track = Object.GetCTracks()
          #iterate through the list of tracks
          for x in track:
              #---Here I would like to check if this is rotation/position track or something that should be ignored ----
              print x
              #---- When x is printed I receive <c4d.CTrack object called 'Position . Y/Track' with ID 5350 at 0x0000025FC3AE2770> so I can see its position but I don't know how to sort that out -----
      

      I think what I'm looking for is a GetTrackName or something along those lines?

      Edit a_block: Added code tags

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello and welcome,

        what exactly do you mean with "export keyframe data"? Do you want to write data into a file? The best way to develop such code would be in a Python script that you can edit and execute in the Script Manager. A XPresso Python node is meant to contain code that is executed as part of XPresso to define the behavior of the XPresso network. A XPresso Python node should not be used to modify the scene or to perform I/O operations.

        A CTrack object stores the DescID of the associated parameter. You can access that DescID with GetDescriptionID().

        Alternatively you can use BaseList2D.FindCTrack() to search for the CTrack associated with a certain parameter DescID. You find an example on GitHub.

        You find general information on how to use CTrack and DescID also in the C++ documentation:

        • CTrack Manual
        • DescID Manual

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

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