MegaShapeHelixEditor.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. 
  2. using UnityEditor;
  3. using UnityEngine;
  4. [CanEditMultipleObjects, CustomEditor(typeof(MegaShapeHelix))]
  5. public class MegaShapeHelixEditor : MegaShapeEditor
  6. {
  7. public float radius1 = 1.0f;
  8. public float radius2 = 1.0f;
  9. public float height = 0.0f;
  10. public float turns = 0.0f;
  11. public float bias = 0.0f;
  12. public bool clockwise = true;
  13. public override bool Params()
  14. {
  15. MegaShapeHelix shape = (MegaShapeHelix)target;
  16. bool rebuild = false;
  17. float v = EditorGUILayout.FloatField("Radius 1", shape.radius1);
  18. if ( v != shape.radius1 )
  19. {
  20. shape.radius1 = v;
  21. rebuild = true;
  22. }
  23. v = EditorGUILayout.FloatField("Radius 2", shape.radius2);
  24. if ( v != shape.radius2 )
  25. {
  26. shape.radius2 = v;
  27. rebuild = true;
  28. }
  29. v = EditorGUILayout.FloatField("Height", shape.height);
  30. if ( v != shape.height )
  31. {
  32. shape.height = v;
  33. rebuild = true;
  34. }
  35. v = EditorGUILayout.FloatField("Turns", shape.turns);
  36. if ( v != shape.turns )
  37. {
  38. shape.turns = v;
  39. rebuild = true;
  40. }
  41. //v = EditorGUILayout.FloatField("Bias", shape.bias);
  42. //if ( v != shape.bias )
  43. //{
  44. // shape.bias = v;
  45. // rebuild = true;
  46. //}
  47. //v = EditorGUILayout.FloatField("Adjust", shape.adjust);
  48. //if ( v != shape.adjust )
  49. //{
  50. // shape.adjust = v;
  51. // rebuild = true;
  52. //}
  53. int iv = EditorGUILayout.IntField("Points Per Turn", shape.PointsPerTurn);
  54. if ( iv != shape.PointsPerTurn )
  55. {
  56. shape.PointsPerTurn = iv;
  57. rebuild = true;
  58. }
  59. bool bv = EditorGUILayout.Toggle("Clockwise", shape.clockwise);
  60. if ( bv != shape.clockwise )
  61. {
  62. shape.clockwise = bv;
  63. rebuild = true;
  64. }
  65. return rebuild;
  66. }
  67. }