GpuEcsAnimationBakerDataDrawer.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #if UNITY_EDITOR
  2. using UnityEditor;
  3. using UnityEngine;
  4. namespace GpuEcsAnimationBaker.Engine.Data
  5. {
  6. [CustomPropertyDrawer(typeof(GpuEcsAnimationBakerData))]
  7. public class GpuEcsAnimationBakerDataDrawer : PropertyDrawer
  8. {
  9. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  10. {
  11. EditorGUI.BeginProperty(position, label, property);
  12. SerializedProperty animationsProperty = property.FindPropertyRelative("animations");
  13. SerializedProperty generateAnimationIdsEnumProperty = property.FindPropertyRelative("generateAnimationIdsEnum");
  14. SerializedProperty animationIdsEnumNameProperty = property.FindPropertyRelative("animationIdsEnumName");
  15. SerializedProperty usePredefinedAnimationEventIdsProperty = property.FindPropertyRelative("usePredefinedAnimationEventIds");
  16. SerializedProperty predefinedAnimationEventIdsProperty = property.FindPropertyRelative("predefinedAnimationEventIds");
  17. SerializedProperty generateAnimationEventIdsEnumProperty = property.FindPropertyRelative("generateAnimationEventIdsEnum");
  18. SerializedProperty animationEventIdsEnumNameProperty = property.FindPropertyRelative("animationEventIdsEnumName");
  19. SerializedProperty attachmentAnchorsProperty = property.FindPropertyRelative("attachmentAnchors");
  20. SerializedProperty generateAttachmentAnchorIdsEnumProperty = property.FindPropertyRelative("generateAttachmentAnchorIdsEnum");
  21. SerializedProperty attachmentAnchorIdsEnumNameProperty = property.FindPropertyRelative("attachmentAnchorIdsEnumName");
  22. SerializedProperty boneUsageProperty = property.FindPropertyRelative("boneUsage");
  23. SerializedProperty transformUsageFlagsParentProperty = property.FindPropertyRelative("transformUsageFlagsParent");
  24. SerializedProperty transformUsageFlagsChildrenProperty = property.FindPropertyRelative("transformUsageFlagsChildren");
  25. EditorGUILayout.PropertyField(animationsProperty);
  26. EditorGUILayout.PropertyField(generateAnimationIdsEnumProperty);
  27. if(generateAnimationIdsEnumProperty.boolValue)
  28. EditorGUILayout.PropertyField(animationIdsEnumNameProperty);
  29. EditorGUILayout.PropertyField(usePredefinedAnimationEventIdsProperty);
  30. if(usePredefinedAnimationEventIdsProperty.boolValue)
  31. EditorGUILayout.PropertyField(predefinedAnimationEventIdsProperty);
  32. EditorGUILayout.PropertyField(generateAnimationEventIdsEnumProperty);
  33. if(generateAnimationEventIdsEnumProperty.boolValue)
  34. EditorGUILayout.PropertyField(animationEventIdsEnumNameProperty);
  35. EditorGUILayout.PropertyField(attachmentAnchorsProperty);
  36. EditorGUILayout.PropertyField(generateAttachmentAnchorIdsEnumProperty);
  37. if(generateAttachmentAnchorIdsEnumProperty.boolValue)
  38. EditorGUILayout.PropertyField(attachmentAnchorIdsEnumNameProperty);
  39. EditorGUILayout.PropertyField(boneUsageProperty);
  40. EditorGUILayout.PropertyField(transformUsageFlagsParentProperty);
  41. EditorGUILayout.PropertyField(transformUsageFlagsChildrenProperty);
  42. }
  43. }
  44. }
  45. #endif