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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Command to create a Nodes Modifier

    Scheduled Pinned Locked Moved General Talk
    programming
    3 Posts 2 Posters 26 Views 1 Watching
    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.
    • I Offline
      ImperfectLink
      last edited by ImperfectLink

      Hi there,
      I'm trying to find the correct command to create a scene nodes modifier (Nodes Modifier) object. The one in the command manager doesn't seem to do anything. I'm finding various methods in which to call up a Nodes Modifier Object through Python to no avail. Any advice would be much appreciated.
      C4DCommandManagerNodesModifier.jpg

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF Offline
        ferdinand @ImperfectLink
        last edited by ferdinand

        Hey @ImperfectLink,
        Welcome to the Maxon developers forum and its community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.

        • Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
        • Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
        • Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.

        It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.

        About your First Question

        The posting you linked to was a legacy posting, I have deleted it. You can find all relevant information in this posting or in the Support entry of the site nav. Your question is a bit ambiguous but I assume you want to instantiate a nodes modifier? Or what do you mean by "the command"? I would say it works like this:

        import c4d
        import maxon
        
        from mxutils import CheckType
        
        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.
            """
            node: c4d.BaseObject = CheckType(c4d.BaseObject(maxon.neutron.DEFORMER_ID))
            doc.InsertObject(node)
            c4d.EventAdd()
        
        if __name__ == '__main__':
            main()
        

        You can find all the Neutron (the code name for scene nodes) IDs here. What stands out that this instantiates a scene node deformer and not a 'modifier', which is indeed a bit puzzling. But both share the same numeric value for their ID:

        c377ba54-581c-445d-bf0a-3b72111390fa-image.png

        In the API there is maxon.neutron.DEFORMER_ID but no modifier ID. And in the UI there is only a modifier. But since they share the type ID and also type name (Scene Nodes Deformer) they must be the same thing and the node editor just renames the entity when it is being inserted for some reason.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        I 1 Reply Last reply Reply Quote 0
        • I Offline
          ImperfectLink @ferdinand
          last edited by

          @ferdinand Thanks for the reply. This will help immensely thank you.

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