Skip to content

Commit 9c542b1

Browse files
committed
initial commit
1 parent 3356cd2 commit 9c542b1

8 files changed

+155
-0
lines changed

ForceSceneView.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#if UNITY_EDITOR
2+
3+
using UnityEngine;
4+
5+
namespace I5Tools
6+
{
7+
public class ForceSceneView : MonoBehaviour
8+
{
9+
private void Awake()
10+
{
11+
UnityEditor.SceneView.FocusWindowIfItsOpen(typeof(UnityEditor.SceneView));
12+
}
13+
}
14+
}
15+
16+
#endif

ForceSceneView.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

I5Tools.cs

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#if UNITY_EDITOR
2+
using UnityEngine;
3+
using UnityEditor;
4+
using VRC.SDK3.Dynamics.PhysBone.Components;
5+
using VRC.Dynamics;
6+
7+
namespace I5Tools
8+
{
9+
public class Tools : MonoBehaviour
10+
{
11+
[MenuItem("Tools/I5Tools/Make All Bones Immovable in World Space")]
12+
public static void MakeAllBonesImmovable()
13+
{
14+
VRCPhysBone[] physBones = FindObjectsOfType<VRCPhysBone>();
15+
foreach (VRCPhysBone physBone in physBones)
16+
{
17+
physBone.immobileType = VRCPhysBoneBase.ImmobileType.World;
18+
physBone.immobile = 1.0f;
19+
}
20+
}
21+
22+
[MenuItem("Tools/I5Tools/Optimize Texture Formats")]
23+
public static void OptimizeTextureFormats()
24+
{
25+
string[] guids = AssetDatabase.FindAssets("t:Texture2D");
26+
bool changesMade = false;
27+
28+
foreach (string guid in guids)
29+
{
30+
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
31+
if (assetPath.Contains("com.unity")) continue;
32+
33+
TextureImporter importer = AssetImporter.GetAtPath(assetPath) as TextureImporter;
34+
if (importer == null)
35+
{
36+
Debug.LogWarning("Failed to get TextureImporter for asset: " + assetPath);
37+
continue;
38+
}
39+
else if (importer.textureType != TextureImporterType.NormalMap && importer.textureType != TextureImporterType.Default)
40+
{
41+
continue;
42+
}
43+
TextureImporterPlatformSettings standalone = importer.GetPlatformTextureSettings("Standalone");
44+
45+
if (importer.textureType == TextureImporterType.NormalMap && (standalone.format != TextureImporterFormat.BC5 || !standalone.overridden))
46+
{
47+
Debug.Log("Normal map not in BC5 format: " + assetPath);
48+
standalone.overridden = true;
49+
standalone.maxTextureSize = importer.maxTextureSize;
50+
standalone.format = TextureImporterFormat.BC5;
51+
importer.SetPlatformTextureSettings(standalone);
52+
changesMade = true;
53+
}
54+
else if (importer.textureType == TextureImporterType.Default && importer.textureCompression != TextureImporterCompression.CompressedHQ && importer.DoesSourceTextureHaveAlpha() && importer.alphaSource != TextureImporterAlphaSource.None && importer.sRGBTexture)
55+
{
56+
Debug.Log("Texture with alpha not in BC7 format: " + assetPath);
57+
importer.textureCompression = TextureImporterCompression.CompressedHQ;
58+
importer.alphaIsTransparency = true;
59+
changesMade = true;
60+
}
61+
}
62+
63+
if (changesMade)
64+
{
65+
AssetDatabase.SaveAssets();
66+
AssetDatabase.Refresh();
67+
}
68+
}
69+
70+
[MenuItem("Tools/I5Tools/Force Scene View in Play Mode")]
71+
public static void CreateDebugManager()
72+
{
73+
GameObject debugManager = new GameObject("ForceSceneView");
74+
debugManager.AddComponent<ForceSceneView>();
75+
}
76+
}
77+
}
78+
#endif

I5Tools.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

I5Tools_Assemblydef.asmdef

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "I5Tools",
3+
"rootNamespace": "I5Tools",
4+
"references": [],
5+
"includePlatforms": [],
6+
"excludePlatforms": [],
7+
"allowUnsafeCode": false,
8+
"overrideReferences": false,
9+
"precompiledReferences": [],
10+
"autoReferenced": true,
11+
"defineConstraints": [],
12+
"versionDefines": [],
13+
"noEngineReferences": false
14+
}

I5Tools_Assemblydef.asmdef.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "com.i5ucc.tools",
3+
"displayName": "I5Tools",
4+
"version": "0.1.0",
5+
"description": "Just a few things that make Avatar Creation workflow a bit easier.",
6+
"files": [
7+
"I5Tools.cs",
8+
"ForceSceneView.cs"
9+
],
10+
"type": "tool"
11+
}

package.json.meta

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)