-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7be2495
commit 1bf7eae
Showing
116 changed files
with
15,559 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
[submodule "Extensions/SteamVR"] | ||
path = Extensions/SteamVR | ||
url = [email protected]:Innoactive/SteamVR.git | ||
branch = feature/unity-assemblies | ||
Submodule SteamVR
deleted from
d9756a
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "SteamVR.Editor", | ||
"references": [ | ||
"GUID:1880273c0d70cde44a4a2d9730fc0a3f" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | ||
// | ||
// Purpose: Custom inspector display for SteamVR_Camera | ||
// | ||
//============================================================================= | ||
|
||
using UnityEngine; | ||
using UnityEditor; | ||
using System.IO; | ||
|
||
[CustomEditor(typeof(SteamVR_Camera)), CanEditMultipleObjects] | ||
public class SteamVR_Editor : Editor | ||
{ | ||
int bannerHeight = 150; | ||
Texture logo; | ||
|
||
SerializedProperty script, wireframe; | ||
|
||
string GetResourcePath() | ||
{ | ||
var ms = MonoScript.FromScriptableObject(this); | ||
var path = AssetDatabase.GetAssetPath(ms); | ||
path = Path.GetDirectoryName(path); | ||
return path.Substring(0, path.Length - "Editor".Length) + "Textures/"; | ||
} | ||
|
||
void OnEnable() | ||
{ | ||
var resourcePath = GetResourcePath(); | ||
|
||
logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png"); | ||
|
||
script = serializedObject.FindProperty("m_Script"); | ||
|
||
wireframe = serializedObject.FindProperty("wireframe"); | ||
|
||
foreach (SteamVR_Camera target in targets) | ||
target.ForceLast(); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
|
||
var rect = GUILayoutUtility.GetRect(Screen.width - 38, bannerHeight, GUI.skin.box); | ||
if (logo) | ||
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); | ||
|
||
if (!Application.isPlaying) | ||
{ | ||
var expand = false; | ||
var collapse = false; | ||
foreach (SteamVR_Camera target in targets) | ||
{ | ||
if (AssetDatabase.Contains(target)) | ||
continue; | ||
if (target.isExpanded) | ||
collapse = true; | ||
else | ||
expand = true; | ||
} | ||
|
||
if (expand) | ||
{ | ||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("Expand")) | ||
{ | ||
foreach (SteamVR_Camera target in targets) | ||
{ | ||
if (AssetDatabase.Contains(target)) | ||
continue; | ||
if (!target.isExpanded) | ||
{ | ||
target.Expand(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
} | ||
} | ||
GUILayout.Space(18); | ||
GUILayout.EndHorizontal(); | ||
} | ||
|
||
if (collapse) | ||
{ | ||
GUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("Collapse")) | ||
{ | ||
foreach (SteamVR_Camera target in targets) | ||
{ | ||
if (AssetDatabase.Contains(target)) | ||
continue; | ||
if (target.isExpanded) | ||
{ | ||
target.Collapse(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
} | ||
} | ||
GUILayout.Space(18); | ||
GUILayout.EndHorizontal(); | ||
} | ||
} | ||
|
||
EditorGUILayout.PropertyField(script); | ||
EditorGUILayout.PropertyField(wireframe); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
|
||
public static void ExportPackage() | ||
{ | ||
AssetDatabase.ExportPackage(new string[] { | ||
"Assets/SteamVR", | ||
"Assets/Plugins/openvr_api.cs", | ||
"Assets/Plugins/openvr_api.bundle", | ||
"Assets/Plugins/x86/openvr_api.dll", | ||
"Assets/Plugins/x86/steam_api.dll", | ||
"Assets/Plugins/x86/libsteam_api.so", | ||
"Assets/Plugins/x86_64/openvr_api.dll", | ||
"Assets/Plugins/x86_64/steam_api.dll", | ||
"Assets/Plugins/x86_64/libsteam_api.so", | ||
"Assets/Plugins/x86_64/libopenvr_api.so", | ||
}, "steamvr.unitypackage", ExportPackageOptions.Recurse); | ||
EditorApplication.Exit(0); | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | ||
// | ||
// Purpose: Preferences pane for how SteamVR plugin behaves. | ||
// | ||
//============================================================================= | ||
|
||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
public class SteamVR_Preferences | ||
{ | ||
/// <summary> | ||
/// Should SteamVR automatically enable VR when opening Unity or pressing play. | ||
/// </summary> | ||
public static bool AutoEnableVR | ||
{ | ||
get | ||
{ | ||
return EditorPrefs.GetBool("SteamVR_AutoEnableVR", true); | ||
} | ||
set | ||
{ | ||
EditorPrefs.SetBool("SteamVR_AutoEnableVR", value); | ||
} | ||
} | ||
|
||
[PreferenceItem("SteamVR")] | ||
static void PreferencesGUI() | ||
{ | ||
EditorGUILayout.BeginVertical(); | ||
EditorGUILayout.Space(); | ||
|
||
// Automatically Enable VR | ||
{ | ||
string title = "Automatically Enable VR"; | ||
string tooltip = "Should SteamVR automatically enable VR on launch and play?"; | ||
AutoEnableVR = EditorGUILayout.Toggle(new GUIContent(title, tooltip), AutoEnableVR); | ||
string helpMessage = "To enable VR manually:\n"; | ||
helpMessage += "- go to Edit -> Project Settings -> Player,\n"; | ||
helpMessage += "- tick 'Virtual Reality Supported',\n"; | ||
helpMessage += "- make sure OpenVR is in the 'Virtual Reality SDKs' list."; | ||
EditorGUILayout.HelpBox(helpMessage, MessageType.Info); | ||
} | ||
|
||
EditorGUILayout.EndVertical(); | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
//======= Copyright (c) Valve Corporation, All rights reserved. =============== | ||
// | ||
// Purpose: Custom inspector display for SteamVR_RenderModel | ||
// | ||
//============================================================================= | ||
|
||
using UnityEngine; | ||
using UnityEditor; | ||
using System.Text; | ||
using System.Collections.Generic; | ||
|
||
[CustomEditor(typeof(SteamVR_RenderModel)), CanEditMultipleObjects] | ||
public class SteamVR_RenderModelEditor : Editor | ||
{ | ||
SerializedProperty script, index, modelOverride, shader, verbose, createComponents, updateDynamically; | ||
|
||
static string[] renderModelNames; | ||
int renderModelIndex; | ||
|
||
void OnEnable() | ||
{ | ||
script = serializedObject.FindProperty("m_Script"); | ||
index = serializedObject.FindProperty("index"); | ||
modelOverride = serializedObject.FindProperty("modelOverride"); | ||
shader = serializedObject.FindProperty("shader"); | ||
verbose = serializedObject.FindProperty("verbose"); | ||
createComponents = serializedObject.FindProperty("createComponents"); | ||
updateDynamically = serializedObject.FindProperty("updateDynamically"); | ||
|
||
// Load render model names if necessary. | ||
if (renderModelNames == null) | ||
{ | ||
renderModelNames = LoadRenderModelNames(); | ||
} | ||
|
||
// Update renderModelIndex based on current modelOverride value. | ||
if (modelOverride.stringValue != "") | ||
{ | ||
for (int i = 0; i < renderModelNames.Length; i++) | ||
{ | ||
if (modelOverride.stringValue == renderModelNames[i]) | ||
{ | ||
renderModelIndex = i; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
static string[] LoadRenderModelNames() | ||
{ | ||
var results = new List<string>(); | ||
results.Add("None"); | ||
|
||
using (var holder = new SteamVR_RenderModel.RenderModelInterfaceHolder()) | ||
{ | ||
var renderModels = holder.instance; | ||
if (renderModels != null) | ||
{ | ||
uint count = renderModels.GetRenderModelCount(); | ||
for (uint i = 0; i < count; i++) | ||
{ | ||
var buffer = new StringBuilder(); | ||
var requiredSize = renderModels.GetRenderModelName(i, buffer, 0); | ||
if (requiredSize == 0) | ||
continue; | ||
|
||
buffer.EnsureCapacity((int)requiredSize); | ||
renderModels.GetRenderModelName(i, buffer, requiredSize); | ||
results.Add(buffer.ToString()); | ||
} | ||
} | ||
} | ||
|
||
return results.ToArray(); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
|
||
EditorGUILayout.PropertyField(script); | ||
EditorGUILayout.PropertyField(index); | ||
//EditorGUILayout.PropertyField(modelOverride); | ||
|
||
GUILayout.BeginHorizontal(); | ||
GUILayout.Label(new GUIContent("Model Override", SteamVR_RenderModel.modelOverrideWarning)); | ||
var selected = EditorGUILayout.Popup(renderModelIndex, renderModelNames); | ||
if (selected != renderModelIndex) | ||
{ | ||
renderModelIndex = selected; | ||
modelOverride.stringValue = (selected > 0) ? renderModelNames[selected] : ""; | ||
} | ||
GUILayout.EndHorizontal(); | ||
|
||
EditorGUILayout.PropertyField(shader); | ||
EditorGUILayout.PropertyField(verbose); | ||
EditorGUILayout.PropertyField(createComponents); | ||
EditorGUILayout.PropertyField(updateDynamically); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
Extensions/SteamVR/Editor/SteamVR_RenderModelEditor.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.