Exemple #1
0
    public void Init(ParameterMetadata parameterMetadata, string type, object value, VerticalLayoutGroup layoutGroupToBeDisabled, GameObject canvasRoot,
                     Parameter.OnChangeParameterHandlerDelegate onChangeParameterHandler, CanvasGroup windowToHideWhenRequestingObj, bool linkable = true)
    {
        base.Init(parameterMetadata, type, value, layoutGroupToBeDisabled, canvasRoot, onChangeParameterHandler, linkable);
        canvasGroupToHide = windowToHideWhenRequestingObj;
        List <string> options = new List <string>();

        /*foreach (Base.ActionPoint ap in Base.ProjectManager.Instance.GetAllActionPoints()) {
         *  foreach (IO.Swagger.Model.NamedOrientation orientation in ap.GetNamedOrientations()) {
         *      options.Add(ap.Data.Name + "." + orientation.Name);
         *  }
         * }*/
        if (value != null)
        {
            try {
                selectedAP          = ProjectManager.Instance.GetActionPointWithOrientation((string)value);
                selectedOrientation = selectedAP.GetOrientationVisual((string)value);
            } catch (KeyNotFoundException ex) {
                Debug.LogError(ex);
            }
        }
        if (type == "link")
        {
            ActionsDropdown.SetValue($"{selectedAP.GetName()}.{selectedOrientation.GetName()}");
        }

        UpdateButtonLabel();
    }
Exemple #2
0
        private void AddNewOrientationVisual(NamedOrientation orientation)
        {
            APOrientation apOrientation = Instantiate(ActionsManager.Instance.ActionPointOrientationPrefab, orientations.transform).GetComponent <APOrientation>();

            apOrientation.ActionPoint = this;
            apOrientation.SetOrientation(orientation.Orientation);
            apOrientation.OrientationId = orientation.Id;
        }
    private void OpenDetailMenu(NamedOrientation orientation)
    {
        OrientationJointsDetailMenu.ShowMenu(CurrentActionPoint, orientation);
        APOrientation orientationArrow = CurrentActionPoint.GetOrientationVisual(orientation.Id);

        SceneManager.Instance.SetSelectedObject(orientationArrow.gameObject);
        orientationArrow.SendMessage("Select", false);
    }
Exemple #4
0
 private void RemoveOrientationVisual(string id)
 {
     try {
         APOrientation o = GetOrientationVisual(id);
         Destroy(o.gameObject);
     } catch (KeyNotFoundException) {
         // älready destroyed..
     }
 }
Exemple #5
0
 /// <summary>
 /// Returns visual representation of orientation
 /// </summary>
 /// <param name="id">UUID of orientation</param>
 /// <returns></returns>
 public APOrientation GetOrientationVisual(string id)
 {
     foreach (Transform transform in orientations.transform)
     {
         APOrientation orientation = transform.GetComponent <APOrientation>();
         if (orientation.OrientationId == id)
         {
             return(orientation);
         }
     }
     throw new KeyNotFoundException("Orientation with id " + id + " not found.");
 }
Exemple #6
0
        public virtual void UpdateOrientation(NamedOrientation orientation)
        {
            NamedOrientation originalOrientation = GetOrientation(orientation.Id);

            originalOrientation.Orientation = orientation.Orientation;
            try {
                APOrientation orientationArrow = GetOrientationVisual(orientation.Id);
                orientationArrow.SetOrientation(orientation.Orientation);
            } catch (KeyNotFoundException) {
                AddNewOrientationVisual(orientation);
            }
            BaseUpdateOrientation(originalOrientation, orientation);
        }
Exemple #7
0
    public async void OpenDetailMenu(NamedOrientation orientation)
    {
        AddOrientationContainer.SetActive(false);
        AddJointsContainer.SetActive(false);
        if (OrientationJointsDetailMenu.IsVisible())
        {
            OrientationJointsDetailMenu.HideMenu();
        }
        ContainerJoints.SetActive(false);
        ContainerOrientations.SetActive(false);
        ContainerPosition.SetActive(false);
        OrientationJointsDetailMenu.ShowMenu(CurrentActionPoint, orientation);
        APOrientation orientationArrow = CurrentActionPoint.GetOrientationVisual(orientation.Id);

        SceneManager.Instance.SetSelectedObject(orientationArrow.gameObject);
    }
Exemple #8
0
    private async void SelectOrientation(object selectedObject)
    {
        APOrientation orientation = (APOrientation)selectedObject;

        if (orientation == null)
        {
            return;
        }
        selectedAP          = orientation.ActionPoint;
        selectedOrientation = orientation;
        UpdateButtonLabel();
        EditorHelper.EnableCanvasGroup(canvasGroupToHide, true);
        canvasGroupToHide.gameObject.SetActive(true);
        if (this.selectedObject != null)
        {
            SelectorMenu.Instance.SetSelectedObject(this.selectedObject, selectedObjectManually, false);
        }
        onChangeParameterHandler?.Invoke(GetName(), GetValue(), type);
        AREditorResources.Instance.LeftMenuProject.UpdateBtns();
        SelectorMenu.Instance.gameObject.SetActive(false);
    }
Exemple #9
0
 public void UpdateOrientationsVisuals()
 {
     foreach (Transform transform in orientations.transform)
     {
         Destroy(transform.gameObject);
     }
     if (!ProjectManager.Instance.APOrientationsVisible)
     {
         return;
     }
     if (!OrientationsVisible)
     {
         return;
     }
     foreach (IO.Swagger.Model.NamedOrientation orientation in Data.Orientations)
     {
         APOrientation apOrientation = Instantiate(ActionsManager.Instance.ActionPointOrientationPrefab, orientations.transform).GetComponent <APOrientation>();
         apOrientation.transform.localRotation = TransformConvertor.ROSToUnity(DataHelper.OrientationToQuaternion(orientation.Orientation));
         apOrientation.ActionPoint             = this;
         apOrientation.OrientationId           = orientation.Id;
     }
 }