Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into experiments/moonsharp
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Jan 18, 2024
2 parents 17b59c9 + 9dc79d3 commit 2f8719e
Show file tree
Hide file tree
Showing 197 changed files with 970 additions and 22,032 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ jobs:
versionSuffix: 1
extra_defines: PICO_SUPPORTED

- name: iOS Zapbox
targetPlatform: iOS
vrsdk: Zapbox
cache: iOS
extraoptions: -btb-il2cpp
extra_defines: ZAPBOX_SUPPORTED
packages_to_remove: com.unity.formats.usd

steps:
- name: Set masking
run: echo "::add-mask::$UNITY_PASSWORD"
Expand Down Expand Up @@ -385,6 +393,8 @@ jobs:
echo "filename=$BASENAME.exe" >> $GITHUB_ENV
elif [[ "${{ matrix.targetPlatform}}" == "StandaloneLinux64" ]]; then
echo "filename=$BASENAME" >> $GITHUB_ENV
elif [[ "${{ matrix.targetPlatform}}" == "iOS" ]]; then
echo "filename=$BASENAME" >> $GITHUB_ENV
elif [[ "${{ matrix.targetPlatform}}" == "StandaloneOSX" ]]; then
echo "filename=$BASENAME.app" >> $GITHUB_ENV
elif [[ "${{ matrix.targetPlatform}}" == "Android" ]]; then
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 67 additions & 28 deletions Assets/Editor/BuildTiltBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.Build.Reporting;
#if UNITY_EDITOR_OSX && UNITY_IPHONE
#if UNITY_IPHONE
using UnityEditor.iOS.Xcode;
#endif
using UnityEditor.SceneManagement;
Expand All @@ -46,10 +46,10 @@ static class BuildTiltBrush
{
// Types, consts, enums

// The vendor name - used for naming android builds - shouldn't have spaces.
public const string kVendorName = "Icosa";
// The vendor name - used for the company name in builds and fbx output. Can have spaces.
public const string kDisplayVendorName = "Icosa Foundation";
// The vendor name as the reverse DNS - used for naming mobile builds - shouldn't have spaces.
public const string kVendorReverseDNS = "foundation.icosa";

// Executable Base
public const string kGuiBuildExecutableName = "OpenBrush";
Expand All @@ -60,9 +60,10 @@ static class BuildTiltBrush
// OSX Executable
public const string kGuiBuildOsxExecutableName = kGuiBuildExecutableName + ".app";
// Android Application Identifier
public static string GuiBuildAndroidApplicationIdentifier => $"foundation.{kVendorName}.{kGuiBuildExecutableName}".ToLower();
public static string GuiBuildAndroidApplicationIdentifier => $"{kVendorReverseDNS}.{kGuiBuildExecutableName}".ToLower();
// Android Executable
public static string GuiBuildAndroidExecutableName => GuiBuildAndroidApplicationIdentifier + ".apk";
public static string GuiBuildiOSApplicationIdentifier => $"{kVendorReverseDNS}.{kGuiBuildExecutableName}".ToLower();

public class TiltBuildOptions
{
Expand Down Expand Up @@ -117,6 +118,9 @@ private static readonly List<KeyValuePair<XrSdkMode, BuildTarget>> kValidSdkTarg
new KeyValuePair<XrSdkMode, BuildTarget>(XrSdkMode.OpenXR, BuildTarget.StandaloneWindows64),
new KeyValuePair<XrSdkMode, BuildTarget>(XrSdkMode.OpenXR, BuildTarget.Android),

// Zapbox
new KeyValuePair<XrSdkMode, BuildTarget>(XrSdkMode.Zapbox, BuildTarget.iOS),

#if OCULUS_SUPPORTED
// Oculus
new KeyValuePair<XrSdkMode, BuildTarget>(XrSdkMode.Oculus, BuildTarget.StandaloneWindows64),
Expand Down Expand Up @@ -297,11 +301,11 @@ public static TiltBuildOptions GetGuiOptions()
Target = GuiSelectedBuildTarget,
XrSdk = GuiSelectedSdk,
Location = GetAppPathForGuiBuild(),
Stamp = "(menuitem)",
Stamp = "menuitem",
UnityOptions = GuiDevelopment
? (BuildOptions.AllowDebugging | BuildOptions.Development | BuildOptions.CleanBuildCache)
: BuildOptions.None,
Description = "(unity editor)",
Description = "unity editor",
};
}

Expand Down Expand Up @@ -347,6 +351,9 @@ public static string GetAppPathForGuiBuild()
case BuildTarget.Android:
location += "/" + GuiBuildAndroidExecutableName;
break;
case BuildTarget.iOS:
location += "/" + kGuiBuildExecutableName;
break;
case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64:
location += "/" + kGuiBuildWindowsExecutableName;
Expand Down Expand Up @@ -949,12 +956,12 @@ public void Dispose()
class TempSetBundleVersion : IDisposable
{
string m_prevBundleVersion;
public TempSetBundleVersion(string configVersionNumber, string stamp)
public TempSetBundleVersion(BuildTarget target, string configVersionNumber, string stamp)
{
m_prevBundleVersion = PlayerSettings.bundleVersion;
// https://stackoverflow.com/a/9741724/194921 for more on the meaning/format of this string
PlayerSettings.bundleVersion = configVersionNumber;
if (!string.IsNullOrEmpty(stamp))
if (!string.IsNullOrEmpty(stamp) && target != BuildTarget.iOS)
{
PlayerSettings.bundleVersion += string.Format("-{0}", stamp);
}
Expand All @@ -972,37 +979,55 @@ class TempSetAppNames : IDisposable
private string m_identifier;
private string m_name;
private string m_company;
private bool m_isAndroid;
public TempSetAppNames(bool isAndroid, string Description)
private bool m_IsAndroidOrIos;
private BuildTarget m_Target;
public TempSetAppNames(BuildTarget target, string Description)
{
m_isAndroid = isAndroid;
m_identifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
m_Target = target;
m_IsAndroidOrIos = m_Target == BuildTarget.Android || m_Target == BuildTarget.iOS;
m_identifier = PlayerSettings.GetApplicationIdentifier(TargetToGroup(target));
m_name = PlayerSettings.productName;
m_company = PlayerSettings.companyName;
string new_name = App.kAppDisplayName;
string new_identifier = GuiBuildAndroidApplicationIdentifier;

string new_identifier = m_identifier;
switch (m_Target)
{
case BuildTarget.Android:
new_identifier = GuiBuildAndroidApplicationIdentifier;
break;
case BuildTarget.iOS:
new_identifier = GuiBuildiOSApplicationIdentifier;
break;
default:
break;
}

#if OCULUS_SUPPORTED || USE_QUEST_PACKAGE_NAME
//Can't change Quest identifier
new_identifier = "com.Icosa.OpenBrush";
#elif ZAPBOX_SUPPORTED
// Zapbox has a separate listing
new_identifier = "foundation.icosa.openbrushzapbox";
#endif
if (!String.IsNullOrEmpty(Description))
{
new_name += " (" + Description + ")";
new_identifier += Description.Replace("_", "").Replace("#", "").Replace("-", "");
new_name += "-(" + Description + ")";
new_identifier += "-" + Description.Replace("_", "").Replace("#", "").Replace("-", "");
}
if (m_isAndroid)
if (m_IsAndroidOrIos)
{
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, new_identifier);
PlayerSettings.SetApplicationIdentifier(TargetToGroup(target), new_identifier);
}
PlayerSettings.productName = new_name;
PlayerSettings.companyName = kVendorName;
PlayerSettings.companyName = kDisplayVendorName;
}

public void Dispose()
{
if (m_isAndroid)
if (m_IsAndroidOrIos)
{
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, m_identifier);
PlayerSettings.SetApplicationIdentifier(TargetToGroup(m_Target), m_identifier);
}
PlayerSettings.productName = m_name;
PlayerSettings.companyName = m_company;
Expand Down Expand Up @@ -1124,6 +1149,9 @@ public TempSetXrPlugin(TiltBuildOptions tiltOptions)
case XrSdkMode.Pico:
targetXrPluginsRequired = new string[] { "Unity.XR.PXR.PXR_Loader" };
break;
case XrSdkMode.Zapbox:
targetXrPluginsRequired = new string[] { "Zappar.XR.ZapboxLoader" };
break;
case XrSdkMode.Monoscopic:
targetSettings.InitManagerOnStart = false;
break;
Expand Down Expand Up @@ -1192,7 +1220,7 @@ class TempSetGraphicsApis : IDisposable
public TempSetGraphicsApis(TiltBuildOptions tiltOptions)
{
m_Target = tiltOptions.Target;
m_graphicsApis = PlayerSettings.GetGraphicsAPIs(tiltOptions.Target);
m_graphicsApis = PlayerSettings.GetGraphicsAPIs(m_Target);
UnityEngine.Rendering.GraphicsDeviceType[] targetGraphicsApisRequired;

switch (tiltOptions.XrSdk)
Expand Down Expand Up @@ -1472,8 +1500,8 @@ public static void DoBuild(TiltBuildOptions tiltOptions)
using (var unused4 = new TempHookUpSingletons())
using (var unused5 = new TempSetScriptingBackend(target, tiltOptions.Il2Cpp))
using (var unused14 = new TempSetGraphicsApis(tiltOptions))
using (var unused6 = new TempSetBundleVersion(App.Config.m_VersionNumber, stamp))
using (var unused10 = new TempSetAppNames(target == BuildTarget.Android, tiltOptions.Description))
using (var unused6 = new TempSetBundleVersion(target, App.Config.m_VersionNumber, stamp))
using (var unused10 = new TempSetAppNames(target, tiltOptions.Description))
using (var unused7 = new TempSetXrPlugin(tiltOptions))
using (var unused13 = new TempSetOpenXrFeatureGroup(tiltOptions))
using (var unused9 = new RestoreFileContents(
Expand Down Expand Up @@ -1766,22 +1794,33 @@ public static void OnPostProcessBuild(BuildTarget target, string path)
{
// TODO: is it possible to embed loose files on iOS?
looseFilesDest = null;
#if UNITY_EDITOR_OSX && UNITY_IPHONE
#if UNITY_IPHONE
string pbxPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

PBXProject project = new PBXProject();
project.ReadFromString(File.ReadAllText(pbxPath));
string pbxTarget = project.TargetGuidByName("Unity-iPhone");
string pbxTarget = project.GetUnityMainTargetGuid();

// additional framework libs
project.AddFrameworkToProject(pbxTarget, "Security.framework", false);
project.AddFrameworkToProject(pbxTarget, "CoreData.framework", false);
// disable bitcode due to issue with Cardboard plugin (b/27129333)
project.SetBuildProperty(pbxTarget, "ENABLE_BITCODE", "false");
// TODO:Mikesky - I've disabled this disable, does bitcode work now?
//project.SetBuildProperty(pbxTarget, "ENABLE_BITCODE", "false");

File.WriteAllText(pbxPath, project.WriteToString());
#else
Die(5, "OS X required for building iOS target.");

string plistPath = path + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromFile(plistPath);
PlistElementDict root = plist.root;

PlistElementBoolean enable = new (true);
root["UIFileSharingEnabled"] = enable;
root["LSSupportsOpeningDocumentsInPlace"] = enable;

//save plist values
plist.WriteToFile(plistPath);
#endif
break;
}
Expand Down
4 changes: 2 additions & 2 deletions Assets/Editor/BuildWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ private void MakeBuildConfigGui()
bool newIsMono = false;
bool newIsIl2cpp = false;

// Android requires IL2CPP
if (BuildTiltBrush.GuiSelectedBuildTarget == BuildTarget.Android)
// Mobile requires IL2CPP
if (BuildTiltBrush.GuiSelectedBuildTarget == BuildTarget.Android || BuildTiltBrush.GuiSelectedBuildTarget == BuildTarget.iOS)
{
newIsIl2cpp = true;
GUILayout.Toggle(newIsIl2cpp, "IL2CPP", toggleOpt);
Expand Down
1 change: 0 additions & 1 deletion Assets/Editor/FindAllTextMeshes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using USD.NET;
using Object = UnityEngine.Object;

namespace TiltBrush
Expand Down
4 changes: 2 additions & 2 deletions Assets/Prefabs/Accounts/Authentication/ReplaceHeadset.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
<title>Tilt Brush - Replace your headset</title>
<title>Open Brush - Replace your headset</title>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="TiltBrush_FavIcon.png" />
<style>
Expand All @@ -21,7 +21,7 @@
<body>
<div>
<img src="TiltasaurusHMDOn.png"/><br/>
Put your headset on to return to Tilt Brush<br/>
Put your headset on to return to Open Brush<br/>
and continue creating.
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
<title>Tilt Brush - Replace your headset</title>
<title>Open Brush - Replace your headset</title>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="TiltBrush_FavIcon.png" />
<style>
Expand All @@ -21,7 +21,8 @@
<body>
<div>
<img src="TiltasaurusHMDOn.png" width=384 height=384/><br/>
Relaunch Tilt Brush to continue creating.
Return to Open Brush to continue creating.<br/>
Meta Quest users can click the "Done" button above.
</div>
</body>
</html>
Loading

0 comments on commit 2f8719e

Please sign in to comment.