Initial commit

This commit is contained in:
2025-12-10 21:06:22 +01:00
commit cc9190b9ce
476 changed files with 320218 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
using UnityEditor;
using UnityEngine;
public class FixTMPColor : EditorWindow
{
private Color originalColor = new Color(0.667f, 0.667f, 0.667f);
private Color originalColorOutput = new Color(0.667f, 0.667f, 0.667f);
private Color fixedColor = GetFixedTMPColor(new Color(0.667f, 0.667f, 0.667f));
private Color fixedColorOutput = GetFixedTMPColor(new Color(0.667f, 0.667f, 0.667f));
[MenuItem("Tools/Fix TMP Color")]
public static void ShowWindow()
{
GetWindow<FixTMPColor>("Fix TMP Color");
}
private void OnGUI()
{
EditorGUI.HelpBox(GUILayoutUtility.GetRect(50, 50), "Translates between an intended color and a color value which displays as the intended color when used in the TextMeshPro Vertex Color field.", MessageType.Info);
EditorGUILayout.Space();
originalColor = EditorGUILayout.ColorField("Original Color", originalColor);
EditorGUI.DrawRect(GUILayoutUtility.GetRect(50, 50), originalColor);
EditorGUILayout.Space();
fixedColor = EditorGUILayout.ColorField("Fixed TMP Vertex Color", fixedColor);
EditorGUI.DrawRect(GUILayoutUtility.GetRect(50, 50), fixedColor);
if (GUI.changed)
{
if (fixedColorOutput != fixedColor)
{
originalColor = GetOriginalTMPColor(fixedColor);
}
else if (originalColorOutput != originalColor)
{
fixedColor = GetFixedTMPColor(originalColor);
}
originalColorOutput = originalColor;
fixedColorOutput = fixedColor;
}
}
private static Color GetFixedTMPColor(Color input)
{
return new Color(
Mathf.Pow(input.r, 1 / 0.4545f),
Mathf.Pow(input.g, 1 / 0.4545f),
Mathf.Pow(input.b, 1 / 0.4545f),
input.a // Not sure what to do with the alpha channel, leaving it unchanged
);
}
private static Color GetOriginalTMPColor(Color input)
{
return new Color(
Mathf.Pow(input.r, 0.4545f),
Mathf.Pow(input.g, 0.4545f),
Mathf.Pow(input.b, 0.4545f),
input.a // Not sure what to do with the alpha channel, leaving it unchanged
);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f109b8a2bddf9124faf97bf9c0f76b06
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class ResetParentTransform : EditorWindow
{
[MenuItem("Tools/Reset Parent Transform")]
public static void ShowWindow()
{
GetWindow<ResetParentTransform>("Reset Parent Transform");
}
private void OnGUI()
{
GUILayout.Label("Reset Parent Transform", EditorStyles.boldLabel);
if (GUILayout.Button("Reset Transform for Selected Parent and Adjust Children"))
{
ResetTransform();
}
}
private void ResetTransform()
{
if (Selection.activeGameObject == null)
{
Debug.LogWarning("No GameObject selected. Please select a GameObject in the hierarchy.");
return;
}
Transform parentTransform = Selection.activeGameObject.transform;
if (parentTransform.childCount == 0)
{
Debug.LogWarning("Selected GameObject has no children. Operation aborted.");
return;
}
List<Transform> children = new List<Transform>();
foreach (Transform child in parentTransform)
{
children.Add(child);
}
foreach (Transform child in children)
{
child.transform.parent = null;
}
// Reset the parent's transform to default values
parentTransform.localPosition = Vector3.zero;
parentTransform.localRotation = Quaternion.identity;
parentTransform.localScale = Vector3.one;
foreach (Transform child in children)
{
child.transform.parent = parentTransform;
}
Debug.Log("Parent transform reset and children adjusted.");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f6748e33b71e564ab800b7a38b0e34e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
using UnityEngine;
using UnityEditor;
public class SwapYAndZCoordinates : EditorWindow
{
[MenuItem("Tools/Swap Y and Z Coordinates")]
public static void ShowWindow()
{
GetWindow<SwapYAndZCoordinates>("Swap Y and Z Coordinates");
}
private void OnGUI()
{
GUILayout.Label("Swap Y and Z Coordinates", EditorStyles.boldLabel);
if (GUILayout.Button("Swap Y and Z for Selected Object and Children"))
{
SwapCoordinates();
}
}
private void SwapCoordinates()
{
if (Selection.activeGameObject == null)
{
Debug.LogWarning("No GameObject selected. Please select a GameObject in the hierarchy.");
return;
}
Transform selectedTransform = Selection.activeGameObject.transform;
SwapYAndZRecursive(selectedTransform);
}
private void SwapYAndZRecursive(Transform parentTransform)
{
foreach (Transform child in parentTransform)
{
SwapYAndZRecursive(child);
}
// Swap the position's Y and Z, and invert the Z-axis
Vector3 newPosition = parentTransform.localPosition;
newPosition = new Vector3(newPosition.x, newPosition.z, -newPosition.y);
parentTransform.localPosition = newPosition;
// Swap the rotation's Y and Z, and rotate by -90 degrees on the X-axis
// Vector3 newRotation = parentTransform.localEulerAngles;
// newRotation = new Vector3(newRotation.x - 90, newRotation.z, newRotation.y);
// parentTransform.localEulerAngles = newRotation;
// // Swap the scale's Y and Z, and invert the Z-axis
// Vector3 newScale = parentTransform.localScale;
// newScale = new Vector3(newScale.x, newScale.z, -newScale.y);
// parentTransform.localScale = newScale;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2881a58c4c53a1a4084dc46538e9fe3f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: