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

    Remove node from Redshift node graph

    Cinema 4D SDK
    s26 c++
    2
    3
    405
    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.
    • S
      spedler
      last edited by

      I'm following the Redshift renderer page in the SDK for R26.1 to create nodes in a Redshift node graph. This all works fine, and adding nodes and making connections is all good. But I wondered, adding a node is simple but how do you remove a node? If adding a node works like this:

      const::maxon::nodes::NodesGraphModelRef& nodeGraph = nodeMat->GetGraph(redshiftId) iferr_return;
      maxon::GraphNode textureNode = nodeGraph.AddChild(maxon::Id(), textureId) iferr_return;
      

      Then I'd have expected something like this to be available:

      nodeGraph.RemoveChild(textureId);    // no such function
      

      But there is nothing like this to use. There is a Remove() function in the GraphModelInterface class but it's protected and not available from the NodesGraphModelRef class.

      Is there a way to delete nodes from a Redshift material node graph? I wondered about using ReplaceChild() to replace the node to be deleted with nothing, but there doesn't seem to be a way to do that either.

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        GraphNode is a friend class of GraphModelInterface, so you should call textureNode.Remove()

        For more information please read GraphNode Manual.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • S
          spedler
          last edited by

          Ah...so simple in the end! Navigating this maze of interdependent classes used in the node system is not easy, that's my excuse 🙂

          Many thanks for this, it solves a very tricky problem I was having.

          Cheers,
          Steve

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