Search Unity

Feature Request Visual scripting — Bolt — Reroute Node

Discussion in 'Visual Scripting' started by DmitriiDzh, Nov 28, 2020.

  1. DmitriiDzh

    DmitriiDzh

    Joined:
    Dec 22, 2019
    Posts:
    3
    Hey folks!

    How to add "empty dots" in Bolt to make connections looks cleaner on diagrams?
    There is such function in Unreal, does Bolt have something similar?



    Best Regards, Dmitrii
     
  2. Ex-Crow

    Ex-Crow

    Joined:
    Aug 14, 2020
    Posts:
    111
    merpheus and DmitriiDzh like this.
  3. DmitriiDzh

    DmitriiDzh

    Joined:
    Dec 22, 2019
    Posts:
    3
  4. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    224
    Hm, I adapted the script to Unity 2021 VisualScripting but unfortunately, even with [PortLabelHidden], the node is not as compact as with Bolt.

    Bolt Addons Community Value Reroute units work but are not compact.png

    Unless I'm missing something?

    This is what the Release page shows:




    My adapted code:

    Code (CSharp):
    1. // Adapted from Bolt Addons Community ValueReroute unit
    2. // https://github.com/RealityStop/Bolt.Addons.Community/blob/master/Runtime/Fundamentals/Units/Utility/ValueReroute.cs
    3. // https://github.com/RealityStop/Bolt.Addons.Community/blob/master/LICENSE (MIT License)
    4.  
    5. using System;
    6. using System.Collections;
    7. using System.Collections.Generic;
    8. using Unity.VisualScripting;
    9. using UnityEngine;
    10.  
    11. namespace CommonsHelper
    12. {
    13.     [UnitCategory("Utility")]
    14.     [UnitTitle("Value Reroute")]
    15.     [UnitShortTitle("Value Reroute")]
    16.     public sealed class ValueReroute : Unit
    17.     {
    18.         [DoNotSerialize]
    19.         [PortLabelHidden]
    20.         public ValueInput input;
    21.        
    22.         [DoNotSerialize]
    23.         [PortLabelHidden]
    24.         public ValueOutput output;
    25.        
    26.         [Serialize]
    27.         public Type portType = typeof(object);
    28.  
    29.         protected override void Definition()
    30.         {
    31.             input = ValueInput(portType, "in");
    32.             output = ValueOutput(portType, "out", flow => flow.GetValue(input));
    33.             Requirement(input, output);
    34.         }
    35.     }
    36. }
    Code (CSharp):
    1. // Adapted from Bolt Addons Community FlowReroute unit
    2. // https://github.com/RealityStop/Bolt.Addons.Community/blob/master/Runtime/Fundamentals/Units/Utility/FlowReroute.cs
    3. // https://github.com/RealityStop/Bolt.Addons.Community/blob/master/LICENSE (MIT License)
    4.  
    5. using System.Collections;
    6. using System.Collections.Generic;
    7. using Unity.VisualScripting;
    8. using UnityEngine;
    9.  
    10. namespace CommonsHelper
    11. {
    12.     [UnitCategory("Utility")]
    13.     [UnitTitle("Flow Reroute")]
    14.     [UnitShortTitle("Flow Reroute")]
    15.     public class FlowRerouteUnit : Unit
    16.     {
    17.         [DoNotSerialize]
    18.         [PortLabelHidden]
    19.         public ControlInput input;
    20.        
    21.         [DoNotSerialize]
    22.         [PortLabelHidden]
    23.         public ControlOutput output;
    24.        
    25.         protected override void Definition()
    26.         {
    27.             input = ControlInput("in", flow => output);
    28.             output = ControlOutput("out");
    29.             Succession(input, output);
    30.         }
    31.     }
    32. }
     
  5. MasterSubby

    MasterSubby

    Joined:
    Sep 5, 2012
    Posts:
    252
    The reroutes are compact because we have a custom widget that overrides the background drawing. You can't get this with just the units themselves. Look for ValueRerouteWidget and FlowRerouteWidget to learn how the compact design is created. In fact, even now the block is completely hidden unless the node is selected or hovered. You can find the code for all the latest changes in the UVSsupport-Dev branch.

    Screenshot_20211002-095027.png
     
    Last edited: Oct 2, 2021