Skip to content

Commit

Permalink
Merge pull request #306 from anatawa12/disallow-multiple-component
Browse files Browse the repository at this point in the history
Disallow multiple component
  • Loading branch information
anatawa12 authored Aug 11, 2023
2 parents 4e0d013 + 50029ec commit 2bc11ee
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog].

### Fixed
- Apply On Play may not working well `#305`
- Some components unexpectedly can be added multiple times `#306`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog].
- Animating Behaviour.m_Enabled not working `#287`
- Error Report Window may not refreshed after build error `#299`
- Apply On Play may not working well `#305`
- Some components unexpectedly can be added multiple times `#306`

### Security

Expand Down
2 changes: 2 additions & 0 deletions Runtime/Activator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Anatawa12.AvatarOptimizer
[AddComponentMenu("")]
[ExecuteAlways]
[DefaultExecutionOrder(-9989)]
[DisallowMultipleComponent]
internal class Activator : MonoBehaviour
{
private void OnValidate()
Expand All @@ -34,6 +35,7 @@ private void RemoveSelf()
[AddComponentMenu("")]
[ExecuteAlways]
[DefaultExecutionOrder(-9997)]
[DisallowMultipleComponent]
internal class AvatarActivator : MonoBehaviour
{
private void Update()
Expand Down
1 change: 1 addition & 0 deletions Runtime/ClearEndpointPosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Anatawa12.AvatarOptimizer
{
[AddComponentMenu("Avatar Optimizer/AAO Clear Endpoint Position")]
[RequireComponent(typeof(VRCPhysBoneBase))]
[DisallowMultipleComponent]
internal class ClearEndpointPosition : AvatarTagComponent
{
}
Expand Down
1 change: 1 addition & 0 deletions Runtime/MakeChildren.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Anatawa12.AvatarOptimizer
{
[AddComponentMenu("Avatar Optimizer/AAO Make Children")]
[DisallowMultipleComponent]
internal class MakeChildren : AvatarTagComponent
{
[CL4EELocalized("MakeChildren:prop:executeEarly", "MakeChildren:tooltip:executeEarly")]
Expand Down
1 change: 1 addition & 0 deletions Runtime/MergeToonLitMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Anatawa12.AvatarOptimizer
{
[AddComponentMenu("Avatar Optimizer/AAO Merge Toon Lit Material")]
[DisallowMultipleComponent]
internal class MergeToonLitMaterial : EditSkinnedMeshComponent
{
public MergeInfo[] merges = Array.Empty<MergeInfo>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Anatawa12.AvatarOptimizer.Test
{
public class AddComponentMenuTest
public class ComponentSettingsTest
{
[Test]
[TestCaseSource(nameof(ComponentTypes))]
Expand All @@ -18,6 +18,14 @@ public void CheckAddComponentMenuIsInAvatarOptimizer(Type type)
Assert.That(addComponentMenu.componentMenu, Does.StartWith("Avatar Optimizer/AAO ").Or.Empty);
}

[Test]
[TestCaseSource(nameof(ComponentTypes))]
public void CheckDisallowMultipleComponentIsSpecified(Type type)
{
var addComponentMenu = type.GetCustomAttribute<DisallowMultipleComponent>();
Assert.That(addComponentMenu, Is.Not.Null);
}

static IEnumerable<Type> ComponentTypes()
{
return
Expand Down
File renamed without changes.

0 comments on commit 2bc11ee

Please sign in to comment.