GetInputs() private method

private GetInputs ( ) : UnityEngine.Experimental.Director.Playable[]
return UnityEngine.Experimental.Director.Playable[]
 static public int GetInputs(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.Experimental.Director.Playable self = (UnityEngine.Experimental.Director.Playable)checkSelf(l);
             var ret = self.GetInputs();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.Experimental.Director.Playable self = (UnityEngine.Experimental.Director.Playable)checkSelf(l);
             System.Collections.Generic.List <UnityEngine.Experimental.Director.Playable> a1;
             checkType(l, 2, out a1);
             self.GetInputs(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 2
0
        // Traverse the graph and place all nodes according to the algorithm
        private void RecursiveTraverse(Playable root)
        {
            foreach (var c in root.GetInputs())
            {
                if (c != null)
                {
                    RecursiveTraverse(c);
                }
            }

            Vector2 nodePos = new Vector2(m_HorizontalPositionForLevel[m_Nodes[root].depth], 0);

            // Move children apart until they stop touching
            var nonNullInputs = root.GetInputs().Where(x => x != null).ToArray();
            if (nonNullInputs.Length > 1)
            {
                SeparateSubtrees(nonNullInputs);
            }
            if (nonNullInputs.Length > 0)
            {
                nodePos.y = GetAveragePosition(nonNullInputs).y;
            }
            m_Nodes[root].position = nodePos;
        }
Exemplo n.º 3
0
        // First pass to identify the nodes, and place them at a default initial position
        private void RecursiveAddNodes(Playable node, int currentDepth, float weight, float parentWeight)
        {
            NodeInfo info = new NodeInfo();
            info.playable = node;
            info.weight = weight;
            info.propagatedWeight = weight * parentWeight;
            info.depth = currentDepth;

            if (currentDepth > m_TreeMaxDepth)
                m_TreeMaxDepth = currentDepth;

            // Assign vertex ID right away for ease of debugging
            info.vertexId = m_Nodes.Keys.Count;
            m_Nodes.Add(node, info);

            Playable[] inputs = node.GetInputs();
            int nbInputs = inputs.Length;

            for (int c = 0; c < nbInputs; c++)
            {
                if (inputs[c] != null)
                    RecursiveAddNodes(inputs[c], currentDepth + 1, node.GetInputWeight(c), weight * parentWeight);
            }
        }
Exemplo n.º 4
0
        // Apply a vertical delta to all nodes in a subtree
        private void RecursiveMoveSubtree(Playable subtreeRoot, float delta)
        {
            m_Nodes[subtreeRoot].position.y += delta;

            foreach (var child in subtreeRoot.GetInputs())
            {
                if (child != null)
                    RecursiveMoveSubtree(child, delta);
            }
        }
Exemplo n.º 5
0
 // Includes all descendants and the subtree root itself
 private List<Playable> GetSubtreeNodes(Playable root)
 {
     var allDescendants = new List<Playable>();
     allDescendants.Add(root);
     foreach (var child in root.GetInputs())
     {
         if (child != null)
             allDescendants.AddRange(GetSubtreeNodes(child));
     }
     return allDescendants;
 }