Skip to content

Commit

Permalink
Merge pull request #180 from Kapim/devel
Browse files Browse the repository at this point in the history
fixed action object menu buttons
  • Loading branch information
Kapim authored Nov 5, 2020
2 parents ec4506d + 17ff59f commit 0f44e90
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ MonoBehaviour:
onStateChanged:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
- m_Target: {fileID: 4455020661743965345}
m_MethodName: OnMenuStateChanged
m_Mode: 1
m_Arguments:
Expand All @@ -623,18 +623,6 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 0}
m_MethodName: OnMenuStateChanged
m_Mode: 2
m_Arguments:
m_ObjectArgument: {fileID: 2219791083400178696}
m_ObjectArgumentAssemblyTypeName: DanielLochner.Assets.SimpleSideMenu.SimpleSideMenu,
Assembly-CSharp
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
onStateSelected:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1746,7 +1734,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -3329,7 +3317,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -4070,7 +4058,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -4257,7 +4245,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -4714,11 +4702,6 @@ PrefabInstance:
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OffEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
Expand All @@ -4729,16 +4712,6 @@ PrefabInstance:
propertyPath: OffEvents.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OffEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand All @@ -4759,6 +4732,21 @@ PrefabInstance:
propertyPath: OffEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OnEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 2990318297726141335, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: OffEvents.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 5371841985900859675, guid: 842e373db2ba5004082e835ac120c8a1,
type: 3}
propertyPath: m_Name
Expand Down Expand Up @@ -4970,7 +4958,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -5100,7 +5088,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -5286,16 +5274,36 @@ PrefabInstance:
propertyPath: description
value: Rename action point
objectReference: {fileID: 0}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: ShowRenameDialog
objectReference: {fileID: 0}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[1].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[1].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4991226775622563084, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7710050843114423662, guid: a37f66d2914458b4c85e50f9fa33cf93,
type: 3}
propertyPath: m_LocalPosition.x
Expand Down Expand Up @@ -5426,7 +5434,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 0}
objectReference: {fileID: 4455020661743965345}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ public void OverrideParameters() {
}

protected override void UpdateSaveBtn() {
if (SceneManager.Instance.SceneStarted) {
SaveParametersBtn.SetInteractivity(false, "Parameters could be overrided only when scene is stopped.");
return;
}
if (!parametersChanged) {
SaveParametersBtn.SetInteractivity(false, "No parameter changed");
return;
}
// TODO: add dry run save
SaveParametersBtn.SetInteractivity(true);


}
}
2 changes: 1 addition & 1 deletion arcor2_AREditor/Assets/BASE/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public class GameManager : Singleton<GameManager> {
/// <summary>
/// Api version
/// </summary>
public const string ApiVersion = "0.9.1";
public const string ApiVersion = "0.9.2";
/// <summary>
/// List of projects metadata
/// </summary>
Expand Down
28 changes: 27 additions & 1 deletion arcor2_AREditor/Assets/BASE/Scripts/Parameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Globalization;
using Michsky.UI.ModernUIPack;
using UnityEngine.Events;
using MiniJSON;

namespace Base {
public class Parameter : IO.Swagger.Model.Parameter {
Expand Down Expand Up @@ -55,6 +56,9 @@ public Parameter(IO.Swagger.Model.ParameterMeta actionParameterMetadata, object
case "double":
SetValue((double) value);
break;
case "boolean":
SetValue((bool) value);
break;
}
}

Expand All @@ -75,6 +79,26 @@ public static T GetValue<T>(string value) {
return JsonConvert.DeserializeObject<T>(value);
}

public static string Encode(string value, string type) {
switch (type) {
/*case "relative_pose":
return GetValue<IO.Swagger.Model.Pose>(value).ToString();*/
case "integer_enum":
case "integer":
return JsonConvert.SerializeObject(int.Parse(value));
case "string_enum":
case "pose":
case "joints":
case "string":
return JsonConvert.SerializeObject(value);
case "double":
return JsonConvert.SerializeObject(double.Parse(value));
case "boolean":
return JsonConvert.SerializeObject(bool.Parse(value));
}
throw new RequestFailedException("Unknown parameter type (" + type + ")");
}

public string GetStringValue() {
return GetStringValue(Value, Type);
}
Expand All @@ -94,6 +118,8 @@ public static string GetStringValue(string value, string type) {
return GetValue<string>(value).ToString();
case "double":
return GetValue<double>(value).ToString();
case "boolean":
return GetValue<bool>(value).ToString();
}
throw new RequestFailedException("Unknown parameter type");
}
Expand Down Expand Up @@ -519,7 +545,7 @@ public static DropdownParameter GetDropdownParameter(string param_id, GameObject
throw new Base.ItemNotFoundException("Parameter not found: " + param_id);
}

private static GameObject InitializeParameter(ParameterMetadata actionParameterMetadata, OnChangeParameterHandlerDelegate handler, VerticalLayoutGroup layoutGroupToBeDisabled, GameObject canvasRoot, string value, bool darkMode = false, string actionProviderId = "") {
public static GameObject InitializeParameter(ParameterMetadata actionParameterMetadata, OnChangeParameterHandlerDelegate handler, VerticalLayoutGroup layoutGroupToBeDisabled, GameObject canvasRoot, string value, bool darkMode = false, string actionProviderId = "") {
GameObject parameter = null;

switch (actionParameterMetadata.Type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ public void Init(string value, bool overriden, ParameterMetadata parameterMetada
}

public void Modify() {
switch (parameterMetadata.Type) {
case "string":
Input = Parameter.InitializeStringParameter(parameterMetadata, OnChangeParameterHandler, null, null, Value.text);
Input.GetComponent<IParameter>().SetLabel("", "");
Value.gameObject.SetActive(false);
Input.transform.SetParent(Value.transform.parent);
Input.transform.SetAsFirstSibling();
break;
}
Input = Parameter.InitializeParameter(parameterMetadata, OnChangeParameterHandler, null, null, Parameter.Encode(Value.text, parameterMetadata.Type), true);
Input.GetComponent<IParameter>().SetLabel("", "");
Value.gameObject.SetActive(false);
Input.transform.SetParent(Value.transform.parent);
Input.transform.SetAsFirstSibling();

SaveBtn.gameObject.SetActive(true);
ModifyBtn.gameObject.SetActive(false);
RestoreBtn.gameObject.SetActive(false);
Expand Down
Binary file modified arcor2_AREditor/Assets/BASE/Scripts/Swagger/IO.Swagger.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions arcor2_AREditor/Assets/BASE/Scripts/WebsocketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2212,6 +2212,39 @@ public async Task DeleteOverride(string id, IO.Swagger.Model.Parameter parameter
}
}


public async Task<List<IO.Swagger.Model.Joint>> InverseKinematics(string robotId, string endEffectorId, bool avoidCollisions, IO.Swagger.Model.Pose pose, List<IO.Swagger.Model.Joint> startJoints) {
int r_id = Interlocked.Increment(ref requestID);
IO.Swagger.Model.InverseKinematicsRequestArgs args = new InverseKinematicsRequestArgs(robotId: robotId,
endEffectorId: endEffectorId, pose: pose, avoidCollisions: avoidCollisions, startJoints: startJoints);

IO.Swagger.Model.InverseKinematicsRequest request = new IO.Swagger.Model.InverseKinematicsRequest(r_id, "InverseKinematics", args: args);
SendDataToServer(request.ToJson(), r_id, true);
IO.Swagger.Model.InverseKinematicsResponse response = await WaitForResult<IO.Swagger.Model.InverseKinematicsResponse>(r_id);
if (response == null || !response.Result) {
throw new RequestFailedException(response == null ? new List<string>() { "Failed to delete override of object parameter" } : response.Messages);
} else {
return response.Data;
}
}

public async Task<IO.Swagger.Model.Pose> ForwardKinematics(string robotId, string endEffectorId, List<IO.Swagger.Model.Joint> joints) {
int r_id = Interlocked.Increment(ref requestID);
IO.Swagger.Model.ForwardKinematicsRequestArgs args = new ForwardKinematicsRequestArgs(robotId: robotId,
endEffectorId: endEffectorId, joints: joints);

IO.Swagger.Model.ForwardKinematicsRequest request = new IO.Swagger.Model.ForwardKinematicsRequest(r_id, "ForwardKinematics", args: args);
SendDataToServer(request.ToJson(), r_id, true);
IO.Swagger.Model.ForwardKinematicsResponse response = await WaitForResult<IO.Swagger.Model.ForwardKinematicsResponse>(r_id);
if (response == null || !response.Result) {
throw new RequestFailedException(response == null ? new List<string>() { "Failed to delete override of object parameter" } : response.Messages);
} else {
return response.Data;
}
}





}
Expand Down
Loading

0 comments on commit 0f44e90

Please sign in to comment.