Fix parameter synced conflict (#1150)

* fix: parameter should be synced if any of sibling parameter is set to be synced

* fix: parameter should be saved/synced if any of menu item references same parameter is set to be saved/synced
This commit is contained in:
nekobako 2024-09-16 06:24:13 +09:00 committed by GitHub
parent b83b89ce38
commit c80d24ea46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -117,8 +117,8 @@ namespace nadena.dev.modular_avatar.core.editor
var canBeBool = true;
var canBeInt = true;
var isSaved = true;
var isSynced = true;
var isSaved = false;
var isSynced = false;
foreach (var mami in list)
{
@ -142,8 +142,8 @@ namespace nadena.dev.modular_avatar.core.editor
else
canBeBool &= mami.Control.value is >= 0 and <= 1;
isSaved &= mami.isSaved;
isSynced &= mami.isSynced;
isSaved |= mami.isSaved;
isSynced |= mami.isSynced;
}
if (!declaredParams.ContainsKey(paramName))

View File

@ -116,6 +116,7 @@ namespace nadena.dev.modular_avatar.core.editor
}
ResolvedParameter.saved |= info.ResolvedParameter.saved;
ResolvedParameter.localOnly &= info.ResolvedParameter.localOnly;
}
public void MergeChild(ParameterInfo info)
@ -305,7 +306,7 @@ namespace nadena.dev.modular_avatar.core.editor
newParameter.defaultValue = info.ResolvedParameter.HasDefaultValue ? info.ResolvedParameter.defaultValue : parameter.defaultValue;
newParameter.name = parameter.name;
newParameter.valueType = parameter.valueType;
newParameter.networkSynced = parameter.networkSynced;
newParameter.networkSynced = parameter.networkSynced || !info.ResolvedParameter.localOnly;
newParameter.saved = parameter.saved || info.ResolvedParameter.saved;
return newParameter;