Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pixtur committed Nov 14, 2023
2 parents 78836bd + 18f9043 commit 66b8643
Show file tree
Hide file tree
Showing 57 changed files with 1,867 additions and 3,672 deletions.
99 changes: 99 additions & 0 deletions .Variations/924b8cc0-5b4b-41d0-a71b-b26465683910.var
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,105 @@
"8367cbad-6214-4167-855b-9f704bb46ac3": -7.0
}
}
},
{
"Id": "3032e5b0-6d66-4e45-a421-bfd2b19fe0f2",
"IsPreset": true,
"ActivationIndex": 13,
"Title": "Test 2",
"PosOnCanvas": {
"X": 10.533621,
"Y": 726.5019
},
"ParameterSetsForChildIds": {
"00000000-0000-0000-0000-000000000000": {
"8c4e188c-18ab-4f69-a60a-14a8e5a12f91": {
"X": 0.14862531,
"Y": -3.3470907,
"Z": 0.0,
"W": 0.0
},
"9a4d8846-6b46-4a4b-a8d3-97f3f9eaf8db": {
"X": 0.7718076,
"Y": 0.0,
"Z": 0.0,
"W": 1.0
},
"4dd19c0b-10c1-43fa-a3e2-970b4f9c6162": -11.0,
"11ba5bbc-4873-489f-85b7-35080f0988cf": 3.9,
"e95c5f4d-df12-42f6-a879-8e26540b03ac": 5.3,
"6eb81dc2-88b5-4ba7-9f82-fe2389dc2926": 0.8,
"e9fd2c91-7cee-481e-933b-a40a27da15dc": -23.5,
"211fd6ee-26a9-4e15-85ba-4a22e865545d": 16.2,
"8367cbad-6214-4167-855b-9f704bb46ac3": 67.0
}
}
},
{
"Id": "b34c6442-9404-467e-a98e-14a1ded6bfd5",
"IsPreset": true,
"ActivationIndex": 14,
"Title": "Test3",
"PosOnCanvas": {
"X": 438.8577,
"Y": 735.4049
},
"ParameterSetsForChildIds": {
"00000000-0000-0000-0000-000000000000": {
"8c4e188c-18ab-4f69-a60a-14a8e5a12f91": {
"X": 0.0,
"Y": 0.95,
"Z": 0.0,
"W": 0.0
},
"9a4d8846-6b46-4a4b-a8d3-97f3f9eaf8db": {
"X": 19.4,
"Y": 20.0,
"Z": 0.0,
"W": 1.0
},
"4dd19c0b-10c1-43fa-a3e2-970b4f9c6162": 28.0,
"11ba5bbc-4873-489f-85b7-35080f0988cf": 132.0,
"e95c5f4d-df12-42f6-a879-8e26540b03ac": 100.0,
"6eb81dc2-88b5-4ba7-9f82-fe2389dc2926": 31.0,
"e9fd2c91-7cee-481e-933b-a40a27da15dc": 0.03,
"211fd6ee-26a9-4e15-85ba-4a22e865545d": -0.2999997,
"8367cbad-6214-4167-855b-9f704bb46ac3": 340.0
}
}
},
{
"Id": "998080c1-bf65-4863-a568-1177bc4bf309",
"IsPreset": true,
"ActivationIndex": 15,
"Title": "Test5",
"PosOnCanvas": {
"X": 155.75218,
"Y": 1024.1165
},
"ParameterSetsForChildIds": {
"00000000-0000-0000-0000-000000000000": {
"8c4e188c-18ab-4f69-a60a-14a8e5a12f91": {
"X": 0.09,
"Y": 0.01,
"Z": 2.18,
"W": 0.0
},
"9a4d8846-6b46-4a4b-a8d3-97f3f9eaf8db": {
"X": 1290.0,
"Y": -34.0,
"Z": -106.7,
"W": 1.0
},
"4dd19c0b-10c1-43fa-a3e2-970b4f9c6162": 28.0,
"11ba5bbc-4873-489f-85b7-35080f0988cf": 132.0,
"e95c5f4d-df12-42f6-a879-8e26540b03ac": 5.0,
"6eb81dc2-88b5-4ba7-9f82-fe2389dc2926": 6.5,
"e9fd2c91-7cee-481e-933b-a40a27da15dc": 3.58,
"211fd6ee-26a9-4e15-85ba-4a22e865545d": 0.09,
"8367cbad-6214-4167-855b-9f704bb46ac3": -230.0
}
}
}
]
}
26 changes: 26 additions & 0 deletions .Variations/f9d453d1-04d9-43ef-9189-50008f93bcc2.var
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,32 @@
"806221f8-6e31-45ec-b62e-5baac6c1fd54": 0.16
}
}
},
{
"Id": "38371470-f8e7-46e0-84d4-f49b6af696f0",
"IsPreset": true,
"ActivationIndex": 7,
"Title": "Fire",
"PosOnCanvas": {
"X": 0.0,
"Y": 186.0
},
"ParameterSetsForChildIds": {
"00000000-0000-0000-0000-000000000000": {
"a7669abe-65c7-4745-97a6-d0d80f6a3150": 24.9,
"78b314b8-f9d2-4723-9b11-c07ba926db86": -30.000002,
"8060756f-72a4-490b-9677-872b70e73b3a": 1.9,
"297a2220-0648-47d3-82a1-c1077a1326a4": 65.0,
"98662eab-90b9-4af1-8ff3-ba6709b5038e": 1.0,
"4109af01-5c9a-4a9f-af7f-87fbcdcece3d": {
"X": 0.0,
"Y": 0.0019999999
},
"806221f8-6e31-45ec-b62e-5baac6c1fd54": 0.07,
"1f09da31-b853-417c-abb1-39e1199a149f": true,
"51621e59-9bdd-4004-a053-d4637278bd92": false
}
}
}
]
}
6 changes: 4 additions & 2 deletions Core/DataTypes/Point.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace T3.Core.DataTypes
{
[StructLayout(LayoutKind.Explicit, Size = 2 * 16)]
[StructLayout(LayoutKind.Explicit, Size = Stride)]
public struct Point
{
[FieldOffset(0)]
Expand All @@ -22,8 +22,10 @@ public static Point Separator()
{
Position = Vector3.Zero,
W = Single.NaN,
Orientation = Quaternion.Identity
Orientation = Quaternion.Identity,
};
}

public const int Stride = 2 * 16;
}
}
15 changes: 15 additions & 0 deletions Core/Operator/Symbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public Symbol(Type instanceType, Guid symbolId, Guid[] orderedInputIds = null)

// input identified by base interface
Type inputSlotType = typeof(IInputSlot);


var inputInfos = instanceType.GetFields().Where(f => inputSlotType.IsAssignableFrom(f.FieldType));
var inputDefs = new List<InputDefinition>();
foreach (var inputInfo in inputInfos)
Expand All @@ -89,6 +91,12 @@ public Symbol(Type instanceType, Guid symbolId, Guid[] orderedInputIds = null)
var attribute = (InputAttribute)customAttributes[0];
var isMultiInput = inputInfo.FieldType.GetGenericTypeDefinition() == typeof(MultiInputSlot<>);
var valueType = inputInfo.FieldType.GetGenericArguments()[0];

if (!TypeNameRegistry.Entries.ContainsKey(valueType))
{
Log.Error($"Skipping input {Name}.{inputInfo.Name} with undefined type {valueType}...");
continue;
}
var inputDef = CreateInputDefinition(attribute.Id, inputInfo.Name, isMultiInput, valueType);
inputDefs.Add(inputDef);
}
Expand All @@ -99,6 +107,7 @@ public Symbol(Type instanceType, Guid symbolId, Guid[] orderedInputIds = null)
foreach (Guid id in orderedInputIds)
{
var inputDefinition = inputDefs.Find(inputDef => inputDef != null && inputDef.Id == id);

if (inputDefinition != null)
{
InputDefinitions.Add(inputDefinition);
Expand All @@ -120,6 +129,12 @@ from attr in attributes
var valueType = output.FieldType.GenericTypeArguments[0];
var attribute = (OutputAttribute)attributes.First();
var outputDataType = GetOutputDataType(output);

if (!TypeNameRegistry.Entries.ContainsKey(valueType))
{
Log.Error($"Skipping output {Name}.{output.Name} with undefined type {valueType}...");
continue;
}

OutputDefinitions.Add(new OutputDefinition
{
Expand Down
18 changes: 16 additions & 2 deletions Editor/App/AppWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using T3.Editor.Gui.Styling;
using Device = SharpDX.Direct3D11.Device;
using Icon = System.Drawing.Icon;
using Rectangle = System.Drawing.Rectangle;
using Resource = SharpDX.Direct3D11.Resource;

namespace T3.Editor.App
Expand Down Expand Up @@ -38,11 +39,22 @@ internal AppWindow(string windowTitle, bool disableClose)
CreateRenderForm(windowTitle, disableClose);
}

public void SetVisible(bool isVisible) => Form.Visible = isVisible;
public void SetVisible(bool isVisible)
{
Form.Visible = isVisible;
}

public void SetSizeable() => Form.FormBorderStyle = FormBorderStyle.Sizable;
public void SetSizeable()
{
Form.FormBorderStyle = FormBorderStyle.Sizable;
if (_boundsBeforeFullscreen.Height != 0 && _boundsBeforeFullscreen.Width != 0)
{
Form.Bounds = _boundsBeforeFullscreen;
}
}

public void Show() => Form.Show();


public Vector2 GetDpi()
{
Expand All @@ -53,6 +65,7 @@ public Vector2 GetDpi()

internal void SetFullScreen(int screenIndex)
{
_boundsBeforeFullscreen = Form.Bounds;
Form.FormBorderStyle = FormBorderStyle.Sizable;
Form.WindowState = FormWindowState.Normal;
Form.FormBorderStyle = FormBorderStyle.None;
Expand Down Expand Up @@ -204,5 +217,6 @@ public NoCloseRenderForm(string title) : base(title)
private RenderTargetView _renderTargetView;
private Texture2D _backBufferTexture;
private bool _isResizingRightNow;
private Rectangle _boundsBeforeFullscreen;
}
}
11 changes: 8 additions & 3 deletions Editor/Gui/Graph/Dialogs/AddInputDialog.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System.Linq;
using ImGuiNET;
using T3.Core.Operator;
using T3.Editor.Gui.Graph.Helpers;
using T3.Editor.Gui.Graph.Modification;
using T3.Editor.Gui.InputUi.VectorInputs;
using T3.Editor.Gui.Styling;
using T3.Editor.Gui.UiHelpers;

using T3.Operators.Types.Id_dab61a12_9996_401e_9aa6_328dd6292beb;

namespace T3.Editor.Gui.Graph.Dialogs
{
Expand All @@ -33,6 +31,12 @@ public void Draw(Symbol symbol)
else if(symbol.InputDefinitions.Exists(i => i.Name == _parameterName))
{
warning = "Parameter name already exists.";
isValid = false;
}
else if (symbol.InstanceType == typeof(HomeCanvas))
{
warning = "You can't add parameters to the home canvas.";
isValid = false;
}

FormInputs.SetIndent(100);
Expand All @@ -48,6 +52,7 @@ public void Draw(Symbol symbol)
if (CustomComponents.DisablableButton("Add", isValid))
{
InputsAndOutputs.AddInputToSymbol(_parameterName, _multiInput, _selectedType, symbol);
_parameterName = string.Empty;
}

ImGui.SameLine();
Expand Down
24 changes: 22 additions & 2 deletions Editor/Gui/Graph/GraphNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,11 @@ public static void Draw(SymbolChildUi childUi, Instance instance, bool preventIn
var inputSlot = instance.GetInput(inputDefinition.Id);
//var valueAsString = inputUi.GetSlotValue(inputSlot);
var valueAsString = GetValueString(inputSlot);

// if (inputSlot is InputSlot<float> f)
// {
// var xxx = f.TypedInputValue.Value;
// }

var valueColor = labelColor;
valueColor.Rgba.W *= 0.6f;

Expand Down Expand Up @@ -1217,7 +1221,7 @@ private static string GetValueString(InputValue inputValue)
{
return inputValue switch
{
InputValue<float> f => $"{f.Value:0.00}",
InputValue<float> f => $"{f.Value:0.000}",
InputValue<int> i => $"{i.Value:G3}",
InputValue<Int3> i => $"{i.Value:G3}",
InputValue<bool> b => $"{b.Value}",
Expand All @@ -1227,6 +1231,22 @@ private static string GetValueString(InputValue inputValue)
_ => ""
};
}

private static string GetValueString(IInputSlot outputSlot)
{

return outputSlot switch
{
InputSlot<float> f => $"{f.TypedInputValue.Value:0.000}",
InputSlot<int> i => $"{i.TypedInputValue.Value:G3}",
InputSlot<Int3> i => $"{i.TypedInputValue.Value:G3}",
InputSlot<bool> b => $"{b.TypedInputValue.Value}",
InputSlot<Vector3> v3 => $"{v3.TypedInputValue.Value:0.0}",
InputSlot<Vector2> v2 => $"{v2.TypedInputValue.Value:0.0}",
InputSlot<string> s => Truncate(s.TypedInputValue.Value),
_ => ""
};
}

private static string GetValueString(ISlot outputSlot)
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/Gui/Interaction/InfinitySliderOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public static void Draw(ref double roundedValue, bool restarted, Vector2 center,
_originalValue = roundedValue;
}

var mouseYDistance = _center.Y - _io.MousePos.Y; // Vector2.Distance(_center, p1);
var mouseYDistance = _center.Y - _io.MousePos.Y;

// Update angle...
var mousePosX = _io.MousePos.X;
var mousePosX = (int)(_io.MousePos.X * 2)/2;
var xOffset = mousePosX - _center.X;
var deltaX = xOffset - _lastXOffset;
_lastXOffset = xOffset;
Expand Down
1 change: 0 additions & 1 deletion Editor/Gui/Interaction/UserAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ private static readonly List<KeyboardBinding> _bindings
new KeyboardBinding(UserActions.PlaybackJumpToStartTime, new KeyCombination(Key.Home)),
new KeyboardBinding(UserActions.PlaybackJumpToNextKeyframe, new KeyCombination(Key.Period)),
new KeyboardBinding(UserActions.PlaybackJumpToPreviousKeyframe, new KeyCombination(Key.Comma)),
new KeyboardBinding(UserActions.PlaybackNextFrame, new KeyCombination(Key.CursorRight, shift: true)),
new KeyboardBinding(UserActions.PlaybackJumpBack, new KeyCombination(Key.B)),

new KeyboardBinding(UserActions.Undo, new KeyCombination(Key.Z, ctrl: true)),
Expand Down
17 changes: 17 additions & 0 deletions Editor/Gui/T3UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using T3.Editor.Gui.UiHelpers.Wiki;
using T3.Editor.Gui.Windows;
using T3.Editor.Gui.Windows.Layouts;
using T3.Editor.Gui.Windows.Output;
using T3.Editor.SystemUi;
using T3.Editor.UiModel;
using T3.Operators.Types.Id_5d7d61ae_0a41_4ffa_a51d_93bab665e7fe;
Expand Down Expand Up @@ -189,10 +190,26 @@ private void TriggerGlobalActionsFromKeyBindings()

private static void ToggleFocusMode() {
var shouldBeFocusMode = !UserSettings.Config.FocusMode;

var outputWindow = OutputWindow.GetPrimaryOutputWindow();
var primaryGraphWindow = GraphWindow.GetPrimaryGraphWindow();

if (shouldBeFocusMode && outputWindow != null && primaryGraphWindow != null)
{
primaryGraphWindow.GraphImageBackground.OutputInstance = outputWindow.Pinning.GetPinnedOrSelectedInstance();
}

UserSettings.Config.FocusMode = shouldBeFocusMode;
UserSettings.Config.ShowToolbar = shouldBeFocusMode;
ToggleAllUiElements();
LayoutHandling.LoadAndApplyLayoutOrFocusMode(shouldBeFocusMode ? 11 : UserSettings.Config.WindowLayoutIndex);

outputWindow = OutputWindow.GetPrimaryOutputWindow();
if (!shouldBeFocusMode && outputWindow != null && primaryGraphWindow != null)
{
outputWindow.Pinning.PinInstance(primaryGraphWindow.GraphImageBackground.OutputInstance);
primaryGraphWindow.GraphImageBackground.ClearBackground();
}
}

private void DrawAppMenuBar()
Expand Down
Loading

0 comments on commit 66b8643

Please sign in to comment.