コード例 #1
0
    public async void InitFromMetadata(IActionProvider actionProvider, Base.ActionMetadata actionMetadata, Base.ActionPoint actionPoint)
    {
        InitDialog(actionProvider, actionMetadata, actionPoint);
        actionParameters = await Base.Parameter.InitActionParameters(actionProvider.GetProviderId(), actionParametersMetadata.Values.ToList(), DynamicContent, OnChangeParameterHandler, DynamicContentLayout, CanvasRoot, CurrentActionPoint, false);

        nameInput.SetValue(Base.ProjectManager.Instance.GetFreeActionName(actionMetadata.Name));
    }
コード例 #2
0
    private RequestResult CheckActionParameters(Base.ActionMetadata actionMetadata)
    {
        //TODO - otestovat
        RequestResult result = new RequestResult(true);
        bool          poseError = false, jointsError = false, dynamicValueError = false;
        bool          anyOrientation = ProjectManager.Instance.AnyOrientationInTheProject();
        bool          anyJoints      = ProjectManager.Instance.AnyJointsInTheProject();

        foreach (ParameterMetadata param in actionMetadata.ParametersMetadata.Values)
        {
            if (!poseError && param.Type == ParameterMetadata.POSE)
            {
                int poseParemetersCount = 0;
                if (anyOrientation)
                {
                    foreach (ParameterMetadata parameter in actionMetadata.ParametersMetadata.Values)
                    {
                        if (parameter.Type == ParameterMetadata.POSE)
                        {
                            if (++poseParemetersCount > 1)
                            {
                                break;
                            }
                        }
                    }
                }

                if (poseParemetersCount == 1 && !currentActionPoint.AnyOrientation())
                {
                    result.Success  = false;
                    result.Message += "(there is no available orientation in the selected AP and this action requires it)\n";
                    poseError       = true;
                }
                else if (!anyOrientation)
                {
                    result.Success  = false;
                    result.Message += "(there is no available orientation in the project and this action requires it)\n";
                    poseError       = true;
                }
            }
            if (!jointsError && param.Type == ParameterMetadata.JOINTS && !anyJoints)
            {
                result.Success  = false;
                result.Message += "(there are no available robot joints in the project and this action requires them)\n";
                jointsError     = true;
            }
            if (!dynamicValueError && !SceneManager.Instance.SceneStarted && param.DynamicValue)
            {
                result.Success    = false;
                result.Message   += "(actions with dynamic parameters could only be created when online)\n";
                dynamicValueError = true;
            }
        }
        return(result);
    }
コード例 #3
0
    public virtual void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string actionType)
    {
        base.Init(projectAction, metadata, ap, actionProvider);

        if (!Base.ProjectManager.Instance.ProjectMeta.HasLogic)
        {
            Destroy(gameObject);
            return;
        }
        playerPrefsKey = "project/" + ProjectManager.Instance.ProjectMeta.Id + "/" + actionType;
    }
コード例 #4
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string keySuffix)
 {
     IO.Swagger.Model.Action prAction = new IO.Swagger.Model.Action(
         flows: new List <IO.Swagger.Model.Flow>(),
         id: "END",
         name: "END",
         parameters: new List <IO.Swagger.Model.ActionParameter>(),
         type: "");
     base.Init(prAction, metadata, ap, actionProvider, keySuffix);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0, 0.1f, 0));
     //Input.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Input);
 }
コード例 #5
0
 public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider)
 {
     ActionPoint    = ap;
     this.metadata  = metadata;
     ActionProvider = actionProvider;
     Data           = projectAction;
     UpdateName(Data.Name);
     if (actionProvider != null)
     {
         UpdateType();
     }
     //UpdateRotation(null);
     SelectorItem = SelectorMenu.Instance.CreateSelectorItem(this);
 }
コード例 #6
0
    public void InitDialog(IActionProvider actionProvider, Base.ActionMetadata actionMetadata, Base.ActionPoint actionPoint) {
        this.actionMetadata = actionMetadata;
        CurrentActionPoint = actionPoint;
        this.actionProvider = actionProvider;
        actionParametersMetadata = new Dictionary<string, Base.ActionParameterMetadata>();
        foreach (IO.Swagger.Model.ActionParameterMeta meta in actionMetadata.Parameters) {
            actionParametersMetadata.Add(meta.Name, new Base.ActionParameterMetadata(meta));
        }

        foreach (Transform t in DynamicContent.transform) {
            Destroy(t.gameObject);
        }
        nameInput.SetLabel("Name", "Name of the action");
        nameInput.SetType("string");
    }
コード例 #7
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string actionType)
 {
     IO.Swagger.Model.Action prAction = new IO.Swagger.Model.Action(
         flows: new List <IO.Swagger.Model.Flow> {
         new IO.Swagger.Model.Flow(
             new List <string> {
             "output"
         }, IO.Swagger.Model.Flow.TypeEnum.Default)
     },
         id: "START",
         name: "START",
         parameters: new List <IO.Swagger.Model.ActionParameter>(),
         type: "");
     base.Init(prAction, metadata, ap, actionProvider, actionType);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0, 0.15f, 0));
     // Output.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Output);
 }
コード例 #8
0
ファイル: Action.cs プロジェクト: xBambusekD/arcor2_editor
        public void Init(string id, string name, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider)
        {
            ActionPoint         = ap;
            this.metadata       = metadata;
            this.ActionProvider = actionProvider;

            Data.Id = id;

            if (!GameManager.Instance.CurrentProject.HasLogic)
            {
                InputArrow.gameObject.SetActive(false);
                OutputArrow.gameObject.SetActive(false);
            }


            UpdateName(name);
            //UpdateUuid(Guid.NewGuid().ToString());
            UpdateType();
            foreach (InputOutput io in GetComponentsInChildren <InputOutput>())
            {
                io.InitData();
            }
        }
コード例 #9
0
        public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider)
        {
            ActionPoint         = ap;
            this.metadata       = metadata;
            this.ActionProvider = actionProvider;
            Data = projectAction;

            if (!Base.ProjectManager.Instance.ProjectMeta.HasLogic)
            {
                InputArrow.gameObject.SetActive(false);
                OutputArrow.gameObject.SetActive(false);
            }


            UpdateName(Data.Name);
            if (actionProvider != null)
            {
                UpdateType();
            }
            foreach (InputOutput io in GetComponentsInChildren <InputOutput>())
            {
                io.Init(null);
            }
        }
コード例 #10
0
ファイル: Action3D.cs プロジェクト: robofit/arcor2_areditor
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider)
 {
     base.Init(projectAction, metadata, ap, actionProvider);
     // Input.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Input);
     //Output.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Output);
 }
コード例 #11
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string keySuffix)
 {
     base.Init(projectAction, metadata, ap, actionProvider, keySuffix);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0.5f, 0, 0));
 }