Scripting - Enabled scripting (#638)

* Scripting - Simplified view model structure
* Scripting - Removed Layer and LayerProperty scripts
This commit is contained in:
Robert Beekman authored and GitHub committed 2021-07-04 11:45:32 +02:00
1 parent ee16d69fb3
commit 631d8de2c3
26 files changed
+278 -578

No files matched your search

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Artemis.Core.ScriptingProviders;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core
@@ -24,16 +23,6 @@ namespace Artemis.Core
/// </summary>
LayerPropertyGroup LayerPropertyGroup { get; }
/// <summary>
/// Gets a collection of all active scripts assigned to this layer property
/// </summary>
List<PropertyScript> Scripts { get; }
/// <summary>
/// Gets a collection of all script configurations assigned to this layer property
/// </summary>
public List<ScriptConfiguration> ScriptConfigurations { get; }
/// <summary>
/// Gets the unique path of the property on the layer
/// </summary>
@@ -81,8 +70,6 @@ namespace Artemis.Core
/// <param name="timeline">The timeline to apply to the property</param>
void Update(Timeline timeline);
#region Events
/// <summary>
/// Occurs when the layer property is disposed
/// </summary>
@@ -137,7 +124,5 @@ namespace Artemis.Core
/// Occurs when a data binding has been disabled
/// </summary>
public event EventHandler<LayerPropertyEventArgs>? DataBindingDisabled;
#endregion
}
}
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.ScriptingProviders;
using Artemis.Storage.Entities.Profile;
using Newtonsoft.Json;
@@ -31,8 +30,6 @@ namespace Artemis.Core
Path = null!;
Entity = null!;
PropertyDescription = null!;
Scripts = new List<PropertyScript>();
ScriptConfigurations = new List<ScriptConfiguration>();
CurrentValue = default!;
DefaultValue = default!;
@@ -60,9 +57,6 @@ namespace Artemis.Core
{
_disposed = true;
while (Scripts.Count > 1)
Scripts[0].Dispose();
foreach (IDataBinding dataBinding in _dataBindings)
dataBinding.Dispose();
@@ -153,12 +147,6 @@ namespace Artemis.Core
/// <inheritdoc />
public PropertyDescriptionAttribute PropertyDescription { get; internal set; }
/// <inheritdoc />
public List<PropertyScript> Scripts { get; }
/// <inheritdoc />
public List<ScriptConfiguration> ScriptConfigurations { get; }
/// <inheritdoc />
public string Path { get; private set; }
@@ -171,18 +159,12 @@ namespace Artemis.Core
if (_disposed)
throw new ObjectDisposedException("LayerProperty");
foreach (PropertyScript propertyScript in Scripts)
propertyScript.OnPropertyUpdating(timeline.Delta.TotalSeconds);
CurrentValue = BaseValue;
UpdateKeyframes(timeline);
UpdateDataBindings(timeline);
OnUpdated();
foreach (PropertyScript propertyScript in Scripts)
propertyScript.OnPropertyUpdated(timeline.Delta.TotalSeconds);
}
/// <inheritdoc />
@@ -762,11 +744,6 @@ namespace Artemis.Core
if (dataBinding != null)
_dataBindings.Add(dataBinding);
}
foreach (ScriptConfiguration scriptConfiguration in ScriptConfigurations)
scriptConfiguration.Script?.Dispose();
ScriptConfigurations.Clear();
ScriptConfigurations.AddRange(Entity.ScriptConfigurations.Select(e => new ScriptConfiguration(e)));
}
/// <summary>
@@ -788,13 +765,6 @@ namespace Artemis.Core
Entity.DataBindingEntities.Clear();
foreach (IDataBinding dataBinding in _dataBindings)
dataBinding.Save();
Entity.ScriptConfigurations.Clear();
foreach (ScriptConfiguration scriptConfiguration in ScriptConfigurations)
{
scriptConfiguration.Save();
Entity.ScriptConfigurations.Add(scriptConfiguration.Entity);
}
}
/// <summary>