DragPointOther.cs 2.5 KB

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