Beispiel #1
0
        protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args)
        {
            DragAndDropVisualMode visualMode = DragAndDropVisualMode.None;

            var draggedIDs = DragAndDrop.GetGenericData("BuildPlayerSceneTreeViewItem") as List <int>;

            if (draggedIDs != null && draggedIDs.Count > 0)
            {
                visualMode = DragAndDropVisualMode.Move;
                if (args.performDrop)
                {
                    int newIndex = FindDropAtIndex(args);

                    var result   = new List <TreeViewItem>();
                    int toInsert = 0;
                    foreach (var item in rootItem.children)
                    {
                        if (toInsert == newIndex)
                        {
                            foreach (var id in draggedIDs)
                            {
                                result.Add(FindItem(id, rootItem));
                            }
                        }
                        toInsert++;
                        if (!draggedIDs.Contains(item.id))
                        {
                            result.Add(item);
                        }
                    }

                    if (result.Count < rootItem.children.Count) //must be appending.
                    {
                        foreach (var id in draggedIDs)
                        {
                            result.Add(FindItem(id, rootItem));
                        }
                    }
                    rootItem.children          = result;
                    EditorBuildSettings.scenes = GetSceneList();
                    ReloadAndSelect(draggedIDs);
                    Repaint();
                }
            }
            else if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
            {
                visualMode = DragAndDropVisualMode.Copy;
                if (args.performDrop)
                {
                    var scenes      = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);
                    var scenesToAdd = new List <EditorBuildSettingsScene>();
                    var selection   = new List <int>();

                    foreach (var path in DragAndDrop.paths)
                    {
                        if (AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(SceneAsset))
                        {
                            var guid = new GUID(AssetDatabase.AssetPathToGUID(path));
                            selection.Add(guid.GetHashCode());

                            bool unique = true;
                            foreach (var scene in scenes)
                            {
                                if (scene.path == path)
                                {
                                    unique = false;
                                    break;
                                }
                            }
                            if (unique)
                            {
                                scenesToAdd.Add(new EditorBuildSettingsScene(path, true));
                            }
                        }
                    }


                    int newIndex = FindDropAtIndex(args);
                    scenes.InsertRange(newIndex, scenesToAdd);
                    EditorBuildSettings.scenes = scenes.ToArray();
                    ReloadAndSelect(selection);
                    Repaint();
                }
            }
            return(visualMode);
        }
 public static GameObjectConversionSettings FromGUID(UnityEditor.GUID guid, BlobAssetStore blobAssetStore) => new GameObjectConversionSettings
 {
     SceneGUID = guid, BlobAssetStore = blobAssetStore
 };
Beispiel #3
0
 private extern void HexToGUIDInternal(string hex, ref GUID guid);
Beispiel #4
0
 public EditorBuildSettingsScene(string path, bool enabled)
 {
     this.m_path    = path.Replace("\\", "/");
     this.m_enabled = enabled;
     GUID.TryParse(AssetDatabase.AssetPathToGUID(path), out this.m_guid);
 }
 public void SetTransitionTypeOverride(GUID guid, ParameterTransitionType type)
 {
     INTERNAL_CALL_SetTransitionTypeOverride(this, guid, type);
 }
			public ParameterTransitionOverrideContext(AudioMixerController controller, GUID parameter, ParameterTransitionType type)
			{
				this.controller = controller;
				this.parameter = parameter;
				this.type = type;
			}
 public static extern Texture GetPreviewTexture(GUID id);
 private static extern void INTERNAL_CALL_ClearTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid);
 public static extern void PausePreview(GUID id);
 public static extern bool IsPreviewPlaying(GUID id);
 public static extern void PlayPreview(GUID id, bool loop);
 public static extern void StopPreview(GUID id);
 public AudioEffectParameterPath(AudioMixerGroupController group, AudioMixerEffectController effect, GUID parameter) : base(group, parameter)
 {
     this.effect = effect;
 }
 public extern bool ContainsParameterGUID(GUID guid);
Beispiel #15
0
 private extern unsafe static bool TrySendMessageInternal(int playerId, GUID messageId, byte *data, int dataSize);
 public bool GetTransitionTypeOverride(GUID guid, out ParameterTransitionType type)
 {
     return INTERNAL_CALL_GetTransitionTypeOverride(this, guid, out type);
 }
Beispiel #17
0
 private extern unsafe static void SendMessageInternal(int playerId, GUID messageId, byte *data, int dataSize, GeneralConnectionSendMode sendMode);
 private static extern void INTERNAL_CALL_SetTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid, ParameterTransitionType type);
 public extern static Type GetImporterType(GUID guid);
Beispiel #20
0
 private extern void HexToGUIDInternal(string hex, ref GUID guid);
 extern public static void SaveAssetIfDirty(GUID guid);
 public AudioGroupParameterPath(AudioMixerGroupController group, GUID parameter)
 {
     this.group = group;
     base.parameter = parameter;
 }
 extern private static string[] GetLabelsInternal(GUID guid);
Beispiel #24
0
 private void PlayPreview()
 {
     m_PreviewID = VideoUtil.StartPreview(m_PlayingClip);
     VideoUtil.PlayPreview(m_PreviewID, true);
 }
 public static string[] GetLabels(GUID guid)
 {
     return(GetLabelsInternal(guid));
 }
Beispiel #26
0
 public EditorBuildSettingsScene(GUID guid, bool enabled)
 {
     this.m_guid    = guid;
     this.m_enabled = enabled;
     this.m_path    = AssetDatabase.GUIDToAssetPath(guid.ToString());
 }
 extern internal static System.Type GetTypeFromVisibleGUIDAndLocalFileIdentifier(GUID guid, long localId);
 extern internal static Object LoadMainAssetAtGUID(GUID assetGUID);
 private extern static ArtifactInfo[] GetArtifactInfos_Internal(GUID guid);
Beispiel #30
0
 public void RefreshGuid()
 {
     systemGuid = System.Guid.NewGuid();
     unityGuid  = UnityEditor.GUID.Generate();
 }
        internal static ArtifactInfo[] GetArtifactInfos(GUID guid)
        {
            var artifactInfos = GetArtifactInfos_Internal(guid);

            return(artifactInfos);
        }
 public void ClearTransitionTypeOverride(GUID guid)
 {
     INTERNAL_CALL_ClearTransitionTypeOverride(this, guid);
 }
Beispiel #33
0
 internal SpriteRect GetSpriteData(GUID guid)
 {
     return(spriteImportMode == SpriteImportMode.Multiple ? m_SpritesMultiple.FirstOrDefault(x => x.spriteID == guid) : m_SpriteSingle);
 }
 public bool GetValue(GUID guid, out float value)
 {
     return INTERNAL_CALL_GetValue(this, guid, out value);
 }
 extern internal static string GUIDToAssetPath_Internal(GUID guid);
 private static extern bool INTERNAL_CALL_GetValue(AudioMixerSnapshotController self, GUID guid, out float value);
 public static string GUIDToAssetPath(GUID guid)
 {
     return(GUIDToAssetPath_Internal(guid));
 }
 private static extern void INTERNAL_CALL_SetValue(AudioMixerSnapshotController self, GUID guid, float value);
 extern public static Hash128 GetAssetDependencyHash(GUID guid);
 public void SetValue(GUID guid, float value)
 {
     INTERNAL_CALL_SetValue(this, guid, value);
 }
 extern private static bool GetGUIDAndLocalIdentifierInFile(int instanceID, out GUID outGuid, out long outLocalId);
Beispiel #42
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                ScenePathAttribute pathAttribute = attribute as ScenePathAttribute;
                Rect propertyRect = position;
                propertyRect.height = EditorGUIUtility.singleLineHeight;

                string[] searchFolders;
                if (pathAttribute.Folders == null ||
                    pathAttribute.Folders.Length == 0)
                {
                    searchFolders = new string[] { Internal.ScenePathSettings.GetDefaultScenePathFolder() };
                }
                else
                {
                    searchFolders = pathAttribute.Folders;
                }

                string[] sceneGUIDs = AssetDatabase.FindAssets($"{pathAttribute.Filter} t:Scene", searchFolders);
                if (sceneGUIDs != null &&
                    sceneGUIDs.Length > 0)
                {
                    string[] scenePaths = sceneGUIDs.Select(ConvertGUIDToFilename).ToArray();

                    int selectedIndex = Mathf.Max(Array.IndexOf(scenePaths, property.stringValue), 0);

                    EditorGUI.BeginChangeCheck();
                    selectedIndex = EditorGUI.Popup(propertyRect,
                                                    label,
                                                    selectedIndex,
                                                    scenePaths.Select(x => new GUIContent(x)).ToArray());
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (selectedIndex >= 0 &&
                            selectedIndex < scenePaths.Length)
                        {
                            property.stringValue = Path.GetFileNameWithoutExtension(scenePaths[selectedIndex]);
                        }
                    }

                    if (IsSceneValid(property.stringValue) == false)
                    {
                        propertyRect.y     += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                        propertyRect.height = EditorGUIUtility.singleLineHeight * c_warningHeightScale;

                        DrawWarningBox(rect: propertyRect,
                                       warningText: "Scene is not included in editor build settings\n",

                                       leftButtonText: "Build Settings",
                                       leftButtonCallback: () =>
                        {
                            EditorApplication.ExecuteMenuItem("File/Build Settings...");
                        },

                                       rightButtonText: "Add it",
                                       rightButtonCallback: () =>
                        {
                            if (selectedIndex >= 0 &&
                                selectedIndex < sceneGUIDs.Length)
                            {
                                EditorBuildSettingsScene scene = new EditorBuildSettingsScene(new UnityEditor.GUID(sceneGUIDs[selectedIndex]), true);

                                var scenesList = new EditorBuildSettingsScene[EditorBuildSettings.scenes.Length + 1];
                                Array.Copy(EditorBuildSettings.scenes, scenesList, scenesList.Length - 1);
                                scenesList[scenesList.Length - 1] = scene;

                                EditorBuildSettings.scenes = scenesList;

                                // force gui repaint
                                EditorUtility.SetDirty(property.serializedObject.targetObject);
                            }
                        });
                    }
                    else if (IsSceneEnabled(property.stringValue) == false)
                    {
                        propertyRect.y     += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                        propertyRect.height = EditorGUIUtility.singleLineHeight * c_warningHeightScale;

                        DrawWarningBox(rect: propertyRect,
                                       warningText: "Scene is not enabled in editor build settings\n",

                                       leftButtonText: "Build Settings",
                                       leftButtonCallback: () =>
                        {
                            EditorApplication.ExecuteMenuItem("File/Build Settings...");
                        },

                                       rightButtonText: "Enable it",
                                       rightButtonCallback: () =>
                        {
                            if (selectedIndex >= 0 &&
                                selectedIndex < sceneGUIDs.Length)
                            {
                                UnityEditor.GUID sceneGUID = new UnityEditor.GUID(sceneGUIDs[selectedIndex]);
                                var scenesList             = new EditorBuildSettingsScene[EditorBuildSettings.scenes.Length];
                                Array.Copy(EditorBuildSettings.scenes, scenesList, scenesList.Length);

                                foreach (var scene in scenesList)
                                {
                                    if (scene.guid == sceneGUID)
                                    {
                                        scene.enabled = true;
                                        break;
                                    }
                                }

                                EditorBuildSettings.scenes = scenesList;

                                // force gui repaint
                                EditorUtility.SetDirty(property.serializedObject.targetObject);
                            }
                        });
                    }
                }
            }
            else
            {
                EditorGUI.PropertyField(position, property, label);
            }
        }
Beispiel #43
0
        public override bool Equals(object obj)
        {
            GUID guid = (GUID)obj;

            return(guid == this);
        }
			public ParameterTransitionOverrideRemoveContext(AudioMixerController controller, GUID parameter)
			{
				this.controller = controller;
				this.parameter = parameter;
			}
Beispiel #45
0
 public ParameterTransitionOverrideRemoveContext(AudioMixerController controller, GUID parameter)
 {
     this.controller = controller;
     this.parameter  = parameter;
 }