From 9d67b5695eb668bb112ded08c85fd99469c99f79 Mon Sep 17 00:00:00 2001 From: Siddharth Malladi Date: Tue, 21 Nov 2023 09:27:27 -0800 Subject: [PATCH] changed strings instead of enums for SType --- p5/core/constants.py | 22 ++++++++++++---------- p5/sketch/Vispy2DRenderer/shape.py | 5 +++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/p5/core/constants.py b/p5/core/constants.py index ddf139ca..7ef029ec 100644 --- a/p5/core/constants.py +++ b/p5/core/constants.py @@ -17,6 +17,8 @@ # from enum import Enum +from p5.core.constants import TESS, TRIANGLES, POINTS, LINES, LINE_STRIP, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP + """Constants Variables for P5 sketches""" @@ -202,16 +204,16 @@ # Shape types / kinds -class SType(Enum): - POINTS = "POINTS" - LINES = "LINES" - LINE_STRIP = "LINE_STRIP" - TRIANGLES = "TRIANGLES" - TRIANGLE_FAN = "TRIANGLE_FAN" - TRIANGLE_STRIP = "TRIANGLE_STRIP" - QUADS = "QUADS" - QUAD_STRIP = "QUAD_STRIP" - TESS = "TESS" +POINTS = "POINTS" +LINES = "LINES" +LINE_STRIP = "LINE_STRIP" +TRIANGLES = "TRIANGLES" +TRIANGLE_FAN = "TRIANGLE_FAN" +TRIANGLE_STRIP = "TRIANGLE_STRIP" +QUADS = "QUADS" +QUAD_STRIP = "QUAD_STRIP" +TESS = "TESS" + # Add all members of SType to global diff --git a/p5/sketch/Vispy2DRenderer/shape.py b/p5/sketch/Vispy2DRenderer/shape.py index 8b1c6492..32b80e2e 100644 --- a/p5/sketch/Vispy2DRenderer/shape.py +++ b/p5/sketch/Vispy2DRenderer/shape.py @@ -30,6 +30,7 @@ from p5.pmath.vector import Point from p5.pmath.utils import SINCOS from p5.core import p5 +from p5.core.constants import TESS, TRIANGLE_FAN __all__ = ["PShape"] @@ -105,7 +106,7 @@ def __init__( children=None, contours=tuple(), vertices=tuple(), - shape_type=SType.TESS, + shape_type="TESS", ): # basic properties of the shape self._fill = None @@ -475,7 +476,7 @@ def __init__( self._stop_angle = stop_angle self.arc_mode = mode - gl_type = SType.TESS if mode in ["OPEN", "CHORD"] else SType.TRIANGLE_FAN + gl_type = "TESS" if mode in ["OPEN", "CHORD"] else "TRIANGLE_FAN" super().__init__( fill_color=fill_color, stroke_color=stroke_color,