Skip to content

Commit ed68e8e

Browse files
PR feedback
1 parent 8b28a2f commit ed68e8e

8 files changed

Lines changed: 28 additions & 27 deletions

File tree

Scripts/Interfaces/FunctionalityInjection/IRequestFeedback.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static void ClearFeedbackRequests(this IRequestFeedback obj)
4848
/// <summary>
4949
/// Get a pooled FeedbackRequest object from the system
5050
/// </summary>
51+
/// <param name="type">The type of request object desired</param>
5152
public static FeedbackRequest GetFeedbackRequestObject(this IRequestFeedback obj, Type type)
5253
{
5354
return getFeedbackRequestObject(type);

Scripts/Utilities/ObjectUtils.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public static Bounds GetBounds(Transform transform)
149149
b.center = k_Transforms[0].position;
150150

151151
foreach (var t in k_Transforms)
152+
{
152153
b.Encapsulate(t.position);
154+
}
153155
}
154156

155157
return b;

Workspaces/Common/Scripts/FilterUI.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ void OnFilterClick(FilterButtonUI clickedButton)
189189
switch (clickedButton.text.text)
190190
{
191191
case k_AllText:
192-
193192
m_SummaryText.text = clickedButton.text.text;
194193
m_DescriptionText.text = "All objects are visible";
195194
break;

Workspaces/PolyWorkspace/PolyWorkspace.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ namespace UnityEditor.Experimental.EditorVR.Workspaces
2525
[MainMenuItem("Poly", "Workspaces", "Import models from Google Poly")]
2626
sealed class PolyWorkspace : Workspace, ISerializeWorkspace
2727
{
28-
const float k_XBounds = 1.094f;
29-
const float k_YBounds = 0.2f;
30-
3128
const float k_MinScale = 0.05f;
3229
const float k_MaxScale = 0.2f;
3330

@@ -44,6 +41,10 @@ sealed class PolyWorkspace : Workspace, ISerializeWorkspace
4441
const string k_Medium = "Medium";
4542
const string k_Simple = "Simple";
4643

44+
static readonly Vector3 k_MinBounds = new Vector3(1.094f, 0.2f, 0.5f);
45+
static readonly Vector3 k_ScrollHandleScale = new Vector3(1.03f, 0.02f, 1.02f); // Extra space for scrolling
46+
static readonly Vector3 k_ScrollHandlePosition = new Vector3(0f, -0.015f, 0f); // Offset from content for collision purposes
47+
4748
[Serializable]
4849
class Preferences
4950
{
@@ -89,7 +90,7 @@ public List<PolyGridAsset> assetData
8990
public override void Setup()
9091
{
9192
// Initial bounds must be set before the base.Setup() is called
92-
minBounds = new Vector3(k_XBounds, k_YBounds, 0.5f);
93+
minBounds = k_MinBounds;
9394
m_CustomStartingBounds = minBounds;
9495

9596
base.Setup();
@@ -124,8 +125,8 @@ public override void Setup()
124125
var scrollHandle = m_PolyUI.scrollHandle;
125126
var scrollHandleTransform = scrollHandle.transform;
126127
scrollHandleTransform.SetParent(m_WorkspaceUI.topFaceContainer);
127-
scrollHandleTransform.localScale = new Vector3(1.03f, 0.02f, 1.02f); // Extra space for scrolling
128-
scrollHandleTransform.localPosition = new Vector3(0f, -0.015f, 0f); // Offset from content for collision purposes
128+
scrollHandleTransform.localScale = k_ScrollHandleScale;
129+
scrollHandleTransform.localPosition = k_ScrollHandlePosition;
129130

130131
scrollHandle.dragStarted += OnScrollDragStarted;
131132
scrollHandle.dragging += OnScrollDragging;

Workspaces/PolyWorkspace/Scripts/PolyGridAsset.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class PolyGridAsset : ListViewItemData<string>, IWeb
3636
public Texture2D thumbnail { get { return m_Thumbnail; } }
3737
public bool initialized { get { return m_Initialized; } }
3838
public long complexity { get { return m_Complexity; } }
39-
public override string index { get { return m_Asset.name; } }
39+
public override string index { get { return m_Asset.name; } } // PolyAsset.name is the GUID
4040

4141
public event Action<PolyGridAsset, GameObject> modelImportCompleted;
4242
public event Action<PolyGridAsset, Texture2D> thumbnailImportCompleted;

Workspaces/PolyWorkspace/Scripts/PolyGridItem.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ class PolyGridItem : DraggableListItem<PolyGridAsset, string>, IPlaceSceneObject
9494
Action<float> m_CompleteHoverTransition;
9595
Action<float> m_SetThumbnailScale;
9696
Action<float> m_SetImportingScale;
97-
9897
Action<Color> m_SetImportingColor;
9998

10099
void Awake()
101100
{
102101
m_CompleteHoverTransition = CompleteHoverTransition;
103102
m_SetThumbnailScale = SetThumbnailScale;
104103
m_SetImportingScale = SetImportingScale;
105-
106104
m_SetImportingColor = SetImportingColor;
107105
}
108106

@@ -422,7 +420,8 @@ IEnumerator AnimateVisibility(bool visible, Action<PolyGridItem> callback)
422420
while (currentTime < k_TransitionDuration)
423421
{
424422
currentTime += Time.deltaTime;
425-
transform.localScale = Vector3.Lerp(currentScale, targetScale, currentTime / k_TransitionDuration);
423+
transform.localScale = Vector3.Lerp(currentScale, targetScale,
424+
MathUtilsExt.SmoothInOutLerpFloat(currentTime / k_TransitionDuration));
426425
yield return null;
427426
}
428427

@@ -446,8 +445,7 @@ IEnumerator ShowGrabbedObject()
446445
currentPreviewOffset = m_PreviewObjectClone.localPosition;
447446

448447
var currentTime = 0f;
449-
var currentVelocity = 0f;
450-
const float kDuration = 1f;
448+
const float duration = 1f;
451449

452450
var targetScale = Vector3.one * k_IconPreviewScale;
453451
var pivotOffset = Vector3.zero;
@@ -484,13 +482,14 @@ IEnumerator ShowGrabbedObject()
484482
}
485483
}
486484

487-
while (currentTime < kDuration - 0.05f)
485+
while (currentTime < duration)
488486
{
489487
if (m_DragObject == null)
490488
yield break; // Exit coroutine if m_GrabbedObject is destroyed before the loop is finished
491489

492-
currentTime = MathUtilsExt.SmoothDamp(currentTime, kDuration, ref currentVelocity, 0.5f, Mathf.Infinity, Time.deltaTime);
493-
m_DragObject.localScale = Vector3.Lerp(currentLocalScale, targetScale, currentTime);
490+
currentTime += Time.deltaTime;
491+
m_DragObject.localScale = Vector3.Lerp(currentLocalScale, targetScale,
492+
MathUtilsExt.SmoothInOutLerpFloat(currentTime / duration));
494493

495494
if (m_PreviewObjectClone)
496495
{
@@ -501,7 +500,8 @@ IEnumerator ShowGrabbedObject()
501500
yield return null;
502501
}
503502

504-
m_DragObject.localScale = targetScale;
503+
m_DragObject.localScale = targetScale;
504+
//No need to hard-set the preview object position/rotation because they will set in OnDragging in parent class
505505
}
506506

507507
static IEnumerator HideGrabbedObject(GameObject itemToHide)

Workspaces/ProjectWorkspace/ProjectWorkspace.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ sealed class ProjectWorkspace : Workspace, IUsesProjectFolderData, IFilterUI, IS
1919
const float k_MinScale = 0.04f;
2020
const float k_MaxScale = 0.09f;
2121

22+
static readonly Vector3 k_MinBounds = new Vector3(MinBounds.x, k_YBounds, 0.5f);
23+
static readonly Vector3 k_CustomStartingBounds = new Vector3(0.8f, k_YBounds, 0.5f);
24+
2225
bool m_AssetGridDragging;
2326
bool m_FolderPanelDragging;
2427

@@ -95,8 +98,8 @@ public List<string> expandedFolders
9598
public override void Setup()
9699
{
97100
// Initial bounds must be set before the base.Setup() is called
98-
minBounds = new Vector3(MinBounds.x, k_YBounds, 0.5f);
99-
m_CustomStartingBounds = new Vector3(0.8f, k_YBounds, 0.5f);
101+
minBounds = k_MinBounds;
102+
m_CustomStartingBounds = k_CustomStartingBounds;
100103

101104
base.Setup();
102105

Workspaces/ProjectWorkspace/Shaders/StandardDecal.shader

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@ Shader "EditorVR/Standard Decal"
3232

3333
void surf (Input IN, inout SurfaceOutputStandard o)
3434
{
35-
if (IN.uv_MainTex.x > 1 || IN.uv_MainTex.x < 0
36-
|| IN.uv_MainTex.y > 1 || IN.uv_MainTex.y < 0)
37-
o.Emission = 0;
38-
else {
39-
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
40-
c *= _Color * c.a;
41-
o.Emission = c.rgb;
42-
}
35+
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
36+
c *= _Color * c.a;
37+
o.Emission = c.rgb;
4338
}
4439
ENDCG
4540
}

0 commit comments

Comments
 (0)