DragPointOther.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using UnityEngine.Rendering;
  4. namespace COM3D2.MeidoPhotoStudio.Plugin
  5. {
  6. internal class DragPointBody : DragPointGeneral
  7. {
  8. public bool IsCube;
  9. private bool isIK;
  10. public bool IsIK
  11. {
  12. get => isIK;
  13. set
  14. {
  15. if (isIK != value)
  16. {
  17. isIK = value;
  18. ApplyDragType();
  19. }
  20. }
  21. }
  22. protected override void ApplyDragType()
  23. {
  24. bool enabled = !IsIK && (Transforming || Selecting);
  25. bool select = IsIK && Selecting;
  26. ApplyProperties(enabled || select, IsCube && enabled, false);
  27. if (IsCube) ApplyColours();
  28. }
  29. }
  30. internal class DragPointBG : DragPointGeneral
  31. {
  32. protected override void ApplyDragType()
  33. {
  34. ApplyProperties(Transforming, Transforming, Rotating);
  35. ApplyColours();
  36. }
  37. }
  38. internal class DragPointDogu : DragPointGeneral
  39. {
  40. private List<Renderer> meshRenderers;
  41. public AttachPointInfo attachPointInfo = AttachPointInfo.Empty;
  42. public string Name => MyGameObject.name;
  43. public string assetName = string.Empty;
  44. public bool ShadowCasting
  45. {
  46. get
  47. {
  48. if (meshRenderers.Count == 0) return false;
  49. return meshRenderers[0].shadowCastingMode == ShadowCastingMode.On;
  50. }
  51. set
  52. {
  53. foreach (Renderer renderer in meshRenderers)
  54. {
  55. renderer.shadowCastingMode = value ? ShadowCastingMode.On : ShadowCastingMode.Off;
  56. }
  57. }
  58. }
  59. public override void Set(Transform myObject)
  60. {
  61. base.Set(myObject);
  62. meshRenderers = new List<Renderer>(MyObject.GetComponentsInChildren<SkinnedMeshRenderer>());
  63. meshRenderers.AddRange(MyObject.GetComponentsInChildren<MeshRenderer>());
  64. }
  65. protected override void ApplyDragType()
  66. {
  67. bool active = (DragPointEnabled && Transforming) || Special;
  68. ApplyProperties(active, active, GizmoEnabled && Rotating);
  69. ApplyColours();
  70. }
  71. protected override void OnDestroy()
  72. {
  73. GameObject.Destroy(MyGameObject);
  74. base.OnDestroy();
  75. }
  76. }
  77. internal class DragPointGravity : DragPointGeneral
  78. {
  79. protected override void ApplyDragType()
  80. {
  81. ApplyProperties(Moving, Moving, false);
  82. ApplyColours();
  83. }
  84. }
  85. }