mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
feat: expose per-component toggles to the NDMF plugin preview UI (#941)
This commit is contained in:
parent
32dc864d8d
commit
c50b3526f6
2
.github/ProjectRoot/vpm-manifest-2022.json
vendored
2
.github/ProjectRoot/vpm-manifest-2022.json
vendored
@ -19,7 +19,7 @@
|
||||
"dependencies": {}
|
||||
},
|
||||
"nadena.dev.ndmf": {
|
||||
"version": "1.5.0-beta.0"
|
||||
"version": "1.5.0-beta.2"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
#region
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using nadena.dev.modular_avatar.animation;
|
||||
using nadena.dev.modular_avatar.core.ArmatureAwase;
|
||||
using nadena.dev.modular_avatar.core.editor.plugin;
|
||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||
using nadena.dev.ndmf;
|
||||
using nadena.dev.ndmf.fluent;
|
||||
using nadena.dev.ndmf.preview;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
|
@ -9,6 +9,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
internal class ObjectSwitcherPreview : IRenderFilter
|
||||
{
|
||||
static TogglablePreviewNode EnableNode = TogglablePreviewNode.Create(
|
||||
() => "Object Switcher",
|
||||
qualifiedName: "nadena.dev.modular-avatar/ObjectSwitcherPreview",
|
||||
true
|
||||
);
|
||||
|
||||
public IEnumerable<TogglablePreviewNode> GetPreviewControlNodes()
|
||||
{
|
||||
yield return EnableNode;
|
||||
}
|
||||
|
||||
public bool IsEnabled(ComputeContext context)
|
||||
{
|
||||
return context.Observe(EnableNode.IsEnabled);
|
||||
}
|
||||
|
||||
public ImmutableList<RenderGroup> GetTargetGroups(ComputeContext context)
|
||||
{
|
||||
var allToggles = context.GetComponentsByType<ModularAvatarObjectToggle>();
|
||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using nadena.dev.modular_avatar.core.editor.plugin;
|
||||
using nadena.dev.ndmf.preview;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
@ -15,6 +16,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
public class ShapeChangerPreview : IRenderFilter
|
||||
{
|
||||
private static TogglablePreviewNode EnableNode = TogglablePreviewNode.Create(
|
||||
() => "Shape Changer",
|
||||
qualifiedName: "nadena.dev.modular-avatar/ShapeChangerPreview",
|
||||
true
|
||||
);
|
||||
|
||||
public IEnumerable<TogglablePreviewNode> GetPreviewControlNodes()
|
||||
{
|
||||
yield return EnableNode;
|
||||
}
|
||||
|
||||
public bool IsEnabled(ComputeContext context)
|
||||
{
|
||||
return context.Observe(EnableNode.IsEnabled);
|
||||
}
|
||||
|
||||
public ImmutableList<RenderGroup> GetTargetGroups(ComputeContext ctx)
|
||||
{
|
||||
var allChangers = ctx.GetComponentsByType<ModularAvatarShapeChanger>();
|
||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using nadena.dev.modular_avatar.core.editor.plugin;
|
||||
using nadena.dev.modular_avatar.core.editor.ScaleAdjuster;
|
||||
using nadena.dev.ndmf.preview;
|
||||
using UnityEditor;
|
||||
@ -15,12 +16,27 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
internal class ScaleAdjusterPreview : IRenderFilter
|
||||
{
|
||||
private static TogglablePreviewNode EnableNode = TogglablePreviewNode.Create(
|
||||
() => "Scale Adjuster",
|
||||
qualifiedName: "nadena.dev.modular-avatar/ScaleAdjusterPreview",
|
||||
true
|
||||
);
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
private static void StaticInit()
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<TogglablePreviewNode> GetPreviewControlNodes()
|
||||
{
|
||||
yield return EnableNode;
|
||||
}
|
||||
|
||||
public bool IsEnabled(ComputeContext context)
|
||||
{
|
||||
return context.Observe(EnableNode.IsEnabled);
|
||||
}
|
||||
|
||||
private static GameObject FindAvatarRootObserving(ComputeContext ctx, GameObject ptr)
|
||||
{
|
||||
while (ptr != null)
|
||||
|
@ -16,6 +16,6 @@
|
||||
},
|
||||
"vpmDependencies": {
|
||||
"com.vrchat.avatars": ">=3.4.0",
|
||||
"nadena.dev.ndmf": ">=1.5.0-beta.0 <2.0.0-a"
|
||||
"nadena.dev.ndmf": ">=1.5.0-beta.2 <2.0.0-a"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user