Layer property - Removed generic events in favor of regular ones

Layer property - Added API for easy hiding/showing properties depending on the state of another property 
Layer property - Made properties on property groups opt-out instead of opt-in, you can opt out with [LayerPropertyIgnore] attribute
This commit is contained in:
Robert committed 2021-01-19 19:32:31 +01:00
1 parent 52906218dc
commit 52a9253846
12 files changed
+209 -92

No files matched your search

@@ -152,20 +152,22 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
// The group has methods for getting this without reflection but then we lose the order of the properties as they are defined on the group
foreach (PropertyInfo propertyInfo in LayerPropertyGroup.GetType().GetProperties())
{
PropertyDescriptionAttribute propertyAttribute = (PropertyDescriptionAttribute) Attribute.GetCustomAttribute(propertyInfo, typeof(PropertyDescriptionAttribute));
PropertyGroupDescriptionAttribute groupAttribute = (PropertyGroupDescriptionAttribute) Attribute.GetCustomAttribute(propertyInfo, typeof(PropertyGroupDescriptionAttribute));
object value = propertyInfo.GetValue(LayerPropertyGroup);
if (Attribute.IsDefined(propertyInfo, typeof(LayerPropertyIgnoreAttribute)))
continue;
// Create VMs for properties on the group
if (propertyAttribute != null && value is ILayerProperty layerProperty)
if (typeof(ILayerProperty).IsAssignableFrom(propertyInfo.PropertyType))
{
ILayerProperty value = (ILayerProperty) propertyInfo.GetValue(LayerPropertyGroup);
// Ensure a supported input VM was found, otherwise don't add it
if (_profileEditorService.CanCreatePropertyInputViewModel(layerProperty))
Items.Add(_layerPropertyVmFactory.LayerPropertyViewModel(layerProperty));
if (value != null && _profileEditorService.CanCreatePropertyInputViewModel(value))
Items.Add(_layerPropertyVmFactory.LayerPropertyViewModel(value));
}
else if (typeof(LayerPropertyGroup).IsAssignableFrom(propertyInfo.PropertyType))
{
LayerPropertyGroup value = (LayerPropertyGroup) propertyInfo.GetValue(LayerPropertyGroup);
if (value != null)
Items.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(value));
}
// Create VMs for child groups on this group, resulting in a nested structure
else if (groupAttribute != null && value is LayerPropertyGroup layerPropertyGroup)
Items.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(layerPropertyGroup));
}
}
}
@@ -77,17 +77,17 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
base.OnInitialActivate();
}
private void LayerPropertyOnKeyframesToggled(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnKeyframesToggled(object sender, LayerPropertyEventArgs e)
{
UpdateKeyframes();
}
private void LayerPropertyOnKeyframeRemoved(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnKeyframeRemoved(object sender, LayerPropertyEventArgs e)
{
UpdateKeyframes();
}
private void LayerPropertyOnKeyframeAdded(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnKeyframeAdded(object sender, LayerPropertyEventArgs e)
{
UpdateKeyframes();
}
@@ -119,17 +119,17 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
LayerPropertyViewModel.IsHighlighted = _profileEditorService.SelectedDataBinding == LayerProperty;
}
private void LayerPropertyOnVisibilityChanged(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnVisibilityChanged(object sender, LayerPropertyEventArgs e)
{
LayerPropertyViewModel.IsVisible = !LayerProperty.IsHidden;
}
private void LayerPropertyOnDataBindingChange(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnDataBindingChange(object sender, LayerPropertyEventArgs e)
{
NotifyOfPropertyChange(nameof(HasDataBinding));
}
private void LayerPropertyOnKeyframesToggled(object sender, LayerPropertyEventArgs<T> e)
private void LayerPropertyOnKeyframesToggled(object sender, LayerPropertyEventArgs e)
{
NotifyOfPropertyChange(nameof(KeyframesEnabled));
}