Skip to content

Commit

Permalink
Merge pull request #86 from Kapim/master
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
Kapim authored Apr 17, 2020
2 parents c8e1ba5 + 3a07f21 commit ac8bba2
Show file tree
Hide file tree
Showing 12 changed files with 4,692 additions and 156 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
using Base;
using UnityEngine.EventSystems;

public class ActionObjectMenuProjectEditor : MonoBehaviour, IMenu {
public Base.ActionObject CurrentObject;
Expand Down Expand Up @@ -60,6 +61,23 @@ public void UpdateMenu() {
foreach (ActionPoint actionPoint in CurrentObject.GetActionPoints()) {
Button button = GameManager.Instance.CreateButton(DynamicContent.transform, actionPoint.Data.Name);
button.onClick.AddListener(() => ShowActionPoint(actionPoint));

// Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button
OutlineOnClick APoutline = actionPoint.GetComponent<OutlineOnClick>();
EventTrigger eventTrigger = button.gameObject.AddComponent<EventTrigger>();
// Create OnPointerEnter entry
EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry {
eventID = EventTriggerType.PointerEnter
};
OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight());
eventTrigger.triggers.Add(OnPointerEnter);

// Create OnPointerExit entry
EventTrigger.Entry OnPointerExit = new EventTrigger.Entry {
eventID = EventTriggerType.PointerExit
};
OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight());
eventTrigger.triggers.Add(OnPointerExit);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEngine.UI;
using Michsky.UI.ModernUIPack;
using Base;
using UnityEngine.EventSystems;

public class ActionObjectsSettingsMenu : MonoBehaviour, IMenu {
public SwitchComponent Visiblity, Interactibility;
Expand Down Expand Up @@ -65,6 +66,23 @@ public void OnSceneChanged(object sender, EventArgs eventArgs) {
Button btn = btnGO.GetComponent<Button>();
btn.GetComponentInChildren<TMPro.TMP_Text>().text = actionObject.Data.Name;
btn.onClick.AddListener(() => ShowActionObject(actionObject));

// Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AO when hovering over button
OutlineOnClick AOoutline = actionObject.GetComponent<OutlineOnClick>();
EventTrigger eventTrigger = btnGO.AddComponent<EventTrigger>();
// Create OnPointerEnter entry
EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry {
eventID = EventTriggerType.PointerEnter
};
OnPointerEnter.callback.AddListener((eventData) => AOoutline.Highlight());
eventTrigger.triggers.Add(OnPointerEnter);

// Create OnPointerExit entry
EventTrigger.Entry OnPointerExit = new EventTrigger.Entry {
eventID = EventTriggerType.PointerExit
};
OnPointerExit.callback.AddListener((eventData) => AOoutline.UnHighlight());
eventTrigger.triggers.Add(OnPointerExit);
}
}

Expand All @@ -78,6 +96,23 @@ public void OnActionPointsChanged(object sender, EventArgs eventArgs) {
Button btn = btnGO.GetComponent<Button>();
btn.GetComponentInChildren<TMPro.TMP_Text>().text = actionPoint.Data.Name;
btn.onClick.AddListener(() => ShowActionPoint(actionPoint));

// Add EventTrigger OnPointerEnter and OnPointerExit - to be able to highlight corresponding AP when hovering over button
OutlineOnClick APoutline = actionPoint.GetComponent<OutlineOnClick>();
EventTrigger eventTrigger = btnGO.AddComponent<EventTrigger>();
// Create OnPointerEnter entry
EventTrigger.Entry OnPointerEnter = new EventTrigger.Entry {
eventID = EventTriggerType.PointerEnter
};
OnPointerEnter.callback.AddListener((eventData) => APoutline.Highlight());
eventTrigger.triggers.Add(OnPointerEnter);

// Create OnPointerExit entry
EventTrigger.Entry OnPointerExit = new EventTrigger.Entry {
eventID = EventTriggerType.PointerExit
};
OnPointerExit.callback.AddListener((eventData) => APoutline.UnHighlight());
eventTrigger.triggers.Add(OnPointerExit);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3525,8 +3525,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 797108402218531859, guid: 1c82e97bdfcacad4f9f0d9b0b08551fc,
type: 3}
objectReference: {fileID: 700810234778228226}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down Expand Up @@ -6009,8 +6008,7 @@ PrefabInstance:
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 797108402218531859, guid: 1c82e97bdfcacad4f9f0d9b0b08551fc,
type: 3}
objectReference: {fileID: 700810234778228226}
- target: {fileID: 1282326451552802060, guid: c77917a7826c62e419cc9a2867495b1f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
Expand Down
6 changes: 5 additions & 1 deletion arcor2_AREditor/Assets/BASE/Scripts/ActionPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void ActionPointBaseUpdate(IO.Swagger.Model.ProjectActionPoint apData) {
Data.Position = apData.Position;
// update position and rotation based on received data from swagger
transform.localPosition = GetScenePosition();
if (Parent != null)
ConnectionToActionObject.UpdateLine();
//TODO: ActionPoint has multiple rotations of end-effectors, for visualization, render end-effectors individually
//transform.localRotation = GetSceneOrientation();
}
Expand All @@ -68,6 +70,7 @@ public void InitAP(IO.Swagger.Model.ProjectActionPoint apData, float size, IActi
Data = apData;
transform.localPosition = GetScenePosition();
SetSize(size);
ActivateForGizmo((ControlBoxManager.Instance.UseGizmoMove == true || ControlBoxManager.Instance.UseGizmoRotate == true) ? "GizmoRuntime" : "Default");
// TODO: is this neccessary?
/*if (Data.Orientations.Count == 0)
Data.Orientations.Add(new IO.Swagger.Model.NamedOrientation(id: "default", orientation: new IO.Swagger.Model.Orientation()));*/
Expand Down Expand Up @@ -303,7 +306,8 @@ public Transform GetTransform() {
// local list of all actions for current action point
currentA.Add(projectAction.Id);
}

if (Parent != null)
ConnectionToActionObject.UpdateLine();
return (currentA, connections);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ public class LineConnection : MonoBehaviour {

public Material ClickMaterial;

private void Start() {
private void Awake() {
lineRenderer = GetComponent<LineRenderer>();
}

private void Start() {
CreateConnection(targets[0], targets[1]);
}

Expand All @@ -29,7 +32,7 @@ public void CreateConnection(Transform input, Transform output) {
connectionActive = true;
}

private void UpdateLine() {
public void UpdateLine() {
lineRenderer.SetPositions(new Vector3[2] { targets[0].position, targets[1].position });
}
}
79 changes: 79 additions & 0 deletions arcor2_AREditor/Assets/TABLET/Materials/OutlineMaterialHover.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: OutlineMaterialHover
m_Shader: {fileID: 4800000, guid: cf123e1ed5ede5b49963c1f5a6528388, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Outline: 0.1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions arcor2_AREditor/Assets/TABLET/Prefabs/ActionObject.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
ClickMaterial: {fileID: 2100000, guid: 1ef88d2e88b167344b7db905a28877ad, type: 2}
HoverMaterial: {fileID: 2100000, guid: 6f85ebaaa5685a345b1269fa36ddcf6c, type: 2}
Renderers: []
--- !u!1 &6802618089977537743
GameObject:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ MonoBehaviour:
type: 3}
SpherePrefab: {fileID: 1882225777272338896, guid: 86f57e8e80a38894c9cdf8cb5ffc41ee,
type: 3}
ActionObjectMaterialTransparent: {fileID: 0}
ActionObjectMaterialOpaque: {fileID: 0}
ActionObjectMaterialTransparent: {fileID: 2100000, guid: ac6dd0a955cbb584fa6ebacfc39f8a2a,
type: 2}
ActionObjectMaterialOpaque: {fileID: 2100000, guid: a42075478d0bf9d4da97396f41dbbd78,
type: 2}
--- !u!114 &3050534694925757164
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -117,6 +119,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
ClickMaterial: {fileID: 2100000, guid: 1ef88d2e88b167344b7db905a28877ad, type: 2}
HoverMaterial: {fileID: 2100000, guid: 6f85ebaaa5685a345b1269fa36ddcf6c, type: 2}
Renderers: []
--- !u!1 &6802618089977537743
GameObject:
Expand Down
1 change: 1 addition & 0 deletions arcor2_AREditor/Assets/TABLET/Prefabs/ActionPoint3D.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
ClickMaterial: {fileID: 2100000, guid: 1ef88d2e88b167344b7db905a28877ad, type: 2}
HoverMaterial: {fileID: 2100000, guid: 6f85ebaaa5685a345b1269fa36ddcf6c, type: 2}
Renderers:
- {fileID: 4618120162863866931}
--- !u!1 &4940753687191564067
Expand Down
Loading

0 comments on commit ac8bba2

Please sign in to comment.