DragPointOther.cs 2.1 KB

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