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

    How to set the position of a node manually?

    Cinema 4D SDK
    python 2024
    2
    4
    561
    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.
    • M
      momoko
      last edited by

      Dear people,

      Is there a chance I use a custom value to set the position (location)
      of a node I create with Python manually inside Graph Editor? Like use a custom value for X and Y of a Texture node.

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

        Hey @momoko,

        Thank you for reaching out to us. Doing that, setting the position of a node, is not possible. You must rely on the auto layout which kicks in once you have finished your transaction.

        Internally, nodes follow a three-tier-architecture, specfically the MVP Pattern. When you do operations on a maxon.NodeGraphModelRef or maxon.GraphModelRef you are operating on the model, i.e., data, part of that three-tier architecture. The view is the Node Editor and the presenter is a type called GraphModelPresenter, they handle in tandem how the data/model layer is displayed and interfacts with user inputs. Or in other words: everything GUI related where you do not have an attribute or a port in a graph node for is not possible to manipulate from the model level.

        You can fold and unfold nodes, hide and show their preview image because each node has an attribute for that as shown in the Node Editor. But you cannot set the position of a node or if a port bundle is unfolded or not. You would need the presenter for that, which is neither public in Python nor C++.

        But the auto-layouter usually does its job nicely πŸ™‚

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        M 1 Reply Last reply Reply Quote 0
        • M
          momoko @ferdinand
          last edited by

          @ferdinand Thank you. I thought that would be possible because Blender was providing that.

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

            Hey @momoko,

            I understood why you asked, as this is common thing to do. Even for our own other node system, Xpresso aka GraphView, doing this is possible in the API. I just provided an explanation as to why the Nodes Team did it like this and why they very likely will never change that (as it would break their design pattern). So that you and future readers can understand why we do this instead of just being confronted with a blunt "no" πŸ™‚

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

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