Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/text-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed May 3, 2024
2 parents 362e85a + f5228c5 commit c8ce22e
Show file tree
Hide file tree
Showing 283 changed files with 12,907 additions and 1,394 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,9 @@ jobs:
cd StandaloneOSX/
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ vars.APPLE_TEAM_ID }})" $FILENAME/Contents/Support/ThirdParty/ffmpeg/bin/ffmpeg
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ vars.APPLE_TEAM_ID }})" $FILENAME/Contents/Plugins/UsdCs.bundle
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ vars.APPLE_TEAM_ID }})" $FILENAME/Contents/Plugins/lib_burst_generated.bundle
for bundle in $FILENAME/Contents/Plugins/*.bundle; do
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ vars.APPLE_TEAM_ID }})" $bundle
done
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements ../Support/macos/OpenBrush.entitlements --sign "Developer ID Application: Icosa Gallery Ltd (${{ vars.APPLE_TEAM_ID }})" $FILENAME
cd -
Expand Down Expand Up @@ -723,6 +724,10 @@ jobs:
"title": "## 🚀 Features",
"labels": ["feature", "enhancement"]
},
{
"title": "## 🎨 UI / UX",
"labels": ["ux"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix", "bugfix"]
Expand Down Expand Up @@ -842,6 +847,10 @@ jobs:
"title": "## 🚀 Features",
"labels": ["feature", "enhancement"]
},
{
"title": "## 🎨 UI / UX",
"labels": ["ux"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix", "bugfix"]
Expand Down
94 changes: 94 additions & 0 deletions Assets/Editor/ConvertNormalMaps.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using UnityEngine;
using UnityEditor;
using System.IO;
using Unity.Collections;

public static class ConvertNormalMaps
{
[MenuItem("Open Brush/Toolkit/Convert Bump Maps to Normal Maps")]
static void Convert()
{
foreach (Object obj in Selection.objects)
{
if (obj is Material)
{
Material material = (Material)obj;
Shader shader = material.shader;
int propertiesCount = ShaderUtil.GetPropertyCount(shader);

for (int j = 0; j < propertiesCount; j++)
{
if (ShaderUtil.GetPropertyType(shader, j) == ShaderUtil.ShaderPropertyType.TexEnv)
{
string propertyName = ShaderUtil.GetPropertyName(shader, j);
Texture texture = material.GetTexture(propertyName);

if (texture is Texture2D normalMap)
{
string texturePath = AssetDatabase.GetAssetPath(normalMap);
bool isNormal = ReimportTexture(texturePath, true);
if (!isNormal) continue;
Texture2D remappedTexture = new Texture2D(normalMap.width, normalMap.height);

// Get the pixels from the source texture
NativeArray<Color32> pixels = normalMap.GetPixelData<Color32>(0);

for (int i = 0; i < pixels.Length; i++)
{
byte red = pixels[i].a;
byte green = pixels[i].g;
byte blue = 255; // pixels[i].b;
byte alpha = 255; // pixels[i].r;
pixels[i] = new Color32(red, green, blue, alpha);
}
remappedTexture.SetPixels32(pixels.ToArray());

// Apply changes
remappedTexture.Apply();

File.WriteAllBytes(texturePath, remappedTexture.EncodeToPNG());
Debug.Log("Exported Normal Map: " + texturePath);
RemoveConversion(texturePath);
}
else
{
Debug.LogWarning("No normal map found in material: " + material.name);
}
}
}
}
}
AssetDatabase.Refresh();
}

private static bool ReimportTexture(string assetPath, bool isReadable)
{
TextureImporter textureImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
if (textureImporter != null)
{
if (textureImporter.textureType != TextureImporterType.NormalMap)
{
return false;
}
textureImporter.isReadable = isReadable;
textureImporter.textureCompression = TextureImporterCompression.Uncompressed;
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
}
return true;
}

private static bool RemoveConversion(string assetPath)
{
TextureImporter textureImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
if (textureImporter != null)
{
if (textureImporter.textureType != TextureImporterType.NormalMap)
{
return false;
}
textureImporter.convertToNormalmap = false;
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
}
return true;
}
}
3 changes: 3 additions & 0 deletions Assets/Editor/ConvertNormalMaps.cs.meta

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

2 changes: 1 addition & 1 deletion Assets/Editor/GlTF_EditorExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private static int RunCommand(string command, params string[] commandArgs)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = new System.Diagnostics.ProcessStartInfo(
command, string.Join(" ", commandArgs));
command, string.Join(" ", commandArgs.Select(arg => $"\"{arg}\"")));
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.UseShellExecute = false;
Expand Down
2 changes: 2 additions & 0 deletions Assets/Manifest_Experimental.asset
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ MonoBehaviour:
- {fileID: 11400000, guid: 2ac14128061517f47a61f3c85ce26dfa, type: 2}
- {fileID: 11400000, guid: 95219c84db13d7c49b0bae92b5f8dc9c, type: 2}
- {fileID: 11400000, guid: b9280b7e789abdd49bd5d85c5554afd3, type: 2}
- {fileID: 11400000, guid: d25091db0e878ba458b54227b23cad57, type: 2}
Environments:
- {fileID: 11400000, guid: c4b465a813a79c044874468d6e60f26c, type: 2}
Locales: []
CompatibilityBrushes: []
89 changes: 89 additions & 0 deletions Assets/Materials/360 Panorama Sphere.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: 360 Panorama Sphere
m_Shader: {fileID: 4800000, guid: 2acb44a1aabdeb44ca27f9dd497c779a, type: 3}
m_ValidKeywords: []
m_InvalidKeywords:
- _STEREOSCOPIC_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _H: 360
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Shininess: 20
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stereoscopic: 1
- _UVSec: 0
- _V: 180
- _WarpEnd: 1
- _WarpStart: 6
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _WarpParams: {r: 6, g: 0.5, b: 0.3, a: 0.1}
m_BuildTextureStacks: []
8 changes: 8 additions & 0 deletions Assets/Materials/360 Panorama Sphere.mat.meta

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

Binary file added Assets/Models/NewSketchButton Sliced.fbx
Binary file not shown.
142 changes: 142 additions & 0 deletions Assets/Models/NewSketchButton Sliced.fbx.meta

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

Loading

0 comments on commit c8ce22e

Please sign in to comment.