Ejemplo n.º 1
0
        void OnMouseHover(EventBase evt)
        {
            VFXView view = GetFirstAncestorOfType <VFXView>();

            if (view == null)
            {
                return;
            }
            VFXBlackboard blackboard = view.blackboard;

            if (blackboard == null)
            {
                return;
            }
            VFXBlackboardRow row = blackboard.GetRowFromController(controller.parentController);

            if (row == null)
            {
                return;
            }

            if (evt.eventTypeId == MouseEnterEvent.TypeId())
            {
                row.AddToClassList("hovered");
            }
            else
            {
                row.RemoveFromClassList("hovered");
            }
        }
        public VFXBlackboardRow GetRowFromController(VFXParameterController controller)
        {
            VFXBlackboardRow row = null;

            m_Parameters.TryGetValue(controller, out row);

            return(row);
        }
Ejemplo n.º 3
0
        public VFXBlackboardRow GetRowFromController(VFXParameterController controller)
        {
            VFXBlackboardCategory cat = null;
            VFXBlackboardRow row = null;
            if (string.IsNullOrEmpty(controller.model.category))
            {
                row = m_DefaultCategory.GetRowFromController(controller);
            }
            else if (m_Categories.TryGetValue(controller.model.category, out cat))
            {
                row = cat.GetRowFromController(controller);
            }

            return row;
        }
        public void SyncParameters(HashSet <VFXParameterController> controllers)
        {
            foreach (var removedControllers in m_Parameters.Where(t => !controllers.Contains(t.Key)).ToArray())
            {
                removedControllers.Value.RemoveFromHierarchy();
                m_Parameters.Remove(removedControllers.Key);
            }

            foreach (var addedController in controllers.Where(t => !m_Parameters.ContainsKey(t)).ToArray())
            {
                VFXBlackboardRow row = new VFXBlackboardRow();

                Add(row);

                row.controller = addedController;

                m_Parameters[addedController] = row;
            }

            if (m_Parameters.Count > 0)
            {
                var orderedParameters = m_Parameters.OrderBy(t => t.Key.order).Select(t => t.Value).ToArray();

                if (ElementAt(0) != orderedParameters[0])
                {
                    orderedParameters[0].SendToBack();
                }

                for (int i = 1; i < orderedParameters.Length; ++i)
                {
                    if (ElementAt(i) != orderedParameters[i])
                    {
                        orderedParameters[i].PlaceInFront(orderedParameters[i - 1]);
                    }
                }
            }
        }