Compare commits
298 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e75e412d10 | |||
| 156571e376 | |||
| 1e7dc01762 | |||
| 879a715b09 | |||
| dc185b4f22 | |||
| a0d2a00a3a | |||
| 5c6b226b64 | |||
| 222d183086 | |||
| 200db545b9 | |||
| f177384da3 | |||
|
|
bfa05a93e3 | ||
|
|
4d53839164 | ||
|
|
0d22094ba4 | ||
|
|
ab5d034f6e | ||
|
|
9e7a685815 | ||
|
|
fd9bc37467 | ||
|
|
f1ef79a103 | ||
|
|
6dcd64ddc7 | ||
| fbfbb8cbaf | |||
| 90b4c46988 | |||
| a3a2732060 | |||
|
|
48f5a48639 | ||
|
|
039b347475 | ||
|
|
3d37b1a61e | ||
|
|
c0effaf025 | ||
|
|
66e07c9bdc | ||
|
|
3a15ab000f | ||
|
|
0a609ce083 | ||
|
|
36660c8495 | ||
|
|
70f9edc918 | ||
|
|
c7c92f3e53 | ||
|
|
d7c2f3b960 | ||
|
|
27afc9d501 | ||
|
|
f1a4ced59d | ||
|
|
8b199b9c78 | ||
|
|
ea9deb82fb | ||
|
|
83ab3a6dbe | ||
|
|
9e19dfd5af | ||
|
|
c852dc4a1e | ||
|
|
ddb76e71de | ||
|
|
78a3d2f38a | ||
|
|
0d6446ae18 | ||
| 9e5916d06c | |||
|
|
3c853c3ba1 | ||
|
|
9489cdc5b5 | ||
|
|
46da2dfe1b | ||
|
|
65aad9159e | ||
|
|
c0256f8c9b | ||
|
|
eeb74e2491 | ||
|
|
bf7cd6c188 | ||
|
|
64e5a573cb | ||
|
|
43edc40b53 | ||
| 411b97e33d | |||
| 27fc3b7eb6 | |||
| ff47263fce | |||
| 0cdbfadfa5 | |||
| 227c242589 | |||
| 9b31c9a7d3 | |||
| 81b7fee9ea | |||
| 285aefc2ae | |||
| 64af1d26da | |||
| efefc4b9fd | |||
| 14ac81f2f2 | |||
| 43bd355b29 | |||
| dc166b9246 | |||
| 143add636f | |||
| 0cb43c31d0 | |||
| 14d30d28e3 | |||
| 115fe62c49 | |||
| ba8d8cf6e0 | |||
|
|
bc6d236e1a | ||
|
|
5d2459979c | ||
|
|
e33f599371 | ||
|
|
927dfff7d1 | ||
|
|
e3ea1ce371 | ||
|
|
31583b828a | ||
|
|
3d340c4312 | ||
|
|
178d242762 | ||
|
|
34c45dc39a | ||
|
|
c013cf0722 | ||
|
|
f19acc5133 | ||
|
|
71075deb47 | ||
|
|
816bad12c2 | ||
|
|
3f3f7f4d77 | ||
|
|
6c0170e4cf | ||
| 0174e943e7 | |||
| 8e768343d8 | |||
| cfde4632cd | |||
|
|
5138587eef | ||
|
|
d3cafd3c15 | ||
|
|
a69e74e853 | ||
|
|
724dd8a07a | ||
|
|
c4bd28c4e7 | ||
|
|
1e616284c0 | ||
|
|
d2fe125488 | ||
|
|
7c46b252dd | ||
|
|
a7498aeb9f | ||
| 9093521f43 | |||
| aa61ffd2f4 | |||
|
|
43cf7767c4 | ||
|
|
750fccaaaa | ||
| 6d3c7edd0d | |||
| e991920a18 | |||
|
|
8769d7328f | ||
|
|
ab36bea0a7 | ||
|
|
17f8325b37 | ||
|
|
a5d3dc6938 | ||
|
|
2f458dde27 | ||
|
|
3e448bc472 | ||
|
|
70e9210167 | ||
|
|
a69f8c4eac | ||
|
|
277662d107 | ||
|
|
0bacb58481 | ||
|
|
cde1f4b594 | ||
|
|
fc79ea1a39 | ||
|
|
af0fc71edd | ||
|
|
2ab022b22b | ||
|
|
5e4d59d30a | ||
|
|
6c94ef65f8 | ||
|
|
870b5a5546 | ||
|
|
78a3a5119f | ||
|
|
1704c4bc05 | ||
|
|
77c9e37aef | ||
|
|
4d7ab052a2 | ||
|
|
80ab32d237 | ||
|
|
ff63a67d9a | ||
|
|
78cb4e4044 | ||
|
|
4eb1f1722d | ||
|
|
e646ef0f7d | ||
| 2b055edb6c | |||
|
|
f99b3b9842 | ||
|
|
6cbdb9dfcb | ||
|
|
168e30c094 | ||
|
|
abab50dc76 | ||
|
|
4f3088685d | ||
|
|
098f544a37 | ||
|
|
4a16af4dce | ||
|
|
6e1fb738e6 | ||
| 41b3755252 | |||
|
|
d04deb59e1 | ||
|
|
cfc3b22c00 | ||
|
|
f447b2b301 | ||
| 2738e5c9f0 | |||
| afb4a704ef | |||
| 9f8f819666 | |||
| 2cfc53e876 | |||
| ed750c012b | |||
| 02329b3532 | |||
| 87672ce3ee | |||
| 6b3934cdd0 | |||
| 4ede9f8c31 | |||
| dfea57877e | |||
| 85c24ecea0 | |||
| 50b76d64f0 | |||
| 1d99d6d15d | |||
| 328edcb44c | |||
| 69a1ed2fff | |||
| a055ff337a | |||
| 16f6d72219 | |||
| d11396b8bc | |||
| 188342a40f | |||
| 3aed07a76a | |||
| 47223965a2 | |||
| 13a43aa1e5 | |||
| cb6f90da98 | |||
| 284c77d0a2 | |||
| 450ec9012f | |||
| 54cb265be1 | |||
| 704559e150 | |||
| 2bcf3e5c10 | |||
| 3551dcfd17 | |||
| 021efa5cb5 | |||
| 221818a81c | |||
| c8c2a855c2 | |||
| 20db91147d | |||
| ad17216055 | |||
| 80a5581054 | |||
| ae7112de56 | |||
| 59f4add2ac | |||
| 219f2f987c | |||
| 998683a881 | |||
| 03948b8b01 | |||
| 1f1e26615c | |||
| eeb0009545 | |||
| 59558c09e3 | |||
| 555c5fd2d8 | |||
| d476b2c269 | |||
| c252ba8b51 | |||
| 513092ca16 | |||
| 550cc04519 | |||
| a7bdaa081f | |||
| 8a3a2be643 | |||
| 4648565214 | |||
| 9034590707 | |||
| 228b5925b7 | |||
| a75c4b38ec | |||
| 94690b38e1 | |||
| 145bb2e8bf | |||
| b7dd213e3a | |||
| cb93a3b7f7 | |||
|
|
70389b2d64 | ||
|
|
4c3edd4f80 | ||
|
|
0df37f9c28 | ||
| 8b553966c4 | |||
| 41c66b3eb6 | |||
| 6166df3e80 | |||
| 24a0f22ce1 | |||
| 3d7fff1c15 | |||
| 6bebede2a1 | |||
| 660d03ef67 | |||
| 44cedfc8ad | |||
| 31ff5058f8 | |||
| 39cc19df48 | |||
| 58532dda73 | |||
| 9e0911359b | |||
| 7ee6e7a4d3 | |||
| 461006c8b4 | |||
|
|
29de3d1b69 | ||
|
|
659353122e | ||
|
|
f6eb8fcf7b | ||
| 6f760f4a92 | |||
| 14937d96b9 | |||
| c7c5ab59e6 | |||
| 71085cd6ee | |||
| 41409d627d | |||
| 4b3bd49242 | |||
| 075a5d7ba1 | |||
| 7d41944b98 | |||
| 8d7142f3b0 | |||
| 9f7a96187f | |||
| 04c589dec9 | |||
| 13a48376a3 | |||
| 2c25f7832b | |||
| f60f7a5634 | |||
| c512dd42c3 | |||
| d6de90fbe9 | |||
| 18735e37e2 | |||
| 45cd4a16ef | |||
| d5de37a168 | |||
| 7262f48fb2 | |||
| 68800cd96f | |||
| ce9546b8ea | |||
| ec4e2a2ea2 | |||
| 21110b5be5 | |||
| acae3becdc | |||
| 5fe3fda9f2 | |||
| 88cdf0de98 | |||
| dd759b878f | |||
|
|
a24c86db3f | ||
|
|
3596f0067e | ||
|
|
daf16351cd | ||
| b01ebb0570 | |||
| 8dbfb46b40 | |||
| aa5b67b3e9 | |||
| f7b7a5b731 | |||
| 48b60e7ef3 | |||
| 1e0e10670e | |||
| a9e3c7c2fa | |||
|
|
e8148b9554 | ||
|
|
ed82c63541 | ||
| 5eec7f1db9 | |||
| 9ca6efa569 | |||
| c3470fc005 | |||
| bf42b39a7b | |||
| ca5ccb9057 | |||
| 75f8a50009 | |||
| 5f38cf7a00 | |||
| d1b428597b | |||
| 5d8e3fbcb7 | |||
| 84b75d5750 | |||
| 5c42ec2230 | |||
| 2747c1e0af | |||
| 512c035917 | |||
| 9c3cdab4bc | |||
| 54c09cc9ab | |||
| 3b2abc2dd9 | |||
| 9541a8c4a7 | |||
| 1f4e410688 | |||
| 2294c78e90 | |||
| aa635f351e | |||
| 88ac83ea46 | |||
| 7496bc6e2a | |||
| 0a01cee64b | |||
| 3df0445d42 | |||
| 629b9987c5 | |||
| 294431ebdb | |||
| 1643444c17 | |||
| 64f5e74f00 | |||
|
|
1b875d9f56 | ||
|
|
a222f1e64f | ||
|
|
c02a9fffe5 | ||
| de2eb6188d | |||
|
|
fce1d284f4 | ||
|
|
bbe8783455 | ||
|
|
38bd96aa03 | ||
|
|
1c0ac513af | ||
|
|
c97a54a009 | ||
|
|
6d7f56e289 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Samples
|
||||||
|
Samples.meta
|
||||||
|
package.json
|
||||||
|
package.json.meta
|
||||||
|
Samples~.meta
|
||||||
5
CONTRIBUTING.md
Normal file
5
CONTRIBUTING.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Contibuting to Humanoid Control Free
|
||||||
|
====================================
|
||||||
|
If you want to contribute to this project, make sure you have access to the repository.
|
||||||
|
You can request access by logging into our [GitLab site](https://gitlab.passervr.com/) with an GitHub or Google account.
|
||||||
|
Besides that, it is best to [contract us](https://passervr.com/contract) about you wanting to contribute to this project. This will ensure you will get access more quickly.
|
||||||
7
CONTRIBUTING.md.meta
Normal file
7
CONTRIBUTING.md.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c55d00a05de5d8340a1a49f5d8b2aeed
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -219,7 +219,7 @@ namespace Passer.Humanoid {
|
|||||||
for (int i = 0; i < hcScripts.Length; i++) {
|
for (int i = 0; i < hcScripts.Length; i++) {
|
||||||
string assetPath = AssetDatabase.GUIDToAssetPath(hcScripts[i]);
|
string assetPath = AssetDatabase.GUIDToAssetPath(hcScripts[i]);
|
||||||
if (assetPath.Length > 36 && assetPath.Substring(assetPath.Length - 27, 27) == "/Scripts/HumanoidControl.cs") {
|
if (assetPath.Length > 36 && assetPath.Substring(assetPath.Length - 27, 27) == "/Scripts/HumanoidControl.cs") {
|
||||||
humanoidPath = assetPath.Substring(6, assetPath.Length - 24);
|
humanoidPath = assetPath.Substring(0, assetPath.Length - 18);
|
||||||
return humanoidPath;
|
return humanoidPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +250,6 @@ namespace Passer.Humanoid {
|
|||||||
//anyChanged |= SteamVRSettingUI(serializedConfiguration);
|
//anyChanged |= SteamVRSettingUI(serializedConfiguration);
|
||||||
//anyChanged |= OculusSettingUI(serializedConfiguration);
|
//anyChanged |= OculusSettingUI(serializedConfiguration);
|
||||||
//anyChanged |= WindowsMRSettingUI(serializedConfiguration);
|
//anyChanged |= WindowsMRSettingUI(serializedConfiguration);
|
||||||
//anyChanged |= VrtkSettingUI(serializedConfiguration);
|
|
||||||
|
|
||||||
//anyChanged |= LeapSettingUI(serializedConfiguration);
|
//anyChanged |= LeapSettingUI(serializedConfiguration);
|
||||||
//anyChanged |= Kinect1SettingUI(serializedConfiguration);
|
//anyChanged |= Kinect1SettingUI(serializedConfiguration);
|
||||||
@ -270,7 +269,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
//anyChanged |= NetworkingSettingUI(serializedConfiguration);
|
//anyChanged |= NetworkingSettingUI(serializedConfiguration);
|
||||||
|
|
||||||
anyChanged |= HumanoidSceneInspector(serializedConfiguration);
|
//anyChanged |= HumanoidSceneInspector(serializedConfiguration);
|
||||||
|
|
||||||
return anyChanged;
|
return anyChanged;
|
||||||
}
|
}
|
||||||
@ -279,35 +278,33 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
private static string[] personalHumanoidNames;
|
private static string[] personalHumanoidNames;
|
||||||
|
|
||||||
public static bool HumanoidSceneInspector(SerializedObject serializedConfiguration) {
|
//public static bool HumanoidSceneInspector(SerializedObject serializedConfiguration) {
|
||||||
bool anyChanged = false;
|
// bool anyChanged = false;
|
||||||
SerializedProperty humanoidSceneNameProp = serializedConfiguration.FindProperty("humanoidSceneName");
|
// SerializedProperty humanoidSceneNameProp = serializedConfiguration.FindProperty("humanoidSceneName");
|
||||||
|
|
||||||
if (HumanoidVisitors.visitors.Count <= 0)
|
// if (HumanoidVisitors.visitors.Count <= 0)
|
||||||
return false;
|
// return false;
|
||||||
|
|
||||||
personalHumanoidNames = new string[HumanoidVisitors.visitors.Count];
|
// personalHumanoidNames = new string[HumanoidVisitors.visitors.Count];
|
||||||
int i = 0;
|
// int i = 0;
|
||||||
int ix;
|
// int ix;
|
||||||
foreach (string personalHumanoid in HumanoidVisitors.visitors) {
|
// foreach (string personalHumanoid in HumanoidVisitors.visitors) {
|
||||||
string name = personalHumanoid;
|
// string name = personalHumanoid;
|
||||||
ix = name.LastIndexOf('/');
|
// ix = name.LastIndexOf('/');
|
||||||
name = name.Substring(ix + 1);
|
// name = name.Substring(ix + 1);
|
||||||
name = name.Substring(0, name.Length - 6); // remove .unity
|
// name = name.Substring(0, name.Length - 6); // remove .unity
|
||||||
personalHumanoidNames[i++] = name;
|
// personalHumanoidNames[i++] = name;
|
||||||
}
|
// }
|
||||||
|
|
||||||
ix = HumanoidVisitors.visitors.FindIndex(name => name == humanoidSceneNameProp.stringValue);
|
// ix = HumanoidVisitors.visitors.FindIndex(name => name == humanoidSceneNameProp.stringValue);
|
||||||
if (ix < 0)
|
// if (ix < 0)
|
||||||
ix = 0;
|
// ix = 0;
|
||||||
ix = EditorGUILayout.Popup("Testing Visitor", ix, personalHumanoidNames);
|
// ix = EditorGUILayout.Popup("Testing Visitor", ix, personalHumanoidNames);
|
||||||
anyChanged = humanoidSceneNameProp.stringValue != HumanoidVisitors.visitors[ix];
|
// anyChanged = humanoidSceneNameProp.stringValue != HumanoidVisitors.visitors[ix];
|
||||||
if (anyChanged)
|
|
||||||
Passer.Humanoid.HumanoidVisitors.SetPersonalHumanoid(humanoidSceneNameProp.stringValue, HumanoidVisitors.visitors[ix]);
|
|
||||||
|
|
||||||
humanoidSceneNameProp.stringValue = HumanoidVisitors.visitors[ix];
|
// humanoidSceneNameProp.stringValue = HumanoidVisitors.visitors[ix];
|
||||||
return anyChanged;
|
// return anyChanged;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public static bool OpenVRSettingUI(SerializedObject serializedConfiguration) {
|
public static bool OpenVRSettingUI(SerializedObject serializedConfiguration) {
|
||||||
bool anyChanged = false;
|
bool anyChanged = false;
|
||||||
@ -432,24 +429,6 @@ namespace Passer.Humanoid {
|
|||||||
return anyChanged;
|
return anyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool VrtkSettingUI(SerializedObject serializedConfiguration) {
|
|
||||||
|
|
||||||
SerializedProperty vrtkSupportProp = serializedConfiguration.FindProperty("vrtkSupport");
|
|
||||||
|
|
||||||
if (!isVrtkSupportAvailable)
|
|
||||||
vrtkSupportProp.boolValue = false;
|
|
||||||
|
|
||||||
else if (!isVrtkAvailable) {
|
|
||||||
using (new EditorGUI.DisabledScope(true)) {
|
|
||||||
EditorGUILayout.Toggle("VRTK Supoort", false);
|
|
||||||
}
|
|
||||||
EditorGUILayout.HelpBox("VRTK is not available. Please download it from the Asset Store.", MessageType.Warning, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vrtkSupportProp.boolValue = EditorGUILayout.Toggle("VRTK Support", vrtkSupportProp.boolValue);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool LeapSettingUI(SerializedObject serializedConfiguration) {
|
public static bool LeapSettingUI(SerializedObject serializedConfiguration) {
|
||||||
SerializedProperty leapSupportProp = serializedConfiguration.FindProperty("leapSupport");
|
SerializedProperty leapSupportProp = serializedConfiguration.FindProperty("leapSupport");
|
||||||
|
|
||||||
@ -802,7 +781,6 @@ namespace Passer.Humanoid {
|
|||||||
configuration.viveTrackerSupport = CheckExtensionViveTracker(configuration);
|
configuration.viveTrackerSupport = CheckExtensionViveTracker(configuration);
|
||||||
configuration.oculusSupport = CheckExtensionOculus(configuration);
|
configuration.oculusSupport = CheckExtensionOculus(configuration);
|
||||||
configuration.windowsMRSupport = CheckExtensionWindowsMR(configuration);
|
configuration.windowsMRSupport = CheckExtensionWindowsMR(configuration);
|
||||||
configuration.vrtkSupport = CheckExtensionVRTK(configuration);
|
|
||||||
configuration.neuronSupport = CheckExtensionNeuron(configuration);
|
configuration.neuronSupport = CheckExtensionNeuron(configuration);
|
||||||
configuration.hi5Support = CheckExtensionHi5(configuration);
|
configuration.hi5Support = CheckExtensionHi5(configuration);
|
||||||
configuration.realsenseSupport = CheckExtensionRealsense(configuration);
|
configuration.realsenseSupport = CheckExtensionRealsense(configuration);
|
||||||
@ -835,7 +813,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public static bool CheckExtensionOpenVR(Configuration configuration) {
|
public static bool CheckExtensionOpenVR(Configuration configuration) {
|
||||||
bool enabled = true; // configuration.openVRSupport;
|
bool enabled = true; // configuration.openVRSupport;
|
||||||
CheckExtension(isViveHandTrackingAvailable, "hVIVEHAND");
|
CheckExtension(isViveHandTrackingAvailable & isViveHandSupportAvailable, "hVIVEHAND");
|
||||||
return CheckExtension(enabled, openVRPath, "hOPENVR");
|
return CheckExtension(enabled, openVRPath, "hOPENVR");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,8 +828,12 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckExtensionViveTracker(Configuration configuration) {
|
public static bool CheckExtensionViveTracker(Configuration configuration) {
|
||||||
bool available = isViveTrackerSupportAvailable;
|
#if UNITY_STANDALONE_WIN
|
||||||
bool enabled = configuration.viveTrackerSupport;
|
bool available = isSteamVrAvailable && isViveTrackerSupportAvailable;
|
||||||
|
#else
|
||||||
|
bool available = false;
|
||||||
|
#endif
|
||||||
|
bool enabled = true; // configuration.viveTrackerSupport;
|
||||||
CheckExtension(available && enabled, "hVIVETRACKER");
|
CheckExtension(available && enabled, "hVIVETRACKER");
|
||||||
return available && enabled;
|
return available && enabled;
|
||||||
}
|
}
|
||||||
@ -867,15 +849,14 @@ namespace Passer.Humanoid {
|
|||||||
return CheckExtension(enabled, windowsMRPath, "hWINDOWSMR");
|
return CheckExtension(enabled, windowsMRPath, "hWINDOWSMR");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckExtensionVRTK(Configuration configuration) {
|
|
||||||
bool enabled = configuration.vrtkSupport && isVrtkAvailable;
|
|
||||||
CheckExtension(enabled, "hVRTK");
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CheckExtensionNeuron(Configuration configuration) {
|
public static bool CheckExtensionNeuron(Configuration configuration) {
|
||||||
bool enabled = configuration.neuronSupport;
|
#if UNITY_STANDALONE_WIN
|
||||||
return CheckExtension(enabled, neuronPath, "hNEURON");
|
bool enabled = isNeuronSupportAvailable;
|
||||||
|
#else
|
||||||
|
bool enabled = false;
|
||||||
|
#endif
|
||||||
|
CheckExtension(enabled, "hNEURON");
|
||||||
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckExtensionHi5(Configuration configuration) {
|
public static bool CheckExtensionHi5(Configuration configuration) {
|
||||||
@ -893,6 +874,7 @@ namespace Passer.Humanoid {
|
|||||||
public static bool CheckExtensionLeap(Configuration configuration) {
|
public static bool CheckExtensionLeap(Configuration configuration) {
|
||||||
bool available = isLeapAvailable && isLeapSupportAvailable;
|
bool available = isLeapAvailable && isLeapSupportAvailable;
|
||||||
CheckExtension(available, "hLEAP");
|
CheckExtension(available, "hLEAP");
|
||||||
|
CheckExtension(isUltraLeapAvailable, "hULTRALEAP");
|
||||||
configuration.leapSupport = available;
|
configuration.leapSupport = available;
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
@ -951,6 +933,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public static bool CheckExtensionOptitrack(Configuration configuration) {
|
public static bool CheckExtensionOptitrack(Configuration configuration) {
|
||||||
bool available = isOptitrackAvailable && isOptitrackSupportAvailable;
|
bool available = isOptitrackAvailable && isOptitrackSupportAvailable;
|
||||||
|
available = false; // hard disable because the code currently contains bugs
|
||||||
CheckExtension(available, "hOPTITRACK");
|
CheckExtension(available, "hOPTITRACK");
|
||||||
configuration.optitrackSupport = available;
|
configuration.optitrackSupport = available;
|
||||||
return available;
|
return available;
|
||||||
@ -970,7 +953,7 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckExtensionNetworking(Configuration configuration) {
|
private static void CheckExtensionNetworking(Configuration configuration) {
|
||||||
if (isPhotonPun2Available) {
|
if (isPhotonPun2Available && isPhotonPun2SupportAvailable) {
|
||||||
GlobalDefine("hPHOTON2");
|
GlobalDefine("hPHOTON2");
|
||||||
GlobalUndefine("hPHOTON1");
|
GlobalUndefine("hPHOTON1");
|
||||||
//Debug.Log(isPhotonVoice2Available);
|
//Debug.Log(isPhotonVoice2Available);
|
||||||
@ -1040,7 +1023,7 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckFaceTracking(Configuration configuration) {
|
private static void CheckFaceTracking(Configuration configuration) {
|
||||||
if (IsFileAvailable(facePath)) {
|
if (DoesTypeExist("Passer.Humanoid.FaceTarget")) {
|
||||||
GlobalDefine("hFACE");
|
GlobalDefine("hFACE");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1115,9 +1098,9 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Availability
|
#region Availability
|
||||||
|
|
||||||
public static bool DoesTypeExist(string className) {
|
public static bool DoesTypeExist(string className) {
|
||||||
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||||
@ -1128,7 +1111,7 @@ namespace Passer.Humanoid {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SDKs
|
#region SDKs
|
||||||
|
|
||||||
protected static bool isUnityXRAvailable {
|
protected static bool isUnityXRAvailable {
|
||||||
get {
|
get {
|
||||||
@ -1137,6 +1120,9 @@ namespace Passer.Humanoid {
|
|||||||
return false;
|
return false;
|
||||||
if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.management"))
|
if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.management"))
|
||||||
return true;
|
return true;
|
||||||
|
else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.oculus"))
|
||||||
|
// Somehow management is no longer available when Oculus is used
|
||||||
|
return true;
|
||||||
else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.openxr"))
|
else if (ConfigurationCheck.packageNameList.Contains("com.unity.xr.openxr"))
|
||||||
// Somehow management is no longer available when OpenXR is used
|
// Somehow management is no longer available when OpenXR is used
|
||||||
return true;
|
return true;
|
||||||
@ -1150,8 +1136,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
private static bool isSteamVrAvailable {
|
private static bool isSteamVrAvailable {
|
||||||
get {
|
get {
|
||||||
return false;
|
return DoesTypeExist("Valve.VR.SteamVR");
|
||||||
//return DoesTypeExist("Valve.VR.SteamVR");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1165,18 +1150,18 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool isVrtkAvailable {
|
|
||||||
get {
|
|
||||||
return DoesTypeExist("VRTK.VRTK_SDKManager");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool isLeapAvailable {
|
private static bool isLeapAvailable {
|
||||||
get {
|
get {
|
||||||
return DoesTypeExist("Leap.Hand");
|
return DoesTypeExist("Leap.Hand");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool isUltraLeapAvailable {
|
||||||
|
get {
|
||||||
|
return DoesTypeExist("Leap.Unity.LeapTestProvider") == false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static bool isAstraAvailable {
|
private static bool isAstraAvailable {
|
||||||
get {
|
get {
|
||||||
return DoesTypeExist("Astra.Body");
|
return DoesTypeExist("Astra.Body");
|
||||||
@ -1293,6 +1278,12 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool isViveHandSupportAvailable {
|
||||||
|
get {
|
||||||
|
return DoesTypeExist("Passer.Tracking.ViveHandSkeleton");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static bool isViveTrackerSupportAvailable {
|
private static bool isViveTrackerSupportAvailable {
|
||||||
get {
|
get {
|
||||||
return DoesTypeExist("Passer.Tracking.ViveTrackerComponent");
|
return DoesTypeExist("Passer.Tracking.ViveTrackerComponent");
|
||||||
@ -1322,11 +1313,6 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
private static bool isVrtkSupportAvailable {
|
|
||||||
get {
|
|
||||||
return DoesTypeExist("Passer.Humanoid.VrtkTracker");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool isLeapSupportAvailable {
|
private static bool isLeapSupportAvailable {
|
||||||
get {
|
get {
|
||||||
@ -1404,7 +1390,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
private static bool isNeuronSupportAvailable {
|
private static bool isNeuronSupportAvailable {
|
||||||
get {
|
get {
|
||||||
return DoesTypeExist("Passer.Humanoid.NeuronTracker");
|
return DoesTypeExist("Passer.Tracking.PerceptionNeuron");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,6 +1421,12 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool isPhotonPun2SupportAvailable {
|
||||||
|
get {
|
||||||
|
return DoesTypeExist("Passer.Humanoid.HumanoidPlayerPunVoice");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Support
|
#endregion Support
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f3801143a6543eb41b3ce964163751e1
|
guid: 693f9f816fd82f44283cd7bf2ed3ef93
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
190
Editor/HumanoidControl/Extensions/Custom/Custom_Editor.cs
Normal file
190
Editor/HumanoidControl/Extensions/Custom/Custom_Editor.cs
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
#if hCUSTOM
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Passer.Humanoid {
|
||||||
|
using Passer.Tracking;
|
||||||
|
|
||||||
|
public class Custom_Editor : Tracker_Editor {
|
||||||
|
|
||||||
|
#region Tracker
|
||||||
|
|
||||||
|
public class TrackerProps : HumanoidControl_Editor.HumanoidTrackerProps {
|
||||||
|
protected SerializedProperty bodySkeletonProp;
|
||||||
|
|
||||||
|
public TrackerProps(SerializedObject serializedObject, HumanoidControl_Editor.HumanoidTargetObjs targetObjs, CustomTracker _custom)
|
||||||
|
: base(serializedObject, targetObjs, _custom, "custom") {
|
||||||
|
tracker = _custom;
|
||||||
|
|
||||||
|
bodySkeletonProp = serializedObject.FindProperty(nameof(HumanoidControl.custom) + "." + nameof(HumanoidControl.custom.bodySkeleton));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Inspector(HumanoidControl humanoid) {
|
||||||
|
Inspector(humanoid, "Custom");
|
||||||
|
|
||||||
|
if (humanoid.custom.enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
bodySkeletonProp.objectReferenceValue = (BodySkeleton)EditorGUILayout.ObjectField("Body Skeleton", bodySkeletonProp.objectReferenceValue, typeof(BodySkeleton), true);
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Tracker
|
||||||
|
|
||||||
|
#region Head
|
||||||
|
|
||||||
|
public class HeadTargetProps : HeadTarget_Editor.TargetProps {
|
||||||
|
protected SerializedProperty sensorProp;
|
||||||
|
|
||||||
|
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
||||||
|
: base(serializedObject, headTarget.custom, headTarget, "custom") {
|
||||||
|
|
||||||
|
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Inspector() {
|
||||||
|
if (headTarget.humanoid.custom.enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(headTarget.custom, headTarget);
|
||||||
|
headTarget.custom.enabled = enabledProp.boolValue;
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
headTarget.custom.SetSensor2Target();
|
||||||
|
headTarget.custom.ShowSensor(headTarget.humanoid.showRealObjects && headTarget.showRealObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledProp.boolValue) {
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
if (sensorProp.objectReferenceValue == null && headTarget.custom.sensorComponent != null)
|
||||||
|
sensorProp.objectReferenceValue = headTarget.custom.sensorComponent; // sensorTransform.GetComponent<SensorComponent>();
|
||||||
|
|
||||||
|
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||||
|
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Head
|
||||||
|
|
||||||
|
#region Hand
|
||||||
|
|
||||||
|
public class HandTargetProps : HandTarget_Editor.TargetProps {
|
||||||
|
protected SerializedProperty sensorProp;
|
||||||
|
protected SerializedProperty attachedBoneProp;
|
||||||
|
|
||||||
|
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
||||||
|
: base(serializedObject, handTarget.custom, handTarget, "custom") {
|
||||||
|
|
||||||
|
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||||
|
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Inspector() {
|
||||||
|
if (handTarget.humanoid.custom.enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(handTarget.custom, handTarget);
|
||||||
|
handTarget.custom.enabled = enabledProp.boolValue;
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
handTarget.custom.SetSensor2Target();
|
||||||
|
handTarget.custom.ShowSensor(handTarget.humanoid.showRealObjects && handTarget.showRealObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledProp.boolValue) {
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
if (sensorProp.objectReferenceValue == null && handTarget.custom.sensorComponent != null)
|
||||||
|
sensorProp.objectReferenceValue = handTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||||
|
|
||||||
|
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||||
|
attachedBoneProp.intValue = (int)(ArmBones)EditorGUILayout.EnumPopup("Bone", (ArmBones)attachedBoneProp.intValue);
|
||||||
|
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Hand
|
||||||
|
|
||||||
|
#region Hips
|
||||||
|
|
||||||
|
public class HipsTargetProps : HipsTarget_Editor.TargetProps {
|
||||||
|
protected SerializedProperty sensorProp;
|
||||||
|
protected SerializedProperty attachedBoneProp;
|
||||||
|
|
||||||
|
public HipsTargetProps(SerializedObject serializedObject, HipsTarget hipsTarget)
|
||||||
|
: base(serializedObject, hipsTarget.custom, hipsTarget, "custom") {
|
||||||
|
|
||||||
|
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||||
|
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Inspector() {
|
||||||
|
if (hipsTarget.humanoid.custom.enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(hipsTarget.custom, hipsTarget);
|
||||||
|
hipsTarget.custom.enabled = enabledProp.boolValue;
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
hipsTarget.custom.SetSensor2Target();
|
||||||
|
hipsTarget.custom.ShowSensor(hipsTarget.humanoid.showRealObjects && hipsTarget.showRealObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledProp.boolValue) {
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
if (sensorProp.objectReferenceValue == null && hipsTarget.custom.sensorComponent != null)
|
||||||
|
sensorProp.objectReferenceValue = hipsTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||||
|
|
||||||
|
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||||
|
attachedBoneProp.intValue = (int)(TorsoBones)EditorGUILayout.EnumPopup("Bone", (TorsoBones)attachedBoneProp.intValue);
|
||||||
|
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Hips
|
||||||
|
|
||||||
|
#region Foot
|
||||||
|
|
||||||
|
public class FootTargetProps : FootTarget_Editor.TargetProps {
|
||||||
|
protected SerializedProperty sensorProp;
|
||||||
|
protected SerializedProperty attachedBoneProp;
|
||||||
|
|
||||||
|
public FootTargetProps(SerializedObject serializedObject, FootTarget footTarget)
|
||||||
|
: base(serializedObject, footTarget.custom, footTarget, "custom") {
|
||||||
|
|
||||||
|
sensorProp = serializedObject.FindProperty("custom.sensorComponent");
|
||||||
|
attachedBoneProp = serializedObject.FindProperty("custom.attachedBone");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Inspector() {
|
||||||
|
if (footTarget.humanoid.custom.enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
enabledProp.boolValue = HumanoidTarget_Editor.ControllerInspector(footTarget.custom, footTarget);
|
||||||
|
footTarget.custom.enabled = enabledProp.boolValue;
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
footTarget.custom.SetSensor2Target();
|
||||||
|
footTarget.custom.ShowSensor(footTarget.humanoid.showRealObjects && footTarget.showRealObjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledProp.boolValue) {
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
if (sensorProp.objectReferenceValue == null && footTarget.custom.sensorComponent != null)
|
||||||
|
sensorProp.objectReferenceValue = footTarget.custom.sensorComponent; //.GetComponent<SensorComponent>();
|
||||||
|
|
||||||
|
sensorProp.objectReferenceValue = (SensorComponent)EditorGUILayout.ObjectField("Sensor", sensorProp.objectReferenceValue, typeof(SensorComponent), true);
|
||||||
|
attachedBoneProp.intValue = (int)(LegBones)EditorGUILayout.EnumPopup("Bone", (LegBones)attachedBoneProp.intValue);
|
||||||
|
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Foot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 19899e56fc3dbbe4ca6012685d51f69d
|
guid: 44d806c9717b1fa46a86f6a982c5e1b9
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -54,27 +54,33 @@ namespace Passer.Humanoid {
|
|||||||
protected void OculusHandTrackingInspector() {
|
protected void OculusHandTrackingInspector() {
|
||||||
#if hOCHAND
|
#if hOCHAND
|
||||||
GUIContent labelText = new GUIContent(
|
GUIContent labelText = new GUIContent(
|
||||||
"Oculus Hand Tracking",
|
"Quest Hand Tracking",
|
||||||
"Enables hand tracking on the Oculus Quest"
|
"Enables hand tracking on the Meta Quest"
|
||||||
);
|
);
|
||||||
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
oculusHandTrackingProp.boolValue = EditorGUILayout.ToggleLeft(labelText, oculusHandTrackingProp.boolValue);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void CheckQuestManifest() {
|
protected virtual void CheckQuestManifest() {
|
||||||
string manifestPath = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
|
try {
|
||||||
FileInfo fileInfo = new FileInfo(manifestPath);
|
string manifestPath = Application.dataPath + "/Plugins/Android/AndroidManifest.xml";
|
||||||
fileInfo.Directory.Create();
|
FileInfo fileInfo = new FileInfo(manifestPath);
|
||||||
bool manifestAvailable = File.Exists(manifestPath);
|
fileInfo.Directory.Create();
|
||||||
if (manifestAvailable)
|
bool manifestAvailable = File.Exists(manifestPath);
|
||||||
|
if (manifestAvailable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
||||||
|
string questManifestPath = Application.dataPath.Substring(0, Application.dataPath.Length - 6) + // remove /Assets
|
||||||
|
humanoidPath + "Extensions/Oculus/QuestManifest.xml";
|
||||||
|
Debug.Log(questManifestPath);
|
||||||
|
File.Copy(questManifestPath, manifestPath);
|
||||||
|
}
|
||||||
|
catch (System.Exception ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
string humanoidPath = Configuration_Editor.FindHumanoidFolder();
|
|
||||||
string questManifestPath = Application.dataPath + humanoidPath + "Extensions/Oculus/QuestManifest.xml";
|
|
||||||
File.Copy(questManifestPath, manifestPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void ViveHandTrackingInspector(HumanoidControl humanoid) {
|
protected void ViveHandTrackingInspector(HumanoidControl humanoid) {
|
||||||
#if hVIVEHAND
|
#if hVIVEHAND
|
||||||
GUIContent labelText = new GUIContent(
|
GUIContent labelText = new GUIContent(
|
||||||
@ -104,7 +110,7 @@ namespace Passer.Humanoid {
|
|||||||
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
public HeadTargetProps(SerializedObject serializedObject, HeadTarget headTarget)
|
||||||
: base(serializedObject, headTarget.unityXR, headTarget, nameof(HeadTarget.unityXR)) {
|
: base(serializedObject, headTarget.unityXR, headTarget, nameof(HeadTarget.unityXR)) {
|
||||||
|
|
||||||
hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".hmd");
|
hmdProp = serializedObject.FindProperty(nameof(HeadTarget.unityXR) + ".sensorComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Inspector() {
|
public override void Inspector() {
|
||||||
@ -116,17 +122,18 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
if (enabledProp.boolValue) {
|
if (enabledProp.boolValue) {
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
if (headTarget.unityXR.hmd == null) {
|
if (headTarget.unityXR.sensorComponent == null) {
|
||||||
// Hmd does not exist
|
// Hmd does not exist
|
||||||
using (new EditorGUILayout.HorizontalScope()) {
|
using (new EditorGUILayout.HorizontalScope()) {
|
||||||
EditorGUILayout.LabelField("Hmd", GUILayout.Width(120));
|
EditorGUILayout.LabelField("Hmd", GUILayout.Width(120));
|
||||||
if (GUILayout.Button("Show")) {
|
if (GUILayout.Button("Show")) {
|
||||||
headTarget.unityXR.CheckSensor(headTarget);
|
//headTarget.unityXR.CheckSensor(headTarget);
|
||||||
|
headTarget.unityXR.CheckSensor(headTarget); //.GetSensorComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.hmd, typeof(UnityXRHmd), true);
|
hmdProp.objectReferenceValue = (UnityXRHmd)EditorGUILayout.ObjectField("Hmd", headTarget.unityXR.sensorComponent, typeof(UnityXRHmd), true);
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -145,7 +152,7 @@ namespace Passer.Humanoid {
|
|||||||
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
public HandTargetProps(SerializedObject serializedObject, HandTarget handTarget)
|
||||||
: base(serializedObject, handTarget.unityXR, handTarget, "unityXR") {
|
: base(serializedObject, handTarget.unityXR, handTarget, "unityXR") {
|
||||||
|
|
||||||
controllerProp = serializedObject.FindProperty("unityXR.controller");
|
controllerProp = serializedObject.FindProperty("unityXR.sensorComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Inspector() {
|
public override void Inspector() {
|
||||||
@ -10,6 +10,7 @@ using Photon.Pun;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Passer {
|
namespace Passer {
|
||||||
|
using Tracking;
|
||||||
using Humanoid;
|
using Humanoid;
|
||||||
|
|
||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
@ -289,15 +290,6 @@ namespace Passer {
|
|||||||
#if pUNITYXR
|
#if pUNITYXR
|
||||||
new UnityXR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.unityXR),
|
new UnityXR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.unityXR),
|
||||||
#endif
|
#endif
|
||||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
|
||||||
// new OpenVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.openVR),
|
|
||||||
//#endif
|
|
||||||
//#if hSTEAMVR && UNITY_STANDALONE_WIN
|
|
||||||
// //new SteamVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.steamVR),
|
|
||||||
//#endif
|
|
||||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
|
||||||
// new Oculus_Editor.TrackerProps(serializedObject, targetObjs, humanoid.oculus),
|
|
||||||
//#endif
|
|
||||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||||
new WindowsMR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.mixedReality),
|
new WindowsMR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.mixedReality),
|
||||||
|
|
||||||
@ -305,14 +297,11 @@ namespace Passer {
|
|||||||
#if hWAVEVR
|
#if hWAVEVR
|
||||||
new WaveVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.waveVR),
|
new WaveVR_Editor.TrackerProps(serializedObject, targetObjs, humanoid.waveVR),
|
||||||
#endif
|
#endif
|
||||||
#if hVRTK
|
|
||||||
new Vrtk_Editor.TrackerProps(serializedObject, targetObjs, humanoid.vrtk),
|
|
||||||
#endif
|
|
||||||
#if hHYDRA && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
#if hHYDRA && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||||
new Hydra_Editor.TrackerProps(serializedObject, targetObjs, humanoid.hydra),
|
new Hydra_Editor.TrackerProps(serializedObject, targetObjs, humanoid.hydra),
|
||||||
#endif
|
#endif
|
||||||
#if hLEAP && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
#if hLEAP && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||||
new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leapTracker),
|
new LeapMotion_Editor.TrackerProps(serializedObject, targetObjs, humanoid.leap),
|
||||||
#endif
|
#endif
|
||||||
#if hKINECT1 && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
#if hKINECT1 && (UNITY_STANDALONE_WIN || UNITY_WSA_10_0)
|
||||||
new Kinect1_Editor.TrackerProps(serializedObject, targetObjs, humanoid.kinect1),
|
new Kinect1_Editor.TrackerProps(serializedObject, targetObjs, humanoid.kinect1),
|
||||||
@ -388,24 +377,11 @@ namespace Passer {
|
|||||||
|
|
||||||
#region Animations
|
#region Animations
|
||||||
|
|
||||||
private SerializedProperty animatorParamForwardProp;
|
private void InitAnimations(HumanoidControl humanoid) { }
|
||||||
private SerializedProperty animatorParamSidewardProp;
|
|
||||||
private SerializedProperty animatorParamRotationProp;
|
|
||||||
private SerializedProperty animatorParamHeightProp;
|
|
||||||
|
|
||||||
|
|
||||||
private void InitAnimations(HumanoidControl humanoid) {
|
|
||||||
|
|
||||||
animatorParamForwardProp = serializedObject.FindProperty("animatorParameterForwardIndex");
|
|
||||||
animatorParamSidewardProp = serializedObject.FindProperty("animatorParameterSidewardIndex");
|
|
||||||
animatorParamRotationProp = serializedObject.FindProperty("animatorParameterRotationIndex");
|
|
||||||
animatorParamHeightProp = serializedObject.FindProperty("animatorParameterHeightIndex");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool showAnimatorParameters = false;
|
bool showAnimatorParameters = false;
|
||||||
private void AnimatorInspector(HumanoidControl humanoid) {
|
private void AnimatorInspector(HumanoidControl humanoid) {
|
||||||
AnimatorControllerInspector(humanoid);
|
AnimatorControllerInspector(humanoid);
|
||||||
AnimatorParametersInspector(humanoid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AnimatorControllerInspector(HumanoidControl humanoid) {
|
private void AnimatorControllerInspector(HumanoidControl humanoid) {
|
||||||
@ -434,44 +410,6 @@ namespace Passer {
|
|||||||
EditorGUILayout.EndHorizontal();
|
EditorGUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AnimatorParametersInspector(HumanoidControl humanoid) {
|
|
||||||
if (showAnimatorParameters && humanoid.animatorEnabled && humanoid.targetsRig.runtimeAnimatorController != null) {
|
|
||||||
if (animatorParameterNames == null)
|
|
||||||
animatorParameterNames = GetAnimatorParameters(humanoid);
|
|
||||||
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
|
|
||||||
GUIContent forwardSpeedText = new GUIContent(
|
|
||||||
"Forward Speed",
|
|
||||||
"Animator parameter controlling the forward motion animation"
|
|
||||||
);
|
|
||||||
animatorParamForwardProp.intValue = SetAnimatorInput(forwardSpeedText, animatorParamForwardProp.intValue, ref humanoid.animatorParameterForward);
|
|
||||||
|
|
||||||
GUIContent sidewardSpeedText = new GUIContent(
|
|
||||||
"Sideward Speed",
|
|
||||||
"Animator parameter controlling the sideward motion animation"
|
|
||||||
);
|
|
||||||
animatorParamSidewardProp.intValue = SetAnimatorInput(sidewardSpeedText, animatorParamSidewardProp.intValue, ref humanoid.animatorParameterSideward);
|
|
||||||
|
|
||||||
GUIContent turnSpeedText = new GUIContent(
|
|
||||||
"Turn Speed",
|
|
||||||
"Animator parameter controlling the rotation animation"
|
|
||||||
);
|
|
||||||
animatorParamRotationProp.intValue = SetAnimatorInput(turnSpeedText, animatorParamRotationProp.intValue, ref humanoid.animatorParameterRotation);
|
|
||||||
|
|
||||||
GUIContent headHeightText = new GUIContent(
|
|
||||||
"Head Height",
|
|
||||||
"Animation parameter controlling the squatting animation"
|
|
||||||
);
|
|
||||||
animatorParamHeightProp.intValue = SetAnimatorInput(headHeightText, animatorParamHeightProp.intValue, ref humanoid.animatorParameterHeight);
|
|
||||||
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
showAnimatorParameters = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected GUIContent[] animatorParameterNames;
|
protected GUIContent[] animatorParameterNames;
|
||||||
public GUIContent[] GetAnimatorParameters(HumanoidControl humanoid) {
|
public GUIContent[] GetAnimatorParameters(HumanoidControl humanoid) {
|
||||||
if (humanoid == null || humanoid.targetsRig.runtimeAnimatorController == null)
|
if (humanoid == null || humanoid.targetsRig.runtimeAnimatorController == null)
|
||||||
@ -723,6 +661,7 @@ namespace Passer {
|
|||||||
CalibrateAtStartSetting();
|
CalibrateAtStartSetting();
|
||||||
StartPositionSetting();
|
StartPositionSetting();
|
||||||
ScalingSetting();
|
ScalingSetting();
|
||||||
|
FloatCorrectionSetting();
|
||||||
DontDestroySetting();
|
DontDestroySetting();
|
||||||
if (IsPrefab(humanoid))
|
if (IsPrefab(humanoid))
|
||||||
DisconnectInstancesSetting();
|
DisconnectInstancesSetting();
|
||||||
@ -781,6 +720,15 @@ namespace Passer {
|
|||||||
scalingProp.intValue = (int)(HumanoidControl.ScalingType)EditorGUILayout.EnumPopup(text, (HumanoidControl.ScalingType)scalingProp.intValue);
|
scalingProp.intValue = (int)(HumanoidControl.ScalingType)EditorGUILayout.EnumPopup(text, (HumanoidControl.ScalingType)scalingProp.intValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void FloatCorrectionSetting() {
|
||||||
|
SerializedProperty floatCorrectionProp = serializedObject.FindProperty(nameof(HumanoidControl.floatCorrection));
|
||||||
|
GUIContent text = new GUIContent(
|
||||||
|
"Float Correction",
|
||||||
|
"Correct floating avatars when user is taller than the avatar"
|
||||||
|
);
|
||||||
|
floatCorrectionProp.boolValue = EditorGUILayout.Toggle(text, floatCorrectionProp.boolValue);
|
||||||
|
}
|
||||||
|
|
||||||
private void ShowTrackers(HumanoidControl humanoid, bool shown) {
|
private void ShowTrackers(HumanoidControl humanoid, bool shown) {
|
||||||
foreach (Tracker tracker in humanoid.trackers)
|
foreach (Tracker tracker in humanoid.trackers)
|
||||||
tracker.ShowTracker(shown);
|
tracker.ShowTracker(shown);
|
||||||
@ -907,6 +855,7 @@ namespace Passer {
|
|||||||
else {
|
else {
|
||||||
humanoid.pose.Show(humanoid);
|
humanoid.pose.Show(humanoid);
|
||||||
humanoid.CopyRigToTargets();
|
humanoid.CopyRigToTargets();
|
||||||
|
humanoid.MatchTargetsToAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1136,7 +1085,7 @@ namespace Passer {
|
|||||||
|
|
||||||
private void RemoveControllers() {
|
private void RemoveControllers() {
|
||||||
foreach (HumanoidSensor sensor in tracker.sensors)
|
foreach (HumanoidSensor sensor in tracker.sensors)
|
||||||
RemoveTransform(sensor.sensorTransform);
|
RemoveSensor(sensor.sensorComponent);
|
||||||
|
|
||||||
if (tracker.headSensor != null)
|
if (tracker.headSensor != null)
|
||||||
tracker.headSensor.RemoveController(headSensorProp);
|
tracker.headSensor.RemoveController(headSensorProp);
|
||||||
@ -1152,11 +1101,16 @@ namespace Passer {
|
|||||||
tracker.rightFootSensor.RemoveController(rightFootSensorProp);
|
tracker.rightFootSensor.RemoveController(rightFootSensorProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveTransform(Transform trackerTransform) {
|
private void RemoveSensor(Tracking.SensorComponent sensorComponent) {
|
||||||
if (trackerTransform != null)
|
if (sensorComponent != null)
|
||||||
DestroyImmediate(trackerTransform.gameObject, true);
|
DestroyImmediate(sensorComponent.gameObject, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private void RemoveTransform(Transform trackerTransform) {
|
||||||
|
// if (trackerTransform != null)
|
||||||
|
// DestroyImmediate(trackerTransform.gameObject, true);
|
||||||
|
//}
|
||||||
|
|
||||||
private void SetSensors2Target() {
|
private void SetSensors2Target() {
|
||||||
foreach (HumanoidSensor sensor in tracker.sensors) {
|
foreach (HumanoidSensor sensor in tracker.sensors) {
|
||||||
sensor.SetSensor2Target();
|
sensor.SetSensor2Target();
|
||||||
|
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
@ -22,7 +22,8 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject GetHumanoidPlayerPrefab(string prefabPath) {
|
public static GameObject GetHumanoidPlayerPrefab(string prefabPath) {
|
||||||
GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
|
//GameObject prefab = PrefabUtility.LoadPrefabContents(prefabPath);
|
||||||
|
GameObject prefab = null;
|
||||||
return prefab;
|
return prefab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d7e8d519f532c4845b3af4baad2a37c7
|
guid: 875a66c1e6398184192242a8674906b3
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -0,0 +1,143 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
#if hPHOTON2
|
||||||
|
using Photon.Pun;
|
||||||
|
#if hPUNVOICE2 && !UNITY_WEBGL
|
||||||
|
using Photon.Voice.PUN;
|
||||||
|
using Photon.Voice.Unity;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Passer.Humanoid {
|
||||||
|
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public class OnLoadHumanoidPlayerPun {
|
||||||
|
static OnLoadHumanoidPlayerPun() {
|
||||||
|
CheckHumanoidPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void CheckHumanoidPlayerVoice() {
|
||||||
|
#if hPUNVOICE2
|
||||||
|
string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
|
||||||
|
prefabPath = prefabPath.Substring(0, prefabPath.Length - 21) + "HumanoidPlayerVoice.prefab";
|
||||||
|
GameObject playerVoicePrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
|
||||||
|
if (playerVoicePrefab == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool hasChanged = false;
|
||||||
|
#if UNITY_WEBGL
|
||||||
|
PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
|
||||||
|
if (photonView == null) {
|
||||||
|
photonView = playerVoicePrefab.AddComponent<PhotonView>();
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
PhotonVoiceView photonVoiceView = playerVoicePrefab.GetComponent<PhotonVoiceView>();
|
||||||
|
if (photonVoiceView == null) {
|
||||||
|
photonVoiceView = playerVoicePrefab.AddComponent<PhotonVoiceView>();
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
if (photonVoiceView.UsePrimaryRecorder == false) {
|
||||||
|
photonVoiceView.UsePrimaryRecorder = true;
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
PhotonTransformView photonTransformView = playerVoicePrefab.GetComponent<PhotonTransformView>();
|
||||||
|
if (photonTransformView == null) {
|
||||||
|
photonTransformView = playerVoicePrefab.AddComponent<PhotonTransformView>();
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
PhotonView photonView = playerVoicePrefab.GetComponent<PhotonView>();
|
||||||
|
if (photonView != null) {
|
||||||
|
// should always be there because of the photonVoiceView
|
||||||
|
if (photonView.ObservedComponents == null) {
|
||||||
|
photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||||
|
photonView.ObservedComponents.Add(photonTransformView);
|
||||||
|
photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Speaker speaker = playerVoicePrefab.GetComponent<Speaker>();
|
||||||
|
//if (speaker == null) {
|
||||||
|
// speaker = playerVoicePrefab.AddComponent<Speaker>();
|
||||||
|
// photonVoiceView.SpeakerInUse = speaker;
|
||||||
|
// hasChanged = true;
|
||||||
|
|
||||||
|
// AudioSource audioSource = playerVoicePrefab.GetComponent<AudioSource>();
|
||||||
|
// if (audioSource != null) {
|
||||||
|
// Debug.Log("adjust rolloff");
|
||||||
|
// // default logaritmic only work when people are closer than 0.5m...
|
||||||
|
// audioSource.maxDistance = 5;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
#endif
|
||||||
|
if (hasChanged)
|
||||||
|
OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerVoicePrefab, prefabPath);
|
||||||
|
#if !UNITY_WEBGL
|
||||||
|
CheckVoiceNetwork();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if hPUNVOICE2 && !UNITY_WEBGL
|
||||||
|
protected static void CheckVoiceNetwork() {
|
||||||
|
NetworkingStarter networkingStarter = Object.FindObjectOfType<NetworkingStarter>();
|
||||||
|
if (networkingStarter == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PhotonVoiceNetwork voiceNetwork = Object.FindObjectOfType<PhotonVoiceNetwork>();
|
||||||
|
if (voiceNetwork != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GameObject voiceNetworkObject = new GameObject("Voice Network");
|
||||||
|
voiceNetwork = voiceNetworkObject.AddComponent<PhotonVoiceNetwork>();
|
||||||
|
|
||||||
|
Recorder voiceRecorder = voiceNetworkObject.AddComponent<Recorder>();
|
||||||
|
voiceRecorder.ReactOnSystemChanges = true;
|
||||||
|
voiceRecorder.TransmitEnabled = true;
|
||||||
|
voiceRecorder.SamplingRate = POpusCodec.Enums.SamplingRate.Sampling48000;
|
||||||
|
|
||||||
|
voiceNetwork.PrimaryRecorder = voiceRecorder;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public static void CheckHumanoidPlayer() {
|
||||||
|
#if hPHOTON1 || hPHOTON2
|
||||||
|
string prefabPath = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefabPath();
|
||||||
|
GameObject playerPrefab = OnLoadHumanoidPlayer.GetHumanoidPlayerPrefab(prefabPath);
|
||||||
|
|
||||||
|
bool hasChanged = false;
|
||||||
|
#if hNW_PHOTON
|
||||||
|
if (playerPrefab != null) {
|
||||||
|
PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
|
||||||
|
if (photonView == null) {
|
||||||
|
photonView = playerPrefab.AddComponent<PhotonView>();
|
||||||
|
photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||||
|
#if hPHOTON2
|
||||||
|
photonView.Synchronization = ViewSynchronization.UnreliableOnChange;
|
||||||
|
#else
|
||||||
|
photonView.synchronization = ViewSynchronization.UnreliableOnChange;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HumanoidPlayer humanoidPun = playerPrefab.GetComponent<HumanoidPlayer>();
|
||||||
|
if (humanoidPun != null)
|
||||||
|
photonView.ObservedComponents.Add(humanoidPun);
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (playerPrefab != null) {
|
||||||
|
PhotonView photonView = playerPrefab.GetComponent<PhotonView>();
|
||||||
|
if (photonView != null)
|
||||||
|
Object.DestroyImmediate(photonView, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (hasChanged)
|
||||||
|
OnLoadHumanoidPlayer.UpdateHumanoidPrefab(playerPrefab, prefabPath);
|
||||||
|
#endif
|
||||||
|
CheckHumanoidPlayerVoice();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 185ec4e1799d1ac4d867b69454f1cd0f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
108
Editor/HumanoidControl/Networking/PhotonPun/PunStarter_Editor.cs
Normal file
108
Editor/HumanoidControl/Networking/PhotonPun/PunStarter_Editor.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
#if hNW_PHOTON
|
||||||
|
#if hPHOTON2
|
||||||
|
using Photon.Pun;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Passer {
|
||||||
|
|
||||||
|
[CustomEditor(typeof(PhotonStarter))]
|
||||||
|
public class PunStarter_Editor : Editor {
|
||||||
|
|
||||||
|
public override void OnInspectorGUI() {
|
||||||
|
base.OnInspectorGUI();
|
||||||
|
|
||||||
|
HumanoidControl[] humanoids = FindObjectsOfType<HumanoidControl>();
|
||||||
|
if (humanoids.Length != 1)
|
||||||
|
// We only support sitatuation with one humanoid in the scene
|
||||||
|
return;
|
||||||
|
|
||||||
|
//HumanoidControl humanoid = humanoids[0];
|
||||||
|
|
||||||
|
if (Application.isPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//GameObject humanoidPrefab = CheckHumanoidPrefab(humanoid);
|
||||||
|
//NetworkingComponentsInspectorPun(humanoid, humanoidPrefab);
|
||||||
|
}
|
||||||
|
|
||||||
|
//private GameObject CheckHumanoidPrefab(HumanoidControl humanoid) {
|
||||||
|
// GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
|
||||||
|
// if (humanoidPrefab == null) {
|
||||||
|
// humanoidPrefab = PrefabUtility.CreatePrefab("Assets/Humanoid/Prefabs/Networking/Resources/" + humanoid.gameObject.name + "_generated.prefab", humanoid.gameObject);
|
||||||
|
// humanoidPrefab.gameObject.SetActive(true);
|
||||||
|
// }
|
||||||
|
// return humanoidPrefab;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private void UpdateHumanoidPrefab(HumanoidControl humanoid) {
|
||||||
|
// if (humanoid != null) {
|
||||||
|
// GameObject humanoidPrefab = Resources.Load<GameObject>(humanoid.gameObject.name + "_generated");
|
||||||
|
// if (humanoidPrefab != null && humanoid.gameObject != humanoidPrefab)
|
||||||
|
// PrefabUtility.ReplacePrefab(humanoid.gameObject, humanoidPrefab, ReplacePrefabOptions.ConnectToPrefab);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
// private void NetworkingComponentsInspectorPun(HumanoidControl humanoid, GameObject humanoidPrefab) {
|
||||||
|
//#if hPHOTON1 || hPHOTON2
|
||||||
|
//#if hNW_PHOTON
|
||||||
|
// CheckPunStarter(humanoid, humanoidPrefab);
|
||||||
|
// PhotonView photonView = humanoid.GetComponent<PhotonView>();
|
||||||
|
// if (photonView == null)
|
||||||
|
// photonView = humanoid.gameObject.AddComponent<PhotonView>();
|
||||||
|
// photonView.ObservedComponents = new System.Collections.Generic.List<Component>();
|
||||||
|
// photonView.ObservedComponents.Add(humanoid);
|
||||||
|
//#else
|
||||||
|
// cleanupPhotonView = humanoid.GetComponent<PhotonView>();
|
||||||
|
//#endif
|
||||||
|
//#endif
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private void CheckPunStarter(HumanoidControl humanoid, GameObject humanoidPrefab) {
|
||||||
|
// if (Application.isPlaying)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
//#if hNW_PHOTON
|
||||||
|
// PhotonStarter photonStarter = FindObjectOfType<PhotonStarter>();
|
||||||
|
// if (photonStarter != null && humanoidPrefab != null && photonStarter.playerPrefab != humanoidPrefab) {
|
||||||
|
// Undo.RecordObject(photonStarter, "Updated Player Prefab");
|
||||||
|
// photonStarter.playerPrefab = humanoidPrefab;
|
||||||
|
// }
|
||||||
|
//#endif
|
||||||
|
// }
|
||||||
|
public void OnDisable() {
|
||||||
|
Cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if hNW_UNET
|
||||||
|
private NetworkIdentity cleanupNetworkIdentity;
|
||||||
|
#endif
|
||||||
|
#if hPHOTON1 || hPHOTON2
|
||||||
|
private PhotonView cleanupPhotonView;
|
||||||
|
#endif
|
||||||
|
private GameObject cleanupPunStarter;
|
||||||
|
private void Cleanup() {
|
||||||
|
#if hNW_UNET
|
||||||
|
if (cleanupNetworkIdentity) {
|
||||||
|
DestroyImmediate(cleanupNetworkIdentity, true);
|
||||||
|
cleanupNetworkIdentity = null;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if hPHOTON1 || hPHOTON2
|
||||||
|
if (cleanupPhotonView) {
|
||||||
|
DestroyImmediate(cleanupPhotonView, true);
|
||||||
|
cleanupPhotonView = null;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (cleanupPunStarter) {
|
||||||
|
DestroyImmediate(cleanupPunStarter, true);
|
||||||
|
cleanupPunStarter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e86563dd015c559479420645216c4a70
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -236,7 +236,13 @@ namespace Passer.Humanoid {
|
|||||||
if (bones[i] == null || bones[i].bone == null || bones[i].bone.transform == null)
|
if (bones[i] == null || bones[i].bone == null || bones[i].bone.transform == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#if UNITY_2022_1_OR_NEWER
|
||||||
|
Handles.FreeMoveHandle(bones[i].bone.transform.position, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
||||||
|
#else
|
||||||
Handles.FreeMoveHandle(bones[i].bone.transform.position, bones[i].bone.transform.rotation, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
Handles.FreeMoveHandle(bones[i].bone.transform.position, bones[i].bone.transform.rotation, 0.002F, Vector3.zero, DotHandleCapSaveID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
controlIds[i] = lastControlID;
|
controlIds[i] = lastControlID;
|
||||||
boneIds[i] = bones[i].boneId;
|
boneIds[i] = bones[i].boneId;
|
||||||
}
|
}
|
||||||
@ -317,6 +323,6 @@ namespace Passer.Humanoid {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace Passer {
|
|||||||
|
|
||||||
private void InitEditors() {
|
private void InitEditors() {
|
||||||
allProps = new TargetProps[] {
|
allProps = new TargetProps[] {
|
||||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
#if hVIVETRACKER
|
||||||
new ViveTracker_Editor.FootTargetProps(serializedObject, footTarget),
|
new ViveTracker_Editor.FootTargetProps(serializedObject, footTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hKINECT1
|
#if hKINECT1
|
||||||
@ -48,9 +48,9 @@ namespace Passer {
|
|||||||
#if hORBBEC
|
#if hORBBEC
|
||||||
new Astra_Editor.FootTargetProps(serializedObject, footTarget),
|
new Astra_Editor.FootTargetProps(serializedObject, footTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hNEURON
|
//#if hNEURON
|
||||||
new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
|
// new Neuron_Editor.FootTargetProps(serializedObject, footTarget),
|
||||||
#endif
|
//#endif
|
||||||
#if hOPTITRACK
|
#if hOPTITRACK
|
||||||
new Optitrack_Editor.FootTargetProps(serializedObject, footTarget),
|
new Optitrack_Editor.FootTargetProps(serializedObject, footTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -63,9 +63,9 @@ namespace Passer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Disable
|
#region Disable
|
||||||
public void OnDisable() {
|
public void OnDisable() {
|
||||||
if (humanoid == null) {
|
if (humanoid == null) {
|
||||||
// This target is not connected to a humanoid, so we delete it
|
// This target is not connected to a humanoid, so we delete it
|
||||||
@ -82,9 +82,9 @@ namespace Passer {
|
|||||||
foreach (TargetProps props in allProps)
|
foreach (TargetProps props in allProps)
|
||||||
props.SetSensor2Target();
|
props.SetSensor2Target();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Inspector
|
#region Inspector
|
||||||
public override void OnInspectorGUI() {
|
public override void OnInspectorGUI() {
|
||||||
if (footTarget == null || humanoid == null)
|
if (footTarget == null || humanoid == null)
|
||||||
return;
|
return;
|
||||||
@ -142,7 +142,7 @@ namespace Passer {
|
|||||||
return foundHumanoid;
|
return foundHumanoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Sensors
|
#region Sensors
|
||||||
private static bool showControllers = true;
|
private static bool showControllers = true;
|
||||||
private void ControllerInspectors(FootTarget footTarget) {
|
private void ControllerInspectors(FootTarget footTarget) {
|
||||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||||
@ -157,9 +157,9 @@ namespace Passer {
|
|||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Configuration
|
#region Configuration
|
||||||
private void InitConfiguration(FootTarget footTarget) {
|
private void InitConfiguration(FootTarget footTarget) {
|
||||||
if (footTarget.humanoid.avatarRig == null)
|
if (footTarget.humanoid.avatarRig == null)
|
||||||
return;
|
return;
|
||||||
@ -200,7 +200,7 @@ namespace Passer {
|
|||||||
UpdateToesBones(target.toes);
|
UpdateToesBones(target.toes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UpperLeg
|
#region UpperLeg
|
||||||
//private string upperLegXname;
|
//private string upperLegXname;
|
||||||
//private SerializedProperty upperLegMinX;
|
//private SerializedProperty upperLegMinX;
|
||||||
//private SerializedProperty upperLegMaxX;
|
//private SerializedProperty upperLegMaxX;
|
||||||
@ -276,9 +276,9 @@ namespace Passer {
|
|||||||
//upperLeg.bone.maxAngles.z = upperLegMaxZ.floatValue;
|
//upperLeg.bone.maxAngles.z = upperLegMaxZ.floatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region LowerLeg
|
#region LowerLeg
|
||||||
//private string lowerLegYname;
|
//private string lowerLegYname;
|
||||||
//private SerializedProperty lowerLegMinX;
|
//private SerializedProperty lowerLegMinX;
|
||||||
//private SerializedProperty lowerLegMaxX;
|
//private SerializedProperty lowerLegMaxX;
|
||||||
@ -326,9 +326,9 @@ namespace Passer {
|
|||||||
//lowerLeg.bone.minAngles.x = lowerLegMinX.floatValue;
|
//lowerLeg.bone.minAngles.x = lowerLegMinX.floatValue;
|
||||||
//lowerLeg.bone.maxAngles.x = lowerLegMaxX.floatValue;
|
//lowerLeg.bone.maxAngles.x = lowerLegMaxX.floatValue;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Foot
|
#region Foot
|
||||||
//private string footXname;
|
//private string footXname;
|
||||||
//private SerializedProperty footMinX;
|
//private SerializedProperty footMinX;
|
||||||
//private SerializedProperty footMaxX;
|
//private SerializedProperty footMaxX;
|
||||||
@ -390,9 +390,9 @@ namespace Passer {
|
|||||||
//foot.bone.minAngles.z = footMinZ.floatValue;
|
//foot.bone.minAngles.z = footMinZ.floatValue;
|
||||||
//foot.bone.maxAngles.z = footMaxZ.floatValue;
|
//foot.bone.maxAngles.z = footMaxZ.floatValue;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Toes
|
#region Toes
|
||||||
//private string toesXname;
|
//private string toesXname;
|
||||||
//private SerializedProperty toesMinX;
|
//private SerializedProperty toesMinX;
|
||||||
//private SerializedProperty toesMaxX;
|
//private SerializedProperty toesMaxX;
|
||||||
@ -441,10 +441,10 @@ namespace Passer {
|
|||||||
//toes.bone.maxAngles.x = toesMaxX.floatValue;
|
//toes.bone.maxAngles.x = toesMaxX.floatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
private SerializedProperty rotationSpeedLimitationProp;
|
private SerializedProperty rotationSpeedLimitationProp;
|
||||||
private SerializedProperty slidePreventionProp;
|
private SerializedProperty slidePreventionProp;
|
||||||
|
|
||||||
@ -470,9 +470,9 @@ namespace Passer {
|
|||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
protected SerializedProperty groundEventProp;
|
protected SerializedProperty groundEventProp;
|
||||||
|
|
||||||
@ -534,11 +534,11 @@ namespace Passer {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene
|
#region Scene
|
||||||
|
|
||||||
public void OnSceneGUI() {
|
public void OnSceneGUI() {
|
||||||
if (footTarget == null || humanoid == null)
|
if (footTarget == null || humanoid == null)
|
||||||
@ -551,12 +551,13 @@ namespace Passer {
|
|||||||
humanoid.pose.UpdatePose(humanoid);
|
humanoid.pose.UpdatePose(humanoid);
|
||||||
else {
|
else {
|
||||||
humanoid.pose.Show(humanoid);
|
humanoid.pose.Show(humanoid);
|
||||||
footTarget.CopyRigToTarget();
|
humanoid.CopyRigToTargets();
|
||||||
|
humanoid.MatchTargetsToAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the target rig from the current foot target
|
// update the target rig from the current foot target
|
||||||
footTarget.CopyTargetToRig();
|
humanoid.CopyTargetsToRig();
|
||||||
// update the avatar bones from the target rig
|
// update the avatar bones from the target rig
|
||||||
humanoid.UpdateMovements();
|
humanoid.UpdateMovements();
|
||||||
// match the target rig with the new avatar pose
|
// match the target rig with the new avatar pose
|
||||||
@ -568,11 +569,11 @@ namespace Passer {
|
|||||||
humanoid.UpdateSensorsFromTargets();
|
humanoid.UpdateSensorsFromTargets();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public abstract class TargetProps {
|
public abstract class TargetProps {
|
||||||
public SerializedProperty enabledProp;
|
public SerializedProperty enabledProp;
|
||||||
public SerializedProperty sensorTransformProp;
|
public SerializedProperty sensorComponentProp;
|
||||||
public SerializedProperty sensor2TargetPositionProp;
|
public SerializedProperty sensor2TargetPositionProp;
|
||||||
public SerializedProperty sensor2TargetRotationProp;
|
public SerializedProperty sensor2TargetRotationProp;
|
||||||
|
|
||||||
@ -581,7 +582,7 @@ namespace Passer {
|
|||||||
|
|
||||||
public TargetProps(SerializedObject serializedObject, LegSensor _sensor, FootTarget _footTarget, string unitySensorName) {
|
public TargetProps(SerializedObject serializedObject, LegSensor _sensor, FootTarget _footTarget, string unitySensorName) {
|
||||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||||
|
|
||||||
@ -592,11 +593,11 @@ namespace Passer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetSensor2Target() {
|
public virtual void SetSensor2Target() {
|
||||||
if (sensor.sensorTransform == null)
|
if (sensor.sensorComponent == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * footTarget.foot.target.transform.rotation;
|
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * footTarget.foot.target.transform.rotation;
|
||||||
sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
sensor2TargetPositionProp.vector3Value = -footTarget.foot.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void Inspector();
|
public abstract void Inspector();
|
||||||
@ -44,17 +44,8 @@ namespace Passer.Humanoid {
|
|||||||
#if pUNITYXR
|
#if pUNITYXR
|
||||||
new UnityXR_Editor.HandTargetProps(serializedObject, handTarget),
|
new UnityXR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
#endif
|
||||||
//#if hOPENVR && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
|
||||||
// new OpenVR_Editor.HandTargetProps(serializedObject, handTarget),
|
|
||||||
//#if hVIVETRACKER
|
|
||||||
// new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
|
||||||
//#endif
|
|
||||||
//#endif
|
|
||||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
|
|
||||||
//new SteamVR_Editor.HandTargetProps(serializedObject, handTarget),
|
|
||||||
#if hVIVETRACKER
|
#if hVIVETRACKER
|
||||||
//new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
new ViveTracker_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
//#if hOCULUS && (UNITY_STANDALONE_WIN || UNITY_ANDROID)
|
||||||
// new Oculus_Editor.HandTargetProps(serializedObject, handTarget),
|
// new Oculus_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
@ -65,9 +56,6 @@ namespace Passer.Humanoid {
|
|||||||
#if hWAVEVR
|
#if hWAVEVR
|
||||||
new WaveVR_Editor.HandTargetProps(serializedObject, handTarget),
|
new WaveVR_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hVRTK
|
|
||||||
new Vrtk_Editor.HandTargetProps(serializedObject, handTarget),
|
|
||||||
#endif
|
|
||||||
#if hLEAP
|
#if hLEAP
|
||||||
new LeapMotion_Editor.HandTargetProps(serializedObject, handTarget),
|
new LeapMotion_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -86,9 +74,9 @@ namespace Passer.Humanoid {
|
|||||||
#if hORBBEC
|
#if hORBBEC
|
||||||
new Astra_Editor.HandTargetProps(serializedObject, handTarget),
|
new Astra_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hNEURON
|
//#if hNEURON
|
||||||
new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
|
// new Neuron_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
//#endif
|
||||||
#if hOPTITRACK
|
#if hOPTITRACK
|
||||||
new Optitrack_Editor.HandTargetProps(serializedObject, handTarget),
|
new Optitrack_Editor.HandTargetProps(serializedObject, handTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -157,8 +145,6 @@ namespace Passer.Humanoid {
|
|||||||
InteractionPointerButton(handTarget);
|
InteractionPointerButton(handTarget);
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
serializedObject.ApplyModifiedProperties();
|
||||||
//serializedObject.Update();
|
|
||||||
//serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandTarget Inspector(HandTarget handTarget, string name) {
|
public static HandTarget Inspector(HandTarget handTarget, string name) {
|
||||||
@ -451,8 +437,8 @@ namespace Passer.Humanoid {
|
|||||||
if (showSettings) {
|
if (showSettings) {
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
|
|
||||||
// Cannot use serializedPropery because showRealObjects is a getter/setter
|
SerializedProperty showObjectsProp = serializedObject.FindProperty("_showRealObjects");
|
||||||
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", handTarget.showRealObjects);
|
bool showRealObjects = EditorGUILayout.Toggle("Show Real Objects", showObjectsProp.boolValue);
|
||||||
if (showRealObjects != handTarget.showRealObjects) {
|
if (showRealObjects != handTarget.showRealObjects) {
|
||||||
handTarget.showRealObjects = showRealObjects;
|
handTarget.showRealObjects = showRealObjects;
|
||||||
handTarget.ShowSensors(showRealObjects, true);
|
handTarget.ShowSensors(showRealObjects, true);
|
||||||
@ -709,12 +695,13 @@ namespace Passer.Humanoid {
|
|||||||
humanoid.pose.UpdatePose(humanoid);
|
humanoid.pose.UpdatePose(humanoid);
|
||||||
else {
|
else {
|
||||||
humanoid.pose.Show(humanoid);
|
humanoid.pose.Show(humanoid);
|
||||||
handTarget.CopyRigToTarget();
|
humanoid.CopyRigToTargets();
|
||||||
|
humanoid.MatchTargetsToAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the target rig from the current hand target
|
// update the target rig from the current hand target
|
||||||
handTarget.CopyTargetToRig();
|
humanoid.CopyTargetsToRig();
|
||||||
// update the avatar bones from the target rig
|
// update the avatar bones from the target rig
|
||||||
humanoid.UpdateMovements();
|
humanoid.UpdateMovements();
|
||||||
// match the target rig with the new avatar pose
|
// match the target rig with the new avatar pose
|
||||||
@ -730,7 +717,8 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public abstract class TargetProps {
|
public abstract class TargetProps {
|
||||||
public SerializedProperty enabledProp;
|
public SerializedProperty enabledProp;
|
||||||
public SerializedProperty sensorTransformProp;
|
//public SerializedProperty sensorTransformProp;
|
||||||
|
public SerializedProperty sensorComponentProp;
|
||||||
public SerializedProperty sensor2TargetPositionProp;
|
public SerializedProperty sensor2TargetPositionProp;
|
||||||
public SerializedProperty sensor2TargetRotationProp;
|
public SerializedProperty sensor2TargetRotationProp;
|
||||||
|
|
||||||
@ -739,7 +727,8 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public TargetProps(SerializedObject serializedObject, Humanoid.ArmSensor _sensor, HandTarget _handTarget, string unitySensorName) {
|
public TargetProps(SerializedObject serializedObject, Humanoid.ArmSensor _sensor, HandTarget _handTarget, string unitySensorName) {
|
||||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
//sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||||
|
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||||
|
|
||||||
@ -34,10 +34,8 @@ namespace Passer.Humanoid {
|
|||||||
#if pUNITYXR
|
#if pUNITYXR
|
||||||
new UnityXR_Editor.HeadTargetProps(serializedObject, headTarget),
|
new UnityXR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hSTEAMVR && UNITY_STANDALONE_WIN
|
|
||||||
#if hVIVETRACKER
|
#if hVIVETRACKER
|
||||||
//new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
|
new ViveTracker_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#if hWINDOWSMR && UNITY_WSA_10_0
|
#if hWINDOWSMR && UNITY_WSA_10_0
|
||||||
new WindowsMR_Editor.HeadTargetProps(serializedObject, headTarget),
|
new WindowsMR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
@ -45,9 +43,6 @@ namespace Passer.Humanoid {
|
|||||||
#if hWAVEVR
|
#if hWAVEVR
|
||||||
new WaveVR_Editor.HeadTargetProps(serializedObject, headTarget),
|
new WaveVR_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hVRTK
|
|
||||||
new Vrtk_Editor.HeadTargetProps(serializedObject, headTarget),
|
|
||||||
#endif
|
|
||||||
#if hREALSENSE
|
#if hREALSENSE
|
||||||
new Realsense_Editor.HeadTargetProps(serializedObject, headTarget),
|
new Realsense_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -66,9 +61,9 @@ namespace Passer.Humanoid {
|
|||||||
#if hOPTITRACK
|
#if hOPTITRACK
|
||||||
new Optitrack_Editor.HeadTargetProps(serializedObject, headTarget),
|
new Optitrack_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hNEURON
|
//#if hNEURON
|
||||||
new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
|
// new Neuron_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
//#endif
|
||||||
#if hTOBII
|
#if hTOBII
|
||||||
new Tobii_Editor.HeadTargetProps(serializedObject, headTarget),
|
new Tobii_Editor.HeadTargetProps(serializedObject, headTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -177,7 +172,7 @@ namespace Passer.Humanoid {
|
|||||||
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
showControllers = EditorGUILayout.Foldout(showControllers, "Controllers", true);
|
||||||
if (showControllers) {
|
if (showControllers) {
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
FirstPersonCameraInspector(headTarget);
|
//FirstPersonCameraInspector(headTarget);
|
||||||
ScreenInspector(headTarget);
|
ScreenInspector(headTarget);
|
||||||
|
|
||||||
foreach (TargetProps props in allProps)
|
foreach (TargetProps props in allProps)
|
||||||
@ -280,7 +275,7 @@ namespace Passer.Humanoid {
|
|||||||
if (headTarget.humanoid == null)
|
if (headTarget.humanoid == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator)+ "." +nameof(HeadTarget.headAnimator.enabled));
|
SerializedProperty animatorProp = serializedObject.FindProperty(nameof(HeadTarget.headAnimator) + "." + nameof(HeadTarget.headAnimator.enabled));
|
||||||
if (animatorProp != null && headTarget.humanoid.animatorEnabled) {
|
if (animatorProp != null && headTarget.humanoid.animatorEnabled) {
|
||||||
|
|
||||||
GUIContent text = new GUIContent(
|
GUIContent text = new GUIContent(
|
||||||
@ -487,12 +482,13 @@ namespace Passer.Humanoid {
|
|||||||
humanoid.pose.UpdatePose(humanoid);
|
humanoid.pose.UpdatePose(humanoid);
|
||||||
else {
|
else {
|
||||||
humanoid.pose.Show(humanoid);
|
humanoid.pose.Show(humanoid);
|
||||||
headTarget.CopyRigToTarget();
|
humanoid.CopyRigToTargets();
|
||||||
|
humanoid.MatchTargetsToAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the target rig from the current head target
|
// update the target rig from the current head target
|
||||||
headTarget.CopyTargetToRig();
|
humanoid.CopyTargetsToRig();
|
||||||
// update the avatar bones from the target rig
|
// update the avatar bones from the target rig
|
||||||
humanoid.UpdateMovements();
|
humanoid.UpdateMovements();
|
||||||
// match the target rig with the new avatar pose
|
// match the target rig with the new avatar pose
|
||||||
@ -509,7 +505,8 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public abstract class TargetProps {
|
public abstract class TargetProps {
|
||||||
public SerializedProperty enabledProp;
|
public SerializedProperty enabledProp;
|
||||||
public SerializedProperty sensorTransformProp;
|
//public SerializedProperty sensorTransformProp;
|
||||||
|
public SerializedProperty sensorComponentProp;
|
||||||
public SerializedProperty sensor2TargetPositionProp;
|
public SerializedProperty sensor2TargetPositionProp;
|
||||||
public SerializedProperty sensor2TargetRotationProp;
|
public SerializedProperty sensor2TargetRotationProp;
|
||||||
|
|
||||||
@ -518,7 +515,7 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
public TargetProps(SerializedObject serializedObject, HeadSensor _sensor, HeadTarget _headTarget, string unitySensorName) {
|
public TargetProps(SerializedObject serializedObject, HeadSensor _sensor, HeadTarget _headTarget, string unitySensorName) {
|
||||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||||
|
|
||||||
@ -529,11 +526,11 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetSensor2Target() {
|
public virtual void SetSensor2Target() {
|
||||||
if (sensor.sensorTransform == null)
|
if (sensor.sensorComponent == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * headTarget.head.target.transform.rotation;
|
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * headTarget.head.target.transform.rotation;
|
||||||
sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
sensor2TargetPositionProp.vector3Value = -headTarget.head.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void Inspector();
|
public abstract void Inspector();
|
||||||
@ -32,7 +32,7 @@ namespace Passer {
|
|||||||
|
|
||||||
private void InitEditors() {
|
private void InitEditors() {
|
||||||
allProps = new TargetProps[] {
|
allProps = new TargetProps[] {
|
||||||
#if hOPENVR && hVIVETRACKER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
|
#if hVIVETRACKER
|
||||||
new ViveTracker_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
new ViveTracker_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hKINECT1
|
#if hKINECT1
|
||||||
@ -47,9 +47,9 @@ namespace Passer {
|
|||||||
#if hORBBEC
|
#if hORBBEC
|
||||||
new Astra_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
new Astra_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||||
#endif
|
#endif
|
||||||
#if hNEURON
|
//#if hNEURON
|
||||||
new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
// new Neuron_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||||
#endif
|
//#endif
|
||||||
#if hOPTITRACK
|
#if hOPTITRACK
|
||||||
new Optitrack_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
new Optitrack_Editor.HipsTargetProps(serializedObject, hipsTarget),
|
||||||
#endif
|
#endif
|
||||||
@ -276,12 +276,13 @@ namespace Passer {
|
|||||||
humanoid.pose.UpdatePose(humanoid);
|
humanoid.pose.UpdatePose(humanoid);
|
||||||
else {
|
else {
|
||||||
humanoid.pose.Show(humanoid);
|
humanoid.pose.Show(humanoid);
|
||||||
hipsTarget.CopyRigToTarget();
|
humanoid.CopyRigToTargets();
|
||||||
|
humanoid.MatchTargetsToAvatar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the target rig from the current hips target
|
// update the target rig from the current hips target
|
||||||
hipsTarget.CopyTargetToRig();
|
humanoid.CopyTargetsToRig();
|
||||||
// update the avatar bones to match the target rig
|
// update the avatar bones to match the target rig
|
||||||
humanoid.UpdateMovements();
|
humanoid.UpdateMovements();
|
||||||
// match the target rig with the new avatar pose
|
// match the target rig with the new avatar pose
|
||||||
@ -297,7 +298,8 @@ namespace Passer {
|
|||||||
|
|
||||||
public abstract class TargetProps {
|
public abstract class TargetProps {
|
||||||
public SerializedProperty enabledProp;
|
public SerializedProperty enabledProp;
|
||||||
public SerializedProperty sensorTransformProp;
|
//public SerializedProperty sensorTransformProp;
|
||||||
|
public SerializedProperty sensorComponentProp;
|
||||||
public SerializedProperty sensor2TargetPositionProp;
|
public SerializedProperty sensor2TargetPositionProp;
|
||||||
public SerializedProperty sensor2TargetRotationProp;
|
public SerializedProperty sensor2TargetRotationProp;
|
||||||
|
|
||||||
@ -306,7 +308,8 @@ namespace Passer {
|
|||||||
|
|
||||||
public TargetProps(SerializedObject serializedObject, TorsoSensor _sensor, HipsTarget _hipsTarget, string unitySensorName) {
|
public TargetProps(SerializedObject serializedObject, TorsoSensor _sensor, HipsTarget _hipsTarget, string unitySensorName) {
|
||||||
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
enabledProp = serializedObject.FindProperty(unitySensorName + ".enabled");
|
||||||
sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
//sensorTransformProp = serializedObject.FindProperty(unitySensorName + ".sensorTransform");
|
||||||
|
sensorComponentProp = serializedObject.FindProperty(unitySensorName + ".sensorComponent");
|
||||||
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
sensor2TargetPositionProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetPosition");
|
||||||
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
sensor2TargetRotationProp = serializedObject.FindProperty(unitySensorName + ".sensor2TargetRotation");
|
||||||
|
|
||||||
@ -317,11 +320,11 @@ namespace Passer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetSensor2Target() {
|
public virtual void SetSensor2Target() {
|
||||||
if (sensor.sensorTransform == null)
|
if (sensor.sensorComponent == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorTransform.rotation) * hipsTarget.hips.target.transform.rotation;
|
sensor2TargetRotationProp.quaternionValue = Quaternion.Inverse(sensor.sensorComponent.transform.rotation) * hipsTarget.hips.target.transform.rotation;
|
||||||
sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorTransform.position);
|
sensor2TargetPositionProp.vector3Value = -hipsTarget.hips.target.transform.InverseTransformPoint(sensor.sensorComponent.transform.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void Inspector();
|
public abstract void Inspector();
|
||||||
@ -7,7 +7,8 @@
|
|||||||
"PhotonVoice",
|
"PhotonVoice",
|
||||||
"PhotonVoice.PUN",
|
"PhotonVoice.PUN",
|
||||||
"PhotonRealtime",
|
"PhotonRealtime",
|
||||||
"PhotonVoice.API"
|
"PhotonVoice.API",
|
||||||
|
"SteamVR"
|
||||||
],
|
],
|
||||||
"includePlatforms": [
|
"includePlatforms": [
|
||||||
"Editor"
|
"Editor"
|
||||||
|
|||||||
@ -12,7 +12,7 @@ using UnityEditor;
|
|||||||
namespace Passer {
|
namespace Passer {
|
||||||
|
|
||||||
[CustomEditor(typeof(Possessable))]
|
[CustomEditor(typeof(Possessable))]
|
||||||
public class Possession_Editor : Editor {
|
public class Possessable_Editor : Editor {
|
||||||
|
|
||||||
protected Possessable possession;
|
protected Possessable possession;
|
||||||
|
|
||||||
@ -42,13 +42,16 @@ namespace Passer {
|
|||||||
Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
|
Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
|
||||||
|
|
||||||
if (IsPrefab(possession.gameObject)) {
|
if (IsPrefab(possession.gameObject)) {
|
||||||
Debug.Log("is prefab");
|
//Debug.Log("is prefab");
|
||||||
possession.assetPath = AssetDatabase.GetAssetPath(possession.gameObject);
|
possession.assetPath = AssetDatabase.GetAssetPath(possession.gameObject);
|
||||||
|
|
||||||
string scenePath = activeScene.path;
|
string scenePath = activeScene.path;
|
||||||
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
||||||
if (assetImporter != null)
|
if (assetImporter != null)
|
||||||
assetImporter.assetBundleName = "possessions"; //activeScene.name + "_possessions";
|
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||||
|
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||||
|
|
||||||
|
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +61,9 @@ namespace Passer {
|
|||||||
|
|
||||||
string scenePath = activeScene.path;
|
string scenePath = activeScene.path;
|
||||||
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
AssetImporter assetImporter = AssetImporter.GetAtPath(possession.assetPath);
|
||||||
assetImporter.assetBundleName = "possessions"; //activeScene.name + "_possessions";
|
// HACK: force avatars to avatarhops because we cannot change assetbundle in package prefabs
|
||||||
//Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName);
|
assetImporter.assetBundleName = activeScene.name + "_possessions";
|
||||||
|
Debug.Log(possession.gameObject + ": Set AssetBundleName to " + assetImporter.assetBundleName + " - " + possession.siteLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,6 +15,7 @@ namespace Passer {
|
|||||||
/// by selecting the appropriate sites in the dialog:
|
/// by selecting the appropriate sites in the dialog:
|
||||||
///
|
///
|
||||||
/// \image html BuildSitesDialog.png
|
/// \image html BuildSitesDialog.png
|
||||||
|
/// \image rtf BuildSitesDialog.png
|
||||||
///
|
///
|
||||||
/// When the Build button is pressed, all sites will be build and become available in the Assets/SiteBuilds folder
|
/// When the Build button is pressed, all sites will be build and become available in the Assets/SiteBuilds folder
|
||||||
/// with a submap for each platform (like Windows, Android...)
|
/// with a submap for each platform (like Windows, Android...)
|
||||||
@ -36,38 +37,6 @@ namespace Passer {
|
|||||||
window.ShowUtility();
|
window.ShowUtility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GenerateSiteBuilds() {
|
|
||||||
string[] assetbundles = AssetDatabase.GetAllAssetBundleNames();
|
|
||||||
|
|
||||||
if (assetbundles.Length > 0) {
|
|
||||||
if (siteBuilds == null) {
|
|
||||||
siteBuilds = AssetDatabase.LoadAssetAtPath<Sites>("Assets/SiteBuilds/SiteList.asset");
|
|
||||||
if (siteBuilds == null) {
|
|
||||||
if (!Directory.Exists("Assets/SiteBuilds"))
|
|
||||||
Directory.CreateDirectory("Assets/SiteBuilds");
|
|
||||||
|
|
||||||
siteBuilds = (Sites)ScriptableObject.CreateInstance(typeof(Sites));
|
|
||||||
AssetDatabase.CreateAsset(siteBuilds, "Assets/SiteBuilds/SiteList.asset");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool hasChanged = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < assetbundles.Length; i++) {
|
|
||||||
Sites.SiteBuild siteBuild = siteBuilds.list.Find(sb => sb.siteName == assetbundles[i]);
|
|
||||||
if (siteBuild == null) {
|
|
||||||
siteBuild = new Sites.SiteBuild() {
|
|
||||||
siteName = assetbundles[i],
|
|
||||||
enabled = true,
|
|
||||||
};
|
|
||||||
siteBuilds.list.Add(siteBuild);
|
|
||||||
hasChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hasChanged)
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector2 scrollPos;
|
private Vector2 scrollPos;
|
||||||
|
|
||||||
private void OnGUI() {
|
private void OnGUI() {
|
||||||
@ -95,6 +64,55 @@ namespace Passer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GenerateSiteBuilds() {
|
||||||
|
string[] assetbundles = AssetDatabase.GetAllAssetBundleNames();
|
||||||
|
|
||||||
|
if (assetbundles.Length > 0) {
|
||||||
|
if (siteBuilds == null) {
|
||||||
|
siteBuilds = AssetDatabase.LoadAssetAtPath<Sites>("Assets/SiteBuilds/SiteList.asset");
|
||||||
|
if (siteBuilds == null) {
|
||||||
|
if (!Directory.Exists("Assets/SiteBuilds"))
|
||||||
|
Directory.CreateDirectory("Assets/SiteBuilds");
|
||||||
|
|
||||||
|
siteBuilds = (Sites)ScriptableObject.CreateInstance(typeof(Sites));
|
||||||
|
AssetDatabase.CreateAsset(siteBuilds, "Assets/SiteBuilds/SiteList.asset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool hasChanged = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < assetbundles.Length; i++) {
|
||||||
|
PrepareSite(assetbundles[i]);
|
||||||
|
|
||||||
|
Sites.SiteBuild siteBuild = siteBuilds.list.Find(sb => sb.siteName == assetbundles[i]);
|
||||||
|
if (siteBuild == null) {
|
||||||
|
siteBuild = new Sites.SiteBuild() {
|
||||||
|
siteName = assetbundles[i],
|
||||||
|
enabled = true,
|
||||||
|
};
|
||||||
|
siteBuilds.list.Add(siteBuild);
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasChanged)
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PrepareSite(string sitename) {
|
||||||
|
string[] paths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(sitename, sitename);
|
||||||
|
if (paths.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Scene scene = UnityEditor.SceneManagement.EditorSceneManager.OpenScene(paths[0]);
|
||||||
|
if (scene == null) {
|
||||||
|
Debug.Log("Could not load " + sitename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Debug.Log("Prepare " + sitename);
|
||||||
|
NetworkObject_Check.CheckNetworkObjects();
|
||||||
|
UnityEditor.SceneManagement.EditorSceneManager.SaveScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
|
||||||
|
}
|
||||||
|
|
||||||
private static void StartBuildToFolder() {
|
private static void StartBuildToFolder() {
|
||||||
string savePath = EditorUtility.SaveFolderPanel("Target folder", "", "");
|
string savePath = EditorUtility.SaveFolderPanel("Target folder", "", "");
|
||||||
BuildSites(savePath);
|
BuildSites(savePath);
|
||||||
|
|||||||
@ -9,42 +9,54 @@ namespace Passer {
|
|||||||
public class SiteNavigator_Editor : Editor {
|
public class SiteNavigator_Editor : Editor {
|
||||||
protected SiteNavigator siteNavigator;
|
protected SiteNavigator siteNavigator;
|
||||||
|
|
||||||
protected string[] siteNames;
|
//protected string[] siteNames;
|
||||||
|
|
||||||
#region Enable
|
#region Enable
|
||||||
|
|
||||||
protected virtual void OnEnable() {
|
protected virtual void OnEnable() {
|
||||||
siteNavigator = (SiteNavigator)target;
|
siteNavigator = (SiteNavigator)target;
|
||||||
|
|
||||||
InitializeSiteNames();
|
//InitializeSiteNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void InitializeSiteNames() {
|
//protected virtual void InitializeSiteNames() {
|
||||||
EditorBuildSettingsScene[] editorBuildSettingsScenes = EditorBuildSettings.scenes;
|
// //HumanoidVisitors.CheckScenes();
|
||||||
int siteCount = editorBuildSettingsScenes.Length - HumanoidVisitors.visitors.Count;
|
// //List<string> humanoidVisitors = HumanoidVisitors.visitors;
|
||||||
|
|
||||||
List<string> siteList = new List<string>();
|
// EditorBuildSettingsScene[] editorBuildSettingsScenes = EditorBuildSettings.scenes;
|
||||||
siteList.Add("-none-");
|
// int siteCount = editorBuildSettingsScenes.Length; // - HumanoidVisitors.visitors.Count;
|
||||||
int j = 0;
|
|
||||||
for (int i = 0; i < siteCount; i++) {
|
|
||||||
if (!editorBuildSettingsScenes[j].enabled) {
|
|
||||||
j++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
string sceneName = editorBuildSettingsScenes[j].path;
|
// List<string> siteList = new List<string>();
|
||||||
int lastSlash = sceneName.LastIndexOf('/');
|
// siteList.Add("-none-");
|
||||||
sceneName = sceneName.Substring(lastSlash + 1);
|
// for (int i = 0; i < siteCount; i++) {
|
||||||
sceneName = sceneName.Substring(0, sceneName.Length - 6); // remove .unity
|
// if (!editorBuildSettingsScenes[i].enabled) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
bool isVisitor = HumanoidVisitors.visitors.Contains(sceneName);
|
// string sceneName = editorBuildSettingsScenes[i].path;
|
||||||
if (!isVisitor) {
|
// if (sceneName.Length > 6) {
|
||||||
//siteNames[i] = sceneName;
|
// int lastSlash = sceneName.LastIndexOf('/');
|
||||||
siteList.Add(sceneName);
|
// sceneName = sceneName.Substring(lastSlash + 1);
|
||||||
j++;
|
// sceneName = sceneName.Substring(0, sceneName.Length - 6); // remove .unity
|
||||||
}
|
|
||||||
|
// // Does not work at the moment the visitors are all scenes
|
||||||
|
// //bool isVisitor = IsHumanoidVisitor(sceneName, humanoidVisitors);
|
||||||
|
// //if (!isVisitor) {
|
||||||
|
// siteList.Add(sceneName);
|
||||||
|
// //}
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// siteNames = siteList.ToArray();//new string[siteCount];
|
||||||
|
//}
|
||||||
|
|
||||||
|
private bool IsHumanoidVisitor(string sceneName, List<string> humanoidVisitors) {
|
||||||
|
foreach(string visitor in humanoidVisitors) {
|
||||||
|
int lastSlash = visitor.LastIndexOf('/');
|
||||||
|
string visitorSceneName = visitor.Substring(lastSlash + 1, visitor.Length - lastSlash - 7);
|
||||||
|
if (visitorSceneName == sceneName)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
siteNames = siteList.ToArray();//new string[siteCount];
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Enable
|
#endregion Enable
|
||||||
@ -82,34 +94,17 @@ namespace Passer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void StartSceneInspector() {
|
protected void StartSceneInspector() {
|
||||||
|
SerializedProperty startSceneProp = serializedObject.FindProperty(nameof(siteNavigator.startScene));
|
||||||
|
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(startSceneProp.stringValue);
|
||||||
|
|
||||||
GUIContent text = new GUIContent(
|
GUIContent text = new GUIContent(
|
||||||
"Start Scene",
|
"Start Scene",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
sceneAsset = (SceneAsset)EditorGUILayout.ObjectField(text, sceneAsset, typeof(SceneAsset), false);
|
||||||
|
|
||||||
SerializedProperty startSceneProp = serializedObject.FindProperty(nameof(siteNavigator.startScene));
|
startSceneProp.stringValue = AssetDatabase.GetAssetPath(sceneAsset);
|
||||||
|
|
||||||
if (siteNames == null || siteNames.Length == 0) {
|
|
||||||
startSceneProp.stringValue = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ix = 0;
|
|
||||||
for (; ix < siteNames.Length; ix++) {
|
|
||||||
if (siteNames[ix] == startSceneProp.stringValue)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ix == siteNames.Length) ix = 0;
|
|
||||||
if (Application.isPlaying) {
|
|
||||||
using (new EditorGUI.DisabledScope(true)) {
|
|
||||||
EditorGUILayout.Popup(text, ix, siteNames);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
ix = EditorGUILayout.Popup(text, ix, siteNames);
|
|
||||||
startSceneProp.stringValue = siteNames[ix];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Inspector
|
#endregion Inspector
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using UnityEngine;
|
|||||||
namespace Passer {
|
namespace Passer {
|
||||||
using Humanoid;
|
using Humanoid;
|
||||||
|
|
||||||
|
[CanEditMultipleObjects]
|
||||||
[CustomEditor(typeof(Handle), true)]
|
[CustomEditor(typeof(Handle), true)]
|
||||||
public class Handle_Editor : Editor {
|
public class Handle_Editor : Editor {
|
||||||
|
|
||||||
@ -42,9 +43,14 @@ namespace Passer {
|
|||||||
//if (HumanoidPreferences.help)
|
//if (HumanoidPreferences.help)
|
||||||
// EditorGUILayout.HelpBox("Component to specify behaviour when grabbing the GameObject", MessageType.None);
|
// EditorGUILayout.HelpBox("Component to specify behaviour when grabbing the GameObject", MessageType.None);
|
||||||
|
|
||||||
handle.hand = (Handle.Hand)EditorGUILayout.EnumPopup("Hand", handle.hand);
|
SerializedProperty handProp = serializedObject.FindProperty(nameof(Handle.hand));
|
||||||
handle.grabType = (Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", handle.grabType);
|
handProp.intValue = (int)(Handle.Hand)EditorGUILayout.EnumPopup("Hand", (Handle.Hand)handProp.intValue);
|
||||||
handle.range = EditorGUILayout.FloatField("Range", handle.range);
|
|
||||||
|
SerializedProperty grabTypeProp = serializedObject.FindProperty(nameof(Handle.grabType));
|
||||||
|
grabTypeProp.intValue = (int)(Handle.GrabType)EditorGUILayout.EnumPopup("Grab type", (Handle.GrabType)grabTypeProp.intValue);
|
||||||
|
|
||||||
|
SerializedProperty rangeProp = serializedObject.FindProperty(nameof(Handle.range));
|
||||||
|
rangeProp.floatValue = EditorGUILayout.FloatField("Range", rangeProp.floatValue);
|
||||||
|
|
||||||
HandPoseInspector(handle);
|
HandPoseInspector(handle);
|
||||||
CheckHandTarget(handle);
|
CheckHandTarget(handle);
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
namespace Passer {
|
namespace Passer {
|
||||||
using Humanoid;
|
using Humanoid;
|
||||||
|
|
||||||
[CustomEditor(typeof(ControllerInput))]
|
[CustomEditor(typeof(ControllerInput), true)]
|
||||||
public class ControllerInput_Editor : Editor {
|
public class ControllerInput_Editor : Editor {
|
||||||
protected ControllerInput controllerInput;
|
protected ControllerInput controllerInput;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build;
|
||||||
#if UNITY_2021_2_OR_NEWER
|
#if UNITY_2021_2_OR_NEWER
|
||||||
using UnityEditor.SceneManagement;
|
using UnityEditor.SceneManagement;
|
||||||
#else
|
#else
|
||||||
@ -10,14 +11,26 @@ namespace Passer {
|
|||||||
|
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class NetworkObject_Check {
|
public class NetworkObject_Check {
|
||||||
|
public int callbackOrder => 0;
|
||||||
|
|
||||||
|
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report) {
|
||||||
|
CheckNetworkObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Check if this gameObject has the right network transform code</summary>
|
/// <summary>Check if this gameObject has the right network transform code</summary>
|
||||||
static NetworkObject_Check() {
|
static NetworkObject_Check() {
|
||||||
|
CheckNetworkObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CheckNetworkObjects() {
|
||||||
NetworkObject[] networkObjects = Object.FindObjectsOfType<NetworkObject>();
|
NetworkObject[] networkObjects = Object.FindObjectsOfType<NetworkObject>();
|
||||||
|
|
||||||
foreach (NetworkObject networkObject in networkObjects)
|
foreach (NetworkObject networkObject in networkObjects)
|
||||||
CheckForNetworkObject(networkObject.gameObject);
|
CheckForNetworkObject(networkObject.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void CheckForNetworkObject(GameObject gameObject) {
|
public static void CheckForNetworkObject(GameObject gameObject) {
|
||||||
CheckNetworkObjectNone(gameObject);
|
CheckNetworkObjectNone(gameObject);
|
||||||
CheckNetworkObjectUnet(gameObject);
|
CheckNetworkObjectUnet(gameObject);
|
||||||
@ -98,6 +111,13 @@ namespace Passer {
|
|||||||
Photon.Pun.PhotonView photonView = gameObject.GetComponent<Photon.Pun.PhotonView>();
|
Photon.Pun.PhotonView photonView = gameObject.GetComponent<Photon.Pun.PhotonView>();
|
||||||
if (photonView == null)
|
if (photonView == null)
|
||||||
photonView = gameObject.AddComponent<Photon.Pun.PhotonView>();
|
photonView = gameObject.AddComponent<Photon.Pun.PhotonView>();
|
||||||
|
if (photonView.ViewID == 0) {
|
||||||
|
NetworkObject networkObject = gameObject.GetComponent<NetworkObject>();
|
||||||
|
if (networkObject != null && networkObject.objectIdentity != 0)
|
||||||
|
photonView.ViewID = (int)networkObject.objectIdentity;
|
||||||
|
else
|
||||||
|
Photon.Pun.PhotonNetwork.AllocateViewID(photonView);
|
||||||
|
}
|
||||||
|
|
||||||
Photon.Pun.PhotonTransformView transformView = gameObject.GetComponent<Photon.Pun.PhotonTransformView>();
|
Photon.Pun.PhotonTransformView transformView = gameObject.GetComponent<Photon.Pun.PhotonTransformView>();
|
||||||
if (transformView == null) {
|
if (transformView == null) {
|
||||||
|
|||||||
@ -76,17 +76,20 @@ namespace Passer.Humanoid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void AttachPrefab(Socket socket, SerializedProperty attachedTransformProp, GameObject prefab) {
|
protected virtual void AttachPrefab(Socket socket, SerializedProperty attachedTransformProp, GameObject prefab) {
|
||||||
|
SerializedProperty attachedHandleProp = serializedObject.FindProperty("attachedHandle");
|
||||||
|
|
||||||
if (attachedTransformProp.objectReferenceValue != null)
|
if (attachedTransformProp.objectReferenceValue != null)
|
||||||
ReleaseObject(socket, attachedTransformProp);
|
ReleaseObject(socket, attachedTransformProp);
|
||||||
|
|
||||||
GameObject obj = Instantiate(prefab, socket.transform.position, socket.transform.rotation);
|
GameObject obj = Instantiate(prefab, socket.transform.position, socket.transform.rotation);
|
||||||
obj.name = prefab.name; // Remove the (Clone)
|
obj.name = prefab.name; // Remove the (Clone)
|
||||||
|
|
||||||
socket.Attach(obj.transform);
|
socket.Attach(obj.transform, false);
|
||||||
if (socket.attachedTransform == null)
|
if (socket.attachedTransform == null)
|
||||||
Debug.LogWarning("Could not attach transform");
|
Debug.LogWarning("Could not attach transform");
|
||||||
else {
|
else {
|
||||||
attachedTransformProp.objectReferenceValue = obj;
|
attachedTransformProp.objectReferenceValue = obj;
|
||||||
|
attachedHandleProp.objectReferenceValue = socket.attachedHandle;
|
||||||
//Handle handle = socket.attachedHandle;
|
//Handle handle = socket.attachedHandle;
|
||||||
//if (handle == null)
|
//if (handle == null)
|
||||||
// Handle.Create(obj, socket);
|
// Handle.Create(obj, socket);
|
||||||
|
|||||||
BIN
HumanoidControl documentation.pdf
Normal file
BIN
HumanoidControl documentation.pdf
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bfe80b67437fde040b2ebc0b9cb73a15
|
guid: 53c8571aa9e542643b485a80320a9a70
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4465d1dbeab5b4e48a3b1a5a237ce59a
|
guid: ef89ebf080626664e9353fa0565b680e
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
18
README.md
18
README.md
@ -1,19 +1,25 @@
|
|||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
Import this package in Unity directlywith the Package Manager git package importer
|
You can import the Humanoid Control Free package in Unity directly with the Package Manager git package importer.
|
||||||
|
|
||||||
See [Unity: Installing from a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
|
See [Unity: Installing from a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
|
||||||
|
|
||||||
Use the link from 'Clone with HTTP' (for example: https://http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git)
|
Use the link from 'Clone with HTTP' (for example: https://git.passer.life/HumanoidControl/HumanoidControl_Free.git)
|
||||||
In this way you can always retrieve the latest version by pressing the Update button in the Package Manager.
|
In this way you can always retrieve the latest version by pressing the `Update` button in the Package Manager.
|
||||||
|
|
||||||
Optionally, you can use a tag to retrieve a specific version. For example:http://gitlab.passervr.com/passer/unity/humanoidcontrol4_free.git#4.1.0.
|
Optionally, you can use a tag to retrieve a specific version. For example:https://git.passer.life/HumanoidControl/HumanoidControl_Free.git#4.1.0.
|
||||||
This will give you a stable version which does not change. Updating can be done by retrieving the package with a link to a new release.
|
This will give you a stable version which does not change. Updating can be done by retrieving the package with a link to a new release.
|
||||||
|
|
||||||
ChangeLog and Releases
|
ChangeLog and Releases
|
||||||
======================
|
======================
|
||||||
You will find all releases with links which can be used in the Unity Package Manager here: https://gitlab.passervr.com/passer/unity/humanoidcontrol4_free/-/releases
|
All releases with UnityPackages and links for the Unity Package Manager: [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags).
|
||||||
|
|
||||||
|
An RSS/Atom feed with all releases can be found on the [Tags page](https://git.passer.life/HumanoidControl/HumanoidControl_Free/tags). Click on the _RSS Feed_ icon in the top-right corner to retrieve the feed.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
=============
|
=============
|
||||||
See [PasserVR HumanoidControl Documentation](https://passervr.com/apis/HumanoidControl/Unity/index.html)
|
For the latest version of the documentation, see [PasserVR HumanoidControl Documentation](https://docs.humanoidcontrol.com/)
|
||||||
|
|
||||||
|
Video
|
||||||
|
=====
|
||||||
|
[](https://passervr.com/PasserVR/videos/HC4Free.mp4)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 7fb2df2e4831fc94782d95487f732d65
|
guid: 9bd4d529ee013784db3923a2bdbc5bef
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@ -11,6 +11,7 @@ namespace Passer.Humanoid {
|
|||||||
/// The preferences can be accessed by the Edit->Preferences... menu.
|
/// The preferences can be accessed by the Edit->Preferences... menu.
|
||||||
///
|
///
|
||||||
/// \image html HumanoidPreferences.png
|
/// \image html HumanoidPreferences.png
|
||||||
|
/// \image rtf HumanoidPreferences.png
|
||||||
///
|
///
|
||||||
/// * SteamVR Support, enables support for SteamVR devices beyound Unity XR (VR, Plus, Pro)
|
/// * SteamVR Support, enables support for SteamVR devices beyound Unity XR (VR, Plus, Pro)
|
||||||
/// * Vive Tracker Support, enables support for Vive Trackers (Plus, Pro)
|
/// * Vive Tracker Support, enables support for Vive Trackers (Plus, Pro)
|
||||||
@ -104,6 +105,7 @@ namespace Passer.Humanoid {
|
|||||||
// return serializedSettings;
|
// return serializedSettings;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
private const string networkingSupportKey = "HumanoidNetworkingSupport";
|
private const string networkingSupportKey = "HumanoidNetworkingSupport";
|
||||||
public static NetworkingSystems networkingSupport {
|
public static NetworkingSystems networkingSupport {
|
||||||
get {
|
get {
|
||||||
@ -125,10 +127,12 @@ namespace Passer.Humanoid {
|
|||||||
EditorPrefs.SetString(visitorSceneNameKey, value);
|
EditorPrefs.SetString(visitorSceneNameKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
static class HumanoidPreferencesIMGUIRegister {
|
static class HumanoidPreferencesIMGUIRegister {
|
||||||
public static bool reload;
|
//public static bool reload;
|
||||||
|
|
||||||
[SettingsProvider]
|
[SettingsProvider]
|
||||||
public static SettingsProvider CreateHumanoidSettingsProvider() {
|
public static SettingsProvider CreateHumanoidSettingsProvider() {
|
||||||
@ -136,39 +140,8 @@ namespace Passer.Humanoid {
|
|||||||
label = "Humanoid Control",
|
label = "Humanoid Control",
|
||||||
guiHandler = (searchContext) => {
|
guiHandler = (searchContext) => {
|
||||||
|
|
||||||
//SerializedObject serializedSettings = HumanoidPreferences.GetOrCreateSerializedSettings();
|
|
||||||
|
|
||||||
//SerializedProperty configurationProp = serializedSettings.FindProperty("configuration");
|
|
||||||
//Configuration oldConfiguration = (Configuration)configurationProp.objectReferenceValue;
|
|
||||||
|
|
||||||
//configurationProp.objectReferenceValue = EditorGUILayout.ObjectField("Configuration", configurationProp.objectReferenceValue, typeof(Configuration), false);
|
|
||||||
//SerializedObject serializedConfiguration = new SerializedObject(configurationProp.objectReferenceValue);
|
|
||||||
|
|
||||||
//bool anyChanged = false;
|
|
||||||
//anyChanged |= (configurationProp.objectReferenceValue != oldConfiguration);
|
|
||||||
//anyChanged |= Configuration_Editor.ConfigurationGUI(serializedConfiguration);
|
|
||||||
//serializedConfiguration.ApplyModifiedProperties();
|
|
||||||
//serializedSettings.ApplyModifiedProperties();
|
|
||||||
|
|
||||||
//Configuration_Editor.CheckExtensions((Configuration)configurationProp.objectReferenceValue);
|
|
||||||
|
|
||||||
VisitorSceneInspector();
|
VisitorSceneInspector();
|
||||||
|
|
||||||
if (reload) {
|
|
||||||
reload = false;
|
|
||||||
#if hUNET
|
|
||||||
OnLoadHumanoidPlayerUnet.CheckHumanoidPlayer();
|
|
||||||
#endif
|
|
||||||
#if hPHOTON1 || hPHOTON2
|
|
||||||
OnLoadHumanoidPlayerPun.CheckHumanoidPlayer();
|
|
||||||
#endif
|
|
||||||
#if hBOLT
|
|
||||||
OnLoadHumanoidPlayerBolt.CheckHumanoidPlayer();
|
|
||||||
#endif
|
|
||||||
#if hMIRROR
|
|
||||||
OnLoadHumanoidPlayerMirror.CheckHumanoidPlayer();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
keywords = new HashSet<string>(
|
keywords = new HashSet<string>(
|
||||||
new[] { "Humanoid", "Oculus", "SteamVR" }
|
new[] { "Humanoid", "Oculus", "SteamVR" }
|
||||||
@ -179,34 +152,18 @@ namespace Passer.Humanoid {
|
|||||||
|
|
||||||
private static string[] visitorNames;
|
private static string[] visitorNames;
|
||||||
private static bool VisitorSceneInspector() {
|
private static bool VisitorSceneInspector() {
|
||||||
bool anyChanged = false;
|
string visitorScenePath = HumanoidPreferences.visitorSceneName;
|
||||||
if (HumanoidVisitors.visitors == null || HumanoidVisitors.visitors.Count <= 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
visitorNames = new string[HumanoidVisitors.visitors.Count];
|
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(visitorScenePath);
|
||||||
int i = 0;
|
sceneAsset = (SceneAsset) EditorGUILayout.ObjectField("Visitor Scene", sceneAsset, typeof(SceneAsset), false);
|
||||||
int ix;
|
visitorScenePath = AssetDatabase.GetAssetPath(sceneAsset);
|
||||||
foreach (string visitor in HumanoidVisitors.visitors) {
|
|
||||||
string name = visitor;
|
|
||||||
ix = name.LastIndexOf('/');
|
|
||||||
name = name.Substring(ix + 1);
|
|
||||||
name = name.Substring(0, name.Length - 6); // remove .unity
|
|
||||||
visitorNames[i++] = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
string visitorSceneName = HumanoidPreferences.visitorSceneName;
|
bool anyChanged = visitorScenePath != HumanoidPreferences.visitorSceneName;
|
||||||
ix = HumanoidVisitors.visitors.FindIndex(name => name == visitorSceneName);
|
|
||||||
if (ix < 0)
|
|
||||||
ix = 0;
|
|
||||||
ix = EditorGUILayout.Popup("Default Visitor scene", ix, visitorNames);
|
|
||||||
anyChanged = visitorSceneName != HumanoidVisitors.visitors[ix];
|
|
||||||
if (anyChanged)
|
|
||||||
HumanoidVisitors.SetPersonalHumanoid(visitorSceneName, HumanoidVisitors.visitors[ix]);
|
|
||||||
|
|
||||||
HumanoidPreferences.visitorSceneName = HumanoidVisitors.visitors[ix];
|
HumanoidPreferences.visitorSceneName = visitorScenePath;
|
||||||
|
|
||||||
return anyChanged;
|
return anyChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user