// [DrawGizmo(GizmoType.InSelectionHierarchy | GizmoType.Active)] // [DrawGizmo(GizmoType.InSelectionHierarchy | GizmoType.NonSelected | GizmoType.Active)] public static void OnDrawGizmos(MoveenSkelWithBones component) { if (!component.isActiveAndEnabled) { return; } Gizmos.color = BONE_COLOR; for (int i = 0; i < component.bones.Count; i++) { Bone bone = component.bones[i]; bone.origin.tick(); //TODO ensure tick in root if (bone.origin.getRot().magnitude() < 0.3f) { MUtil.log(component, "wrong quaternion: " + bone.origin.getRot()); //Debug.Log(" " + i); continue; } UnityEditorUtils.diamond(bone.origin.getPos(), bone.origin.getRot().normalized(), bone.r); } Type type = component.GetType(); Gizmos.color = Color.green; for (int index = 0; index < type.GetFields().Length; index++) { FieldInfo field = type.GetFields()[index]; if (field.FieldType == typeof(Vector3)) { if (field.GetCustomAttributes(typeof(CustomSkelResultAttribute), true).Length != 0) { Vector3 cur = (Vector3)field.GetValue(component); Gizmos.DrawWireSphere(cur, 0.04f); } } if (field.FieldType == typeof(P <Vector3>)) { if (field.GetCustomAttributes(typeof(CustomSkelResultAttribute), true).Length != 0) { P <Vector3> cur = (P <Vector3>)field.GetValue(component); Gizmos.DrawWireSphere(cur.v, 0.04f); } } } }