//*** Nodes stuffs ****//

    // Add a new object to the tree
    public void AddNodeObject(string fullPath, object[] args, string type)
    {
        var name       = MyUtility.GetNameFromUrlPath(fullPath);
        var parentPath = MyUtility.GetParentUrlPath(fullPath);

        // If the node is a root node
        if (string.IsNullOrEmpty(parentPath))
        {
            var node = CreateNodeObject(name, fullPath, args, type);
            _rootNodes.Add(node);
        }
        // If the node is a child node
        else
        {
            var parentNode = FindBaseItem(parentPath);

            if (parentNode != null)
            {
                var node = CreateNodeObject(name, fullPath, args, type);
                _rootNodes.Add(node);
                parentNode.AddChild(node);

                if (name.Contains("RNA"))
                {
                    _rnaInstanceNodeId = node.Id;
                }
            }
            else
            {
                throw new Exception("System error");
            }
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        if (_rootNodes == null)
        {
            _rootNodes = new List <BaseItem>();
        }
        foreach (var path in SceneManager.Get.SceneHierarchy)
        {
            AddNodeObject(path, new object[] { MyUtility.GetNameFromUrlPath(path) }, "Text");
        }
        InitNodeItems();

        // Register event callbacks
        foreach (var node in _rootNodes)
        {
            node.SetFoldedState(FoldedAtLaunch);
            node.PointerClick += OnNodePointerClick;
            node.PointerExit  += OnNodePointerExit;
            node.PointerEnter += OnNodePointerEnter;
            node.RangeFieldItem.CustomRangeSliderUi.RangeSliderDrag += OnRangeSliderDrag;
        }

        SetSelectedNode(_rootNodes[0]);
        cutObjectUiController.OnSelectedCutObjectChange += OnSelectedCutObjectChange;

        OnNodePointerExit(null);
    }