This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ported some standard shader changes and added tmpro shader variant (#141
) * ported some standard shader changes and added tmpro shader variant * added missing icon * Added a missing inspector for the bezier Updated dotted line png meta Exposed distortion settings as they could be added later. * Fixed icon and renamed class
- Loading branch information
1 parent
f02fcc2
commit d338896
Showing
19 changed files
with
1,716 additions
and
184 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace XRTK.Inspectors | ||
{ | ||
/// <summary> | ||
/// A custom shader inspector for the "Mixed Reality Toolkit/TextShader3D". | ||
/// </summary> | ||
public class Text3DShaderGUI : ShaderGUI | ||
{ | ||
protected bool firstTimeApply = true; | ||
protected MaterialProperty cullMode; | ||
|
||
|
||
public override void OnGUI(MaterialEditor matEditor, MaterialProperty[] props) | ||
{ | ||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching from an existing material. | ||
// Do this before any GUI code has been issued to prevent layout issues in subsequent GUILayout statements (case 780071) | ||
if (firstTimeApply) | ||
{ | ||
firstTimeApply = false; | ||
} | ||
|
||
EditorGUIUtility.labelWidth = 0f; | ||
|
||
EditorGUI.BeginChangeCheck(); | ||
{ | ||
base.OnGUI(matEditor, props); | ||
} | ||
} | ||
|
||
protected static class Styles | ||
{ | ||
public static GUIContent cullMode = new GUIContent("Culling Mode", "Type of culling to apply to polygons - typically this is set to backfacing"); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
Inspectors/Utilities/Lines/DataProviders/BezierDataProviderInspector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using XRTK.Utilities.Lines; | ||
|
||
namespace XRTK.Inspectors.Utilities.Lines.DataProviders | ||
{ | ||
[CustomEditor(typeof(BezierLineDataProvider))] | ||
public class BezierDataProviderInspector : BaseMixedRealityLineDataProviderInspector | ||
{ | ||
private const float HANDLE_SIZE_MODIFIER = 0.04f; | ||
private const float PICK_SIZE_MODIFIER = 0.06f; | ||
|
||
private SerializedProperty controlPoints; | ||
private SerializedProperty inertia; | ||
private SerializedProperty useLocalTangentPoints; | ||
|
||
private int selectedHandleIndex = -1; | ||
|
||
protected override void OnEnable() | ||
{ | ||
base.OnEnable(); | ||
|
||
controlPoints = serializedObject.FindProperty("controlPoints"); | ||
inertia = serializedObject.FindProperty("inertia"); | ||
useLocalTangentPoints = serializedObject.FindProperty("useLocalTangentPoints"); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
base.OnInspectorGUI(); | ||
serializedObject.Update(); | ||
|
||
// We always draw line points for bezier. | ||
DrawLinePoints = true; | ||
|
||
EditorGUILayout.PropertyField(controlPoints, true); | ||
EditorGUILayout.PropertyField(inertia, true); | ||
EditorGUILayout.PropertyField(useLocalTangentPoints); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
|
||
protected override void OnSceneGUI() | ||
{ | ||
base.OnSceneGUI(); | ||
|
||
for (int i = 0; i < 4; i++) | ||
{ | ||
serializedObject.Update(); | ||
|
||
bool isTangentHandle = i % 3 != 0; | ||
bool isLastPoint = i == 3; | ||
|
||
var controlPointPosition = LineData.GetPoint(i); | ||
var controlPointProperty = controlPoints.FindPropertyRelative("point" + (i + 1)); | ||
|
||
// Draw our tangent lines | ||
Handles.color = Color.gray; | ||
if (i == 0) | ||
{ | ||
Handles.DrawLine(LineData.GetPoint(0), LineData.GetPoint(1)); | ||
} | ||
else if (!isTangentHandle) | ||
{ | ||
Handles.DrawLine(LineData.GetPoint(i), LineData.GetPoint(i - 1)); | ||
|
||
if (!isLastPoint) | ||
{ | ||
Handles.DrawLine(LineData.GetPoint(i), LineData.GetPoint(i + 1)); | ||
} | ||
} | ||
|
||
Handles.color = isTangentHandle ? Color.white : Color.green; | ||
float handleSize = HandleUtility.GetHandleSize(controlPointPosition); | ||
|
||
if (Handles.Button(controlPointPosition, Quaternion.identity, handleSize * HANDLE_SIZE_MODIFIER, handleSize * PICK_SIZE_MODIFIER, Handles.DotHandleCap)) | ||
{ | ||
selectedHandleIndex = i; | ||
} | ||
|
||
// Draw our handles | ||
if (Tools.current == Tool.Move && selectedHandleIndex == i) | ||
{ | ||
EditorGUI.BeginChangeCheck(); | ||
|
||
var newTargetPosition = Handles.PositionHandle(controlPointPosition, Quaternion.identity); | ||
|
||
if (EditorGUI.EndChangeCheck()) | ||
{ | ||
Undo.RecordObject(LineData, "Change Bezier Point Position"); | ||
LineData.SetPoint(i, newTargetPosition); | ||
} | ||
} | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Inspectors/Utilities/Lines/DataProviders/BezierDataProviderInspector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.