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
    1. Maxon Developers Forum
    2. Leo_Saramago
    3. Posts
    • Profile
    • Following 1
    • Followers 0
    • Topics 10
    • Posts 39
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by Leo_Saramago

    • Hiring C++ Developer

      Hello, everyone!

      I'm looking for a C++ developer to turn a prototype I wrote in Python into a plug-in. You can send me your previous work, private details and rates via LinkedIn (https://www.linkedin.com/in/leo-saramago-755aab7a/) or send an e-mail message to [email protected] .

      Thanks for your time.

      posted in General Talk
      Leo_SaramagoL
      Leo_Saramago
    • RE: How many C++ and Python devs do we have here?

      I'm looking for a C++ developer. I wrote a prototype in Python that needs some love... It's meant to become a real plug-in. Yes, there's a budget. Hey, @a_block , how can I reach you? Anybody else interested? Please, reply to this, let's talk. Thanks for your time.

      posted in General Talk
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      @ferdinand Hi! Thanks for clarifying things some more. I guess I was looking for frozen values in the wrong place. Browser search wouldn't give me any results.

      The problem with writing CKey into CTrack\CCurve in my original scenario is that I have to pass the values of the keys whenever I apply the methods, and I don't have those values. I have the sources', yes, but not the targets'. The source is a Mixamo Control Rig - frozen values in almost every _bind joint.

      That's why I thought of GetMg()/SetMg() iterating over the joint chains within the frame range. They work, but then I have to use CallCommand to set keyframes and do some clean up afterwards. No big deal, really.

      So, just to wrap this up, is there a way to set keyframes, other than CallCommand, that doesn't require CKey values?

      Thanks for your time,

      Leo

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      @m_adam Hi! Thanks for the reply.

      None of those would work because the source's curves are not to be copied as they are. I mean, the values of each keyframe in each curve are not necessarily the same because the source has frozen values.

      Based on those links you've provided, the only option would be to forget about GetMg()/SetMeg() methods. I would have to retrieve all frozen values from source objects, and use them to offset each key value in every curve. And I'd have to do the same to target objects - because they could also have frozen values. Then, depending on how both source and target objects were nested, I'd have to figure out their overall offsets.

      Is this train of thought correct? If so, what's the DescID that would retrieve values stored in "freeze"?

      Once again, thanks!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      @Leo_Saramago This photoshop montage illustrates my point:
      Keyframing_right_after_SetMg.png
      On the left, you can see the curves for my source object. The curves on the right belong to my target object, and they came to be after applying SetMg(mg) in every frame inside a loop. This is the result I'm actually going for, except for the unwanted keyframes concerning Scale. Nothing that I couldn't put up with, I mean, deleting those keyframes wouldn't be trouble at all, it's just that MAXON SDK Team recommends avoiding CallCommands - in this case, I used c4d.CallCommand(12410) #Record Active Objects. As I had mentioned before, the source object has frozen values, hence those curves being different.
      Keyframing_right_after_SetMg-Viewport.png
      As you can see above, both objects have the same animation going on in Global Space. I just want to learn how to achieve this same result the proper way.

      Thanks for your time,

      Leo

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      Ok, now that I'm sure I've grabbed the proper data via GetMg(), can I apply SetMg() to each target joint and keyframe all properties at once for each frame? Or do I have to go thru each CTrack curve of my target joint and use SetMg() over and over again?

      Thanks, these answers have been very helpful!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      @mp5gosu and @ferdinand Thank you very much. Really helpful! Sorry for the delay. I'll perform a couple of tests and get back to you before closing this one. Soon, I promise.

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      For testing purposes: I created a cube and gave it some keyframe animation, then baked it. Console shows the same values for every frame when I execute this simplified version of my original python code:

      import c4d
      
      def main():
          
          c4d.CallCommand(12501) #Moves Playhead to Start
          obj = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER) #Remember: Select Object in OM
          
          for i in range(10):
              mg = obj[0].GetMg()
              print (mg.off)
              c4d.CallCommand(12414) #Moves Playhead to Next Frame
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      @Leo_Saramago I forgot to mention I have baked the animation in the _bind chain.

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      Hello, there!

      I would like to copy the animation I have on a Mixamo Control Rig to a different character. By different, I mean only the hierarchies and naming convention don't match.

      I'm having trouble with copying data from Mixamo Control Rig's _bind joint chain. Most curves and values can't be applied directly because the joints inside the Mixamo Rig have frozen values.

      That's why I'm going for GetMg() and SetMg(). I've tried looping within a frame range, but GetMg() always returns the same vectors. I even tried c4d.CallCommand(12414) inside a loop, but no luck. Any pointers?

      Thanks for your time,

      Leo

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: R23's Execution Order

      It sure does answer the question.

      Thanks, Riccardo!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • R23's Execution Order

      Hi! I'm aware Scene Nodes happen after Generators, but I was wondering if they go by the usual -499 to 499 evaluation ranges. Are these exposed in any nodes?

      Thanks for your time,

      Leo

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: Maximize/Resize "Add Motion Clip" Window

      @zipit Thanks!

      posted in General Talk
      Leo_SaramagoL
      Leo_Saramago
    • Maximize/Resize "Add Motion Clip" Window

      Hi! Is there a way to Maximize/Resize the "Add Motion Clip" window via Python since C4D's interface won't allow it? Thanks for your time.

      posted in General Talk
      Leo_SaramagoL
      Leo_Saramago
    • RE: PYTHON - GetCustomDataTypeDefault(--- integer ---)

      Hello, @zipit ! I ended up using GetClone() to solve the AddUserData issue.

      A little after that, I found myself in a corner again: unfortunately, there's no way to retrieve Userdata selection in the Attributes Manager - that's why I narrow down my Userdata tracks to only those that will be manipulated by using GetCTracks. Among Userdata, Vectors show up with their components, though, and this means matching by name becomes impossible without slicing. Checking the type allows me to know when slicing is needed. This time, it was much easier to pass values as an argument, they were at hand, so I did apply your first solution, effortlessly.

      Polymorphism... I haven't heard of it since my C++ days... about 25 years ago, when I thought I'd be a real coder.

      This script I'm about to finish will speed up my 3D workflow tremendously.

      Once again, thanks a lot!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: PYTHON - GetCustomDataTypeDefault(--- integer ---)

      @zipit Hey, thanks for your quick reply.

      It's definitely a solution, but it forces me to pass the value, which means more code tweaking than what I intended to go for.

      Thanks again!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • PYTHON - GetCustomDataTypeDefault(--- integer ---)

      Hello, there!

      My goal here is to create temporary Userdata.

      ...
      bContainer = c4d.GetCustomDataTypeDefault(myType)
      bContainer[c4d.DESC_NAME] = "TempData"
      myID = obj.AddUserData(bContainer)
      ...
      

      It turns out myType is not an integer, which is what GetCustomDataTypeDefault expects, it's a <type 'float'> passed along from a source somewhere else. Yet, another function could make it a vector instead... Is there a way to cross check myType with c4d.DTYPE_REAL, c4d.DTYPE_VECTOR, and so on, or simply get the proper integer value based on type dynamically?

      Or should I drop this idea altogether and get Basecontainers from different sources with GetClone so I could feed them to the AddUserData method whenever necessary?

      Thanks for your time,

      Leo

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: PYTHON - Userdata CTracks and Basecontainer

      I'm from the Music realm, and I've dealt with all kinds of hardware/software. Cinema 4D gets to be at the very top in every single aspect, support team included.

      Thanks again, I'll close this topic now.

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: PYTHON - Userdata CTracks and Basecontainer

      @zipit said in PYTHON - Userdata CTracks and Basecontainer:

      For user data the first DescLevel of the DescID will always be c4d.ID_USERDATA which is necessary because the namespace here is not curated by Maxon or or the plugin author so they had to introduce a sub namespace to make the ID unambiguous (there might be a user data element with the ID 1000 but also a static description element with that same first DescLevel)

      Those lines should be near the top of any official explanation concerning Userdata in Python. Now that C4D is going Subscription, more and more people will struggle thru this.

      Your help was invaluable @zipit ! Thanks a lot for your time(and patience). I think I'm finally starting to get the hang of all this. Here's the code that works:

      def main():
          objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
          
          obj = objs[0] #Grab the Null that has relevant Userdata only
          
          UD_ids, UD_names, UD_types, UD_values = [],[],[],[]
          
          for descID, bc in obj.GetUserDataContainer():
              #list of IDs
              UD_ids.append(descID)
              
              #list of names
              UD_names.append(bc[c4d.DESC_NAME]) 
              
              #list of types
              UD_types.append(type(obj[descID]))
              
              ##list of values
              UD_values.append(obj[descID])
                      
          print "Userdata Names: " + str(UD_names)
          print "Respective IDs: " + str(UD_ids)
          print "Respective types: "+ str(UD_types)
          print "Respective values: " + str(UD_values)
          print " "
          
          srcObjs = obj.GetCTracks() #This is just a test. Only 'Stratocaster_R' is supposed have a CTrack
          srcObj = srcObjs[0] #For Testing purposes
          
          if UD_names[0][:-2] == srcObj.GetName()[:-2]: #For testing purposes, the actual code will create tracks inside the loop
              tgt_descID = UD_ids[0]
          
          print tgt_descID
          
          track = obj.FindCTrack(UD_ids[0])
          
          if track == None:
              print str("There are no keyframes at the \'"+str(UD_names[0])+"\' Userdata parameter.")
              print ("Creating one now.\n ")
              track = c4d.CTrack(obj, tgt_descID) #Create Track using descID
              obj.InsertTrackSorted(track)
              obj.Message(c4d.MSG_UPDATE)
              c4d.EventAdd()
      
      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago
    • RE: PYTHON - Userdata CTracks and Basecontainer

      @zipit That bad? Gee... this one is gonna break my brain! Thanks!!!

      posted in Cinema 4D SDK
      Leo_SaramagoL
      Leo_Saramago