Commit b4eb7e01 authored by Sylvain Renault's avatar Sylvain Renault
Browse files

Issue showing objects in Editor UI is solved (creator ID should never be Empty!).

Some improvmenents in the Graph editor (design, messages).
parent 3857ad31
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ namespace ETSI.ARF.WorldStorage.UI
        protected Vector2 scrollPos;
        protected Vector2 scrollPos;
        protected Color ori;
        protected Color ori;
        protected GUIStyle gsTest;
        protected GUIStyle gsTest;
        protected string saveText = "Save";


        public void Update()
        public void Update()
        {
        {
+24 −11
Original line number Original line Diff line number Diff line
@@ -189,6 +189,9 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
            GUILayout.Label("Augmented Reality Framework", leftStyle);
            GUILayout.Label("Augmented Reality Framework", leftStyle);
            GUILayout.Label("Copyright (C) 2024, ETSI (BSD 3-Clause License)", leftStyle);
            GUILayout.Label("Copyright (C) 2024, ETSI (BSD 3-Clause License)", leftStyle);


            //separator line
            Rect rect = EditorGUILayout.GetControlRect(false, 1);
            EditorGUI.DrawRect(rect, Color.gray);


            switch (type)
            switch (type)
            {
            {
@@ -221,7 +224,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                //anchor icon
                //anchor icon
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                Texture anchorImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png", typeof(Texture));
                Texture anchorImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png", typeof(Texture));
                GUI.backgroundColor = Color.clear;
                GUI.backgroundColor = WorldStorageWindow.arfColors[8];
                GUILayout.Box(anchorImage, GUILayout.Width(40), GUILayout.Height(40));
                GUILayout.Box(anchorImage, GUILayout.Width(40), GUILayout.Height(40));


                //anchor label
                //anchor label
@@ -245,7 +248,8 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                    GUI.backgroundColor = Color.clear;
                    GUI.backgroundColor = Color.clear;
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginHorizontal();
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    EditorGUILayout.LabelField("This element is not synchronized with the World Storage");
                    GUILayout.Label("This element is not synchronized with the World Storage!", EditorStyles.whiteBoldLabel);

                    GUILayout.EndHorizontal();
                    GUILayout.EndHorizontal();
                }
                }


@@ -260,7 +264,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                if (!SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString()))
                if (!SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString()))
                {
                {
                    EditorGUILayout.LabelField("none yet (element not yet saved in the server)");
                    EditorGUILayout.LabelField("None yet (element not yet saved in the server)");
                }
                }
                else
                else
                {
                {
@@ -268,6 +272,8 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndHorizontal();


                GUI.backgroundColor = Color.white;

                //name
                //name
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                EditorGUI.BeginChangeCheck();
@@ -433,7 +439,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                //
                //
                //FOOTER
                //FOOTER
                //
                //
                GUILayout.FlexibleSpace();
                //GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.FlexibleSpace();


@@ -494,6 +500,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                GUI.backgroundColor = Color.green;
                GUI.backgroundColor = Color.green;
                if (GUILayout.Button("Save"))
                if (GUILayout.Button("Save"))
                {
                {
                    System.Guid _creator = Guid.NewGuid(); // System.Guid.Parse(WorldStorageWindow.WorldStorageWindowSingleton.worldStorageUser.UUID);
                    if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString()))
                    if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString()))
                    {
                    {
                        if (SaveInfo.instance.elemsToUpdate.Contains(worldAnchor.UUID.ToString()))
                        if (SaveInfo.instance.elemsToUpdate.Contains(worldAnchor.UUID.ToString()))
@@ -510,6 +517,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                        posX.Add(worldAnchorNode.GetPosition().x.ToString());
                        posX.Add(worldAnchorNode.GetPosition().x.ToString());
                        var posY = new Collection<String>();
                        var posY = new Collection<String>();
                        posY.Add(worldAnchorNode.GetPosition().y.ToString());
                        posY.Add(worldAnchorNode.GetPosition().y.ToString());

                        WorldAnchor worldAnchor = worldAnchorNode.worldAnchor;
                        WorldAnchor worldAnchor = worldAnchorNode.worldAnchor;
                        worldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX;
                        worldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX;
                        worldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY;
                        worldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY;
@@ -560,7 +568,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                //trackable icon
                //trackable icon
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                Texture trackImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png", typeof(Texture));
                Texture trackImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png", typeof(Texture));
                GUI.backgroundColor = Color.clear;
                GUI.backgroundColor = WorldStorageWindow.arfColors[7];
                GUILayout.Box(trackImage, GUILayout.Width(40), GUILayout.Height(40));
                GUILayout.Box(trackImage, GUILayout.Width(40), GUILayout.Height(40));


                //trackable label
                //trackable label
@@ -584,7 +592,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                    GUI.backgroundColor = Color.clear;
                    GUI.backgroundColor = Color.clear;
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginHorizontal();
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    EditorGUILayout.LabelField("This element is not synchronized with the World Storage");
                    GUILayout.Label("This element is not synchronized with the World Storage!", EditorStyles.whiteBoldLabel);
                    GUILayout.EndHorizontal();
                    GUILayout.EndHorizontal();
                }
                }


@@ -599,7 +607,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                if (!SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString()))
                if (!SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString()))
                {
                {
                    EditorGUILayout.LabelField("none yet (element not yet saved in the server)");
                    EditorGUILayout.LabelField("None yet (element not yet saved in the server)");
                }
                }
                else
                else
                {
                {
@@ -607,6 +615,8 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndHorizontal();


                GUI.backgroundColor = Color.white;

                //name
                //name
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                EditorGUI.BeginChangeCheck();
@@ -932,6 +942,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                                TrackablePayload = new byte[64],
                                TrackablePayload = new byte[64],
                                LocalCRS = localCRS,
                                LocalCRS = localCRS,
                                Unit = UnitSystem.CM,
                                Unit = UnitSystem.CM,
                                Confidence = 0,
                                TrackableSize = trackableSize,
                                TrackableSize = trackableSize,
                                KeyvalueTags = new KeyvalueTagList()
                                KeyvalueTags = new KeyvalueTagList()
                            };
                            };
@@ -1010,7 +1021,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                //world link icon
                //world link icon
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                Texture linkImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/link.png", typeof(Texture));
                Texture linkImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/link.png", typeof(Texture));
                GUI.backgroundColor = Color.clear;
                GUI.backgroundColor = WorldStorageWindow.arfColors[9];
                GUILayout.Box(linkImage, GUILayout.Width(40), GUILayout.Height(40));
                GUILayout.Box(linkImage, GUILayout.Width(40), GUILayout.Height(40));


                //world link label
                //world link label
@@ -1034,19 +1045,21 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                    GUI.backgroundColor = Color.clear;
                    GUI.backgroundColor = Color.clear;
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginHorizontal();
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    GUILayout.Box(warningImage, GUILayout.Width(27), GUILayout.Height(27));
                    EditorGUILayout.LabelField("This element is not synchronized with the World Storage");
                    GUILayout.Label("This element is not synchronized with the World Storage!", EditorStyles.whiteBoldLabel);
                    GUILayout.EndHorizontal();
                    GUILayout.EndHorizontal();
                }
                }


                //ELEMENT'S ATTRIBUTES
                //ELEMENT'S ATTRIBUTES
                EditorGUI.BeginChangeCheck();
                EditorGUI.BeginChangeCheck();


                GUI.backgroundColor = Color.white;

                //uuid
                //uuid
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                EditorGUILayout.LabelField("UUID ", EditorStyles.boldLabel, GUILayout.Width(50));
                if (!SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString()))
                if (!SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString()))
                {
                {
                    EditorGUILayout.LabelField("none yet (element not yet saved in the server)");
                    EditorGUILayout.LabelField("None yet (element not yet saved in the server)");
                }
                }
                else
                else
                {
                {
+3 −4
Original line number Original line Diff line number Diff line
@@ -67,12 +67,14 @@ namespace ETSI.ARF.WorldStorage.UI
            winSingleton.worldStorageUser = user;
            winSingleton.worldStorageUser = user;
            if (!string.IsNullOrEmpty(UUID))
            if (!string.IsNullOrEmpty(UUID))
            {
            {
                winSingleton.saveText = "Update";
                winSingleton.UUID = UUID;
                winSingleton.UUID = UUID;
                winSingleton.GetParams();
                winSingleton.GetParams();
            }
            }
            else
            else
            {
            {
                // Create new one
                // Create new one
                winSingleton.saveText = "Create";
                winSingleton.AddObject();
                winSingleton.AddObject();
            }
            }
        }
        }
@@ -155,7 +157,7 @@ namespace ETSI.ARF.WorldStorage.UI
            // ---------------------
            // ---------------------
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUI.backgroundColor = WorldStorageWindow.arfColors[2];
            GUI.backgroundColor = WorldStorageWindow.arfColors[2];
            if (GUILayout.Button("Save"))
            if (GUILayout.Button(saveText))
            {
            {
                Debug.Log("PUT Trackable");
                Debug.Log("PUT Trackable");


@@ -170,7 +172,6 @@ namespace ETSI.ARF.WorldStorage.UI
                        if (WorldStorageWindow.WorldStorageWindowSingleton != null)
                        if (WorldStorageWindow.WorldStorageWindowSingleton != null)
                        {
                        {
                            WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                            WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                            WorldStorageWindow.WorldStorageWindowSingleton.repaint = true;
                        }
                        }
                        Close();
                        Close();
                    });
                    });
@@ -194,7 +195,6 @@ namespace ETSI.ARF.WorldStorage.UI
                        if (WorldStorageWindow.WorldStorageWindowSingleton != null)
                        if (WorldStorageWindow.WorldStorageWindowSingleton != null)
                        {
                        {
                            WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                            WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                            WorldStorageWindow.WorldStorageWindowSingleton.repaint = true;
                        }
                        }
                        Close();
                        Close();
                    });
                    });
@@ -316,7 +316,6 @@ namespace ETSI.ARF.WorldStorage.UI
                UUID = response.result;
                UUID = response.result;
                UUID = UUID.Trim('"'); //Bugfix: remove " from server return value
                UUID = UUID.Trim('"'); //Bugfix: remove " from server return value
                WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables();
                WorldStorageWindow.WorldStorageWindowSingleton.repaint = true;
            });
            });
        }
        }


+3 −1
Original line number Original line Diff line number Diff line
@@ -64,12 +64,14 @@ namespace ETSI.ARF.WorldStorage.UI
            winSingleton.worldStorageUser = user;
            winSingleton.worldStorageUser = user;
            if (!string.IsNullOrEmpty(UUID))
            if (!string.IsNullOrEmpty(UUID))
            {
            {
                winSingleton.saveText = "Update";
                winSingleton.UUID = UUID;
                winSingleton.UUID = UUID;
                winSingleton.GetParams();
                winSingleton.GetParams();
            }
            }
            else
            else
            {
            {
                // Create new one
                // Create new one
                winSingleton.saveText = "Create";
                winSingleton.AddObject();
                winSingleton.AddObject();
            }
            }
        }
        }
@@ -152,7 +154,7 @@ namespace ETSI.ARF.WorldStorage.UI
            // ---------------------
            // ---------------------
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUI.backgroundColor = WorldStorageWindow.arfColors[2];
            GUI.backgroundColor = WorldStorageWindow.arfColors[2];
            if (GUILayout.Button("Save"))
            if (GUILayout.Button(saveText))
            {
            {
                Debug.Log("PUT World Anchor");
                Debug.Log("PUT World Anchor");


+7 −1
Original line number Original line Diff line number Diff line
@@ -122,6 +122,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows


            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginChangeCheck();
            worldStorageServer = (WorldStorageServer)EditorGUILayout.ObjectField("World Storage Server", worldStorageServer, typeof(WorldStorageServer), false, GUILayout.Width(500));
            worldStorageServer = (WorldStorageServer)EditorGUILayout.ObjectField("World Storage Server", worldStorageServer, typeof(WorldStorageServer), false, GUILayout.Width(500));
            worldStorageUser = (WorldStorageUser)EditorGUILayout.ObjectField("User", worldStorageUser, typeof(WorldStorageUser), false, GUILayout.Width(500));
            if (EditorGUI.EndChangeCheck())
            if (EditorGUI.EndChangeCheck())
            {
            {
                GraphEditorWindow.ResetWindow();
                GraphEditorWindow.ResetWindow();
@@ -143,6 +144,7 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                        myGraph.style.top = Length.Percent(11);
                        myGraph.style.top = Length.Percent(11);
                        myGraph.style.bottom = Length.Percent(5);
                        myGraph.style.bottom = Length.Percent(5);
                        rootVisualElement.Add(myGraph);
                        rootVisualElement.Add(myGraph);
                        Debug.Log("World Graph window initialized.");
                    }
                    }
                    catch (Exception e)
                    catch (Exception e)
                    {
                    {
@@ -163,7 +165,11 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
            leftStyle.alignment = TextAnchor.MiddleLeft;
            leftStyle.alignment = TextAnchor.MiddleLeft;


            GUILayout.Label("Augmented Reality Framework", leftStyle);
            GUILayout.Label("Augmented Reality Framework", leftStyle);
            GUILayout.Label("Copyright (C) 2022, ETSI (BSD 3-Clause License)", leftStyle);
            GUILayout.Label("Copyright (C) 2024, ETSI (BSD 3-Clause License)", leftStyle);

            //separator line
            Rect rect = EditorGUILayout.GetControlRect(false, 1);
            EditorGUI.DrawRect(rect, Color.gray);


            //reframe all elements to see them all
            //reframe all elements to see them all
            if (SaveInfo.instance.toReFrame && (twoFrames == 2))
            if (SaveInfo.instance.toReFrame && (twoFrames == 2))
Loading