Skip to content

Commit 8f529e5

Browse files
committed
updated math node socket types
1 parent 4cb2682 commit 8f529e5

3 files changed

Lines changed: 72 additions & 62 deletions

File tree

Editor/Scripts/Interactivity/VisualScriptingExport/UnitExporters/Math/Mathf_CeilToIntUnitExport.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public bool InitializeInteractivityNodes(UnitExporter unitExporter)
2525

2626
var floatToIntNode = unitExporter.CreateNode<Type_FloatToIntNode>();
2727

28-
ceilNode.ValueIn(Math_CeilNode.IdInputA).MapToInputPort(unit.valueInputs[0]);
28+
ceilNode.ValueIn(Math_CeilNode.IdValueA).MapToInputPort(unit.valueInputs[0]);
2929

3030
floatToIntNode.ValueIn(Type_FloatToIntNode.IdInputA)
31-
.ConnectToSource(ceilNode.ValueOut(Math_CeilNode.IdValueResult));
31+
.ConnectToSource(ceilNode.ValueOut(Math_CeilNode.IdOut));
3232

33-
floatToIntNode.ValueOut(Math_CeilNode.IdValueResult).MapToPort(unit.result);
33+
floatToIntNode.ValueOut(Math_CeilNode.IdOut).MapToPort(unit.result);
3434

3535
unitExporter.ByPassFlow(unit.enter, unit.exit);
3636
return true;

Editor/Scripts/Interactivity/VisualScriptingExport/UnitExporters/Math/Mathf_FloorToIntUnitExport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public bool InitializeInteractivityNodes(UnitExporter unitExporter)
2525

2626
var floatToIntNode = unitExporter.CreateNode<Type_FloatToIntNode>();
2727

28-
floorNode.ValueIn(Math_FloorNode.IdInputA).MapToInputPort(unit.valueInputs[0]);
29-
floatToIntNode.ValueIn(Type_FloatToIntNode.IdInputA).ConnectToSource(floorNode.ValueOut(Math_FloorNode.IdValueResult));
28+
floorNode.ValueIn(Math_FloorNode.IdValueA).MapToInputPort(unit.valueInputs[0]);
29+
floatToIntNode.ValueIn(Type_FloatToIntNode.IdInputA).ConnectToSource(floorNode.ValueOut(Math_FloorNode.IdOut));
3030

3131
unitExporter.MapValueOutportToSocketName(unit.result, Type_FloatToIntNode.IdValueResult, floatToIntNode);
3232
unitExporter.ByPassFlow(unit.enter, unit.exit);

Runtime/Scripts/Interactivity/Schema/Nodes/Math/MathNodes.cs

Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,11 @@ public class Math_MixNode : GltfInteractivityNodeSchema
410410
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
411411
public const string IdOut = "value";
412412

413-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
413+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
414414
public const string IdValueA = "a";
415-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
415+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
416416
public const string IdValueB = "b";
417-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
417+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
418418
public const string IdValueC = "c";
419419
}
420420

@@ -425,11 +425,11 @@ public class Math_ClampNode : GltfInteractivityNodeSchema
425425
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
426426
public const string IdOut = "value";
427427

428-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
428+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
429429
public const string IdValueA = "a";
430-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
430+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
431431
public const string IdValueB = "b";
432-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
432+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
433433
public const string IdValueC = "c";
434434
}
435435

@@ -453,9 +453,9 @@ public class Math_MinNode : GltfInteractivityNodeSchema
453453
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
454454
public const string IdOut = "value";
455455

456-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
456+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
457457
public const string IdValueA = "a";
458-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
458+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
459459
public const string IdValueB = "b";
460460
}
461461

@@ -466,9 +466,9 @@ public class Math_MaxNode : GltfInteractivityNodeSchema
466466
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
467467
public const string IdOut = "value";
468468

469-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
469+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
470470
public const string IdValueA = "a";
471-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
471+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
472472
public const string IdValueB = "b";
473473
}
474474

@@ -479,9 +479,9 @@ public class Math_SubNode : GltfInteractivityNodeSchema
479479
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
480480
public const string IdOut = "value";
481481

482-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
482+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
483483
public const string IdValueA = "a";
484-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
484+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
485485
public const string IdValueB = "b";
486486
}
487487

@@ -492,10 +492,10 @@ public class Math_MulNode : GltfInteractivityNodeSchema
492492
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
493493
public const string IdOut = "value";
494494

495-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float,
495+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float,
496496
GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float2x2, GltfTypes.Float3x3, GltfTypes.Float4x4)]
497497
public const string IdValueA = "a";
498-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float,
498+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float,
499499
GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float2x2, GltfTypes.Float3x3, GltfTypes.Float4x4)]
500500
public const string IdValueB = "b";
501501
}
@@ -521,9 +521,9 @@ public class Math_RemNode : GltfInteractivityNodeSchema
521521
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
522522
public const string IdOut = "value";
523523

524-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
524+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
525525
public const string IdValueA = "a";
526-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
526+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
527527
public const string IdValueB = "b";
528528
}
529529

@@ -534,9 +534,9 @@ public class Math_DivNode : GltfInteractivityNodeSchema
534534
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
535535
public const string IdOut = "value";
536536

537-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
537+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
538538
public const string IdValueA = "a";
539-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
539+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
540540
public const string IdValueB = "b";
541541
}
542542

@@ -570,49 +570,76 @@ public class Math_AndNode : GltfInteractivityNodeSchema
570570
{
571571
public override string Op { get; set; } = "math/and";
572572

573-
[OutputSocketDescription(GltfTypes.Bool)]
573+
[OutputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
574574
public const string IdOut = "value";
575575

576-
[InputSocketDescription(GltfTypes.Bool)]
576+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
577577
public const string IdValueA = "a";
578-
[InputSocketDescription(GltfTypes.Bool)]
578+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
579579
public const string IdValueB = "b";
580580
}
581581

582582
public class Math_OrNode : GltfInteractivityNodeSchema
583583
{
584584
public override string Op { get; set; } = "math/or";
585585

586-
[OutputSocketDescription(GltfTypes.Bool)]
586+
[OutputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
587587
public const string IdOut = "value";
588588

589-
[InputSocketDescription(GltfTypes.Bool)]
589+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
590590
public const string IdValueA = "a";
591-
[InputSocketDescription(GltfTypes.Bool)]
591+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
592592
public const string IdValueB = "b";
593593
}
594594

595595
public class Math_XorNode : GltfInteractivityNodeSchema
596596
{
597597
public override string Op { get; set; } = "math/xor";
598598

599-
[OutputSocketDescription(GltfTypes.Bool)]
599+
[OutputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
600600
public const string IdOut = "value";
601601

602-
[InputSocketDescription(GltfTypes.Bool)]
602+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
603603
public const string IdValueA = "a";
604-
[InputSocketDescription(GltfTypes.Bool)]
604+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
605605
public const string IdValueB = "b";
606606
}
607607

608608
public class Math_NotNode : GltfInteractivityNodeSchema
609609
{
610610
public override string Op { get; set; } = "math/not";
611611

612-
[OutputSocketDescription(GltfTypes.Bool)]
612+
[OutputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
613613
public const string IdOut = "value";
614614

615-
[InputSocketDescription(GltfTypes.Bool)]
615+
[InputSocketDescription(GltfTypes.Bool, GltfTypes.Int)]
616+
public const string IdValueA = "a";
617+
}
618+
619+
public abstract class AbstractSameOneInOneOutNodeWithMatrixTypes : GltfInteractivityNodeSchema
620+
{
621+
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
622+
public const string IdOut = "value";
623+
624+
[InputSocketDescription(GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
625+
public const string IdValueA = "a";
626+
}
627+
628+
public abstract class AbstractSameOneInOneOutNodeWithMatrixAndIntTypes : GltfInteractivityNodeSchema
629+
{
630+
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
631+
public const string IdOut = "value";
632+
633+
[InputSocketDescription(GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
634+
public const string IdValueA = "a";
635+
}
636+
637+
public abstract class AbstractSameOneInOneOutNodeWithInt : GltfInteractivityNodeSchema
638+
{
639+
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
640+
public const string IdOut = "value";
641+
642+
[InputSocketDescription(GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
616643
public const string IdValueA = "a";
617644
}
618645

@@ -675,17 +702,17 @@ public class Math_SqrtNode : AbstractSameOneInOneOutNode
675702
public override string Op { get; set; } = "math/sqrt";
676703
}
677704

678-
public class Math_SignNode : AbstractSameOneInOneOutNode
705+
public class Math_SignNode : AbstractSameOneInOneOutNodeWithInt
679706
{
680707
public override string Op { get; set; } = "math/sign";
681708
}
682709

683-
public class Math_SaturateNode : AbstractSameOneInOneOutNode
710+
public class Math_SaturateNode : AbstractSameOneInOneOutNodeWithMatrixTypes
684711
{
685712
public override string Op { get; set; } = "math/saturate";
686713
}
687714

688-
public class Math_AbsNode : AbstractSameOneInOneOutNode
715+
public class Math_AbsNode : AbstractSameOneInOneOutNodeWithMatrixAndIntTypes
689716
{
690717
public override string Op { get; set; } = "math/abs";
691718
}
@@ -712,17 +739,17 @@ public class Math_IsNaNNode : GltfInteractivityNodeSchema
712739
public const string IdValueA = "a";
713740
}
714741

715-
public class Math_TruncNode : AbstractSameOneInOneOutNode
742+
public class Math_TruncNode : AbstractSameOneInOneOutNodeWithMatrixTypes
716743
{
717744
public override string Op { get; set; } = "math/trunc";
718745
}
719746

720-
public class Math_FractNode : AbstractSameOneInOneOutNode
747+
public class Math_FractNode : AbstractSameOneInOneOutNodeWithMatrixTypes
721748
{
722749
public override string Op { get; set; } = "math/fract";
723750
}
724751

725-
public class Math_NegNode : AbstractSameOneInOneOutNode
752+
public class Math_NegNode : AbstractSameOneInOneOutNodeWithMatrixTypes
726753
{
727754
public override string Op { get; set; } = "math/neg";
728755
}
@@ -824,15 +851,9 @@ public class Math_DegNode : GltfInteractivityNodeSchema
824851
}
825852

826853

827-
public class Math_CeilNode : GltfInteractivityNodeSchema
854+
public class Math_CeilNode : AbstractSameOneInOneOutNodeWithMatrixTypes
828855
{
829856
public override string Op { get; set; } = "math/ceil";
830-
831-
[InputSocketDescription(GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3)]
832-
public const string IdInputA = "a";
833-
834-
[OutputSocketDescriptionWithTypeDependencyFromInput(IdInputA)]
835-
public const string IdValueResult = "value";
836857
}
837858

838859
public class Math_EqNode : GltfInteractivityNodeSchema
@@ -854,15 +875,9 @@ public class Math_EqNode : GltfInteractivityNodeSchema
854875
public const string IdValueB = "b";
855876
}
856877

857-
public class Math_FloorNode : GltfInteractivityNodeSchema
878+
public class Math_FloorNode : AbstractSameOneInOneOutNodeWithMatrixTypes
858879
{
859880
public override string Op { get; set; } = "math/floor";
860-
861-
[InputSocketDescription(GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3)]
862-
public const string IdInputA = "a";
863-
864-
[OutputSocketDescriptionWithTypeDependencyFromInput(IdInputA)]
865-
public const string IdValueResult = "value";
866881
}
867882

868883
public class Math_AddNode : GltfInteractivityNodeSchema
@@ -872,9 +887,9 @@ public class Math_AddNode : GltfInteractivityNodeSchema
872887
[OutputSocketDescriptionWithTypeDependencyFromInput(IdValueA)]
873888
public const string IdOut = "value";
874889

875-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
890+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueB, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
876891
public const string IdValueA = "a";
877-
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
892+
[InputSocketDescriptionWithTypeDependencyFromOtherPort(IdValueA, GltfTypes.Int, GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4, GltfTypes.Float4x4)]
878893
public const string IdValueB = "b";
879894
}
880895

@@ -976,14 +991,9 @@ public class Math_Rotate3dNode : GltfInteractivityNodeSchema
976991
public const string IdOutputResult = "value";
977992
}
978993

979-
public class Math_RoundNode : GltfInteractivityNodeSchema
994+
public class Math_RoundNode : AbstractSameOneInOneOutNodeWithMatrixTypes
980995
{
981996
public override string Op { get; set; } = "math/round";
982-
983-
[InputSocketDescription(GltfTypes.Float, GltfTypes.Float2, GltfTypes.Float3, GltfTypes.Float4)]
984-
public const string IdInputA = "a";
985-
[OutputSocketDescriptionWithTypeDependencyFromInput(IdInputA)]
986-
public const string IdValueResult = "value";
987997
}
988998

989999
public class Math_SelectNode : GltfInteractivityNodeSchema

0 commit comments

Comments
 (0)