Created
March 26, 2024 15:47
-
-
Save li5414/a40f895fde429ac4923647cccf910736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Text.RegularExpressions; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using UnityEngine; | |
| using UnityEditor.Graphing; | |
| using UnityEditor.ShaderGraph.Drawing.Controls; | |
| using UnityEditor.ShaderGraph.Internal; | |
| namespace UnityEditor.ShaderGraph | |
| { | |
| [FormerName("UnityEngine.MaterialGraph.BoneIndexNode")] | |
| [Title("Input", "Geometry", "BoneIndex")] | |
| class BoneIndexNode : AbstractMaterialNode, IMayRequireVertexSkinning | |
| { | |
| public override int latestVersion => 1; | |
| private const int kOutputSlotId = 0; | |
| public const string kOutputSlotName = "Out"; | |
| //public override List<CoordinateSpace> validSpaces => new List<CoordinateSpace> { CoordinateSpace.Object }; | |
| public BoneIndexNode() | |
| { | |
| name = "BoneIndex"; | |
| precision = Precision.Single; | |
| UpdateNodeAfterDeserialization(); | |
| } | |
| public sealed override void UpdateNodeAfterDeserialization() | |
| { | |
| AddSlot(new Vector4MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, Vector4.zero)); | |
| RemoveSlotsNameNotMatching(new[] { kOutputSlotId }); | |
| } | |
| public override string GetVariableNameForSlot(int slotId) | |
| { | |
| return "IN.BoneIndices"; | |
| } | |
| public bool RequiresVertexSkinning(ShaderStageCapability stageCapability = ShaderStageCapability.All) | |
| { | |
| return true; | |
| } | |
| public override void OnAfterMultiDeserialize(string json) | |
| { | |
| base.OnAfterMultiDeserialize(json); | |
| //required update | |
| if(sgVersion < 1) | |
| { | |
| ChangeVersion(1); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment