Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error when we opened Editor of MergePhysBone #167

Merged
merged 2 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Error when we opened Editor of MergePhysBone component `#167`

### Security

Expand Down
5 changes: 0 additions & 5 deletions Editor/MergePhysBoneEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ namespace Anatawa12.AvatarOptimizer
[CustomEditor(typeof(MergePhysBone))]
internal class MergePhysBoneEditor : AvatarTagComponentEditorBase
{
private SerializedObject _mergedPhysBone;
private MergePhysBoneEditorRenderer _renderer;
private SerializedProperty _makeParent;
private SerializedProperty _componentsSetProp;

private void OnEnable()
{
_renderer = new MergePhysBoneEditorRenderer(serializedObject);
_mergedPhysBone = new SerializedObject(serializedObject.FindProperty("merged").objectReferenceValue);
_makeParent = serializedObject.FindProperty("makeParent");
_componentsSetProp = serializedObject.FindProperty(nameof(MergePhysBone.componentsSet));
}

protected override void OnInspectorGUIInner()
{
_mergedPhysBone.Update();

EditorGUILayout.PropertyField(_makeParent);
if (_makeParent.boolValue && ((Component)target).transform.childCount != 0)
EditorGUILayout.HelpBox(CL4EE.Tr("MergePhysBone:error:makeParentWithChildren"), MessageType.Error);
Expand All @@ -40,7 +36,6 @@ protected override void OnInspectorGUIInner()
_renderer.DoProcess();

serializedObject.ApplyModifiedProperties();
_mergedPhysBone.ApplyModifiedProperties();
}
}

Expand Down