mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-01 20:25:07 +08:00
additional minor fixes (#976)
* fix: shape changer preview does not respect inverted mode * fix: incorrect parameter generation for non-direct-child MAMIs
This commit is contained in:
parent
6b99b763a7
commit
cd366cab2d
@ -23,7 +23,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
|
|
||||||
public IEnumerable<ProvidedParameter> GetSuppliedParameters(ndmf.BuildContext context = null)
|
public IEnumerable<ProvidedParameter> GetSuppliedParameters(ndmf.BuildContext context = null)
|
||||||
{
|
{
|
||||||
if (_component.Control == null || _component.GetComponent<ReactiveComponent>() == null) yield break;
|
if (_component.Control == null) yield break;
|
||||||
|
if (!ParameterAssignerPass.ShouldAssignParametersToMami(_component)) yield break;
|
||||||
|
|
||||||
var hidden = false;
|
var hidden = false;
|
||||||
var name = _component.Control?.parameter?.name;
|
var name = _component.Control?.parameter?.name;
|
||||||
|
@ -11,6 +11,23 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ParameterAssignerPass : Pass<ParameterAssignerPass>
|
internal class ParameterAssignerPass : Pass<ParameterAssignerPass>
|
||||||
{
|
{
|
||||||
|
internal static bool ShouldAssignParametersToMami(ModularAvatarMenuItem item)
|
||||||
|
{
|
||||||
|
bool hasRC = false;
|
||||||
|
foreach (var rc in item.GetComponentsInChildren<ReactiveComponent>(true))
|
||||||
|
{
|
||||||
|
// Only track components where this is the closest parent
|
||||||
|
var parentMami = rc.GetComponentInParent<ModularAvatarMenuItem>();
|
||||||
|
if (parentMami == item)
|
||||||
|
{
|
||||||
|
hasRC = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasRC;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Execute(ndmf.BuildContext context)
|
protected override void Execute(ndmf.BuildContext context)
|
||||||
{
|
{
|
||||||
var paramIndex = 0;
|
var paramIndex = 0;
|
||||||
@ -24,7 +41,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(mami.Control?.parameter?.name))
|
if (string.IsNullOrWhiteSpace(mami.Control?.parameter?.name))
|
||||||
{
|
{
|
||||||
if (mami.GetComponent<ReactiveComponent>() == null) continue;
|
if (!ShouldAssignParametersToMami(mami)) continue;
|
||||||
|
|
||||||
if (mami.Control == null) mami.Control = new VRCExpressionsMenu.Control();
|
if (mami.Control == null) mami.Control = new VRCExpressionsMenu.Control();
|
||||||
mami.Control.parameter = new VRCExpressionsMenu.Control.Parameter
|
mami.Control.parameter = new VRCExpressionsMenu.Control.Parameter
|
||||||
|
@ -99,20 +99,6 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
_group = group;
|
_group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsChangerActive(ModularAvatarShapeChanger changer, ComputeContext context)
|
|
||||||
{
|
|
||||||
if (changer == null) return false;
|
|
||||||
|
|
||||||
if (context != null)
|
|
||||||
{
|
|
||||||
return context.ActiveAndEnabled(changer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return changer.isActiveAndEnabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashSet<int> GetToDeleteSet(SkinnedMeshRenderer proxy, ComputeContext context)
|
private HashSet<int> GetToDeleteSet(SkinnedMeshRenderer proxy, ComputeContext context)
|
||||||
{
|
{
|
||||||
@ -133,9 +119,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
foreach (var changer in _changers)
|
foreach (var changer in _changers)
|
||||||
{
|
{
|
||||||
var shapes = context.Observe(changer, c => c.Shapes.ToImmutableList(), Enumerable.SequenceEqual);
|
var shapes = context.Observe(changer, c => c.Shapes.ToImmutableList(), Enumerable.SequenceEqual);
|
||||||
|
|
||||||
if (!IsChangerActive(changer, context)) continue;
|
|
||||||
|
|
||||||
foreach (var shape in shapes)
|
foreach (var shape in shapes)
|
||||||
if (shape.ChangeType == ShapeChangeType.Delete)
|
if (shape.ChangeType == ShapeChangeType.Delete)
|
||||||
{
|
{
|
||||||
@ -268,8 +252,6 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
|
|
||||||
foreach (var changer in _changers)
|
foreach (var changer in _changers)
|
||||||
{
|
{
|
||||||
if (!IsChangerActive(changer, null)) continue;
|
|
||||||
|
|
||||||
foreach (var shape in changer.Shapes)
|
foreach (var shape in changer.Shapes)
|
||||||
{
|
{
|
||||||
var index = mesh.GetBlendShapeIndex(shape.ShapeName);
|
var index = mesh.GetBlendShapeIndex(shape.ShapeName);
|
||||||
|
Loading…
Reference in New Issue
Block a user