void CreateSubProperties(ref int insertIndex, List <int> fieldPath) { var subControllers = controller.GetSubControllers(fieldPath); var subFieldPath = new List <int>(); int cpt = 0; foreach (var subController in subControllers) { PropertyRM prop = PropertyRM.Create(subController, 85); if (prop != null) { m_SubProperties.Add(prop); Insert(insertIndex++, prop); } if (prop == null || !prop.showsEverything) { subFieldPath.Clear(); subFieldPath.AddRange(fieldPath); subFieldPath.Add(cpt); CreateSubProperties(ref insertIndex, subFieldPath); } ++cpt; } }
void CreateSubProperties(ref int insertIndex, List <int> fieldPath) { var subControllers = controller.GetSubControllers(fieldPath); var subFieldPath = new List <int>(); int cpt = 0; foreach (var subController in subControllers) { subController.RegisterHandler(this); PropertyRM prop = PropertyRM.Create(subController, 85); if (prop != null) { m_SubProperties.Add(prop); Insert(insertIndex++, prop); } if (subController.expanded) { subFieldPath.Clear(); subFieldPath.AddRange(fieldPath); subFieldPath.Add(cpt); CreateSubProperties(ref insertIndex, subFieldPath); } ++cpt; } }
public static PropertyRM Create(IPropertyRMProvider controller, float labelWidth) { Type propertyType = GetPropertyType(controller); Profiler.BeginSample(propertyType.Name + ".CreateInstance"); PropertyRM result = System.Activator.CreateInstance(propertyType, new object[] { controller, labelWidth }) as PropertyRM; Profiler.EndSample(); return(result); }
protected virtual void SyncSettings() { Profiler.BeginSample("VFXNodeUI.SyncSettings"); if (settingsContainer == null && controller.settings != null) { object settings = controller.settings; settingsContainer = this.Q("settings"); m_SettingsDivider = this.Q("settings-divider"); foreach (var setting in controller.settings) { AddSetting(setting); } } if (settingsContainer != null) { var activeSettings = controller.model.GetSettings(false, VFXSettingAttribute.VisibleFlags.InGraph); for (int i = 0; i < m_Settings.Count; ++i) { m_Settings[i].RemoveFromHierarchy(); } hasSettings = false; for (int i = 0; i < m_Settings.Count; ++i) { PropertyRM prop = m_Settings[i]; if (prop != null && activeSettings.Any(s => s.field.Name == controller.settings[i].name)) { hasSettings = true; settingsContainer.Add(prop); prop.Update(); } } if (hasSettings) { settingsContainer.RemoveFromClassList("nosettings"); } else { settingsContainer.AddToClassList("nosettings"); } } if (m_SettingsDivider != null) { m_SettingsDivider.visible = hasSettingDivider && hasSettings; } Profiler.EndSample(); }
protected void AddSetting(VFXSettingController setting) { var rm = PropertyRM.Create(setting, DefaultLabelWidth); if (rm != null) { m_Settings.Add(rm); } else { Debug.LogErrorFormat("Cannot create controller for {0}", setting.name); } }
void BuildProperty() { Profiler.BeginSample("VFXNodeUI.BuildProperty"); if (m_PropertyRM != null) { Remove(m_PropertyRM); } m_PropertyRM = PropertyRM.Create(controller, 100); if (m_PropertyRM != null) { Add(m_PropertyRM); } Profiler.EndSample(); }
void BuildProperty() { Profiler.BeginSample("VFXNodeUI.BuildProperty"); float effectiveWidth = -1; if (m_PropertyRM != null) { Remove(m_PropertyRM); effectiveWidth = m_PropertyRM.effectiveLabelWidth; } m_PropertyRM = PropertyRM.Create(controller, VFXNodeUI.DefaultLabelWidth); if (m_PropertyRM != null) { Add(m_PropertyRM); if (effectiveWidth >= 0) { m_PropertyRM.SetLabelWidth(effectiveWidth); } } Profiler.EndSample(); }
public void SelfChange(int change) { if (change == VFXParameterController.ValueChanged) { foreach (var prop in allProperties) { prop.Update(); } return; } int insertIndex = 0; 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_SubProperties != null) { foreach (var prop in m_SubProperties) { prop.RemoveFromHierarchy(); } } m_SubProperties = new List <PropertyRM>(); List <int> fieldpath = new List <int>(); if (!m_Property.showsEverything) { CreateSubProperties(ref insertIndex, fieldpath); } if (m_TooltipProperty == null) { m_TooltipProperty = new StringPropertyRM(new SimplePropertyRMProvider <string>("Tooltip", () => controller.model.tooltip, t => controller.model.tooltip = t), 55); } Insert(insertIndex++, m_TooltipProperty); } else { m_TooltipProperty = null; } } else { insertIndex += 1 + m_SubProperties.Count; } if (controller.canHaveRange) { 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_RangeProperty == null) { m_RangeProperty = new BoolPropertyRM(new SimplePropertyRMProvider <bool>("Range", () => controller.hasRange, t => controller.hasRange = t), 55); } Insert(insertIndex++, m_RangeProperty); if (controller.hasRange) { if (m_MinProperty.parent == null) { Insert(insertIndex++, m_MinProperty); Insert(insertIndex++, m_MaxProperty); } } else if (m_MinProperty.parent != null) { m_MinProperty.RemoveFromHierarchy(); m_MaxProperty.RemoveFromHierarchy(); } } else { if (m_MinProperty != null) { m_MinProperty.RemoveFromHierarchy(); m_MinProperty = null; } if (m_MaxProperty != null) { m_MaxProperty.RemoveFromHierarchy(); m_MaxProperty = null; } if (m_RangeProperty != null) { m_RangeProperty.RemoveFromHierarchy(); m_RangeProperty = null; } } foreach (var prop in allProperties) { prop.Update(); } }
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 } if (controller.canHaveRange) { 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_RangeProperty == null) { m_RangeProperty = new BoolPropertyRM(new SimplePropertyRMProvider <bool>("Range", () => controller.hasRange, t => controller.hasRange = t), 55); } Insert(insertIndex++, m_RangeProperty); if (controller.hasRange) { if (m_MinProperty.parent == null) { Insert(insertIndex++, m_MinProperty); Insert(insertIndex++, m_MaxProperty); } } else if (m_MinProperty.parent != null) { m_MinProperty.RemoveFromHierarchy(); m_MaxProperty.RemoveFromHierarchy(); } } else { if (m_MinProperty != null) { m_MinProperty.RemoveFromHierarchy(); m_MinProperty = null; } if (m_MaxProperty != null) { m_MaxProperty.RemoveFromHierarchy(); m_MaxProperty = null; } if (m_RangeProperty != null) { m_RangeProperty.RemoveFromHierarchy(); m_RangeProperty = null; } } } else { m_Property = null; m_ExposedProperty = null; m_SubProperties = null; m_MinProperty = null; m_MaxProperty = null; m_RangeProperty = null; if (m_TooltipProperty == null) { m_TooltipProperty = new StringPropertyRM(new SimplePropertyRMProvider <string>("Tooltip", () => controller.model.tooltip, t => controller.model.tooltip = t), 55); } Insert(insertIndex++, m_TooltipProperty); } foreach (var prop in allProperties) { prop.Update(); } }