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

    Update timeline markers on user data slider input.

    Cinema 4D SDK
    python r20 r21
    3
    4
    829
    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.
    • G
      gsmetzer
      last edited by Manuel

      I have a python generator with two integers as user data. The two integer sliders control the start and length of a timeline marker. Currently the timeline markers only update to the new integer value on mouse-up. However I would like the timeline markers to update on each value change as the user slides the integer.
      How is this possible? I have been trying different messaging and event add techniques but not finding a solution. Thank You for any help.

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        Hi,

        you should show us some code, it is really hard to tell what you are doing otherwise.

        1. Note that the Python Generator's main() function is bound by threading limitations.

        2. The appropriate choice to force a redraw of managers is usually c4d.GeSyncMessage().

        Cheers
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by Manuel

          hello,

          On your generator you can create the Message function and react accordingly.
          To check if the marker already exist, the most direct and easiest way is to use its name.

          you can find other ids you can use on this page

          This is a basic example, you may want to add some extra functionalities.

          import c4d
          
          
          
          def FindMarker(timeOfMarker, name):
              # Retrieves the first marker of document
              fm = c4d.documents.GetFirstMarker(doc)
              
              # for each markers checks compare its name
              while fm:
                  if fm.GetName() == name:
                      return fm
                  fm = fm.GetNext()
              return None
          
          
          def RemoveAndCreate(timeOfMarker, name):
              # Checks if marker alread exist (compare name)
              mark = FindMarker(timeOfMarker, name)
          
              # Removes the maker if it exist
              if mark is not None:
                  mark.Remove()
              
              # Returns the exising marker
              return c4d.documents.AddMarker(doc, None, timeOfMarker, name)
              
          
          def message(id, data):
              # if User Data are changed
              if id == c4d.MSG_DESCRIPTION_VALIDATE:
                  # Retrieves the User Data values
                  fmt = op[c4d.ID_USERDATA,1]
                  smt = op[c4d.ID_USERDATA,2]
                   
                  # Creates the Marker, Removes the existing ones first)
                  RemoveAndCreate(fmt, "First Maker")
                  RemoveAndCreate(smt, "Second Marker")
                  c4d.EventAdd()
              return True
          
          
          
          def main():
              pass
              
          

          Cheers
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 0
          • G
            gsmetzer
            last edited by

            Thank You @m_magalhaes and @zipit

            Both your suggestions were very helpful. The controller works very well @m_magalhaes I just needed to convert my user data input to BaseTime and it works perfectly.

            I was able to solve the updating issue to work how I want. I only needed to add:

            c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)

            Now my timeline markers update nicely as I change values.

            This topic can be marked solved.

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