diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index dcf0546c..ccae5833 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -19,6 +19,17 @@ jobs: - name: Checkout uses: actions/checkout@v3 + + - name: Checkout logo assets + uses: actions/checkout@v3 + if: startsWith(github.ref, 'refs/tags/') + with: + repository: bdunderscore/modular-avatar-images + path: image-assets + - name: Inject logo assets + if: startsWith(github.ref, 'refs/tags/') + run: | + cp -f image-assets/img/logo/ma_logo.png Packages/net.fushizen.modular-avatar/Editor/Images/logo.png - name: get version id: version diff --git a/Packages/net.fushizen.modular-avatar/Editor/Images/.gitignore b/Packages/net.fushizen.modular-avatar/Editor/Images/.gitignore new file mode 100644 index 00000000..91dd402f --- /dev/null +++ b/Packages/net.fushizen.modular-avatar/Editor/Images/.gitignore @@ -0,0 +1 @@ +ma_* \ No newline at end of file diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/AvatarParametersEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/AvatarParametersEditor.cs index e339f846..9ef8ce6f 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/AvatarParametersEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/AvatarParametersEditor.cs @@ -412,6 +412,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + EditorGUI.BeginChangeCheck(); _devMode = EditorGUILayout.Toggle(G("params.devmode"), _devMode); if (EditorGUI.EndChangeCheck() || _reorderableList == null || _needsRebuild) SetupList(); diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/BlendshapeSyncEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/BlendshapeSyncEditor.cs index 4eb4beeb..195139ec 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/BlendshapeSyncEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/BlendshapeSyncEditor.cs @@ -98,6 +98,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + serializedObject.Update(); _list.DoLayoutList(); diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/BoneProxyEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/BoneProxyEditor.cs index e70bd41f..1813d542 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/BoneProxyEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/BoneProxyEditor.cs @@ -28,6 +28,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + GameObject parentAvatar = null; bool suppressTarget = false; diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs new file mode 100644 index 00000000..705d360a --- /dev/null +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs @@ -0,0 +1,44 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace net.fushizen.modular_avatar.core.editor +{ + internal static class LogoDisplay + { + private static Texture2D LOGO_ASSET; + private static float TARGET_HEIGHT => EditorStyles.label.lineHeight * 3; + + private static GUIStyle STYLE => new GUIStyle() + { + fixedHeight = TARGET_HEIGHT, + fixedWidth = TARGET_HEIGHT * (LOGO_ASSET.width / (float)LOGO_ASSET.height), + stretchHeight = false, + stretchWidth = false, + imagePosition = ImagePosition.ImageOnly + }; + + static LogoDisplay() + { + var placeholderPath = AssetDatabase.GUIDToAssetPath("2a2bb4e0b8e906743890ef10c778e65c"); + + var path = placeholderPath.Substring(0, placeholderPath.LastIndexOf("/", StringComparison.Ordinal)); + path += "/ma_logo.png"; + + var real_logo = AssetDatabase.LoadAssetAtPath(path); + if (real_logo != null) LOGO_ASSET = real_logo; + else LOGO_ASSET = AssetDatabase.LoadAssetAtPath(placeholderPath); + } + + internal static void DisplayLogo() + { + if (LOGO_ASSET == null) return; + + var height = TARGET_HEIGHT; + var width = (height / (float)LOGO_ASSET.height) * LOGO_ASSET.width; + var rect = GUILayoutUtility.GetRect(width, height); + + GUI.DrawTexture(rect, LOGO_ASSET, ScaleMode.ScaleToFit); + } + } +} \ No newline at end of file diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs.meta b/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs.meta new file mode 100644 index 00000000..34736bc3 --- /dev/null +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/LogoDisplay.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 44a66efb3c5244688dc712e961abf6df +timeCreated: 1666469072 \ No newline at end of file diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MenuInstallerEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MenuInstallerEditor.cs index edf85ff2..89441d20 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MenuInstallerEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MenuInstallerEditor.cs @@ -49,6 +49,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + SetupMenuEditor(); var installTo = serializedObject.FindProperty(nameof(ModularAvatarMenuInstaller.installTargetMenu)); diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeAnimationEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeAnimationEditor.cs index 5f210b43..b4b6c2e3 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeAnimationEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeAnimationEditor.cs @@ -48,6 +48,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + serializedObject.Update(); EditorGUILayout.PropertyField(prop_animator, G("merge_animator.animator")); diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeArmatureEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeArmatureEditor.cs index f27f9ea9..01c7a932 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeArmatureEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/MergeArmatureEditor.cs @@ -32,6 +32,8 @@ namespace net.fushizen.modular_avatar.core.editor public override void OnInspectorGUI() { + LogoDisplay.DisplayLogo(); + var target = (ModularAvatarMergeArmature) this.target; var priorMergeTarget = target.mergeTargetObject;