Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
ousttrue 2026-06-30 16:26:32 +09:00 committed by GitHub
parent d76f3bd763
commit 561fcc1835
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 12 deletions

View File

@ -8,7 +8,7 @@ namespace UniVRM10
{
public class Vrm10ColliderGroupsWindow : EditorWindow
{
const string WINDOW_TITLE = "VRM10CollierGroups";
const string WINDOW_TITLE = "VRM10ColliderGroups";
const string ListPath = "SpringBone.ColliderGroups";
ObjectField m_target;
SerializedObject serializedObject;
@ -80,7 +80,14 @@ namespace UniVRM10
{
var path = $"{ListPath}.Array.data[{values[0]}]";
var prop = serializedObject.FindProperty(path);
selected.Bind(new SerializedObject(prop.objectReferenceValue));
var obj = prop.objectReferenceValue;
selected.Unbind();
selected.Clear();
if (obj != null)
{
selected.Bind(new SerializedObject(obj));
}
// var joint = vrm.SpringBone.Springs[values[0]].Joints.FirstOrDefault();
// if (joint)
// {
@ -109,21 +116,33 @@ namespace UniVRM10
HandleUtility.Repaint();
if (list != null && list.selectedIndex >= 0
&& list.selectedIndex < vrm.SpringBone.Springs.Count)
&& list.selectedIndex < vrm.SpringBone.ColliderGroups.Count)
{
Handles.color = Color.red;
var selected = vrm.SpringBone.ColliderGroups[list.selectedIndex];
foreach (var collider in selected.Colliders)
var group = vrm.SpringBone.ColliderGroups[list.selectedIndex];
if (group == null)
{
if (collider)
return;
}
var matrixBackup = Handles.matrix;
try
{
foreach (var collider in group.Colliders)
{
// collider.DrawGizmos();
Handles.matrix = collider.transform.localToWorldMatrix;
Handles.DrawWireDisc(collider.Offset, Vector3.right, collider.Radius);
Handles.DrawWireDisc(collider.Offset, Vector3.up, collider.Radius);
Handles.DrawWireDisc(collider.Offset, Vector3.forward, collider.Radius);
if (collider)
{
Handles.matrix = collider.transform.localToWorldMatrix;
Handles.DrawWireDisc(collider.Offset, Vector3.right, collider.Radius);
Handles.DrawWireDisc(collider.Offset, Vector3.up, collider.Radius);
Handles.DrawWireDisc(collider.Offset, Vector3.forward, collider.Radius);
}
}
}
finally
{
Handles.matrix = matrixBackup;
}
}
}
}

View File

@ -72,7 +72,7 @@ namespace UniVRM10
#if UNITY_2022_3_OR_NEWER
list.selectedIndicesChanged += (e) =>
#else
m_springs.onSelectedIndicesChange += (e) =>
list.onSelectedIndicesChange += (e) =>
#endif
{
var values = e.ToArray();