Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
767 changes: 767 additions & 0 deletions Config/Presets.json

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions Config/ProjectSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
"Tooll.IsHost": "true",
"Tooll.OperatorTestReferencePath": "assets-common/test-references/",
"Tooll.ProfilingEnabled": "false",
"Soundtrack.BPM": 120.0,
"Soundtrack.BPM": 128.0,
"Soundtrack.BPMOffset": 0,
"Tooll.FullScreen.DisplayNumber": "1",
"Tooll.FullScreen.Resolution.Width": "1920",
"Tooll.FullScreen.Resolution.Height": "1080",
"Git.OperatorRepositoryURL": "git@github.com:framefield/tooll_private_operators.git",
"Git.OperatorRepositoryBranch": "develop",
"Tooll.FullScreen.Resolution.Width": "1366",
"Tooll.FullScreen.Resolution.Height": "768",
"Tooll.RenderView.Camera.MaxVelocity": 2.0,
"Tooll.RenderView.Camera.Acceleration": 1.0,
"Tooll.RenderView.Camera.Friction": 0.30000001192092896,
"Soundtrack.Path": "assets-wireline/music/extant - demo techno v01.mp3",
"Soundtrack.ImagePath": "assets-wireline/music/extant - demo techno v01.mp3.waveform.png",
"Soundtrack.Path": "assets-fnm/cafeinv/music/music.mp3",
"Soundtrack.ImagePath": "assets-fnm/cafeinv/music/music.mp3.waveform.png",
"Tooll.SelectionView.Camera.MaxVelocity": 2.0,
"Tooll.SelectionView.Camera.Acceleration": 1.0,
"Tooll.SelectionView.Camera.Friction": 0.30000001192092896,
"LoaderProgressOperator": ""
"Tooll.SelectionView.Camera.Friction": 0.30000001192092896
}
21 changes: 21 additions & 0 deletions Config/UserPresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@
"Id": "3c0e2e80-7b5d-4fe1-bb86-41a337a156a1"
}
],
"3b4733a5-c5a3-4f11-9543-3907437f2ae1": [
{
"ValuesByParameterID": {
"22761b9d-34ef-4e07-824a-af458f53ce90": 1.0,
"3c24c919-5847-4fad-8e61-c32e954eea5c": 1.0,
"522c7185-c00f-4932-be40-28fe856cfec6": 1.0,
"6b40e98a-b1e7-462a-b97d-bcfa882c4259": 0.0,
"7da91bf7-03eb-4243-97f8-bd5a41f1dbf5": 1.0,
"b30c3066-f9b1-4bf1-a81d-304ae2e48069": 0.0,
"cbcb92c6-c368-4da5-a70e-083d93944602": 0.0,
"eca1ed7a-8e61-450f-9c50-bfb903e049d0": 0.3,
"ef840e45-8e09-4d07-9b79-e6f2c93ad0c7": 1.0,
"ff8fa7b2-0fbd-41f4-9e4d-4e9c66cdc84c": 0.0
},
"OperatorInstanceID": "e083bce8-ec2e-4f87-984f-66a51ad9a95d",
"MetaOperatorID": "3b4733a5-c5a3-4f11-9543-3907437f2ae1",
"IsInstancePreset": true,
"Name": null,
"Id": "5d9a7033-d2b3-4946-9dda-89d4208af4b1"
}
],
"407e6fda-bdab-49a1-870f-eb37ecc9c32b": [
{
"ValuesByParameterID": {
Expand Down
8 changes: 7 additions & 1 deletion Core/Curve/Curve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public void MoveV(double u, double newU)
public List<KeyValuePair<double, VDefinition>> GetPoints()
{
var points = new List<KeyValuePair<double, VDefinition>>();
if (State == null ) // exception was here
return points;
foreach (var item in State.Table)
points.Add(new KeyValuePair<double, VDefinition>(item.Key, item.Value.Clone()));
return points;
Expand All @@ -127,7 +129,9 @@ public List<KeyValuePair<double, VDefinition>> GetPoints()
// Returns null if there is no vDefition at that position
public VDefinition GetV(double u)
{
VDefinition foundValue;
VDefinition foundValue;
if (State == null) // exception was here
return null;
if (State.Table.TryGetValue(u, out foundValue))
return foundValue.Clone();

Expand All @@ -137,6 +141,8 @@ public VDefinition GetV(double u)
public double GetSampledValue(double u)
{
var state = State;
if (state == null) // exception was here
return 0.0;
if (state.Table.Count < 1 || double.IsNaN(u) || double.IsInfinity(u))
return 0.0;

Expand Down
2 changes: 1 addition & 1 deletion Core/Curve/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static OperatorPart GetOperatorPartBelongingToCurve(ICurve curve)
var compositionOp = curveFunc.OperatorPart.Parent.Parent;
var animatedOpPart = (from connection in compositionOp.Connections
where connection.SourceOp == curveFunc.OperatorPart.Parent
select connection.TargetOpPart).SingleOrDefault();
select connection.TargetOpPart).FirstOrDefault(); // Exception with SingleOrDefault();

return animatedOpPart;
}
Expand Down
29 changes: 8 additions & 21 deletions Core/MetaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,16 @@ internal MetaManager()
// }
}

private static bool _metaOpsPrepared = false;

public void PrepareMetaOperators()
public void LoadMetaOperators()
{
if (_metaOpsPrepared)
{
return;
}

var coreAssembly = (from asm in AppDomain.CurrentDomain.GetAssemblies()
where asm.GetName().Name == "Core"
select asm).First();

Logger.Info("Loading operator definition parts...");
try
{
var watch = new Stopwatch();
watch.Start();
try {
Type[] t = coreAssembly.GetTypes();
}
catch (Exception e)
Expand All @@ -96,30 +90,23 @@ where asm.GetName().Name == "Core"
if (e is System.Reflection.ReflectionTypeLoadException)
{
var typeLoadException = e as ReflectionTypeLoadException;
var loaderExceptions = typeLoadException.LoaderExceptions;
var loaderExceptions = typeLoadException.LoaderExceptions;
}
}
var metaOpPartTypes = (from type in coreAssembly.GetTypes()
let properties = type.GetProperties(BindingFlags.Public | BindingFlags.Static)
from p in properties
where p.PropertyType == typeof(MetaOperatorPart)
select new { Type = type, PropInfo = p }).ToList();
where p.PropertyType == typeof (MetaOperatorPart)
select new {Type = type, PropInfo = p}).ToList();

metaOpPartTypes.ForEach(metaType =>
{
AddMetaOperatorPart((MetaOperatorPart)(metaType.PropInfo.GetValue(metaType.Type, null)));
AddMetaOperatorPart((MetaOperatorPart) (metaType.PropInfo.GetValue(metaType.Type, null)));
Logger.Debug("loaded: '{0}'", metaType.PropInfo.Name);
});

AppDomain.CurrentDomain.AssemblyResolve += ResolveEventHandler;
_metaOpsPrepared = true;
}

public void LoadMetaOperators()
{
var watch = new Stopwatch();
watch.Start();
PrepareMetaOperators();
Logger.Info("Loading operator types...");
if (Directory.Exists(MetaPath) && ReadMetaOpsOnInit)
{
Expand Down
6 changes: 5 additions & 1 deletion Core/MetaOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public void ReorderInputsOfOpInstance()
public List<MetaOutput> Outputs { get; internal set; }
internal Dictionary<Guid, Tuple<MetaOperator, InstanceProperties>> Operators { get; set; }


public List<Tuple<Guid, MetaOperatorPart>> OperatorParts
{
get { return _operatorParts; }
Expand Down Expand Up @@ -926,7 +927,10 @@ private void RaisePropertyChangedEvent(string propertyName)

private InstanceProperties GetOperatorProperties(Guid opId)
{
return Operators[opId].Item2;
Tuple<MetaOperator, InstanceProperties> op;
if (!Operators.TryGetValue(opId, out op)) // DART FIX: Exceptions was too long
return null;
return op.Item2;
}

internal string GetName(Guid opId)
Expand Down
19 changes: 14 additions & 5 deletions Core/ResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@ internal class ImageFileResourceReader : FileResourceReader
{
internal override FileResource ReadFromDisc(string filename)
{
var image = SharpDX.Direct3D11.Resource.FromFile<Texture2D>(D3DDevice.Device, filename);
return new ImageResource() { Filename = filename, Image = image };
try
{
var image = SharpDX.Direct3D11.Resource.FromFile<Texture2D>(D3DDevice.Device, filename);
return new ImageResource() { Filename = filename, Image = image };
}
catch
{
return null;
}
}
}

Expand Down Expand Up @@ -402,8 +409,10 @@ private static FileResource LookUpOrCreateResource(FileResourceReader resourceRe
if (!_filenameToResourceDict.TryGetValue(filename, out fileResource))
{
fileResource = resourceReader.ReadFromDisc(filename);
CacheFileResource(fileResource);
Logger.Debug("Caching resource {0}...", fileResource.Filename);
if (fileResource != null) {
CacheFileResource(fileResource);
Logger.Debug("Caching resource {0}...", fileResource.Filename);
}
}
else
{
Expand All @@ -418,7 +427,7 @@ public static ImageResource ReadImage(string filename)
FileInfo fi = new FileInfo(filename);
var resource = LookUpOrCreateResource(_imageFileResourceReader, fi.FullName) as ImageResource;
if (resource == null)
Logger.Error("read or cached resource could not be treated as image");
Logger.Error( "read or cached resource: '{0}' could not be treated as image", filename );
return resource;
}

Expand Down
9 changes: 5 additions & 4 deletions Framefield.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27428.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5EB693F4-CDD7-441C-81FF-D8EB89A0506B}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -111,7 +111,6 @@ Global
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|Win32.ActiveCfg = Release|x86
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|Win32.Build.0 = Release|x86
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|x64.ActiveCfg = Release|x64
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|x64.Build.0 = Release|x64
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|x86.ActiveCfg = Release|x86
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF}.Release|x86.Build.0 = Release|x86
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -131,7 +130,6 @@ Global
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|Win32.ActiveCfg = Release|x86
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|Win32.Build.0 = Release|x86
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|x64.ActiveCfg = Release|x64
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|x64.Build.0 = Release|x64
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|x86.ActiveCfg = Release|x86
{2A6D6D67-F14A-4F12-85F1-7A95760E2357}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand All @@ -145,4 +143,7 @@ Global
{75CB0010-840E-4AD5-AE90-27ED65B2E9CF} = {5EB693F4-CDD7-441C-81FF-D8EB89A0506B}
{2A6D6D67-F14A-4F12-85F1-7A95760E2357} = {5EB693F4-CDD7-441C-81FF-D8EB89A0506B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E608D97-5452-4AF4-85A5-AD4CB9B1109E}
EndGlobalSection
EndGlobal
69 changes: 8 additions & 61 deletions Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,80 +259,27 @@ private OperatorPartContext GetNewContext(float t = 0.0f)
return context;
}

private void DrawFrame(float t, Operator op)
private void DrawFrame(float t)
{
if (_model != null)
{
_model.GlobalTime = t;
}
_model.GlobalTime = t;

D3DDevice.Device.ImmediateContext.ClearDepthStencilView(_renderTargetDepthView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
D3DDevice.Device.ImmediateContext.ClearRenderTargetView(_renderTargetView, new SharpDX.Color4(0.0f, 0.0f, 0.0f, 1.0f));
D3DDevice.Device.ImmediateContext.InputAssembler.InputLayout = _renderer.SceneDefaultInputLayout;

//invalidate all time accessors
var invalidator = new OperatorPart.InvalidateInvalidatables();
op.Outputs[0].TraverseWithFunctionUseSpecificBehavior(null, invalidator);
_model.HomeOperator.Outputs[0].TraverseWithFunctionUseSpecificBehavior(null, invalidator);

var context = GetNewContext(t);
var context = GetNewContext((float)_model.GlobalTime);

op.Outputs[0].Eval(context);
_model.HomeOperator.Outputs[0].Eval(context);
}

private class ProgressOpProxy : ProgressVisualizer
{
private Player _parent;
private Operator _op;
public ProgressOpProxy(Player parent, Operator op)
{
_parent = parent;
_op = op;
}
public void Update(float progress)
{
D3DDevice.BeginFrame();
_parent.DrawFrame(progress - 1.0f, _op);
D3DDevice.EndFrame();
D3DDevice.SwapChain.Present(0, PresentFlags.None);
}
public void Dispose() { }
}

public void Precalc() {
Logger.Info("Precalculating ...");
ProgressVisualizer pv = null;

// load custom progress operator
var loaderOp = ProjectSettings.TryGet("LoaderProgressOperator", "");
if (!String.IsNullOrEmpty(loaderOp))
{
Guid id = Guid.Empty;
try
{
id = new Guid(loaderOp);
}
catch (FormatException)
{
Logger.Warn("Malformed GUID for loader progress operator: {0}", loaderOp);
}
MetaOperator meta = null;
if (!id.Equals(Guid.Empty))
{
Logger.Info("Loading loader progress operator ...");
MetaManager.Instance.PrepareMetaOperators();
meta = MetaManager.Instance.LoadMetaOperator(id);
}
if (meta != null)
{
pv = new ProgressOpProxy(this, meta.CreateOperator(Guid.NewGuid()));
}
}

// use simple loader bar if no custom progress operator available
if (pv == null)
{
pv = new SimpleLoadingBar(_form, D3DDevice.Device, D3DDevice.SwapChain);
}
var pv = new ProgressVisualizer(_form, D3DDevice.Device, D3DDevice.SwapChain);
pv.Update(0.0f);

MetaManager.InitializeCallback = progress => pv.Update(_operatorLoadEndProgress * progress);
Expand Down Expand Up @@ -401,7 +348,7 @@ public override OperatorPartContext Eval(OperatorPartContext context, List<Opera
{
Logger.Debug("pre-rendering frame at t={0}", t);
D3DDevice.BeginFrame();
DrawFrame((float)t, _model.HomeOperator);
DrawFrame((float)t);
D3DDevice.EndFrame();
i++;
pv.Update(_preCacheStartProgress + (1.0f - _preCacheStartProgress) * i / preCacheTimes.Count);
Expand Down Expand Up @@ -450,7 +397,7 @@ private void Update() {
TimeLogger.BeginFrame(time);
D3DDevice.BeginFrame();

DrawFrame((float)time, _model.HomeOperator);
DrawFrame((float)time);

D3DDevice.SwapChain.Present(_settings.VSyncEnabled ? 1 : 0, PresentFlags.None);

Expand Down
9 changes: 2 additions & 7 deletions Player/ProgressVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@

namespace Framefield.Player
{
public interface ProgressVisualizer : IDisposable
public class ProgressVisualizer : IDisposable
{
void Update(float progress);
}

public class SimpleLoadingBar : ProgressVisualizer
{
public SimpleLoadingBar(RenderForm form, SharpDX.Direct3D11.Device device, SwapChain swapChain) {
public ProgressVisualizer(RenderForm form, SharpDX.Direct3D11.Device device, SwapChain swapChain) {
_form = form;
_device = device;
_swapChain = swapChain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ await Task.Run(() =>
{
var errorText = string.Format("Unable to download operators from: {0}\n\nYou may find more details in your log-file.",
repos.RemotePath + " (" + repos.Branch + ")");
throw new ShutDownException(errorText, "Connection Failure");
// throw new ShutDownException(errorText, "Connection Failure");
}
});
}
Expand Down
Loading