Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I detach nodes from a group (custom editor window graph view) and edit the group capabilities

Discussion in 'Editor & General Support' started by TheRealRan, Mar 11, 2021.

  1. TheRealRan

    TheRealRan

    Joined:
    Jun 3, 2019
    Posts:
    18
    I am making a custom graph view node based system, and I am able to drag my nodes into the group.

    However, once I drag them in, I cannot drag them out unless I delete the node.

    If I delete the group, I also delete everything inside.

    I was searching for group capabilities in the documentation but it seems to be an enumeration, so I can only have one at the time, and I cannot find anything to understand what manipulators are.

    upload_2021-3-11_21-43-24.png

    How am I able to, if currently possible:
    • Delete or detach group only
    • Drag out nodes from the group
    • Change group capabilities
     

    Attached Files:

  2. TheRealRan

    TheRealRan

    Joined:
    Jun 3, 2019
    Posts:
    18
    I just noticed that you can detach the nodes by pressing shift + click.

    Still didn't figure out the rest, though.

    EDIT:

    You can do
    Code (CSharp):
    1. capabilities -= Capabilities.YourDesiredCapability;
    to remove a capability, however you cannot do
    Code (CSharp):
    1. capabilities += Capabilities.YourDesiredCapability;
    to add a capability, for whatever reason.

    You can also create your "Delete" action by overriding BuildContextualMenu on GraphView and doing
    Code (CSharp):
    1. evt.menu.AppendAction("Delete", actionEvent => DeleteMethod(selection));
    (selection = selected elements, a GraphView variable). By deleting the selected element the group won't delete every node inside and only the group itself.

    Also there are some handy methods for group title changed and some others on https://docs.unity3d.com/2019.2/Documentation/ScriptReference/Experimental.GraphView.GraphView.html.
     
    Last edited: Mar 29, 2021
    SimonFireproof likes this.