diff --git a/API/oursin/atlas/ontology.py b/API/oursin/atlas/ontology.py index 54a5fc18..707f34f7 100644 --- a/API/oursin/atlas/ontology.py +++ b/API/oursin/atlas/ontology.py @@ -3,6 +3,7 @@ from pathlib import Path import json +import vbl_aquarium class CustomAtlas: def __init__(self, atlas_name, atlas_dimensions, atlas_resolution): @@ -113,16 +114,14 @@ def set_visibilities(self, area_list, area_visibility, side = utils.Side.FULL): # output dictionary should match JSON schema AreaData: #{"acronym": ["a", "b", "c"], "side": [-1, 0, 1], "visible": [true, true, false]} - data_dict = {} - data_dict['acronym'] = [] - data_dict['side'] = [] - data_dict['visible'] = [] - for i, area in enumerate(area_list): - data_dict['acronym'].append(area.acronym) - data_dict['visible'].append(area_visibility[i]) - data_dict['side'].append(side.value) - client.sio.emit('SetAreaVisibility', json.dumps(data_dict)) + data = vbl_aquarium.urchin.AreaGroupData( + acronyms = [area.acronym for area in area_list], + visible = area_visibility, + side = [side.value] * len(area_list), + ) + + client.sio.emit('SetAreaVisibility', data.model_dump_json()) def set_colors(self, area_list, area_colors, sided="full"): """Set color of multiple areas at once. diff --git a/UnityClient/Packages/vbl.urchin/Scripts/API/Client_SocketIO.cs b/UnityClient/Packages/vbl.urchin/Scripts/API/Client_SocketIO.cs index 07868d52..acb7a067 100644 --- a/UnityClient/Packages/vbl.urchin/Scripts/API/Client_SocketIO.cs +++ b/UnityClient/Packages/vbl.urchin/Scripts/API/Client_SocketIO.cs @@ -81,7 +81,7 @@ void Start() public static Action AtlasLoad; //public static Action AtlasCreateCustom; //public static Action AtlasSetReferenceCoord; - //public static Action AtlasSetAreaVisibility; + public static Action AtlasSetAreaVisibility; public static Action> AtlasSetAreaColors; public static Action> AtlasSetAreaIntensities; public static Action AtlasSetColormap; @@ -97,7 +97,7 @@ private void Start_Atlas() manager.Socket.On("LoadAtlas", x => AtlasLoad.Invoke(x)); //manager.Socket.On("CustomAtlas", x => AtlasCreateCustom.Invoke(JsonUtility.FromJson(x))); //manager.Socket.On("AtlasSetReferenceCoord", x => AtlasSetReferenceCoord.Invoke(JsonUtility.FromJson(x))); - //manager.Socket.On("SetAreaVisibility", x => AtlasSetAreaVisibility.Invoke(JsonUtility.FromJson(x))); + manager.Socket.On("SetAreaVisibility", x => AtlasSetAreaVisibility.Invoke(JsonUtility.FromJson(x))); manager.Socket.On>("SetAreaColors", x => AtlasSetAreaColors.Invoke(x)); manager.Socket.On>("SetAreaIntensity", x => AtlasSetAreaIntensities.Invoke(x)); manager.Socket.On("SetAreaColormap", x => AtlasSetColormap.Invoke(x)); diff --git a/UnityClient/Packages/vbl.urchin/Scripts/Managers/AtlasManager.cs b/UnityClient/Packages/vbl.urchin/Scripts/Managers/AtlasManager.cs index 84506624..faf2142a 100644 --- a/UnityClient/Packages/vbl.urchin/Scripts/Managers/AtlasManager.cs +++ b/UnityClient/Packages/vbl.urchin/Scripts/Managers/AtlasManager.cs @@ -56,7 +56,7 @@ private void Start() Client_SocketIO.AtlasLoad += LoadAtlas; //Client_SocketIO.AtlasCreateCustom += CustomAtlas; - //Client_SocketIO.AtlasSetAreaVisibility += SetAreaVisibility; + Client_SocketIO.AtlasSetAreaVisibility += SetAreaVisibility; Client_SocketIO.AtlasSetAreaColors += SetAreaColors; Client_SocketIO.AtlasSetAreaIntensities += SetAreaIntensity; Client_SocketIO.AtlasSetColormap += SetAreaColormap; @@ -104,58 +104,58 @@ public async void LoadAtlas(string atlasName) // BrainAtlasManager.CustomAtlas(data.name, dims, res); //} -// public void SetAreaVisibility(AreaData data) -// { -// for (int i = 0; i < data.acronym.Length; i++) -// { -// int areaID = BrainAtlasManager.ActiveReferenceAtlas.Ontology.Acronym2ID(data.acronym[i]); - -// OntologyNode node = BrainAtlasManager.ActiveReferenceAtlas.Ontology.ID2Node(areaID); -// OntologyNode.OntologyNodeSide side = (OntologyNode.OntologyNodeSide)data.side[i]; - -// if (node == null) -// return; - -// bool set = false; - -// bool full = side == OntologyNode.OntologyNodeSide.Full; -// bool leftSide = side == OntologyNode.OntologyNodeSide.Left; -// bool rightSide = side == OntologyNode.OntologyNodeSide.Right; - -// if (full && node.FullLoaded.IsCompleted) -// { -// node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Full); -// VisibleNodes.Add(node); -// set = true; -//#if UNITY_EDITOR -// Debug.Log("Setting full model visibility to true"); -//#endif -// } -// if (leftSide && node.SideLoaded.IsCompleted) -// { -// node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Left); -// VisibleNodes.Add(node); -// set = true; -//#if UNITY_EDITOR -// Debug.Log("Setting left model visibility to true"); -//#endif -// } -// if (rightSide && node.SideLoaded.IsCompleted) -// { -// node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Right); -// VisibleNodes.Add(node); -// set = true; -//#if UNITY_EDITOR -// Debug.Log("Setting right model visibility to true"); -//#endif -// } - -// if (set) -// NodeVisibleEvent.Invoke(node); -// else -// LoadIndividualArea(node, full, leftSide, rightSide, data.visible[i]); -// } -// } + public void SetAreaVisibility(AreaGroupData data) + { + for (int i = 0; i < data.acronyms.Length; i++) + { + int areaID = BrainAtlasManager.ActiveReferenceAtlas.Ontology.Acronym2ID(data.acronyms[i]); + + OntologyNode node = BrainAtlasManager.ActiveReferenceAtlas.Ontology.ID2Node(areaID); + OntologyNode.OntologyNodeSide side = (OntologyNode.OntologyNodeSide)data.side[i]; + + if (node == null) + return; + + bool set = false; + + bool full = side == OntologyNode.OntologyNodeSide.Full; + bool leftSide = side == OntologyNode.OntologyNodeSide.Left; + bool rightSide = side == OntologyNode.OntologyNodeSide.Right; + + if (full && node.FullLoaded.IsCompleted) + { + node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Full); + VisibleNodes.Add(node); + set = true; +#if UNITY_EDITOR + Debug.Log("Setting full model visibility to true"); +#endif + } + if (leftSide && node.SideLoaded.IsCompleted) + { + node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Left); + VisibleNodes.Add(node); + set = true; +#if UNITY_EDITOR + Debug.Log("Setting left model visibility to true"); +#endif + } + if (rightSide && node.SideLoaded.IsCompleted) + { + node.SetVisibility(data.visible[i], OntologyNode.OntologyNodeSide.Right); + VisibleNodes.Add(node); + set = true; +#if UNITY_EDITOR + Debug.Log("Setting right model visibility to true"); +#endif + } + + if (set) + NodeVisibleEvent.Invoke(node); + else + LoadIndividualArea(node, full, leftSide, rightSide, data.visible[i]); + } + } public async void SetAreaColors(Dictionary areaColor) { diff --git a/UnityClient/ProjectSettings/ProjectSettings.asset b/UnityClient/ProjectSettings/ProjectSettings.asset index fd42b231..b295aed3 100644 --- a/UnityClient/ProjectSettings/ProjectSettings.asset +++ b/UnityClient/ProjectSettings/ProjectSettings.asset @@ -76,6 +76,7 @@ PlayerSettings: androidMinimumWindowWidth: 400 androidMinimumWindowHeight: 300 androidFullscreenMode: 1 + androidAutoRotationBehavior: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -136,7 +137,9 @@ PlayerSettings: vulkanEnableLateAcquireNextImage: 0 vulkanEnableCommandBufferRecycling: 1 loadStoreDebugModeEnabled: 0 - bundleVersion: 0.5.3 + visionOSBundleVersion: 1.0 + tvOSBundleVersion: 1.0 + bundleVersion: 0.5.4 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 @@ -437,7 +440,6 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchEnableFileSystemTrace: 0 - switchUseGOLDLinker: 0 switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: