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

    Copying/Pasting GvNodes?

    Cinema 4D SDK
    c++ 2023
    2
    3
    475
    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.
    • F
      Filip
      last edited by

      Hi!
      I am writing a plugin that utilizes a custom node editor based on Xpresso (GvNodeMaster, GvNodeGUI, etc.), displayed in a GeDialog.

      Now I would like to implement Copy/Paste functionality, i.e. to be able to copy and paste selected GvNodes both within a single GvNodeMaster and between different GvNodeMasters. My GvNodeMasters are owned and stored within custom BaseMaterials.

      1. Is there some built in functionality I could use for this? The Xpresso editor implements this functionality, is there any way I can call those copy/paste functions?

      2. If not, how do I create a copy of a GvNode and insert it into another GvNodeMaster? Using GetClone() does not seem to work, which makes sense as GvNode according to the docs are not really normal BaseList2D:s*

      Any suggestions?

      Thanks!
      /Filip

      *) From the docs: "The GvNode is a double BaseList2D node. Internally it has an operator that corresponds to GvOperatorData. Use GetOperatorContainer() to access most parameters."

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

        Hey @Filip,

        thank you for reaching out to us. You can call the commands for copy and paste of the Xpresso editor:

        CallCommand(300001010); // Copy
        CallCommand(300001011); // Paste
        

        Appart from that, the general rule "we do not expose UI functionalities but the data structures behind them" applies. There is no Object Manager interface, there is no Material Manager interface, and there is also no Xpresso Editor interface.

        So, if you want to clone something , you should use GetClone. That the method does not work or that GvNode is not a 'really normal' C4DAtom I would call untrue without proof/demonstration. Not quite sure what the person writing that sentence in the docs meant, but a GvNode should be copyable. This is how the Xpresso editor implements node copying (there is a bit more going on, but this is the end of the call chain). The Internal's are there because this is code from our internal types, but they are wrapped by the public ones, the GvNode you are using.

        GvInternalNode* GvInternalNodeMaster::CopyNode(GvInternalNode *source)
        {
          return (GvInternalNode*)source->GetClone(COPYFLAGS::NONE, nullptr);
        }
        

        As always, questions without your code are usually not so good, as we then have to speculate, which makes things a lengthy process.

        Cheers,
        Ferdinand

        PS: There are also the copy buffer methods on GvNodeMaster if you want to preserve connections, copy multiple nodes at once etc.:

        https://developers.maxon.net/docs/cpp/2024_4_0/class_gv_node_master.html

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • F
          Filip
          last edited by

          "PS: There are also the copy buffer methods on GvNodeMaster if you want to preserve connections, copy multiple nodes at once etc.:"
          -That looks like it might be exactly what I need! Thanks a lot!

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