void ParentingSplineUI() { Blue_BoldLable("Spline 链接"); spline.beginningSpline = (CatmullRomSpline)EditorGUILayout.ObjectField("开始 spline", spline.beginningSpline, typeof(CatmullRomSpline), true); if (spline.beginningSpline == spline) { spline.beginningSpline = null; } spline.endingSpline = (CatmullRomSpline)EditorGUILayout.ObjectField("结束 spline", spline.endingSpline, typeof(CatmullRomSpline), true); if (spline.endingSpline == spline) { spline.endingSpline = null; } if (spline.beginningSpline != null) { if (spline.controlPoints.Count > 0 && spline.beginningSpline.points.Count > 0) { spline.beginningMinWidth = spline.beginningMinWidth * (spline.beginningSpline.vertPerRow - 1); spline.beginningMaxWidth = spline.beginningMaxWidth * (spline.beginningSpline.vertPerRow - 1); EditorGUILayout.MinMaxSlider("Part parent", ref spline.beginningMinWidth, ref spline.beginningMaxWidth, 0, spline.beginningSpline.vertPerRow - 1); spline.beginningMinWidth = (int)spline.beginningMinWidth; spline.beginningMaxWidth = (int)spline.beginningMaxWidth; spline.beginningMinWidth = Mathf.Clamp(spline.beginningMinWidth, 0, spline.beginningSpline.vertPerRow - 1); spline.beginningMaxWidth = Mathf.Clamp(spline.beginningMaxWidth, 0, spline.beginningSpline.vertPerRow - 1); if (spline.beginningMinWidth == spline.beginningMaxWidth) { if (spline.beginningMinWidth > 0) { spline.beginningMinWidth--; } else { spline.beginningMaxWidth++; } } spline.vertPerRow = (int)(spline.beginningMaxWidth - spline.beginningMinWidth) + 1; spline.beginningMinWidth = spline.beginningMinWidth / (float)(spline.beginningSpline.vertPerRow - 1); spline.beginningMaxWidth = spline.beginningMaxWidth / (float)(spline.beginningSpline.vertPerRow - 1); spline.GenerateBeginningParentBased(); } } else { spline.beginningMaxWidth = 1; spline.beginningMinWidth = 0; } if (spline.endingSpline != null) { if (spline.controlPoints.Count > 1 && spline.endingSpline.points.Count > 0) { spline.endingMinWidth = spline.endingMinWidth * (spline.endingSpline.vertPerRow - 1); spline.endingMaxWidth = spline.endingMaxWidth * (spline.endingSpline.vertPerRow - 1); EditorGUILayout.MinMaxSlider("Part parent", ref spline.endingMinWidth, ref spline.endingMaxWidth, 0, spline.endingSpline.vertPerRow - 1); spline.endingMinWidth = (int)spline.endingMinWidth; spline.endingMaxWidth = (int)spline.endingMaxWidth; spline.endingMinWidth = Mathf.Clamp(spline.endingMinWidth, 0, spline.endingSpline.vertPerRow - 1); spline.endingMaxWidth = Mathf.Clamp(spline.endingMaxWidth, 0, spline.endingSpline.vertPerRow - 1); if (spline.endingMinWidth == spline.endingMaxWidth) { if (spline.endingMinWidth > 0) { spline.endingMinWidth--; } else { spline.endingMaxWidth++; } } spline.vertPerRow = (int)(spline.endingMaxWidth - spline.endingMinWidth) + 1; spline.endingMinWidth = spline.endingMinWidth / (float)(spline.endingSpline.vertPerRow - 1); spline.endingMaxWidth = spline.endingMaxWidth / (float)(spline.endingSpline.vertPerRow - 1); spline.GenerateEndingParentBased(); } } else { spline.endingMaxWidth = 1; spline.endingMinWidth = 0; } }