Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GeometryNode.cs 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using UnityEditor.ShaderGraph.Drawing.Controls;
  4. using UnityEngine;
  5. using UnityEditor.Graphing;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using UnityEditor.ShaderGraph.Internal;
  9. namespace UnityEditor.ShaderGraph
  10. {
  11. abstract class GeometryNode : AbstractMaterialNode
  12. {
  13. public GeometryNode()
  14. {
  15. m_PreviewMode = PreviewMode.Preview3D;
  16. }
  17. public virtual List<CoordinateSpace> validSpaces => new List<CoordinateSpace> { CoordinateSpace.Object, CoordinateSpace.View, CoordinateSpace.World, CoordinateSpace.Tangent };
  18. [SerializeField]
  19. private CoordinateSpace m_Space = CoordinateSpace.World;
  20. [PopupControl("Space")]
  21. public PopupList spacePopup
  22. {
  23. get
  24. {
  25. var names = validSpaces.Select(cs => cs.ToString().PascalToLabel()).ToArray();
  26. return new PopupList(names, (int)m_Space);
  27. }
  28. set
  29. {
  30. if (m_Space == (CoordinateSpace)value.selectedEntry)
  31. return;
  32. m_Space = (CoordinateSpace)value.selectedEntry;
  33. Dirty(ModificationScope.Graph);
  34. }
  35. }
  36. public CoordinateSpace space => m_Space;
  37. public override bool hasPreview
  38. {
  39. get { return true; }
  40. }
  41. }
  42. }