Commit 813decd2 authored by Nathan Chambron's avatar Nathan Chambron
Browse files

fix: removed error when saving link with unreferenced connected elements

parent 02bcee6d
Loading
Loading
Loading
Loading
+21 −12
Original line number Diff line number Diff line
@@ -1015,11 +1015,15 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows
                }

                //save button

                //if one of the connected elements is not in the server, you can't save the link
                if (GUILayout.Button("Save"))
                {
                    if ((SaveInfo.instance.nodePositions.ContainsKey(worldLink.UUIDTo.ToString()) && SaveInfo.instance.nodePositions.ContainsKey(worldLink.UUIDFrom.ToString())))
                    { 
                        if (SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString()))
                        {
                        if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element in the server ?", "Yes", "No"))
                            if (SaveInfo.instance.elemsToUpdate.Contains(worldLink.UUID.ToString()))
                            {
                                WorldLinkRequest.UpdateWorldLink(SaveInfo.instance.worldStorageServer, worldLink);
                                SaveInfo.instance.elemsToUpdate.Remove(worldLink.UUID.ToString());
@@ -1036,6 +1040,11 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows
                            SaveInfo.instance.linkIds.Add(uuid);
                        }
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("Error", "You are not able to save this link because at least one of its connected elements is not saved in the World Storage", "Ok");
                    }
                }
                GUILayout.Space(10);
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(10);