DragPointOther.cs 2.6 KB

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