fix: warning when object name contains "." (#1123)

* fix: warning when object name contains "."

* chore: change RC state and layer names to not reference Shape Changer specifically

---------

Co-authored-by: bd_ <bd_@nadena.dev>
This commit is contained in:
nekobako 2024-09-14 09:49:58 +09:00 committed by GitHub
parent 566a030730
commit 2735adf55c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ namespace nadena.dev.modular_avatar.core.editor
if (initialStateHolder == null) return;
_initialStateClip = new AnimationClip();
_initialStateClip.name = "MA Shape Changer Defaults";
_initialStateClip.name = "Reactive Component Defaults";
initialStateHolder.CurrentClip = _initialStateClip;
foreach (var (key, initialState) in initialStates)
@ -264,7 +264,9 @@ namespace nadena.dev.modular_avatar.core.editor
{
var asc = context.Extension<AnimationServicesContext>();
var asm = new AnimatorStateMachine();
asm.name = "MA Shape Changer " + info.TargetProp.TargetObject.name;
// Workaround for the warning: "'.' is not allowed in State name"
asm.name = "RC " + info.TargetProp.TargetObject.name.Replace(".", "_");
var x = 200;
var y = 0;
@ -344,7 +346,10 @@ namespace nadena.dev.modular_avatar.core.editor
}
var state = new AnimatorState();
state.name = group.ControllingConditions[0].DebugName;
// Workaround for the warning: "'.' is not allowed in State name"
state.name = group.ControllingConditions[0].DebugName.Replace(".", "_");
state.motion = clip;
state.writeDefaultValues = false;
states.Add(new ChildAnimatorState
@ -559,10 +564,10 @@ namespace nadena.dev.modular_avatar.core.editor
new AnimatorControllerLayer
{
stateMachine = asm,
name = "MA Shape Changer " + layerName,
name = "RC " + layerName,
defaultWeight = 1
}
).ToArray();
}
}
}
}