VoxelSkinnedAnimationObjectBone.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using UnityEngine;
  2. using UnityEngine.Assertions;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. namespace VoxelImporter
  7. {
  8. public class VoxelSkinnedAnimationObjectBone : MonoBehaviour
  9. {
  10. #if !UNITY_EDITOR
  11. void Awake()
  12. {
  13. Destroy(this);
  14. }
  15. #else
  16. public bool EditorInitialize()
  17. {
  18. return false;
  19. }
  20. private VoxelSkinnedAnimationObject _voxelObject;
  21. public VoxelSkinnedAnimationObject voxelObject
  22. {
  23. get
  24. {
  25. if (_voxelObject == null)
  26. {
  27. var trans = transform.parent;
  28. while (trans != null)
  29. {
  30. var ctl = trans.GetComponent<VoxelSkinnedAnimationObject>();
  31. if (ctl != null)
  32. {
  33. _voxelObject = ctl;
  34. break;
  35. }
  36. trans = trans.parent;
  37. }
  38. }
  39. return _voxelObject;
  40. }
  41. }
  42. public VoxelSkinnedAnimationObjectBone mirrorBone;
  43. public int boneIndex = -1;
  44. public bool bonePositionSave;
  45. public Vector3 bonePosition;
  46. public Quaternion boneRotation;
  47. public WeightData weightData;
  48. #region Editor
  49. public Mesh[] edit_weightMesh = null;
  50. public Texture2D edit_weightColorTexture;
  51. public bool edit_disablePositionAnimation = true;
  52. public bool edit_disableRotationAnimation = false;
  53. public bool edit_disableScaleAnimation = true;
  54. public bool edit_mirrorSetBoneAnimation = true;
  55. public bool edit_mirrorSetBonePosition = true;
  56. public bool edit_mirrorSetBoneWeight = true;
  57. public bool edit_objectFoldout = true;
  58. #endregion
  59. #endif
  60. }
  61. }