浏览代码

add SplinePath check for length

MonkeyFirst 10 年之前
父节点
当前提交
14f35757cd
共有 1 个文件被更改,包括 30 次插入29 次删除
  1. 30 29
      bin/Data/Scripts/Editor/EditorViewDebugIcons.as

+ 30 - 29
bin/Data/Scripts/Editor/EditorViewDebugIcons.as

@@ -161,39 +161,40 @@ void UpdateViewDebugIcons()
                     {
                         SplinePath@ sp = cast<SplinePath>(component);
                         if(sp !is null)
-                        {
-                            for(int step=0; step < splinePathResolution; step++)
+                            if(sp.length > 0.01f)
                             {
-                                int index = (i * splinePathResolution) + step;
-                                Vector3 splinePoint = sp.GetPoint(splineStep * step);
-                                Billboard@ bb = debugIconsSet[ICON_SPLINE_PATH].billboards[index];
-                                float stepDistance = (camPos - splinePoint).length;
-                                if (isOrthographic) stepDistance = debugIconsOrthoDistance;
-
-                                if(step == 0) // SplinePath start
-                                {
-                                    bb.color = debugIconsColors[ICON_COLOR_SPLINE_PATH_BEGIN];
-                                    bb.size = ClampToIconMaxSize(Max(debugIconsSize * stepDistance, debugIconsSize));
-                                    bb.position = splinePoint;
-                                }
-                                else if((step+1) >= (splinePathResolution - splineStep)) // SplinePath end
+                                for(int step=0; step < splinePathResolution; step++)
                                 {
-                                    bb.color = debugIconsColors[ICON_COLOR_SPLINE_PATH_END];
-                                    bb.size = ClampToIconMaxSize(Max(debugIconsSize * stepDistance, debugIconsSize));
-                                    bb.position = splinePoint;
-                                }
-                                else // SplinePath middle points
-                                {
-                                    bb.color = finalIconColor;
-                                    bb.size = ClampToIconMaxSize(Max(debugIconsSizeSmall * stepDistance, debugIconsSizeSmall));
-                                    bb.position = splinePoint;
+                                    int index = (i * splinePathResolution) + step;
+                                    Vector3 splinePoint = sp.GetPoint(splineStep * step);
+                                    Billboard@ bb = debugIconsSet[ICON_SPLINE_PATH].billboards[index];
+                                    float stepDistance = (camPos - splinePoint).length;
+                                    if (isOrthographic) stepDistance = debugIconsOrthoDistance;
+
+                                    if(step == 0) // SplinePath start
+                                    {
+                                        bb.color = debugIconsColors[ICON_COLOR_SPLINE_PATH_BEGIN];
+                                        bb.size = ClampToIconMaxSize(Max(debugIconsSize * stepDistance, debugIconsSize));
+                                        bb.position = splinePoint;
+                                    }
+                                    else if((step+1) >= (splinePathResolution - splineStep)) // SplinePath end
+                                    {
+                                        bb.color = debugIconsColors[ICON_COLOR_SPLINE_PATH_END];
+                                        bb.size = ClampToIconMaxSize(Max(debugIconsSize * stepDistance, debugIconsSize));
+                                        bb.position = splinePoint;
+                                    }
+                                    else // SplinePath middle points
+                                    {
+                                        bb.color = finalIconColor;
+                                        bb.size = ClampToIconMaxSize(Max(debugIconsSizeSmall * stepDistance, debugIconsSizeSmall));
+                                        bb.position = splinePoint;
+                                    }
+                                    bb.enabled = sp.enabled;
+                                    // Blend Icon relatively by distance to it
+                                    bb.color = Color(bb.color.r, bb.color.g, bb.color.b, 1.2f - 1.0f / (debugIconsMaxSize.x / bb.size.x));
+                                    if (bb.color.a < 0.25f) bb.enabled = false;
                                 }
-                                bb.enabled = sp.enabled;
-                                // Blend Icon relatively by distance to it
-                                bb.color = Color(bb.color.r, bb.color.g, bb.color.b, 1.2f - 1.0f / (debugIconsMaxSize.x / bb.size.x));
-                                if (bb.color.a < 0.25f) bb.enabled = false;
                             }
-                        }
                     }
                     else
                     {