Compare commits
No commits in common. "5badf016a5be60838bcb9bb8d634b73d804d9d38" and "b774208e32783f74f2f6d45b1716247fc5a42fc9" have entirely different histories.
5badf016a5
...
b774208e32
14 changed files with 0 additions and 304 deletions
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 4a654954dc6cec1489d07ed6e2948696
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 242e6d8788815f146a868fa94fce66ea
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "MenuIconReplacerEditor",
|
|
||||||
"rootNamespace": "",
|
|
||||||
"references": [
|
|
||||||
"GUID:108c6ed81f83e074fa168f7087c2a246",
|
|
||||||
"GUID:62ced99b048af7f4d8dfe4bed8373d76",
|
|
||||||
"GUID:5718fb738711cd34ea54e9553040911d"
|
|
||||||
],
|
|
||||||
"includePlatforms": [
|
|
||||||
"Editor"
|
|
||||||
],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 80b77092c9bbd5b48b726b52e8b9c308
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
|
||||||
using gay.lilyy.MenuIconReplacer;
|
|
||||||
|
|
||||||
namespace gay.lilyy.MenuIconReplacer.Editor
|
|
||||||
{
|
|
||||||
[CustomEditor(typeof(MenuIconReplacerConfig))]
|
|
||||||
public class MenuIconReplacerInspector : UnityEditor.Editor
|
|
||||||
{
|
|
||||||
private SerializedProperty replacementsProperty;
|
|
||||||
private bool showReplacements = true;
|
|
||||||
|
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
replacementsProperty = serializedObject.FindProperty("replacements");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
|
||||||
{
|
|
||||||
serializedObject.Update();
|
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
EditorGUILayout.LabelField("Menu Icon Replacer", EditorStyles.boldLabel);
|
|
||||||
EditorGUILayout.HelpBox("Configure texture replacements for menu icons. The left texture will be replaced with the right texture in the expressions menu.", MessageType.Info);
|
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
|
|
||||||
showReplacements = EditorGUILayout.Foldout(showReplacements, $"Replacements ({replacementsProperty.arraySize})", true);
|
|
||||||
|
|
||||||
if (showReplacements)
|
|
||||||
{
|
|
||||||
EditorGUI.indentLevel++;
|
|
||||||
|
|
||||||
// Add new replacement button
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
if (GUILayout.Button("Add Replacement"))
|
|
||||||
{
|
|
||||||
replacementsProperty.InsertArrayElementAtIndex(replacementsProperty.arraySize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Button("Clear All") && replacementsProperty.arraySize > 0)
|
|
||||||
{
|
|
||||||
if (EditorUtility.DisplayDialog("Clear All Replacements",
|
|
||||||
"Are you sure you want to clear all replacements?", "Yes", "Cancel"))
|
|
||||||
{
|
|
||||||
replacementsProperty.ClearArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
|
|
||||||
// Display replacements
|
|
||||||
for (int i = 0; i < replacementsProperty.arraySize; i++)
|
|
||||||
{
|
|
||||||
var element = replacementsProperty.GetArrayElementAtIndex(i);
|
|
||||||
var fromProperty = element.FindPropertyRelative("from");
|
|
||||||
var toProperty = element.FindPropertyRelative("to");
|
|
||||||
|
|
||||||
EditorGUILayout.BeginVertical("box");
|
|
||||||
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
EditorGUILayout.LabelField($"Replacement {i + 1}", EditorStyles.boldLabel, GUILayout.Width(100));
|
|
||||||
|
|
||||||
if (GUILayout.Button("Remove", GUILayout.Width(60)))
|
|
||||||
{
|
|
||||||
replacementsProperty.DeleteArrayElementAtIndex(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
EditorGUILayout.LabelField("From:", GUILayout.Width(40));
|
|
||||||
EditorGUILayout.PropertyField(fromProperty, GUIContent.none);
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
EditorGUILayout.BeginHorizontal();
|
|
||||||
EditorGUILayout.LabelField("To:", GUILayout.Width(40));
|
|
||||||
EditorGUILayout.PropertyField(toProperty, GUIContent.none);
|
|
||||||
EditorGUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
// Validation
|
|
||||||
var fromTexture = fromProperty.objectReferenceValue as Texture2D;
|
|
||||||
var toTexture = toProperty.objectReferenceValue as Texture2D;
|
|
||||||
|
|
||||||
if (fromTexture != null && toTexture != null && fromTexture == toTexture)
|
|
||||||
{
|
|
||||||
EditorGUILayout.HelpBox("Warning: Source and target textures are the same.", MessageType.Warning);
|
|
||||||
}
|
|
||||||
else if (fromTexture != null && toTexture == null)
|
|
||||||
{
|
|
||||||
EditorGUILayout.HelpBox("Target texture is not set.", MessageType.Warning);
|
|
||||||
}
|
|
||||||
else if (fromTexture == null && toTexture != null)
|
|
||||||
{
|
|
||||||
EditorGUILayout.HelpBox("Source texture is not set.", MessageType.Warning);
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorGUILayout.EndVertical();
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorGUI.indentLevel--;
|
|
||||||
}
|
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 43cc613e338942941a9a549788e36afc
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using gay.lilyy.MenuIconReplacer;
|
|
||||||
using nadena.dev.ndmf;
|
|
||||||
using NUnit.Framework.Constraints;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using VRC.SDK3.Avatars.ScriptableObjects;
|
|
||||||
using static VRC.SDK3.Avatars.ScriptableObjects.VRCExpressionsMenu;
|
|
||||||
|
|
||||||
[assembly: ExportsPlugin(typeof(MenuIconReplacerPlugin))]
|
|
||||||
|
|
||||||
namespace gay.lilyy.MenuIconReplacer
|
|
||||||
{
|
|
||||||
public class MenuIconReplacerPlugin : Plugin<MenuIconReplacerPlugin>
|
|
||||||
{
|
|
||||||
public override string DisplayName => "MenuIconReplacer";
|
|
||||||
public override string QualifiedName => "gay.lilyy.MenuIconReplacer";
|
|
||||||
|
|
||||||
protected override void Configure()
|
|
||||||
{
|
|
||||||
InPhase(BuildPhase.Optimizing).BeforePlugin("gay.lilyy.MenuIconRemover").Run("ReplaceMenuIcons", ctx =>
|
|
||||||
{
|
|
||||||
var obj = ctx.AvatarRootObject.GetComponent<MenuIconReplacerConfig>();
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
ctx.AvatarDescriptor.expressionsMenu = RecurseMenu(obj, ctx.AvatarDescriptor.expressionsMenu);
|
|
||||||
Object.DestroyImmediate(obj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private VRCExpressionsMenu RecurseMenu(MenuIconReplacerConfig cfg, VRCExpressionsMenu menu)
|
|
||||||
{
|
|
||||||
if (menu == null) return null;
|
|
||||||
|
|
||||||
var newMenu = ScriptableObject.CreateInstance<VRCExpressionsMenu>();
|
|
||||||
newMenu.controls = new List<Control>();
|
|
||||||
|
|
||||||
foreach (var control in menu.controls)
|
|
||||||
{
|
|
||||||
var icon = control.icon;
|
|
||||||
foreach (var entry in cfg.replacements)
|
|
||||||
{
|
|
||||||
if (entry.from == icon) {
|
|
||||||
icon = entry.to;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var newControl = new Control
|
|
||||||
{
|
|
||||||
name = control.name,
|
|
||||||
type = control.type,
|
|
||||||
icon = icon,
|
|
||||||
parameter = control.parameter,
|
|
||||||
subMenu = RecurseMenu(cfg, control.subMenu),
|
|
||||||
value = control.value,
|
|
||||||
style = control.style,
|
|
||||||
labels = control.labels,
|
|
||||||
subParameters = control.subParameters
|
|
||||||
};
|
|
||||||
newMenu.controls.Add(newControl);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newMenu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 5b9fdfa35ac20a541848fa1c355dda23
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: dbba2be0d4a22f24abf8cf72fcc0ae76
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace gay.lilyy.MenuIconReplacer
|
|
||||||
{
|
|
||||||
[System.Serializable]
|
|
||||||
public class TextureReplacement
|
|
||||||
{
|
|
||||||
public Texture2D from;
|
|
||||||
public Texture2D to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MenuIconReplacerConfig : MonoBehaviour, VRC.SDKBase.IEditorOnly
|
|
||||||
{
|
|
||||||
[HideInInspector]
|
|
||||||
public List<TextureReplacement> replacements = new List<TextureReplacement>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a6d76942481598d4b8d9c823b1f809c0
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "MenuIconReplacerRuntime",
|
|
||||||
"rootNamespace": "",
|
|
||||||
"references": [],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": false,
|
|
||||||
"precompiledReferences": [],
|
|
||||||
"autoReferenced": true,
|
|
||||||
"defineConstraints": [],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 108c6ed81f83e074fa168f7087c2a246
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -58,7 +58,6 @@ namespace gay.lilyy.MenuStyling
|
||||||
{
|
{
|
||||||
foreach (var child in menu.controls)
|
foreach (var child in menu.controls)
|
||||||
{
|
{
|
||||||
if (child.name != " " && child.name != "" && child.name != null) {
|
|
||||||
if (!child.name.StartsWith(config.Prefix))
|
if (!child.name.StartsWith(config.Prefix))
|
||||||
{
|
{
|
||||||
child.name = config.Prefix + child.name;
|
child.name = config.Prefix + child.name;
|
||||||
|
|
@ -67,8 +66,6 @@ namespace gay.lilyy.MenuStyling
|
||||||
{
|
{
|
||||||
child.name += config.Suffix;
|
child.name += config.Suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (child.type == Control.ControlType.SubMenu && child.subMenu != null)
|
if (child.type == Control.ControlType.SubMenu && child.subMenu != null)
|
||||||
{
|
{
|
||||||
WalkMenu(config, child.subMenu);
|
WalkMenu(config, child.subMenu);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue