| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Runtime.CompilerServices;
- using BansheeEngine;
- namespace BansheeEditor
- {
- public sealed class Selection
- {
- public static Action<SceneObject[], string[]> OnSelectionChanged;
- public static Action<SceneObject> OnSceneObjectPing;
- public static Action<string> OnResourcePing;
- public static SceneObject sceneObject
- {
- get
- {
- SceneObject[] selection;
- Internal_GetSceneObjectSelection(out selection);
- if(selection.Length > 0)
- return selection[0];
- return null;
- }
- set
- {
- Internal_SetSceneObjectSelection(new SceneObject[] { value });
- }
- }
- public static SceneObject[] sceneObjects
- {
- get
- {
- SceneObject[] selection;
- Internal_GetSceneObjectSelection(out selection);
- return selection;
- }
- set
- {
- Internal_SetSceneObjectSelection(value);
- }
- }
- public static string[] resourceUUIDs
- {
- get
- {
- string[] selection;
- Internal_GetResourceUUIDSelection(out selection);
- return selection;
- }
- set
- {
- Internal_SetResourceUUIDSelection(value);
- }
- }
- public static string[] resourcePaths
- {
- get
- {
- string[] selection;
- Internal_GetResourcePathSelection(out selection);
- return selection;
- }
- set
- {
- Internal_SetResourcePathSelection(value);
- }
- }
- public static void Ping(Resource resource)
- {
- string path = ProjectLibrary.GetPath(resource);
- Internal_PingResource(path);
- }
- public static void Ping(SceneObject so)
- {
- Internal_PingSceneObject(so);
- }
- private static void Internal_TriggerSelectionChanged(SceneObject[] objects, string[] paths)
- {
- if (OnSelectionChanged != null)
- OnSelectionChanged(objects, paths);
- }
- private static void Internal_TriggerSceneObjectPing(SceneObject so)
- {
- if (OnSceneObjectPing != null)
- OnSceneObjectPing(so);
- }
- private static void Internal_TriggerResourcePing(string path)
- {
- if (OnResourcePing != null)
- OnResourcePing(path);
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_GetSceneObjectSelection(out SceneObject[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_SetSceneObjectSelection(SceneObject[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_GetResourceUUIDSelection(out string[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_SetResourceUUIDSelection(string[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_GetResourcePathSelection(out string[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_SetResourcePathSelection(string[] selection);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_PingResource(string resourcePath);
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_PingSceneObject(SceneObject so);
- }
- }
|