add HelpURL Attribute (#491)

* add HelpURL Attribute

Now you can open website with clicking ? button on the inspector

* docs: use language redirect

---------

Co-authored-by: bd_ <bd_@nadena.dev>
This commit is contained in:
anatawa12 2023-10-11 20:40:26 +09:00 committed by GitHub
parent 907cb57b9e
commit 939e63c297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 31 additions and 0 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using nadena.dev.modular_avatar.core.armature_lock;
using UnityEditor;
using UnityEngine;
using VRC.SDKBase;
@ -9,6 +10,7 @@ namespace nadena.dev.modular_avatar.core.ArmatureAwase
[ExecuteInEditMode]
//[AddComponentMenu("")]
[DisallowMultipleComponent]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/move-independently?lang=auto")]
class MAMoveIndependently : MonoBehaviour, IEditorOnly
{
private float EPSILON = 0.000001f;

View File

@ -4,6 +4,7 @@ using UnityEngine;
namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA Menu Group")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/menu-group?lang=auto")]
public class ModularAvatarMenuGroup : MenuSourceComponent
{
public GameObject targetObject;

View File

@ -4,6 +4,7 @@ using VRC.SDK3.Avatars.ScriptableObjects;
namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA Menu Installer")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/menu-installer?lang=auto")]
public class ModularAvatarMenuInstaller : AvatarTagComponent
{
public VRCExpressionsMenu menuToAppend;

View File

@ -35,6 +35,7 @@ namespace nadena.dev.modular_avatar.core
[DisallowMultipleComponent]
[ExecuteAlways]
[AddComponentMenu("Modular Avatar/MA Blendshape Sync")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/blendshape-sync?lang=auto")]
public class ModularAvatarBlendshapeSync : AvatarTagComponent
{
public List<BlendshapeBinding> Bindings = new List<BlendshapeBinding>();

View File

@ -62,6 +62,7 @@ namespace nadena.dev.modular_avatar.core
[ExecuteInEditMode]
[DisallowMultipleComponent]
[AddComponentMenu("Modular Avatar/MA Bone Proxy")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/bone-proxy?lang=auto")]
public class ModularAvatarBoneProxy : AvatarTagComponent
{
private Transform _targetCache;

View File

@ -14,6 +14,7 @@ namespace nadena.dev.modular_avatar.core
/// We can also end up with a loop between install targets; in this case, we break the loop at an arbitrary point.
/// </summary>
[AddComponentMenu("Modular Avatar/MA Menu Install Target")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/menu-install-target?lang=auto")]
internal class ModularAvatarMenuInstallTarget : MenuSourceComponent
{
public ModularAvatarMenuInstaller installer;

View File

@ -11,6 +11,7 @@ namespace nadena.dev.modular_avatar.core
}
[AddComponentMenu("Modular Avatar/MA Menu Item")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/menu-item?lang=auto")]
public class ModularAvatarMenuItem : AvatarTagComponent, MenuSource
{
public VRCExpressionsMenu.Control Control;

View File

@ -34,6 +34,7 @@ namespace nadena.dev.modular_avatar.core
}
[AddComponentMenu("Modular Avatar/MA Merge Animator")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/merge-animator?lang=auto")]
public class ModularAvatarMergeAnimator : AvatarTagComponent
{
public RuntimeAnimatorController animator;

View File

@ -42,6 +42,7 @@ namespace nadena.dev.modular_avatar.core
[ExecuteInEditMode]
[DisallowMultipleComponent]
[AddComponentMenu("Modular Avatar/MA Merge Armature")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/merge-armature?lang=auto")]
public class ModularAvatarMergeArmature : AvatarTagComponent
{
public AvatarObjectReference mergeTarget = new AvatarObjectReference();

View File

@ -5,6 +5,7 @@ namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA Mesh Settings")]
[DisallowMultipleComponent]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/mesh-settings?lang=auto")]
public class ModularAvatarMeshSettings : AvatarTagComponent
{
internal static readonly Bounds DEFAULT_BOUNDS = new Bounds(Vector3.zero, Vector3.one * 2);

View File

@ -28,6 +28,7 @@ namespace nadena.dev.modular_avatar.core
{
[DisallowMultipleComponent]
[AddComponentMenu("Modular Avatar/MA PhysBone Blocker")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/physbone-blocker?lang=auto")]
public class ModularAvatarPBBlocker : AvatarTagComponent
{
public override void ResolveReferences()

View File

@ -30,6 +30,7 @@ namespace nadena.dev.modular_avatar.core
[DisallowMultipleComponent]
[AddComponentMenu("Modular Avatar/MA Parameters")]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/parameters?lang=auto")]
public class ModularAvatarParameters : AvatarTagComponent
{
public List<ParameterConfig> parameters = new List<ParameterConfig>();

View File

@ -4,6 +4,7 @@ namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA Replace Object")]
[DisallowMultipleComponent]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/replace-object?lang=auto")]
public class ModularAvatarReplaceObject : AvatarTagComponent
{
public AvatarObjectReference targetObject = new AvatarObjectReference();

View File

@ -4,6 +4,7 @@ namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA Visible Head Accessory")]
[DisallowMultipleComponent]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/visible-head-accessory?lang=auto")]
public class ModularAvatarVisibleHeadAccessory : AvatarTagComponent
{
// no configuration needed

View File

@ -4,6 +4,7 @@ namespace nadena.dev.modular_avatar.core
{
[AddComponentMenu("Modular Avatar/MA World Fixed Object")]
[DisallowMultipleComponent]
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/world-fixed-object?lang=auto")]
public class ModularAvatarWorldFixedObject : AvatarTagComponent
{
// no configuration needed

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using nadena.dev.modular_avatar.core;
using NUnit.Framework;
using UnityEditor;
@ -54,6 +55,20 @@ namespace modular_avatar_tests
Assert.That(icon, Is.EqualTo(_iconTexture));
}
[Test]
[TestCaseSource(nameof(ComponentTypes))]
public void CheckHelpURL(Type type)
{
// excluded types
if (type == typeof(Activator)) return;
if (type == typeof(AvatarActivator)) return;
if (type == typeof(TestComponent)) return;
// get icon
var helpUrl = type.GetCustomAttribute<HelpURLAttribute>();
Assert.That(helpUrl, Is.Not.Null);
}
/// <returns>All non-abstract MonoBehaviour classes</returns>
static IEnumerable<Type> ComponentTypes()
{