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

    Topics created by Leo_Saramago

    • Leo_SaramagoL

      Hiring C++ Developer

      General Talk
      • • • Leo_Saramago
      1
      0
      Votes
      1
      Posts
      541
      Views

      No one has replied

    • Leo_SaramagoL

      Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      Cinema 4D SDK
      • • • Leo_Saramago
      13
      0
      Votes
      13
      Posts
      2.4k
      Views

      ferdinandF

      Hi @Leo_Saramago,

      while I agree that using transforms/matrices is more convenient than vectors for position, scale and rotation, it frankly do not quite get why you cannot use the latter since matrices are exactly the same, just written in a more convenient form.

      There are however multiple convenience methods attached to BaseDocument, .AnimateObject(), .AutoKey(), .Record() and .RecordKey(), with which you can animate nodes without having to deal with the more atomic animation types directly. I have attached a very simple example at the end for the .Record() method, in the hopes that this reflects what you are trying to do.

      Cheers,
      Ferdinand

      """Little example for one of the animation convenience methods of BaseDocuement. Select an object and run the script, it will create a short animation for it. As discussed in: plugincafe.maxon.net/topic/13228/ """ import c4d import math def main(): """ """ # Get out when there is no object selected. op is predefined as the # primary selected object in a script module. if op is None: raise ValueError("Please select an object.") # Set a frozen rotation for that object. op[c4d.ID_BASEOBJECT_FROZEN_ROTATION] = c4d.Vector(0, 0, math.pi) # Set a frozen translation for that object. op[c4d.ID_BASEOBJECT_FROZEN_POSITION] = c4d.Vector(50., 0, 0) # Take ten steps. for t in range(10): # Create a BaseTime in 1/10th of a second intervals from our step count. bt = c4d.BaseTime(t * .1) # Set the document to that time. doc is like op a predefined script # module attribute, pointing to the currently active document. doc.SetTime(bt) # Set the rotation of our object. rotation = t * .1 * math.pi op[c4d.ID_BASEOBJECT_REL_ROTATION] = c4d.Vector(rotation, 0, 0) # You can also make use of SetMg() here if you want to, this however # will not respect the frozen values, or only in a way that is probably # not what you want. So if you set a frozen offset of (100, 0, 0) # for example and then write an offset of (0, 0, 0) into the object # via SetMg(), the object will then have the relative position of # (-100, 0, 0) in the coordinate manger, because (0, 0, 0) in world # coordinates is (-100, 0, 0) in frozen coordinates. Keyframing with # SetMg() will however work fine. # mg = c4d.utils.MatrixRotZ(rotation) # mg.off = c4d.Vector(t * 10, 0, 0) # op.SetMg(mg) # Record the active object(s) in the document. Additional convenience # methods for animating stuff are BaseDocument.AnimateObject(), # .AutoKey(), and .RecordKey(). Se documentation for details. doc.Record() # Push an update event to Cinema 4D, so that our editor is getting updated. c4d.EventAdd() if __name__=='__main__': main()```
    • Leo_SaramagoL

      R23's Execution Order

      Cinema 4D SDK
      • • • Leo_Saramago
      3
      0
      Votes
      3
      Posts
      505
      Views

      Leo_SaramagoL

      It sure does answer the question.

      Thanks, Riccardo!

    • Leo_SaramagoL

      Maximize/Resize "Add Motion Clip" Window

      General Talk
      • • • Leo_Saramago
      3
      0
      Votes
      3
      Posts
      618
      Views

      Leo_SaramagoL

      @zipit Thanks!

    • Leo_SaramagoL

      PYTHON - GetCustomDataTypeDefault(--- integer ---)

      Cinema 4D SDK
      • • • Leo_Saramago
      6
      0
      Votes
      6
      Posts
      1.1k
      Views

      ManuelM

      Hello,

      nothing to add, thanks @zipit for the answer 🙂

      @Leo_Saramago don't forget to mark your thread to solved.

      Cheers,
      Manuel

    • Leo_SaramagoL

      PYTHON - Userdata CTracks and Basecontainer

      Cinema 4D SDK
      • • • Leo_Saramago
      12
      0
      Votes
      12
      Posts
      2.4k
      Views

      ManuelM

      hello,
      thanks @zipit for answering the question 🙂

      and thanks you both for the kinds words 🙂

      Cheers,
      Manuel

    • Leo_SaramagoL

      PYTHON - NBIT - UserData Attirbutes Manager Selection

      Cinema 4D SDK
      • • • Leo_Saramago
      3
      0
      Votes
      3
      Posts
      608
      Views

      Leo_SaramagoL

      Thanks, m_magalhaes!

    • Leo_SaramagoL

      User data button Python Tag part 2 - No more Notify Messages! Why?

      Cinema 4D SDK
      • python r19 • • Leo_Saramago
      2
      0
      Votes
      2
      Posts
      542
      Views

      Leo_SaramagoL

      I figured it out.

      The missing piece is a listener that's supposed to be added in main(), something like:

      def main(): obj = op.GetObject() bc = c4d.BaseContainer() obj.AddEventNotification(op, c4d.NOTIFY_EVENT_MESSAGE, 0, bc)

      The reason why this was not so obvious earlier today is that I read somewhere that there was no need for adding listeners in main(), that I would be adding unnecessary tasks. This is probably my fault, I may have misinterpreted or assumed things from a different context.

      But, to my defense, I must say that the code that works has no listeners in it. Have a look!

      Well, this is where it gets tricky: the listener code had been there indeed, but I had erased it after a few iterations(because I thought it was overkill).

      This means that the listener is still working despite the fact that I had it erased from the Python Tag code, in other words, it's garbage.

      I hope this helps other users as well as the Maxon team(you guys rule!)

      Thanks for your time,

      Leo

    • Leo_SaramagoL

      User Data button Python Tag r19 - avoid "index out of depth" console feedback

      Cinema 4D SDK
      • r19 python • • Leo_Saramago
      4
      0
      Votes
      4
      Posts
      955
      Views

      Leo_SaramagoL

      @m_magalhaes said in User Data button Python Tag r19 - avoid "index out of depth" console feedback:

      if desc_id.GetDepth() > 1

      Thanks a lot, Manuel! It's perfect now.

    • Leo_SaramagoL

      Placing Motion Sources at Timeline Markers with Python - r19

      Cinema 4D SDK
      • python • • Leo_Saramago
      14
      0
      Votes
      14
      Posts
      3.5k
      Views

      Leo_SaramagoL

      Ok, I'll let you off the hook. I feel like I can pick from where the code is now and move on. I'm gonna set it to SOLVED.

      Thanks a lot for your time!!!