예제 #1
0
파일: Prefab.cs 프로젝트: Ruu/BansheeEngine
 private static extern void Internal_CreateInstance(Prefab instance, IntPtr so);
예제 #2
0
 private static extern void Internal_CreateInstance(Prefab instance, IntPtr so, bool isScene);
예제 #3
0
        /// <summary>
        /// Triggered when a scene object drop operation finishes over the content area.
        /// </summary>
        /// <param name="windowPos">Coordinates of the pointer relative to the window where the drop operation finished
        ///                         .</param>
        /// <param name="objects">Dropped scene objects.</param>
        private void OnSceneObjectDragDropped(Vector2I windowPos, SceneObject[] objects)
        {
            ClearHoverHighlight();
            autoScrollAmount = 0;

            if (EndDragSelection())
                return;

            string destinationFolder = CurrentFolder;

            LibraryGUIEntry underCursorElement = FindElementAt(windowPos);
            if (underCursorElement != null)
            {
                LibraryEntry entry = ProjectLibrary.GetEntry(underCursorElement.path);
                if (entry != null && entry.Type == LibraryEntryType.Directory)
                    destinationFolder = entry.Path;
            }

            if (objects != null)
            {
                List<string> addedResources = new List<string>();
                foreach (var so in objects)
                {
                    if (so == null)
                        continue;

                    Prefab newPrefab = new Prefab(so);

                    string destination = LibraryUtility.GetUniquePath(Path.Combine(destinationFolder, so.Name + ".prefab"));
                    addedResources.Add(destination);

                    ProjectLibrary.Create(newPrefab, destination);
                    ProjectLibrary.Refresh();
                }

                SetSelection(addedResources);
            }
        }
예제 #4
0
 /// <summary>
 /// Sets the currently active scene to the provided scene.
 /// </summary>
 /// <param name="scene">Scene which to set as active.</param>
 internal static void SetActive(Prefab scene)
 {
     if (scene != null)
     {
         activeSceneUUID = scene.UUID;
         activeSceneName = scene.Name;
         isGenericPrefab = !scene.IsScene;
     }
 }
예제 #5
0
        /// <summary>
        /// Instantiates scene object(s) from a prefab.
        /// </summary>
        /// <param name="prefab">Prefab to instantiate.</param>
        /// <param name="description">Optional description of what exactly the command does.</param>
        /// <returns>Instantiated scene object.</returns>
        public static SceneObject Instantiate(Prefab prefab, string description = "")
        {
            if (prefab != null)
                return Internal_Instantiate(prefab.GetCachedPtr(), description);

            return null;
        }