Skip to content

Commit 9deb5c1

Browse files
committed
Renamed "b" values in math/rotate2D and math/rotate3D to match newest spec change.
1 parent 3781bf5 commit 9deb5c1

File tree

7 files changed

+38
-6
lines changed

7 files changed

+38
-6
lines changed

Runtime/Scripts/Interactivity/Playback/NodeRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static BehaviourEngineNode CreateBehaviourEngineNode(BehaviourEngine engi
271271
["math/normalize"] = new MathOneOperandSpec<float2, float3, float4>(),
272272
["math/or"] = new MathTwoOperandsSpec<int, bool>(),
273273
["math/pi"] = new MathConstantSpec(),
274-
["math/rotate2D"] = new MathTwoOperandsRetSpec<float2, float, float2>(),
274+
["math/rotate2D"] = new MathRotate2DSpec(),
275275
["math/rotate3D"] = new MathRotate3DSpec(),
276276
["math/round"] = new MathOneOperandFloatSpec(),
277277
["math/sign"] = new MathOneOperandSpec<int, float, float2, float3, float4>(),
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using Unity.Mathematics;
3+
using UnityEngine;
4+
5+
namespace UnityGLTF.Interactivity.Playback
6+
{
7+
public class MathRotate2DSpec : NodeSpecifications
8+
{
9+
protected override (NodeFlow[] flows, NodeValue[] values) GenerateInputs()
10+
{
11+
var values = new NodeValue[]
12+
{
13+
new NodeValue(ConstStrings.A, "Vector to Rotate", new Type[] { typeof(float2)}),
14+
new NodeValue(ConstStrings.ANGLE, "Angle in Radians", new Type[] { typeof(float)}),
15+
};
16+
17+
return (null, values);
18+
}
19+
20+
protected override (NodeFlow[] flows, NodeValue[] values) GenerateOutputs()
21+
{
22+
var values = new NodeValue[]
23+
{
24+
new NodeValue(ConstStrings.VALUE, "Rotated Vector", new Type[] { typeof(float2) }),
25+
};
26+
27+
return (null, values);
28+
}
29+
}
30+
}

Runtime/Scripts/Interactivity/Playback/NodeSpecs/Math/Rotate2D.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Scripts/Interactivity/Playback/NodeSpecs/Math/Rotate3D.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protected override (NodeFlow[] flows, NodeValue[] values) GenerateInputs()
1111
var values = new NodeValue[]
1212
{
1313
new NodeValue(ConstStrings.A, "Vector to Rotate", new Type[] { typeof(float3)}),
14-
new NodeValue(ConstStrings.B, "Rotation Quaternion", new Type[] { typeof(float4)}),
14+
new NodeValue(ConstStrings.ROTATION, "Rotation Quaternion", new Type[] { typeof(float4)}),
1515
};
1616

1717
return (null, values);

Runtime/Scripts/Interactivity/Playback/Nodes/Math/Rotate2D.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public MathRotate2D(BehaviourEngine engine, Node node) : base(engine, node)
1313
public override IProperty GetOutputValue(string id)
1414
{
1515
TryEvaluateValue(ConstStrings.A, out IProperty a);
16-
TryEvaluateValue(ConstStrings.B, out IProperty b);
16+
TryEvaluateValue(ConstStrings.ANGLE, out IProperty b);
1717

1818
return a switch
1919
{

Runtime/Scripts/Interactivity/Playback/Nodes/Math/Rotate3D.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public MathRotate3D(BehaviourEngine engine, Node node) : base(engine, node)
1414
public override IProperty GetOutputValue(string id)
1515
{
1616
TryEvaluateValue(ConstStrings.A, out IProperty a);
17-
TryEvaluateValue(ConstStrings.B, out IProperty b);
17+
TryEvaluateValue(ConstStrings.ROTATION, out IProperty b);
1818

1919
return a switch
2020
{

Tests/Runtime/Interactivity/Nodes/Math/MathNodesTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ private static void RotateTest3D<T, V>(string fileName, string testName, string
912912
var outputs = new Dictionary<string, IProperty>();
913913

914914
inputs.Add(ConstStrings.A, new Value() { id = ConstStrings.A, property = new Property<T>(a) });
915-
inputs.Add(ConstStrings.B, new Value() { id = ConstStrings.B, property = new Property<V>(b) });
915+
inputs.Add(ConstStrings.ROTATION, new Value() { id = ConstStrings.ROTATION, property = new Property<V>(b) });
916916
outputs.Add(ConstStrings.VALUE, new Property<T>(expected));
917917

918918
QueueTest(nodeName, fileName, testName, testDescription, CreateSelfContainedTestGraph(nodeName, inputs, outputs, ComparisonType.Approximately));
@@ -931,7 +931,7 @@ private static void RotateTest2D<T, V>(string fileName, string testName, string
931931
var outputs = new Dictionary<string, IProperty>();
932932

933933
inputs.Add(ConstStrings.A, new Value() { id = ConstStrings.A, property = new Property<T>(a) });
934-
inputs.Add(ConstStrings.B, new Value() { id = ConstStrings.B, property = new Property<V>(b) });
934+
inputs.Add(ConstStrings.ANGLE, new Value() { id = ConstStrings.ANGLE, property = new Property<V>(b) });
935935
outputs.Add(ConstStrings.VALUE, new Property<T>(expected));
936936

937937
QueueTest(nodeName, fileName, testName, testDescription, CreateSelfContainedTestGraph(nodeName, inputs, outputs, ComparisonType.Approximately));

0 commit comments

Comments
 (0)