public void OnFocusToggleClick(BaseItem item) { var value = item.RangeFieldItem.Toggle.GetState(); item.RangeFieldItem.Toggle.SetState(value); item.RangeFieldItem.LockToggle.gameObject.SetActive(value); if (item.IsLeafNode()) { var cutObject = CutObjectManager.Get.GetSelectedCutObject(); CutObjectManager.Get.GetSelectedCutObject().IngredientCutParameters[CPUBuffers.Get.NodeToIngredientLookup[item.Id]].IsFocus = value; } foreach (var child in item.GetAllChildren()) { if (child.IsLeafNode()) { var cutObject = CutObjectManager.Get.GetSelectedCutObject(); CutObjectManager.Get.GetSelectedCutObject().IngredientCutParameters[CPUBuffers.Get.NodeToIngredientLookup[child.Id]].IsFocus = value; } child.RangeFieldItem.Toggle.SetState(value); child.RangeFieldItem.LockToggle.gameObject.SetActive(value); } SetAllLockState(false); UpdateHideShowOcclusionUIFields(); UpdateVisibilityToogleStates(); }
public void OnThreeStateToggleClick(BaseItem baseItem) { var value = baseItem.RangeFieldItem.ThreeStateToggle.GetState(); var value1 = (value == ThreeStateToggleState.Zero) ? 0.5f : (value == ThreeStateToggleState.Plus) ? 1.0f : 0.0f; if (baseItem.IsLeafNode()) { var cutObject = CutObjectManager.Get.GetSelectedCutObject(); CutObjectManager.Get.GetSelectedCutObject().IngredientCutParameters[CPUBuffers.Get.NodeToIngredientLookup[baseItem.Id]].value1 = value1; } foreach (var child in baseItem.GetAllChildren()) { if (child.IsLeafNode()) { var cutObject = CutObjectManager.Get.GetSelectedCutObject(); CutObjectManager.Get.GetSelectedCutObject().IngredientCutParameters[CPUBuffers.Get.NodeToIngredientLookup[child.Id]].value1 = value1; } child.RangeFieldItem.ThreeStateToggle.SetState(value1); } }
public void OnThreeStateToggleClick(BaseItem baseItem) { var value = baseItem.RangeFieldItem.ThreeStateToggle.GetState(); var value1 = value == ThreeStateToggleState.Zero ? 0.5f : value == ThreeStateToggleState.Plus ? 1.0f : 0.0f; if (baseItem.IsLeafNode()) { var cutObject = SceneManager.Get.GetSelectedCutObject(); SceneManager.Get.GetSelectedCutObject().IngredientCutParameters[SceneManager.Get.NodeToIngredientLookup[baseItem.Id]].value1 = value1; } foreach (var child in baseItem.GetAllChildren()) { if (child.IsLeafNode()) { var cutObject = SceneManager.Get.GetSelectedCutObject(); SceneManager.Get.GetSelectedCutObject().IngredientCutParameters[SceneManager.Get.NodeToIngredientLookup[child.Id]].value1 = value1; } child.RangeFieldItem.ThreeStateToggle.SetState(value1); } }
public void OnFocusToggleClick(BaseItem item) { var value = item.RangeFieldItem.Toggle.GetState(); item.RangeFieldItem.Toggle.SetState(value); item.RangeFieldItem.LockToggle.gameObject.SetActive(value); if (item.IsLeafNode()) { var cutObject = SceneManager.Get.GetSelectedCutObject(); SceneManager.Get.GetSelectedCutObject().IngredientCutParameters[SceneManager.Get.NodeToIngredientLookup[item.Id]].IsFocus = value; } foreach (var child in item.GetAllChildren()) { if (child.IsLeafNode()) { var cutObject = SceneManager.Get.GetSelectedCutObject(); SceneManager.Get.GetSelectedCutObject().IngredientCutParameters[SceneManager.Get.NodeToIngredientLookup[child.Id]].IsFocus = value; } child.RangeFieldItem.Toggle.SetState(value); child.RangeFieldItem.LockToggle.gameObject.SetActive(value); } SetAllLockState(false); UpdateHideShowOcclusionUIFields(); UpdateVisibilityToogleStates(); }
public void HighlightInstances(string path, int index) { NewSelectionManager.Instance.HierarchySelectedItemPath = path; //NewSelectionManager.Instance.SelectedProteinInstanceId = -1; //NewSelectionManager.Instance.SelectedLipidInstanceId = -1; if (index == baseItem.ViewController._rnaInstanceNodeId) { NewSelectionManager.Instance.RnaSelected = true; } else { NewSelectionManager.Instance.RnaSelected = false; } if (path == "root") { NewSelectionManager.Instance.RnaSelected = true; } int clickedItemType = CPUBuffers.Get.NodeToIngredientLookup[index]; // here I save indices of intances that I highlight so that I can unhighlight them more efficiently NewSelectionManager.Instance.SelectedGroupInstanceIndices = new List <int>(); NewSelectionManager.Instance.SelectedGroupLipidInstanceIndices = new List <int>(); if (baseItem.IsLeafNode()) // Selected item is Protein or Lipid Type { for (var i = 0; i < CPUBuffers.Get.ProteinInstanceInfos.Count; i++) { var info = CPUBuffers.Get.ProteinInstanceInfos[i]; var type = (int)info.x; if (type == clickedItemType) { CPUBuffers.Get.ProteinInstanceInfos[i] = new Vector4(type, (int)InstanceState.Highlighted, info.z, info.w); NewSelectionManager.Instance.SelectedGroupInstanceIndices.Add(i); } else { CPUBuffers.Get.ProteinInstanceInfos[i] = new Vector4(type, (int)InstanceState.Normal, info.z, info.w); } } GPUBuffers.Get.ProteinInstancesInfo.SetData(CPUBuffers.Get.ProteinInstanceInfos.ToArray()); for (var i = 0; i < CPUBuffers.Get.LipidInstanceInfos.Count; i++) { var info = CPUBuffers.Get.LipidInstanceInfos[i]; var type = (int)info.x; if (type == clickedItemType) { CPUBuffers.Get.LipidInstanceInfos2[i] = new Vector4((int)InstanceState.Highlighted, info.y, info.z, info.w); NewSelectionManager.Instance.SelectedGroupLipidInstanceIndices.Add(i); } else { CPUBuffers.Get.LipidInstanceInfos2[i] = new Vector4((int)InstanceState.Normal, info.y, info.z, info.w); } } GPUBuffers.Get.LipidInstancesInfo2.SetData(CPUBuffers.Get.LipidInstanceInfos2.ToArray()); } else // Selected item is Compartment (multiple Protein Types) { var typesList = new List <int>(); foreach (var child in baseItem.GetAllChildren()) // GetAllChildren returns ALL children under the node, even going to lower "levels" (at least I think) { if (child.IsLeafNode()) { var id = CPUBuffers.Get.NodeToIngredientLookup[child.Id]; typesList.Add(id); } } for (var i = 0; i < CPUBuffers.Get.ProteinInstanceInfos.Count; i++) { var info = CPUBuffers.Get.ProteinInstanceInfos[i]; var type = (int)info.x; if (typesList.Contains(type)) // proteins { CPUBuffers.Get.ProteinInstanceInfos[i] = new Vector4(type, (int)InstanceState.Highlighted, info.z, info.w); NewSelectionManager.Instance.SelectedGroupInstanceIndices.Add(i); } else { CPUBuffers.Get.ProteinInstanceInfos[i] = new Vector4(type, (int)InstanceState.Normal, info.z, info.w); } } GPUBuffers.Get.ProteinInstancesInfo.SetData(CPUBuffers.Get.ProteinInstanceInfos.ToArray()); for (var i = 0; i < CPUBuffers.Get.LipidInstanceInfos.Count; i++) { var info = CPUBuffers.Get.LipidInstanceInfos[i]; var type = (int)info.x; if (typesList.Contains(type)) { CPUBuffers.Get.LipidInstanceInfos2[i] = new Vector4((int)InstanceState.Highlighted, info.y, info.z, info.w); NewSelectionManager.Instance.SelectedGroupLipidInstanceIndices.Add(i); } else { CPUBuffers.Get.LipidInstanceInfos2[i] = new Vector4((int)InstanceState.Normal, info.y, info.z, info.w); } } GPUBuffers.Get.LipidInstancesInfo2.SetData(CPUBuffers.Get.LipidInstanceInfos2.ToArray()); } }