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. pchg
    3. Topics
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 29
    • Groups 0

    Topics

    • P

      How to Swap location in Object Manager

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK c++ s26 windows
      3
      2
      0 Votes
      3 Posts
      683 Views
      P
      @ferdinand Thank you very much for your reply
    • P

      How to obtain the color of each ball in each frame

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 windows c++
      2
      3
      0 Votes
      2 Posts
      548 Views
      ferdinandF
      Hello @pchg, Thank you for reaching out to us. Please note that we normally expect question to be accompanied by code. It is also still unanswered in which context you want to do this: As an effector, as a Script Manager script, etc. Cheers, Ferdinand Result [image: 1730718564670-347fc2f0-a0cd-4583-816b-b3e38fda2280-image.png] Code """Reads out the particle data of a MoGraph Cloner object. Must be run as a Script Manager script in Cinema 4D with a MoGraph Cloner object selected. """ import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not op or not op.CheckType(c4d.Omgcloner): raise ValueError("Please select a MoGraph Cloner object.") # Get the particle data from the cloner object. data: c4d.modules.mograph.MoData = c4d.modules.mograph.GeGetMoData(op) if data is None: return # Get the transform and color data for the particles. matrices: list[c4d.Matrix] = data.GetArray(c4d.MODATA_MATRIX) colors: list[c4d.Vector] = data.GetArray(c4d.MODATA_COLOR) # Iterate over all particle data and do something with it. If we were in an effector, we could # also write back data. Technically, we could also write back data here, but it would be volatile. for i in range(data.GetCount()): matrix: c4d.Matrix = matrices[i] color: c4d.Vector = colors[i] print(f"Particle {i} at {matrix.off} with color {color}") if __name__ == '__main__': main() And here is the 2024.0.0 effector full control mode default code which more or less is very similar but also writes data. """Realizes an effector that attracts MoGraph particles spherically around its origin. Add the example to a Matrix object to understand its effect. In Full Control mode we can realize a true attraction force as we have full control over the particle values. Compare this example to Parameter Control mode to understand the difference. """ import c4d op: c4d.BaseObject # The Python Effector object containing this code. gen: c4d.BaseObject # The MoGraph Generator executing `op`. doc: c4d.documents.BaseDocument # The document `op` and `gen`are contained in. def main() -> bool: """Called by Cinema 4D to evaluate the effector. """ # Get the particle data for the effector #op. Get out when either the data cannot be retrieved. data: c4d.modules.mograph.MoData = c4d.modules.mograph.GeGetMoData(op) if data is None: return 1.0 # The transform of both the generator and the effector, the transforms of all particles, and # finally the position of the effector as if it would live in the coordinate system of the # generator. mgGen: c4d.Matrix = gen.GetMg() mgEff: c4d.Matrix = op.GetMg() matrices: list[c4d.Matrix] = data.GetArray(c4d.MODATA_MATRIX) q: c4d.Vector = ~mgGen * mgEff.off # For each particle compute a weight `w` for how much the particle should be attracted to the # attraction point `q`, and then blend the particle position between the attraction point and # its own position `p`. for i in range(data.GetCount()) : p: c4d.Vector = matrices[i].off w: float = c4d.utils.RangeMap((mgGen * ~mgEff * p).GetLength(), 0., 100., 0., 1., True) ** 3. matrices[i].off = c4d.utils.MixVec(q, p, w) # Write the new data back. data.SetArray(c4d.MODATA_MATRIX, matrices, op[c4d.FIELDS].HasContent()) return True
    • P

      How to modify the index

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ windows
      4
      1
      0 Votes
      4 Posts
      805 Views
      P
      @ferdinand Thank you for your reply
    • P

      How to preserve the animation of a sphere

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ windows
      9
      2
      0 Votes
      9 Posts
      2k Views
      P
      @i_mazlov thank you very much
    • P

      How to get sphere coordinates

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ windows
      6
      2
      0 Votes
      6 Posts
      1k Views
      i_mazlovI
      Hi @pchg , This thread is almost a full duplicate of your adjacent thread: How to preserve the animation of a sphere. The answer is provided there. Cheers, Ilia
    • P

      How to Get cloner data in C++

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ windows
      2
      1
      0 Votes
      2 Posts
      553 Views
      M
      Hi you can find in read_modata_color_r16.py a Python example doing exactly that. To retrieve the position instead of retrieving the MODATA_COLOR your need to retrieve MODATA_MATRIX. There is no difference for doing it in C++. Cheers, Maxime.
    • P

      How to change the color of shaded wire in C++

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++
      3
      1
      0 Votes
      3 Posts
      653 Views
      P
      @i_mazlov Thank you for your reply
    • P

      How to obtain the selection order of objects in C++

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ macos windows
      4
      1
      0 Votes
      4 Posts
      776 Views
      P
      @spedler Thank you for your help
    • P

      How to Obtain the .FBX Points of Objects in C++

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ macos windows
      3
      4
      0 Votes
      3 Posts
      588 Views
      P
      @ferdinand Thank you for your reply
    • P

      How to create ToolBox in C++.

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ windows
      3
      2
      0 Votes
      3 Posts
      728 Views
      P
      @ferdinand Thank you
    • P

      How to obtain all vertices of an object in C++.

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++ sdk
      3
      0 Votes
      3 Posts
      592 Views
      P
      @m_adam Thanks
    • P

      Cinema 4D Unable to use MATLAB library

      Watching Ignoring Scheduled Pinned Locked Moved Cinema 4D SDK s26 c++
      4
      0 Votes
      4 Posts
      657 Views
      i_mazlovI
      Hello @pchg, Please note that the subject is out of scope of support as declared in the forum guidelines, namely: We cannot provide support for third party libraries. As a direction of your further investigation you can consider checking MATLAB library for using incompatible dependencies. Another guess would be to check if plugin registration succeeds at all. Thanks for your understanding! Cheers, Ilia