Skip to content

Commit

Permalink
changed strings instead of enums for SType
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Malladi committed Nov 21, 2023
1 parent 0d6a1bb commit 9d67b56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
22 changes: 12 additions & 10 deletions p5/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions p5/sketch/Vispy2DRenderer/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9d67b56

Please sign in to comment.