예제 #1
0
        public void SelfChange(int change)
        {
            if (change == VFXParameterController.ValueChanged)
            {
                foreach (var prop in allProperties)
                {
                    prop.Update();
                }
                return;
            }

            int insertIndex = 0;


            bool isOutputParameter = controller.isOutput;

            if (!isOutputParameter)
            {
                if (m_ExposedProperty == null)
                {
                    m_ExposedProperty = new BoolPropertyRM(new SimplePropertyRMProvider <bool>("Exposed", () => controller.exposed, t => controller.exposed = t), 55);
                    Insert(insertIndex++, m_ExposedProperty);
                }
                else
                {
                    insertIndex++;
                }

                if (m_Property == null || !m_Property.IsCompatible(controller))
                {
                    if (m_Property != null)
                    {
                        m_Property.RemoveFromHierarchy();
                    }
                    m_Property = PropertyRM.Create(controller, 55);
                    if (m_Property != null)
                    {
                        Insert(insertIndex++, m_Property);
                        if (!m_Property.showsEverything)
                        {
                            RecreateSubproperties(ref insertIndex);
                        }
                        List <int> fieldpath = new List <int>();

                        if (m_TooltipProperty == null)
                        {
                            m_TooltipProperty = new StringPropertyRM(new SimplePropertyRMProvider <string>("Tooltip", () => controller.model.tooltip, t => controller.model.tooltip = t), 55);
                            TextField field = m_TooltipProperty.Query <TextField>();
                            field.multiline = true;
                        }
                        Insert(insertIndex++, m_TooltipProperty);
                    }
                    else
                    {
                        m_TooltipProperty = null;
                    }
                }
                else
                {
                    insertIndex += 1 + (m_SubProperties != null ? m_SubProperties.Count : 0) + 1; //main property + subproperties + tooltip
                }
                bool mustRelayout = false;

                if (controller.canHaveValueFilter)
                {
                    if (m_MinProperty == null || !m_MinProperty.IsCompatible(controller.minController))
                    {
                        if (m_MinProperty != null)
                        {
                            m_MinProperty.RemoveFromHierarchy();
                        }
                        m_MinProperty = PropertyRM.Create(controller.minController, 55);
                    }
                    if (m_MaxProperty == null || !m_MaxProperty.IsCompatible(controller.minController))
                    {
                        if (m_MaxProperty != null)
                        {
                            m_MaxProperty.RemoveFromHierarchy();
                        }
                        m_MaxProperty = PropertyRM.Create(controller.maxController, 55);
                    }

                    if (m_ValueFilterProperty == null)
                    {
                        m_ValueFilterProperty = new EnumPropertyRM(new ValueFilterEnumPropertyRMProvider("Mode", () => controller.valueFilter, t => controller.valueFilter = t, controller.portType != typeof(uint)), 55);
                    }
                    Insert(insertIndex++, m_ValueFilterProperty);

                    if (controller.model.valueFilter == VFXValueFilter.Range)
                    {
                        if (m_MinProperty.parent == null)
                        {
                            Insert(insertIndex++, m_MinProperty);
                            Insert(insertIndex++, m_MaxProperty);
                            mustRelayout = true;
                        }
                    }
                    else if (m_MinProperty.parent != null)
                    {
                        m_MinProperty.RemoveFromHierarchy();
                        m_MaxProperty.RemoveFromHierarchy();
                    }
                    if (controller.valueFilter == VFXValueFilter.Enum)
                    {
                        if (m_EnumProperty == null || !m_EnumProperty.IsCompatible(controller.enumController))
                        {
                            if (m_EnumProperty != null)
                            {
                                m_EnumProperty.RemoveFromHierarchy();
                            }
                            m_EnumProperty = new VFXListParameterEnumValuePropertyRM(controller.enumController, 55);
                        }
                        if (m_EnumProperty.parent == null)
                        {
                            Insert(insertIndex++, m_EnumProperty);
                            mustRelayout = true;
                        }
                    }
                    else if (m_EnumProperty != null && m_EnumProperty.parent != null)
                    {
                        m_EnumProperty.RemoveFromHierarchy();
                    }
                }
                else
                {
                    if (m_MinProperty != null)
                    {
                        m_MinProperty.RemoveFromHierarchy();
                        m_MinProperty = null;
                    }
                    if (m_MaxProperty != null)
                    {
                        m_MaxProperty.RemoveFromHierarchy();
                        m_MaxProperty = null;
                    }
                    if (m_ValueFilterProperty != null)
                    {
                        m_ValueFilterProperty.RemoveFromHierarchy();
                        m_ValueFilterProperty = null;
                    }
                }

                if (mustRelayout)
                {
                    Relayout();
                }
            }
            else
            {
                m_Property            = null;
                m_ExposedProperty     = null;
                m_SubProperties       = null;
                m_MinProperty         = null;
                m_MaxProperty         = null;
                m_ValueFilterProperty = null;
                if (m_TooltipProperty == null)
                {
                    m_TooltipProperty = new StringPropertyRM(new SimplePropertyRMProvider <string>("Tooltip", () => controller.model.tooltip, t => controller.model.tooltip = t), 55);
                    TextField field = m_TooltipProperty.Query <TextField>();
                    field.multiline = true;
                }
                Insert(insertIndex++, m_TooltipProperty);
            }


            foreach (var prop in allProperties)
            {
                prop.Update();
            }
        }
예제 #2
0
 public new void Clear()
 {
     m_ExposedProperty     = null;
     m_ValueFilterProperty = null;
 }