public void ConvertParameterToInline()
        {
            VFXParameter newParameter = m_ViewController.AddVFXParameter(Vector2.zero, VFXLibrary.GetParameters().First(t => t.model.type == typeof(AABox)));

            m_ViewController.LightApplyChanges();

            VFXParameterController parameterController = m_ViewController.GetParameterController(newParameter);

            parameterController.model.AddNode(new Vector2(123, 456));

            AABox value = new AABox {
                center = new Vector3(1, 2, 3), size = new Vector3(4, 5, 6)
            };

            parameterController.value = value;

            m_ViewController.LightApplyChanges();

            VFXParameterNodeController parameterNode = parameterController.nodes.First();

            parameterNode.ConvertToInline();

            VFXInlineOperator op = m_ViewController.graph.children.OfType <VFXInlineOperator>().First();

            Assert.AreEqual(new Vector2(123, 456), op.position);
            Assert.AreEqual(typeof(AABox), op.type);
            Assert.AreEqual(value, op.inputSlots[0].value);
        }
        public void ConvertToInline()
        {
            VFXInlineOperator op = ScriptableObject.CreateInstance <VFXInlineOperator>();

            op.SetSettingValue("m_Type", (SerializableType)parentController.model.type);

            viewController.graph.AddChild(op);

            op.position = position;

            if (infos.linkedSlots != null)
            {
                foreach (var link in infos.linkedSlots.ToArray())
                {
                    var ancestors = new List <VFXSlot>();
                    ancestors.Add(link.outputSlot);
                    VFXSlot parent = link.outputSlot.GetParent();
                    while (parent != null)
                    {
                        ancestors.Add(parent);

                        parent = parent.GetParent();
                    }
                    int index = parentController.model.GetSlotIndex(ancestors.Last());

                    if (index >= 0 && index < op.GetNbOutputSlots())
                    {
                        VFXSlot slot = op.outputSlots[index];
                        for (int i = ancestors.Count() - 2; i >= 0; --i)
                        {
                            int subIndex = ancestors[i + 1].GetIndex(ancestors[i]);

                            if (subIndex >= 0 && subIndex < slot.GetNbChildren())
                            {
                                slot = slot[subIndex];
                            }
                            else
                            {
                                slot = null;
                                break;
                            }
                        }
                        if (slot.path != link.outputSlot.path.Substring(1)) // parameters output are still named 0, inline outputs have no name.
                        {
                            Debug.LogError("New inline don't have the same subslot as old parameter");
                        }
                        else
                        {
                            link.outputSlot.Unlink(link.inputSlot);
                            slot.Link(link.inputSlot);
                        }
                    }
                }
            }

            op.inputSlots[0].value = value;
            viewController.LightApplyChanges();
            viewController.PutInSameGroupNodeAs(viewController.GetNodeController(op, 0), this);
            viewController.RemoveElement(this);
        }