Skip to content

Commit

Permalink
Merge branch 'main' into 90hz
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeage authored Aug 19, 2021
2 parents 3d984ca + ee14a3a commit a57b0be
Show file tree
Hide file tree
Showing 526 changed files with 41,770 additions and 2,503 deletions.
8 changes: 3 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@

root = true

[*.{cs,py,json,cfg}]
[*.{json,cfg}]
indent_style = space
indent_size = 2

[*.py]
indent_size = 4

[*.cs]
[*.{cs,py}]
indent_style = space
indent_size = 4

# Microsoft .NET properties
Expand Down
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fbe9985b182e64aa110aef3f8d4336887550ff8f
eba58b2225c2d33e091b4c584904418d82853092
2b1f4a2df600df58374b4f43e92ac9ee1531900b
109 changes: 95 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ on: # yamllint disable-line rule:truthy
pull_request: {}
push:
branches:
- "*"
- "**"
tags:
- "v*"

env:
UNITY_VERSION: "2019.4.24f1"
UNITY_VERSION: "2019.4.25f1"
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
# If UNITY_SERIAL is not set, then use a hardcoded license. Otherwise, don't set this, so the game-ci actions will use EMAIL/PASS/SERIAL
UNITY_LICENSE: ${{ fromJSON('["<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"56bce8b03146a1a47339b2bc8a7a40af276146b9\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LURFWjQtVVk1TS04M1lULTNOWVAtNEtXNg==\"/>\n <SerialMasked Value=\"F4-DEZ4-UY5M-83YT-3NYP-XXXX\"/>\n <StartDate Value=\"2021-01-27T00:00:00\"/>\n <UpdateDate Value=\"2021-04-10T11:43:41\"/>\n <InitialActivationDate Value=\"2021-01-27T07:00:51\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.4.24f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>GYC1YpQHTB2q5CllgJhlpihJuAk=</DigestValue></Reference></SignedInfo><SignatureValue>WE8iCxEU2CEWYaVo4EiFJzCmftuq994dQk7wPenZcQ0VZhJ7eXYLkxbJSXGCPbYv+Bphz0T0mhEy\nq2fV05Yfp1xiKryawbiA7kk7wIY6qTo35Oex+jEg5DX1V2Rf3uUeXfareHagnHTt43+slTCN1gNd\nbPHZhHetWWYBECMCkt95ISJg8R2eIxT2MeeHoey2Xr4+Y0MEJE57cmj2hYcd1rg5S6sbnovBlav4\nS5GdvS8ZufejTvuYrvhLMA+BBnJ2g1elqMaYJZu5nV1J2cTI/Xaipvp265CM5lykzRVrQAHxz5zt\n9M6hFRxnhRGamyTPOtxcCwG9Cl4xYKS1TyhEww==</SignatureValue></Signature></root>", null]')[secrets.UNITY_SERIAL != null] }}
UNITY_LICENSE: ${{ fromJSON('["<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"56bce8b03146a1a47339b2bc8a7a40af276146b9\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LURFWjQtVVk1TS04M1lULTNOWVAtNEtXNg==\"/>\n <SerialMasked Value=\"F4-DEZ4-UY5M-83YT-3NYP-XXXX\"/>\n <StartDate Value=\"2021-01-27T00:00:00\"/>\n <UpdateDate Value=\"2021-05-06T05:54:38\"/>\n <InitialActivationDate Value=\"2021-01-27T07:00:51\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.4.25f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>xCBKYap0JQVBqX22jba4k5Da5t0=</DigestValue></Reference></SignedInfo><SignatureValue>n8eYH6Exi6mpw6onE5blxgQY1bAb+NLrsblMlFLUTPVTGw5KmugyVHedyZiI47D3nZVK/FpGaVxJ\n2xcNBr8yR1lfQrakloAZhvlCTiNi/O8N+6aHGZgyi/5+2SLqj0E/ZB+bVlTaSioLy/cF6iOt0d0T\nvW+VEdhht9iWrKKeNBakcXGccX5tQhJFaTR8aYevp0t0TMz3cfGPhs5qDivufqoFl34Y6qa8HjAC\n+OvrlD0TIgMyev+czK0KMIRsT/euOoyOHupXb93BuiMWceRIqf4mYvPKJbhx15Zy3uxHbsF6lV8q\nGah5JCb8iGRTDmG2JzMg6pXCjiznPFNk4Tkl7Q==</SignatureValue></Signature></root>", null]')[secrets.UNITY_SERIAL != null] }}

jobs:
configuration:
Expand All @@ -37,8 +37,8 @@ jobs:
stamp: ${{ steps.version.outputs.stamp }}
prerelease: ${{ steps.version.outputs.prerelease }}
changelog: ${{ steps.changelog.outputs.changelog }}
btbgithub: ${{ steps.github.outputs.btbgithub }}
basename: ${{ steps.github.outputs.basename }}
description: ${{ steps.github.outputs.description}}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -81,18 +81,31 @@ jobs:
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=changelog::$CHANGELOG"
- name: Set github suffix if relevant
- name: Set custom app name and package name, if relevant
id: github
env:
PRERELEASE: ${{ steps.version.outputs.prerelease }}
run: |
if [ "$PRERELEASE" == "true" ]
# For a PR action (i.e., syncronize / open), the value of github.ref will be refs/pull/1234/merge
# For a push action, it will be either refs/heads/foo_branch_name OR refs/tags/v1234.
# We want to use the base name for pushes of tags or to main, the PR number for PRs, and the branch name for named branches.
if [[ "$PRERELEASE" == "false" || ${{ github.ref }} == refs/heads/main ]]
then
echo "::set-output name=btbgithub::-btb-github"
echo "::set-output name=basename::OpenBrush-github"
else
echo "::set-output name=btbgithub::"
echo "::set-output name=basename::OpenBrush"
echo "::set-output name=description::"
else
if [[ ${{ github.ref }} == refs/pull/* ]]
then
DESCRIPTION="PR#$(echo ${{ github.ref }} | sed -e 's#refs/pull/##' -e 's#/merge##')"
elif [[ ${{ github.ref }} == refs/heads/* ]]
then
DESCRIPTION="$(echo ${{ github.ref }} | sed -e 's#refs/heads/##')"
else
DESCRIPTION="Unknown"
fi
echo "::set-output name=description::-btb-description ${DESCRIPTION}"
IDENTIFIER=$(echo ${DESCRIPTION} | sed -e 's/[\/#_-]//g')
echo "::set-output name=basename::OpenBrush-${IDENTIFIER}"
fi
build:
name: ${{ matrix.name }}
Expand Down Expand Up @@ -147,6 +160,27 @@ jobs:


steps:
- name: Free extra space
# This takes several minutes, so we only do it where required
if: matrix.targetPlatform == 'Android'
run: |
echo "Initial free space"
df -h
sudo swapoff -a
sudo rm -f /swapfile
docker rmi $(docker image ls -aq)
#echo "Listing 100 largest packages"
#dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn | head -n 100
echo "Removing large packages"
sudo apt-get remove -y '^ghc-8.*' '^dotnet-.*' azure-cli google-cloud-sdk 'adoptopenjdk-.*-hotspot' google-chrome-stable firefox 'php.*'
sudo apt-get autoremove -y
sudo apt-get clean
echo "Removing remaining large directories"
rm -rf /usr/share/dotnet/
rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Disk space after cleanup"
df -h
- name: Checkout repository
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -242,7 +276,7 @@ jobs:
env:
BASENAME: ${{ needs.configuration.outputs.basename}}
run:
echo "filename=com.Icosa.$(echo $BASENAME | sed -e 's/-//g').apk" >> $GITHUB_ENV
echo "filename=com.Icosa.$BASENAME.apk" >> $GITHUB_ENV

- name: Set build stamp
if: ${{ needs.configuration.outputs.stamp }}
Expand Down Expand Up @@ -293,7 +327,7 @@ jobs:
allowDirtyBuild: true # Because of the OVR Update, the build tree might be dirty
unityVersion: ${{ env.UNITY_VERSION }}
targetPlatform: ${{ matrix.targetPlatform }}
customParameters: -btb-target ${{ matrix.targetPlatform }} -btb-display ${{ matrix.vrsdk }} -btb-out /github/workspace/build/${{ matrix.targetPlatform }}-${{ matrix.vrsdk }}/${{ env.filename }} ${{ needs.configuration.outputs.btbgithub }} ${{ env.stamp }} ${{ matrix.extraoptions }}
customParameters: -btb-target ${{ matrix.targetPlatform }} -btb-display ${{ matrix.vrsdk }} -btb-out /github/workspace/build/${{ matrix.targetPlatform }}-${{ matrix.vrsdk }}/${{ env.filename }} ${{ needs.configuration.outputs.description}} ${{ env.stamp }} ${{ matrix.extraoptions }}
versioning: Custom
version: ${{ needs.configuration.outputs.version }}
buildMethod: BuildTiltBrush.CommandLine
Expand Down Expand Up @@ -400,9 +434,9 @@ jobs:
zip -r OpenBrush_Desktop_Experimental_$VERSION.zip OpenBrush_Desktop_Experimental_$VERSION/
zip -r OpenBrush_Rift_$VERSION.zip OpenBrush_Rift_$VERSION/
zip -r OpenBrush_Rift_Experimental_$VERSION.zip OpenBrush_Rift_Experimental_$VERSION/
chmod a+x OpenBrush_Linux_$VERSION/OpenBrush || chmod a+x OpenBrush_Linux_$VERSION/OpenBrush-github
chmod a+x OpenBrush_Linux_$VERSION/OpenBrush*
tar cvfz OpenBrush_Linux_$VERSION.tgz OpenBrush_Linux_$VERSION/
chmod a+x OpenBrush_Linux_Experimental_$VERSION/OpenBrush || chmod a+x OpenBrush_Linux_Experimental_$VERSION/OpenBrush-github
chmod a+x OpenBrush_Linux_Experimental_$VERSION/OpenBrush*
tar cvfz OpenBrush_Linux_Experimental_$VERSION.tgz OpenBrush_Linux_Experimental_$VERSION/
rm -rf OpenBrush_Desktop_$VERSION
rm -rf OpenBrush_Desktop_Experimental_$VERSION
Expand All @@ -419,3 +453,50 @@ jobs:
prerelease: ${{ needs.configuration.outputs.prerelease }}
tag_name: ${{ needs.configuration.outputs.version }}
files: releases/*
publish_oculus:
name: Publish Oculus Release
needs: [configuration, build]
runs-on: macos-latest # the ovr-platform-util tool is only available for Mac and Windows
if: |
github.event_name == 'push' &&
github.repository == 'icosa-gallery/open-brush' &&
(github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v'))
strategy:
fail-fast: false

steps:
- name: Download Build Artifacts (Windows Rift)
uses: actions/download-artifact@v2
with:
name: Windows Rift
path: build_windows_rift
- name: Download Build Artifacts (Oculus Quest)
uses: actions/download-artifact@v2
with:
name: Oculus Quest
path: build_oculus_quest
- name: Publish Oculus Builds
env:
VERSION: ${{ needs.configuration.outputs.version }}
PRERELEASE: ${{ needs.configuration.outputs.prerelease }}
OCULUS_RIFT_APP_ID: ${{ secrets.OCULUS_RIFT_APP_ID }}
OCULUS_RIFT_APP_SECRET: ${{ secrets.OCULUS_RIFT_APP_SECRET }}
OCULUS_QUEST_APP_ID: ${{ secrets.OCULUS_QUEST_APP_ID }}
OCULUS_QUEST_APP_SECRET: ${{ secrets.OCULUS_QUEST_APP_SECRET }}
run: |
mkdir releases
mv build_oculus_quest/*/com.Icosa.OpenBrush*apk releases/OpenBrush_Quest_$VERSION.apk
mv build_windows_rift/StandaloneWindows64-Oculus/ releases/OpenBrush_Rift_$VERSION/
cd releases
zip -r OpenBrush_Rift_$VERSION.zip OpenBrush_Rift_$VERSION/
curl -L 'https://www.oculus.com/download_app/?id=1462426033810370' -o ovr-platform-util
chmod 755 ovr-platform-util
if [ "$PRERELEASE" == "false" ]
then
./ovr-platform-util upload-quest-build --app-id ${OCULUS_QUEST_APP_ID} --app-secret ${OCULUS_QUEST_APP_SECRET} --apk OpenBrush_Quest_$VERSION.apk --channel LIVE
./ovr-platform-util upload-rift-build --app-id ${OCULUS_RIFT_APP_ID} --app-secret ${OCULUS_RIFT_APP_SECRET} --build-dir OpenBrush_Rift_$VERSION --launch-file OpenBrush.exe --channel LIVE --version $VERSION --firewall_exceptions true --redistributables 822786567843179,1675031999409058,2657209094360789
else
./ovr-platform-util upload-quest-build --app-id ${OCULUS_QUEST_APP_ID} --app-secret ${OCULUS_QUEST_APP_SECRET} --apk OpenBrush_Quest_$VERSION.apk --channel Beta
./ovr-platform-util upload-rift-build --app-id ${OCULUS_RIFT_APP_ID} --app-secret ${OCULUS_RIFT_APP_SECRET} --build-dir OpenBrush_Rift_$VERSION --launch-file OpenBrush.exe --channel BETA --version $VERSION --firewall_exceptions true --redistributables 822786567843179,1675031999409058,2657209094360789
fi
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
rev: "7e343070a0355c86f72bdee226b5e19ffcbac931" # "v5.0.211103"
hooks:
- id: dotnet-format
exclude: ^Assets/ThirdParty
exclude: ^(Assets/ThirdParty)|(Packages/)
args:
- --folder
- --include
92 changes: 92 additions & 0 deletions Assets/Editor/BrushLister.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using TiltBrush;
using UnityEditor;
using UnityEngine;
using Valve.Newtonsoft.Json.Utilities;
using Object = UnityEngine.Object;

public class BrushLister : MonoBehaviour
{
private static StringBuilder brushList;
private static List<Guid> deprecated;
private static TiltBrushManifest brushManifest;
private static TiltBrushManifest brushManifestX;

[MenuItem("Tilt/Info/Brush Lister")]
static void ListBrushes()
{
brushList = new StringBuilder();

Object[] defaultBrushes = Resources.LoadAll("Brushes", typeof(BrushDescriptor)).ToArray();
var experimentalBrushes = Resources.LoadAll("X/Brushes", typeof(BrushDescriptor)).ToArray();

brushManifest = AssetDatabase.LoadAssetAtPath<TiltBrushManifest>("Assets/Manifest.asset");
brushManifestX = AssetDatabase.LoadAssetAtPath<TiltBrushManifest>("Assets/Manifest_Experimental.asset");

deprecated = new List<Guid>();

foreach (BrushDescriptor b in defaultBrushes) { if (b.m_Supersedes != null) deprecated.Add(b.m_Supersedes.m_Guid); }
foreach (BrushDescriptor b in experimentalBrushes) { if (b.m_Supersedes != null) deprecated.Add(b.m_Supersedes.m_Guid); }

foreach (BrushDescriptor brush in defaultBrushes) { AppendValidBrushString(brush, false); }
foreach (BrushDescriptor brush in experimentalBrushes)
{
try { AppendValidBrushString(brush, true); }
catch (Exception UnassignedReferenceException)
{
Debug.Log($"Experimental brush loading error: {UnassignedReferenceException}");
}
}

Debug.Log($"{brushList}");
}

public static string getBrushRowString(BrushDescriptor brush, bool experimental)
{
// Exclude legacy brushes
if (brush.m_SupersededBy != null) return "";
var brushScripts = sniffBrushScript(brush);
string prefabName = brush.m_BrushPrefab != null ? brush.m_BrushPrefab.name : "";
string materialName = brush.Material != null ? brush.Material.name : "";
string shaderName = brush.Material != null ? brush.Material.shader.name : "";
string manifest = "";
if (brushManifest.Brushes.Contains(brush) && brushManifestX.Brushes.Contains(brush))
{
manifest = "both";
}
else if (brushManifest.Brushes.Contains(brush))
{
manifest = "Default";
}
else if (brushManifestX.Brushes.Contains(brush))
{
manifest = "Experimental";
}
return $"{brush.m_Description}\t{brush.m_AudioReactive}\t{prefabName}\t{materialName}\t{shaderName}\t{brushScripts}\t{experimental}\t{brush.m_SupersededBy}\t{manifest}";
}

public static string sniffBrushScript(BrushDescriptor brush)
{
GameObject prefab = brush.m_BrushPrefab;
if (prefab == null) return "";
var componentNames = new List<string>();
foreach (MonoBehaviour c in prefab.GetComponents<MonoBehaviour>())
{
if (c.GetType() == typeof(MeshFilter) || c.GetType() == typeof(Transform) || c.GetType() == typeof(MeshRenderer)) continue;
componentNames.Add(c.GetType().ToString().Replace("TiltBrush.", ""));
}
return string.Join(",", componentNames);
}

public static void AppendValidBrushString(BrushDescriptor brush, bool experimental)
{
if (deprecated.Contains(brush.m_Guid)) return;
var rowString = getBrushRowString(brush, experimental);
if (rowString != "") brushList.AppendLine($"{rowString}");
}

}

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

Loading

0 comments on commit a57b0be

Please sign in to comment.