浏览代码
- Updated ShadowsTest scene with a setup of cameras.
- Updated ShadowsTest scene with a setup of cameras.
- Split Input Registering code from DebugActionManager and used it to register inputs for FreeCamera/main
Julien Ignace
7 年前
当前提交
55bd39cb
共有 7 个文件被更改,包括 1051 次插入 和 130 次删除
-
884SampleScenes/HDTest/ShadowsTest.unity
-
81ScriptableRenderPipeline/Core/Camera/FreeCamera.cs
-
100ScriptableRenderPipeline/Core/Debugging/DebugActionManager.cs
-
10ScriptableRenderPipeline/Core/Inputs.meta
-
93ScriptableRenderPipeline/Core/Inputs/InputRegistering.cs
-
13ScriptableRenderPipeline/Core/Inputs/InputRegistering.cs.meta
884
SampleScenes/HDTest/ShadowsTest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: edb108228f2caa44ca8154fd4985e101 |
|||
folderAsset: yes |
|||
timeCreated: 1504859102 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEngine.Experimental |
|||
{ |
|||
#if UNITY_EDITOR
|
|||
public class InputManagerEntry |
|||
{ |
|||
public enum Kind { KeyOrButton, Mouse, Axis } |
|||
public enum Axis { X, Y, Third, Fourth, Fifth, Sixth, Seventh, Eigth } |
|||
public enum Joy { All, First, Second } |
|||
|
|||
public string name = ""; |
|||
public string desc = ""; |
|||
public string btnNegative = ""; |
|||
public string btnPositive = ""; |
|||
public string altBtnNegative = ""; |
|||
public string altBtnPositive = ""; |
|||
public float gravity = 0.0f; |
|||
public float deadZone = 0.0f; |
|||
public float sensitivity = 0.0f; |
|||
public bool snap = false; |
|||
public bool invert = false; |
|||
public Kind kind = Kind.Axis; |
|||
public Axis axis = Axis.X; |
|||
public Joy joystick = Joy.All; |
|||
} |
|||
|
|||
public class InputRegistering |
|||
{ |
|||
|
|||
static bool InputAlreadyRegistered(string name, InputManagerEntry.Kind kind, UnityEditor.SerializedProperty spAxes) |
|||
{ |
|||
for (var i = 0; i < spAxes.arraySize; ++i) |
|||
{ |
|||
var spAxis = spAxes.GetArrayElementAtIndex(i); |
|||
var axisName = spAxis.FindPropertyRelative("m_Name").stringValue; |
|||
var kindValue = spAxis.FindPropertyRelative("type").intValue; |
|||
if (axisName == name && (int)kind == kindValue) |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
static void WriteEntry(UnityEditor.SerializedProperty spAxes, InputManagerEntry entry) |
|||
{ |
|||
if (InputAlreadyRegistered(entry.name, entry.kind, spAxes)) |
|||
return; |
|||
|
|||
spAxes.InsertArrayElementAtIndex(spAxes.arraySize); |
|||
var spAxis = spAxes.GetArrayElementAtIndex(spAxes.arraySize - 1); |
|||
spAxis.FindPropertyRelative("m_Name").stringValue = entry.name; |
|||
spAxis.FindPropertyRelative("descriptiveName").stringValue = entry.desc; |
|||
spAxis.FindPropertyRelative("negativeButton").stringValue = entry.btnNegative; |
|||
spAxis.FindPropertyRelative("altNegativeButton").stringValue = entry.altBtnNegative; |
|||
spAxis.FindPropertyRelative("positiveButton").stringValue = entry.btnPositive; |
|||
spAxis.FindPropertyRelative("altPositiveButton").stringValue = entry.altBtnPositive; |
|||
spAxis.FindPropertyRelative("gravity").floatValue = entry.gravity; |
|||
spAxis.FindPropertyRelative("dead").floatValue = entry.deadZone; |
|||
spAxis.FindPropertyRelative("sensitivity").floatValue = entry.sensitivity; |
|||
spAxis.FindPropertyRelative("snap").boolValue = entry.snap; |
|||
spAxis.FindPropertyRelative("invert").boolValue = entry.invert; |
|||
spAxis.FindPropertyRelative("type").intValue = (int)entry.kind; |
|||
spAxis.FindPropertyRelative("axis").intValue = (int)entry.axis; |
|||
spAxis.FindPropertyRelative("joyNum").intValue = (int)entry.joystick; |
|||
} |
|||
|
|||
static public void RegisterInputs(List<InputManagerEntry> entries) |
|||
{ |
|||
// Grab reference to input manager
|
|||
var currentSelection = UnityEditor.Selection.activeObject; |
|||
UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Project Settings/Input"); |
|||
var inputManager = UnityEditor.Selection.activeObject; |
|||
|
|||
// Wrap in serialized object
|
|||
var soInputManager = new UnityEditor.SerializedObject(inputManager); |
|||
var spAxes = soInputManager.FindProperty("m_Axes"); |
|||
|
|||
foreach(InputManagerEntry entry in entries) |
|||
{ |
|||
WriteEntry(spAxes, entry); |
|||
} |
|||
|
|||
// Commit
|
|||
soInputManager.ApplyModifiedProperties(); |
|||
|
|||
UnityEditor.Selection.activeObject = currentSelection; |
|||
} |
|||
} |
|||
#endif
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 130ea682941bc7e48a1cd0af4ce3844c |
|||
timeCreated: 1504859117 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue