DragPointOther.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 = false;
  9. private bool isIK = false;
  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. DragType current = CurrentDragType;
  25. bool enabled = !IsIK && (Transforming || (current == DragType.Select));
  26. bool select = IsIK && current == DragType.Select;
  27. ApplyProperties(enabled || select, IsCube && enabled, false);
  28. }
  29. }
  30. internal class DragPointBG : DragPointGeneral
  31. {
  32. protected override void ApplyDragType()
  33. {
  34. ApplyProperties(Transforming, Transforming, Rotating);
  35. }
  36. }
  37. internal class DragPointDogu : DragPointGeneral
  38. {
  39. private List<Renderer> meshRenderers;
  40. public AttachPointInfo attachPointInfo = AttachPointInfo.Empty;
  41. public string Name => MyGameObject.name;
  42. public string assetName = string.Empty;
  43. public bool ShadowCasting
  44. {
  45. get
  46. {
  47. if (meshRenderers.Count == 0) return false;
  48. return meshRenderers[0].shadowCastingMode == ShadowCastingMode.On;
  49. }
  50. set
  51. {
  52. foreach (Renderer renderer in meshRenderers)
  53. {
  54. renderer.shadowCastingMode = value ? ShadowCastingMode.On : ShadowCastingMode.Off;
  55. }
  56. }
  57. }
  58. public override void Set(Transform myObject)
  59. {
  60. base.Set(myObject);
  61. meshRenderers = new List<Renderer>(MyObject.GetComponentsInChildren<SkinnedMeshRenderer>());
  62. meshRenderers.AddRange(MyObject.GetComponentsInChildren<MeshRenderer>());
  63. }
  64. protected override void ApplyDragType()
  65. {
  66. DragType current = CurrentDragType;
  67. bool active = (DragPointEnabled && Transforming) || Special;
  68. ApplyProperties(active, active, GizmoEnabled && Rotating);
  69. }
  70. protected override void OnDestroy()
  71. {
  72. GameObject.Destroy(MyGameObject);
  73. base.OnDestroy();
  74. }
  75. }
  76. internal class DragPointGravity : DragPointGeneral
  77. {
  78. protected override void ApplyDragType() => ApplyProperties(Moving, Moving, false);
  79. }
  80. }