Exemplo n.º 1
0
        void PasteNode(VFXModel model, Vector2 center, Rect bounds, ref Node node)
        {
            var offset = node.position - bounds.min;

            model.position = center + offset;

            PasteModelSettings(model, node.settings, model.GetType());

            model.Invalidate(VFXModel.InvalidationCause.kSettingChanged);

            var slotContainer = model as IVFXSlotContainer;
            var inputSlots    = slotContainer.inputSlots;

            for (int i = 0; i < node.inputSlots.Length && i < inputSlots.Count; ++i)
            {
                if (inputSlots[i].name == node.inputSlots[i].name)
                {
                    inputSlots[i].value = node.inputSlots[i].value.Get();
                    if (inputSlots[i].spaceable)
                    {
                        inputSlots[i].space = node.inputSlots[i].space;
                    }
                }
            }

            if ((node.flags & Node.Flags.Collapsed) == Node.Flags.Collapsed)
            {
                model.collapsed = true;
            }

            if ((node.flags & Node.Flags.SuperCollapsed) == Node.Flags.SuperCollapsed)
            {
                model.superCollapsed = true;
            }

            foreach (var slot in AllSlots(slotContainer.inputSlots))
            {
                slot.collapsed = !node.expandedInputs.Contains(slot.path);
            }
            foreach (var slot in AllSlots(slotContainer.outputSlots))
            {
                slot.collapsed = !node.expandedOutputs.Contains(slot.path);
            }
        }
Exemplo n.º 2
0
        void PasteNode(VFXModel model, ref Node node)
        {
            model.position = node.position + pasteOffset;

            PasteModelSettings(model, node.settings, model.GetType());

            model.Invalidate(VFXModel.InvalidationCause.kSettingChanged);

            var slotContainer = model as IVFXSlotContainer;
            var inputSlots    = slotContainer.inputSlots;

            for (int i = 0; i < node.inputSlots.Length; ++i)
            {
                if (inputSlots[i].name == node.inputSlots[i].name)
                {
                    inputSlots[i].value = node.inputSlots[i].value.Get();
                }
            }

            if ((node.flags & Node.Flags.Collapsed) == Node.Flags.Collapsed)
            {
                model.collapsed = true;
            }

            if ((node.flags & Node.Flags.SuperCollapsed) == Node.Flags.SuperCollapsed)
            {
                model.superCollapsed = true;
            }

            foreach (var slot in AllSlots(slotContainer.inputSlots))
            {
                slot.collapsed = !node.expandedInputs.Contains(slot.path);
            }
            foreach (var slot in AllSlots(slotContainer.outputSlots))
            {
                slot.collapsed = !node.expandedOutputs.Contains(slot.path);
            }
        }