mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-08 14:52:49 +08:00
Add logo rendering logic
This commit is contained in:
parent
a8bc589603
commit
7d0d9de710
11
.github/workflows/build-release.yml
vendored
11
.github/workflows/build-release.yml
vendored
@ -19,6 +19,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
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
|
- name: get version
|
||||||
id: version
|
id: version
|
||||||
|
1
Packages/net.fushizen.modular-avatar/Editor/Images/.gitignore
vendored
Normal file
1
Packages/net.fushizen.modular-avatar/Editor/Images/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
ma_*
|
@ -412,6 +412,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
_devMode = EditorGUILayout.Toggle(G("params.devmode"), _devMode);
|
_devMode = EditorGUILayout.Toggle(G("params.devmode"), _devMode);
|
||||||
if (EditorGUI.EndChangeCheck() || _reorderableList == null || _needsRebuild) SetupList();
|
if (EditorGUI.EndChangeCheck() || _reorderableList == null || _needsRebuild) SetupList();
|
||||||
|
@ -98,6 +98,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
serializedObject.Update();
|
serializedObject.Update();
|
||||||
|
|
||||||
_list.DoLayoutList();
|
_list.DoLayoutList();
|
||||||
|
@ -28,6 +28,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
GameObject parentAvatar = null;
|
GameObject parentAvatar = null;
|
||||||
|
|
||||||
bool suppressTarget = false;
|
bool suppressTarget = false;
|
||||||
|
@ -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<Texture2D>(path);
|
||||||
|
if (real_logo != null) LOGO_ASSET = real_logo;
|
||||||
|
else LOGO_ASSET = AssetDatabase.LoadAssetAtPath<Texture2D>(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 44a66efb3c5244688dc712e961abf6df
|
||||||
|
timeCreated: 1666469072
|
@ -49,6 +49,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
SetupMenuEditor();
|
SetupMenuEditor();
|
||||||
|
|
||||||
var installTo = serializedObject.FindProperty(nameof(ModularAvatarMenuInstaller.installTargetMenu));
|
var installTo = serializedObject.FindProperty(nameof(ModularAvatarMenuInstaller.installTargetMenu));
|
||||||
|
@ -48,6 +48,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
serializedObject.Update();
|
serializedObject.Update();
|
||||||
|
|
||||||
EditorGUILayout.PropertyField(prop_animator, G("merge_animator.animator"));
|
EditorGUILayout.PropertyField(prop_animator, G("merge_animator.animator"));
|
||||||
|
@ -32,6 +32,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
var target = (ModularAvatarMergeArmature) this.target;
|
var target = (ModularAvatarMergeArmature) this.target;
|
||||||
var priorMergeTarget = target.mergeTargetObject;
|
var priorMergeTarget = target.mergeTargetObject;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user