Browse Source

Variation in Base Graph Bug Fixes

This fixes a few bugs with the previous check-in.
Peter Robinson 3 years ago
parent
commit
48e12cc950

+ 26 - 1
engine/source/gui/editor/guiParticleGraphInspector.cc

@@ -473,9 +473,28 @@ void GuiParticleGraphInspector::renderPoints(const RectI &contentRect, const Col
 	}
 }
 
+Vector<GuiParticleGraphInspector::GraphPoint>* GuiParticleGraphInspector::getRenderPoints()
+{
+	if (!mAwake)
+	{
+		return NULL;
+	}
+
+	if (mDirty) 
+	{ 
+		RectI rect = RectI(0, 0, 1, 1); 
+		calculatePoints(rect); mDirty = true; 
+	} 
+	return &mPointList;
+}
+
 void GuiParticleGraphInspector::renderVariation(const RectI& contentRect, const ColorI& color)
 {
 	Vector<GraphPoint>* variPointList = mVariationInspector->getRenderPoints();
+	if (!variPointList)
+	{
+		return;
+	}
 
 	S32 vPen = 0;
 	S32 bPen = 0;
@@ -584,6 +603,12 @@ void GuiParticleGraphInspector::renderLine(const RectI &contentRect, const Point
 //Points are leftTop, rightTop, leftBottom, rightBottom
 void GuiParticleGraphInspector::renderQuad(const RectI& contentRect, const Point2I& point1, const Point2I& point2, const Point2I& point3, const Point2I& point4, const ColorI& quadColor)
 {
+	//if the heights of the left and right sides are both zero then we can exit now
+	if ((point1.y - point3.y) == 0 && (point2.y - point4.y) == 0)
+	{
+		return;
+	}
+
 	RectI area = RectI(point1.x, getMin(point1.y, point2.y), point2.x - point1.x, point1.y < point2.y ? getMax(point3.y, point4.y) - point1.y : getMax(point3.y, point4.y) - point2.y);
 	if (!contentRect.overlaps(area))
 	{
@@ -591,7 +616,7 @@ void GuiParticleGraphInspector::renderQuad(const RectI& contentRect, const Point
 		return;
 	}
 
-	if (point1.y > point4.y || point2.y > point3.y)
+	if ((point1.y > point4.y || point2.y > point3.y) && area.extent.y > 1)
 	{
 		Point2I point5 = Point2I(mRound((point1.x + point2.x) / 2), mRound((point1.y + point2.y) / 2));
 		Point2I point6 = Point2I(mRound((point3.x + point4.x) / 2), mRound((point3.y + point4.y) / 2));

+ 1 - 1
engine/source/gui/editor/guiParticleGraphInspector.h

@@ -81,7 +81,7 @@ public:
    virtual void onTouchDragged(const GuiEvent &event);
 
    void onRender(Point2I offset, const RectI &updateRect);
-   Vector<GraphPoint>* getRenderPoints() { if (mDirty) { RectI rect = RectI(0, 0, 1, 1); calculatePoints(rect); mDirty = true; } return &mPointList; }
+   Vector<GraphPoint>* getRenderPoints();
 
 protected:
 	U32 findHitGraphPoint(const Point2I &point);