Selection.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. public sealed class Selection
  7. {
  8. public static Action<SceneObject[], string[]> OnSelectionChanged;
  9. public static SceneObject[] sceneObjects
  10. {
  11. get
  12. {
  13. SceneObject[] selection;
  14. Internal_GetSceneObjectSelection(out selection);
  15. return selection;
  16. }
  17. set
  18. {
  19. Internal_SetSceneObjectSelection(value);
  20. }
  21. }
  22. public static string[] resourceUUIDs
  23. {
  24. get
  25. {
  26. string[] selection;
  27. Internal_GetResourceUUIDSelection(out selection);
  28. return selection;
  29. }
  30. set
  31. {
  32. Internal_SetResourceUUIDSelection(value);
  33. }
  34. }
  35. public static string[] resourcePaths
  36. {
  37. get
  38. {
  39. string[] selection;
  40. Internal_GetResourcePathSelection(out selection);
  41. return selection;
  42. }
  43. set
  44. {
  45. Internal_SetResourcePathSelection(value);
  46. }
  47. }
  48. private static void Internal_TriggerSelectionChanged(SceneObject[] objects, string[] paths)
  49. {
  50. if (OnSelectionChanged != null)
  51. OnSelectionChanged(objects, paths);
  52. }
  53. [MethodImpl(MethodImplOptions.InternalCall)]
  54. internal static extern void Internal_GetSceneObjectSelection(out SceneObject[] selection);
  55. [MethodImpl(MethodImplOptions.InternalCall)]
  56. internal static extern void Internal_SetSceneObjectSelection(SceneObject[] selection);
  57. [MethodImpl(MethodImplOptions.InternalCall)]
  58. internal static extern void Internal_GetResourceUUIDSelection(out string[] selection);
  59. [MethodImpl(MethodImplOptions.InternalCall)]
  60. internal static extern void Internal_SetResourceUUIDSelection(string[] selection);
  61. [MethodImpl(MethodImplOptions.InternalCall)]
  62. internal static extern void Internal_GetResourcePathSelection(out string[] selection);
  63. [MethodImpl(MethodImplOptions.InternalCall)]
  64. internal static extern void Internal_SetResourcePathSelection(string[] selection);
  65. }
  66. }