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
    • Register
    • Login
    1. Home
    2. mrittman
    • Profile
    • Following 0
    • Followers 1
    • Topics 3
    • Posts 17
    • Best 0
    • Controversial 0
    • Groups 0

    mrittman

    @mrittman

    0
    Reputation
    77
    Profile views
    17
    Posts
    1
    Followers
    0
    Following
    Joined Last Online
    Website www.mattrittman.com/ Location Des Moines, IA Age 40

    mrittman Unfollow Follow

    Latest posts made by mrittman

    • RE: Add/Remove Groups of User Data

      @m_magalhaes said in Add/Remove Groups of User Data:

      Hello,

      I was also talking about something like this. But it's not the best way to go. I suggest a TagData (plugin) with his own UI.

      pyTagCode = '\
      import c4d \n\
      #Welcome to the world of Python \n\
      \n\
      def main():\n\
          print "this ia a message"\n\
      \n\
      '
      
      
      
      import c4d
      
      # Main function
      def main():
          if op is None:
              gui.MessageDialog("Please selecte a target object")
          tag = c4d.BaseTag(c4d.Tpython)
          tag[c4d.TPYTHON_CODE] = pyTagCode
          op.InsertTag(tag)
          c4d.EventAdd()   
      
      # Execute main()
      if __name__=='__main__':
          main()
      

      By the way, don't forget you can save tag presets, that include python tags. You can simple add them with right click on your object in OM and "Load tag preset"

      Cheers,
      Manuel

      Oh this is good to know! Thanks so much for the information, this is quite helpful!

      Matt

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Add/Remove Groups of User Data

      @zipit Thanks so much man, this is really quite helpful! I sure appreciate all the help!

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Add/Remove Groups of User Data

      @m_magalhaes I see, but how do you create a script that generates a python tag with that code already in it?

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Add/Remove Groups of User Data

      @m_magalhaes Hey man I'm so sorry I didn't see your reply! This was extremely helpful! Pretty much exactly what I was looking for.

      Do you know if this can be converted to a Python script so that I can drop it into any project?

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Output Current Sound Track Name

      @s_bach Okay it's kind of working now, but is only outputting the last track in the list. I am using this script in a python tag:

      import c4d
      #Welcome to the world of Python
      
      def main():
      
          # find object in scene, store in obj
          obj = doc.SearchObject('VO')
      
      
          # store some variables
          track = obj.GetCTracks()
      
          obj[c4d.ID_USERDATA,4] = track[0].GetName()
          track[0][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,6]
          track[0][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,7]
          track[0][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,14]
      
          obj[c4d.ID_USERDATA,10] = track[1].GetName()
          track[1][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,11]
          track[1][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,12]
          track[1][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,9]
      
          obj[c4d.ID_USERDATA,15] = track[2].GetName()
          track[2][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,16]
          track[2][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,17]
          track[2][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,18]
      
          obj[c4d.ID_USERDATA,3] = track[3].GetName()
          track[3][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,20]
          track[3][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,21]
          track[3][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,22]
      
          obj[c4d.ID_USERDATA,24] = track[4].GetName()
          track[4][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,25]
          track[4][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,26]
          track[4][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,27]
      
          obj[c4d.ID_USERDATA,29] = track[5].GetName()
          track[5][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,30]
          track[5][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,31]
          track[5][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,32]
      
          obj[c4d.ID_USERDATA,34] = track[6].GetName()
          track[6][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,35]
          track[6][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,36]
          track[6][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,37]
      
          obj[c4d.ID_USERDATA,39] = track[7].GetName()
          track[7][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,40]
          track[7][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,41]
          track[7][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,42]
      
          obj[c4d.ID_USERDATA,44] = track[8].GetName()
          track[8][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,45]
          track[8][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,46]
          track[8][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,47]
      
          obj[c4d.ID_USERDATA,49] = track[9].GetName()
          track[9][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,50]
          track[9][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,51]
          track[9][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,52]
      
          obj[c4d.ID_USERDATA,54] = track[10].GetName()
          track[10][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,55]
          track[10][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,56]
          track[10][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,57]
      
          obj[c4d.ID_USERDATA,59] = track[11].GetName()
          track[11][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,60]
          track[11][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,61]
          track[11][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,62]
      
          obj[c4d.ID_USERDATA,64] = track[12].GetName()
          track[12][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,65]
          track[12][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,66]
          track[12][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,67]
      
          obj[c4d.ID_USERDATA,69] = track[13].GetName()
          track[13][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,70]
          track[13][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,71]
          track[13][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,72]
      
          obj[c4d.ID_USERDATA,74] = track[14].GetName()
          track[14][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,75]
          track[14][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,76]
          track[14][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,77]
      
          obj[c4d.ID_USERDATA,79] = track[15].GetName()
          track[15][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,80]
          track[15][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,81]
          track[15][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,82]
      
          obj[c4d.ID_USERDATA,84] = track[16].GetName()
          track[16][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,85]
          track[16][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,86]
          track[16][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,87]
      
          obj[c4d.ID_USERDATA,89] = track[17].GetName()
          track[17][c4d.CID_SOUND_ONOFF] = obj[c4d.ID_USERDATA,90]
          track[17][c4d.CID_SOUND_START] = obj[c4d.ID_USERDATA,91]
          track[17][c4d.CID_SOUND_NAME] = obj[c4d.ID_USERDATA,92]
      
      
      
          # outputs the current track name where playhead is
          traks = obj.GetCTracks()
      
          for trak in traks:
      
              start = trak[c4d.CID_SOUND_START]
      
              # get length
              # length is stored as a string; need to convert it to int
              length = trak[c4d.CID_SOUND_LENGTH]
              length = length[:-2]
              length = int(float(length))
              fps = doc.GetFps()
              end = start + c4d.BaseTime(length, fps)
      
              # check if the current frame is within the range of the sound clip
      
              curTime = doc.GetTime()
      
              if curTime >= start and curTime < end:
                  obj[c4d.ID_USERDATA,19] = trak.GetName()
              else:
                  obj[c4d.ID_USERDATA,19] = "No Track"
      
              trak = trak.GetNext()
      
      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Output Current Sound Track Name

      Also, with this code, I am getting the spinning beachball of death 😕
      It must be trapped in the loop maybe?

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Use a list or array for data?

      @m_magalhaes Yeah since the ID’s of my userdata are all over the place, maybe I better just stick with writing them all out 😕

      I was trying to make it so it started with just one track, and have an add/remove button at the top that would create additional tracks. But this starts to get extremely confusing for me to wrap my head around, as I’m only just a beginner.

      posted in General Talk
      mrittmanM
      mrittman
    • RE: Output Current Sound Track Name

      Thanks @s_bach, I really appreciate your help. I’m more of a motion designer, but wanted to tailor the scene I’m working on to make it easier.

      HTML/CSS come really easy to me, but my brain just comes to a halt when I try and get my head around python 😕

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Add/Remove Groups of User Data

      @m_magalhaes I am writing it in a python tag.

      I should note that when it comes to programming, I’m not all that smart 😛

      posted in Cinema 4D SDK
      mrittmanM
      mrittman
    • RE: Output Current Sound Track Name

      @s_bach So something like this?

      track = op.GetFirstCTrack()
      
      while track is not None:
      
      start = track[c4d.CID_SOUND_START]
      
      # get length
      # length is stored as a string; need to convert it to int
      length = track[c4d.CID_SOUND_LENGTH]
      length = length[:-2]
      length = int(float(length))
      fps = doc.GetFps()
      end = start + c4d.BaseTime(length, fps)
      
      # check if the current frame is within the range of the sound clip
      
      curTime = doc.GetTime()
      
      if curTime >= start and curTime < end:
          print("Uses Track: " + track.GetName())
      else:
          print("no hit")
      

      I'm really struggling with wrapping my head around this 😞

      posted in Cinema 4D SDK
      mrittmanM
      mrittman