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

    Object Generator as Particles

    Cinema 4D SDK
    python
    2
    2
    375
    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.
    • bacaB
      baca
      last edited by baca

      Hi,

      I'd like to create Python Generator with point cloud. And make it possible to render it as particles using "RS Object" -> "Particles".
      Similar to Emitter and Matrix object.

      "Particles" tab of "RS Object" is optional, and not appears everythere.
      Are there any options to make it possible?

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

        Hi,

        sorry, the display of this tab is hardcoded an only available for a couple of builtin objects.

        What you can do is have a Matrix object in object mode that point to your generator, the rs tag being applied to the matrix object.

        You can also create that setup inside your generator. Below, i am using a cube but that could be your PointObject instead.

        Keep in mind that python is slow, using it for point cloud or anything related to particles might be super slow.

        from typing import Optional
        import c4d
        
        doc: c4d.documents.BaseDocument # The document evaluating this python generator
        op: c4d.BaseObject # The python generator
        hh: Optional["PyCapsule"] # A HierarchyHelp object, only defined when main is executed
        
        def main() -> c4d.BaseObject:
        .
            cube =  c4d.BaseObject(c4d.Ocube)
            parent = c4d.BaseObject(c4d.Onull)
            cube.InsertUnder(parent)
            matrix = c4d.BaseObject(c4d.Omgmatrix)
            matrix.InsertUnder(parent)
            matrix[c4d.ID_MG_MOTIONGENERATOR_MODE] = c4d.ID_MG_MOTIONGENERATOR_MODE_OBJECT
            matrix[c4d.MG_OBJECT_LINK] = cube
            matrix[c4d.MG_POLY_MODE_] = c4d.MG_POLY_MODE_VERTEX
            rsTag = matrix.MakeTag(1036222)
            rsTag[c4d.REDSHIFT_OBJECT_PARTICLE_MODE] = 2
        
            
            
            return parent
        
        

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

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